Keyboard Shortcuts
ctrl + shift + ? :
Show all keyboard shortcuts
ctrl + g :
Navigate to a group
ctrl + shift + f :
Find
ctrl + / :
Quick actions
esc to dismiss
Likes
- Jmriusers
- Messages
Search
Locked
Re: Running a python script in JMRI
#scripting
I ran into version problems, for why I used was some import files for version 3, whereas JMRI uses version 2 of python.
toggle quoted message
Show quoted text
On Monday, December 23, 2019, <tim_p1964@...> wrote: Hi all |
Locked
Re: Running a python script in JMRI
#scripting
Tim,
Your question prompted me to do something I been meaning to explore so here is what I found real quick. Sensor-sound.py is already in JMRI. The Python scripts are in JMRI/jython The sound files are located in JMRI/resources/sounds Sensor-Sound.py has an important line entry m.snd = jmri.jmrit.Sound("resources/sounds/Crossing.wav") change that to the file you want (GENERAL01.wav) and make sure to copy it to the JMRI/resources/sounds. Looking for a trigger to kick off the sound event. It looks like line "sensors.provideSensor("4").addPropertyChangeListener(m)" is it. In table sensor I set up a sensor "4".? To start everything I went to Preference Start Up. You tell Panel Pro or which ever to startup script Sensor-sound.py. It runs in the background listening for sensor 4. When it "sensor 4" goes active the sound file will play. I got it to play once. It looks like you have to add code to reset or rearm the listener as it plays once. In the crossing gate sample I assume that you add the m.snd.loop and inactive to trigger to cut the gate crossing sound on and off. I think I'm going to play with this later on. But anyway It looks easier to use these scripts as they require little effort to get going. Inobu ? # Listens for specific Sensor (Sensor #4), plays crossing gate sound on train entering block. # # Based on Listen example and sound example by Bob Jacobsen, copyright 2004 # Modified by Scott CR Henry import jmri import java # Define the listener to play a sound when a sensor goes active class SoundListener(java.beans.PropertyChangeListener): ? ? def propertyChange(self, event): ??? if ((event.newValue == ACTIVE) and (event.oldValue == INACTIVE)) : self.snd.play() ??? # play the sound once ??? ??? # You can also do snd.loop() to start playing the sound ??? # as a continuous loop, and snd.stop() to stop it # Create one of these and set it's sound # create the sound object by loading a file m = SoundListener() m.snd = jmri.jmrit.Sound("resources/sounds/Crossing.wav") # Attach that listener to desired sensors, e.g. number 4 and 7 sensors.provideSensor("4").addPropertyChangeListener(m) sensors.provideSensor("7").addPropertyChangeListener(m) # To use a different sound, create another copy of the listener # and set its sound to a different file m = SoundListener() # ("m" is the same variable, but it now contains a different copy of SoundListener) m.snd = jmri.jmrit.Sound("resources/sounds/RlyClick.wav") # and attach this new one to another sensor sensors.provideSensor("9").addPropertyChangeListener(m) |
Locked
Running a python script in JMRI
#scripting
Hi all
I am trying to run the following script in JMRI' import wave infiles = ["General01.wav", "General03.wav"] outfile = "sounds.wav" data= [] path = "C:/Users/tim_p/sounds/Peter/" for infile in infiles : ??? fullpath = path + infile ??? print(fullpath) ??? w = wave.open(fullpath, 'rb') ??? data.append( [w.getparams(), w.readframes(w.getnframes())] ) ??? w.close() output = wave.open(path + outfile, 'wb') output.setparams(data[0][0]) output.writeframes(data[0][1]) output.writeframes(data[1][1]) output.close() print("done") whilst it runs fine in the python idle enviroment it won't run as a script in JMRI. I am guessing the wave library does not exist in JMRI. how do i solve this? many thanks Tim |
Locked
Re: WiThrottle Runaways
#withrottleserver
Thanks James. Very helpful and I appreciate your input.
Reg |
Locked
Re: WiThrottle Runaways
#withrottleserver
Thanks Christopher , we often have issues with new operators, but once we get them set up it has been working well.
|
Locked
Re: Double track signaling question
OP deleted original message
-- Peter Ulvestad JMRI Users Group Moderator - ( ) Tam Valley Group Moderator - ( ) Sprog-DCC Group Moderator - ( ) Edmonton Model Railroad Association - |
Locked
Re: Double track signaling question
¿ªÔÆÌåÓýI did my signaling for bidirectional. ?My feeling is that if your layout has the capacity to switch mains, you will do that and if so, you should plan for it. ?JMRI can easily manage this scenario. ?Well, I will say the system can do it, but programming for it is a little more challenging.Thomas Cain Indianapolis, IN atsf93@... See my?NEW website?and layout?at: ? Modeling the Eastern Illinois?Santa Fe from the Prototype
|
Locked
Re: Double track signaling question
¿ªÔÆÌåÓýDepends but current of traffic signaled in that direction (rule 251) is more common, especially in the East. ?Full CTC on double track rule 261 is bidirectional.? As with all things signaled, check your prototype¡¯s rule book, ETT and special instructions for the date you model. ? On Dec 23, 2019, at 10:13 AM, Eric Smith <eric@...> wrote:
|
Locked
Re: Double track signaling question
Eric, Since you are asking about "prototypical", let the prototype answer the question. ?The answer will vary depending on the selected prototype and the modeled era. ?Even free lanced layouts tend to be based on a favorite prototype. Note: ?This is more of a LDISG (Layout Designed Special Interest Group) question than a JMRI question. Dave Sand ----- Original message ----- From: Eric Smith <eric@...> Subject: [jmriusers] Double track signaling question Date: Monday, December 23, 2019 12:13 PM This is likely a dumb question, but on a double track mainline section, is it more prototypical to use bi-directional signals on each track, or only unidirectional signals, assuming right-hand running? It seems like using bi-directional signals would be more practical and flexible. Thanks.? - Eric -- Eric Smith? Northstar Computer Systems (317) 288-1720 |
In JMRI you can also use Logix to setup routes with much fancier things like
complex triggers etc... For the control of which turnout first and how quickly, you can use delays in the Action part to do the sequence and how much delay. -Ken Cameron, Member JMRI Dev Team www.jmri.org www.fingerlakeslivesteamers.org www.cnymod.org www.syracusemodelrr.org |
¿ªÔÆÌåÓýAnother comment that I would add is that some of my operators sometimes ask, what route should I set after using a staging route so they could ¡°return staging to normal.¡± ?My response is there is never a need to return staging to any particular route, unless there is a ¡°through¡± track in staging which I do not have. ?You just select the route you are going to use and that is what counts at that time. ?I do have routes where staging connects to the layout since there are 4 of these connections and there is a route for this and a route that disconnects staging so that I can run trains continuously on the layout. ?Routes/Macros are really quite cool.Thomas Cain Indianapolis, IN atsf93@... See my?NEW website?and layout?at: ? Modeling the Eastern Illinois?Santa Fe from the Prototype
|
I am using the Layout editor to control signals and turnouts through an SPROG II.
Only signal decoders (NCE light-it) and accessory decoders (DCCconcepts AD1-HP) are connected to the DCC signal.
I also use MERG Cbus for occupancy detection.
?
Initially, after poweron, the system enters a state where accessory commands are not sent when changing a turnout.
The USB led on the SPROG II is then dark, and when changing a signal there is a short flash and the signal decoder changes.
Pushing a turnout on the panel moves the turnout on the screen, but there is no LED flash and the actual turnout does not move.
?
I have to set power OFF and restart JMRI once to enter a state where the turnouts will work.
In this state the USB led flashes continuously, sending FF 0 FF, and the accessory commands are sent in-between when pushing a turnout icon.
Signals work fine in this state also.
?
Also, if I leave the DCC power ON and then quit JMRI, it will enter the wrong state on restart.
?
Using ver 4.17.7 on windows 7.
?
Any clues, anyone?
?
Torgrim
? |
I did find routes easy to set up on JMRI. The only negative I have is that any Turnouts do not fire in line sequence, but System name sequence. I did manage to sort this out using an editor (Atom), and now I can follow the route setting from start to finish. I would also recommend using a delay after each turnout is switched so there isn't a massive load on the supply. Thomas has a good idea about using a spreadsheet, and noting the normally closed / open positions of turnouts as some of mine are reversed.
|
Locked
Re: Test version 4.17.7 of JMRI/DecoderPro is available for download
Nelson,
Please post your panel file(s)a any custom items needed to reproduce your issue and I'll take a look at it. --SteveT |
Locked
Re: id tags not found error though they seem to be there
Paul,
I tried opening the Id Tag table first then the Cars window to no effect. Still no tag id in the drop down. Same error list in the console. The console list is showing errors for valid id tags. Allen |
Locked
Re: Test version 4.17.7 of JMRI/DecoderPro is available for download
Dave:
Sorry for the delay in replying it took me a while to try what you suggested. Using the browser on the windows system produced the same result as what we get on the pies. There where no unexpected messages on the console. This issue continues to exist on 4.17.8 but does not exist in 4.17.6 so I've rolled back to it. Have not tried a clean install I want to make sure that it is safe to do so. Nelson |
¿ªÔÆÌåÓýWayne,?I don¡¯t know what kind of DCC system you have. ?My DCC system is NCE. ?In NCE the same function is called Macros. ?Setting Macros in NCE and then Routes in JMRI requires separate programming. ?I am assuming that you have already programmed/identified the stationary decoders that control the turnouts in your staging yard. ?You might want to make a list of their addresses. ?And then next you will want to make individual notations of the turnouts for each route and their state for each route. ?When you are programming routes in JMRI you are doing it solely in JMRI. ?So the process I did in NCE to program the routes then had to be repeated in JMRI. ? I¡¯m thinking that you have already read the JMRI route programming information at: ? I made some mistakes in my first routes, but when I got it all figured out it really start making sense and went faster. ?I highly recommend that you make out an excel spreadsheet to list the turnouts in each route and their state of thrown or closed. ?This is slightly different from your first list because I discovered that in my positioning of turnouts in staging the interpretation of what was closed or thrown might be different than what I had thought or programmed. ?I did not change my stationary decoder programming ?because in staging these identifications are not as easily determined. ?Out on the layout closed is always "stay on the mainline" and thrown "leaves the mainline." ?In staging it all depends on where you want to go. ?Finally after you have programmed your route, walk to the staging yard and see if you had correctly interpreted the ¡°thrown¡± and ¡°closed¡± interpretations and if you and your stationary decoders didn¡¯t interpret the same thing go back to JMRI and reverse the ¡°thrown¡± or ¡°closed¡± state in your list of the turnouts you selected in your route. ?Depending on the size of your staging yard it can be a time consuming process, but I found it to be a surprisingly satisfactory task. ?I have also found that this function is remarkably dependable. ?The only times that selecting a route through staging didn¡¯t work was because a wire to the switch machine had come loose or their was a short to the circuit controlling some or part of the switch machines and I just didn¡¯t know they were ¡°off line.¡± ? Good luck with programming your staging yard. Thomas Cain Indianapolis, IN atsf93@... See my?NEW website?and layout?at: ? Modeling the Eastern Illinois?Santa Fe from the Prototype
|
to navigate to use esc to dismiss