¿ªÔÆÌåÓý

Date

Locked Re: Script Closing Serial Ports Question

 

Hi Dave,
As requested, here is an example of how I close the serial port. Also note that the "return 0" also terminates the script:
if closing_test == 1 :
??? ??? ?print "Script Ends"
??? ??? ?self.inputStream.close()
??? ??? ?self.outputStream.close()
??? ??? ?self.port.close()
??? ??? ?return 0
I started with Bob Jacobsen's SerialPortDevice.py in the JMRI release as a learning tool and template. (Thanks Bob!)
The test above would be in the equivalent of the handle(self)

If you followed this thread before, I was also interested in using a second script to forcibly close the port too.
to accomplish this (again with a great suggestion from Bob!) you create a global variable which can be used to refer to the
open port. So again referring to SerialPortDevice.py by structure, you would have in your original script:
??? def __init__(self, portname) :
??? global extport
??? ...
??? extport = self.port = self.portID.open("JMRI", 50)
??? ...

And here is my ForcePortClose.py? script to close the specific port and terminate:

import jarray
import jmri
import purejavacomm

class SerialCloseM(jmri.jmrit.automat.AbstractAutomaton) :
??? # ctor starts up the serial port
??? def __init__(self, portname) :
??????? global extport
??????? self.portID = purejavacomm.CommPortIdentifier.getPortIdentifier(portname)
??????? extport.close()
??????? return
??? # init() is the place for your initialization
??? def init(self) :
??????? return
??? # handle() is called repeatedly until it returns false.
??? def handle(self) :
????????? return 0
??? def write(self, data) :
??????? return
??? def flush(self) :
??????? self.outputStream.flush()
??????? return
# create one of these; provide the name of the serial port
a = SerialCloseM("COM13")
# set the thread name, so easy to cancel if needed
a.setName("ForcePortClose script")
# start running
a.start();


Also, FYI, what I found is that using the second script to close the port while the first script is still running
will force a portnotopen exception and terminate the first script as well. This, for me, was a desirable side effect!

An educational note: When Bob suggested using a global variable I was, at first, surprised that a global variable would
exist beyond the scope of the script. But one should realize that the global scope is JMRI not just one script. That is,
any script runs inside the global JMRI scope, and my own thinking was myopically focused on a single script.
Score another point for the beauty and the complexity that is JMRI.

I will be publishing an app soon that will incorporate these features and add another that you might find useful too.
More to come...
'Hope this helps. Have fun!? :-)
Best regards,
Geoff Bunza
scalemodelanimation.com


Locked Re: Full timetable automation - AutoDispatcher 2 - abstraction - documentation - scripting

 

¿ªÔÆÌåÓý

James,

NX is a standard JMRI feature: ?

The dispatcher (human) selects an entry sensor and an exit sensor. ?The system sets the turnouts and allocates the blocks. ?The sensors are assigned to block boundaries using the right click context menu, the same procedure for assigning signal heads and signal masts.

The IECC video appears to be using NX or a variation because the mouse was clicking points on the panel to assign blocks.

Dave Sand


On Aug 16, 2018, at 6:23 AM, jamespetts via Groups.Io <jamespetts@...> wrote:

Jay,

that is most interesting. I have had a look over the general instructions, which give me an idea of what you have achieved but not so much how you have achieved it, and it would be most useful to know more about the latter.

For example, the instructions refer to NX switches for a system in which the dispatchers click a starting location and an end location and the train will move and be signalled from the former to the latter. Did you have to write full pathfinding code for the selection of the appropriate transits - indeed, did you even use transits for this?

As another example, you have a timetable: is this in any way represented in the control software, or is it just a set of instructions for human operators? If it is represented, did you have to write your own code for parsing the text/XML/etc. file containing the timetable or similar and other things at such a low level, or were you able to use (undocumented?) higher level features of JMRI to achieve this?

To what extent is the code that you have written layout specific and/or timetable specific?

Thank you very much for your post: it was most interesting to read about the Jenzen Family Trains layouts.

James.


Locked Re: Multiple turnouts on one address using functions?

 

Dave Lowe,

Thanks for the interest. I looked at your link - just one picture, but a neat implimentation.
I'm not using servos, so I've been working with the SMA-17. Mine are also homebrew on perf board. The lights function well and with relays to the outputs, will control the turnouts. Haven't tried to work them into JMRI because I got off on the TF-4 track.
The programming is going slow. I tried first to use the TF-4's and scripting. I'm gotten a lot of help here, but may not be able to make this work.
If I give up on this way, I'll go back to my SMA-17 decoders and try to impliment that way. I think that I'll have more success programming the aurdiuno. My limititation, not the program's.?
I can't seem to wrap my head around the scripts, even though it was once something I did nearly every day.

Don


Locked Re: Full timetable automation - AutoDispatcher 2 - abstraction - documentation - scripting

 

Hi,

The dispatcher tells Extra CR2340 is clear from Echo 3 to Jackson 1 via radio.

In JMRI the train name is put into the Tools>Blocks>Value for Echo3 (iconified window).? Echo 3 would show occupied on the layout panel and in the block table.??
A Marker (<CR2340) is created on the layout editor panel and set at the Jackson 1 block for reference.? ?Arrow shows direction.
The dispatcher throws turnouts to set the route between Echo and Jackson via mouse clicks.
Engineer moves the train along the route.? If this was on the Western division the engineer could also check signals icons on a panel editor screen for misaligned switches/ occupied blocks and act accordingly.

Easy to do with a few trains and no conflicts - an art form with 10/15 trains all over the layout and meets.? One of our older members dispatched for PC out of Albany - was somewhat easy for him, everyone else...

In TC drag the train icon from a Engines/Trains window onto the 'switchboard' and place it directionally in the Echo block (showing occupied).
Select 'autotrain' icon from the main window and drag the train icon from Echo to Jackson with the mouse.? TC allocates 2 or 3 blocks ahead and sets the turnouts for a route.? Engineer moves the train along the route (or it is done by the computer...).? Signals embedded in the block diagrams show permission, and a throttle window will also show next and distant signal aspects.? Conflicted routing (e.g. blocks already allocated by another train's routing) would 'hold' the Extra and then resume after the meet.? That is TC 'out of the box'.

In all fairness AutoDispatcher and Dispatcher could do the same thing.? But that operational setup (signals and associated logic, direction sensors, sections, transits, etc.) that is directly proportional to the complexity of the trackwork, can be more daunting, IMHO.? Seems to be easy on siding-mainline-siding situations.? A four track main with multiple trains and CP's...(unless you where just to make it all look like 4 straight tracks).
?
Background:

As with other model railroad museums the public would like to come and watch trains run (whether as paying guests or not).? With limited manpower the more automated an operation frees up staff for the docent and administrative functions (not that we don't like running the trains...) and allows for more exhibit opportunities.? It took 'all hands on deck' - 32 of the 35 members - to produce an Open House (we mustered up 2 per year, 5 days each).

The railroad has two divisions in a point to point.? The Eastern yard connects to a 4 track mainline with various industries along the way (CTC territory - think NE Corridor).? The main use of a middle yard is to add/pull motive power for the Western division climb.? That division is single track with passing siding(s).? Reverse loops at each end yard turn passenger trains.? Most trains run as 'Extras's' East or West.??

JMRI PanelPro has a layout editor component depicting the layout in a 'straight line' manner a la what Jay has set up (not as pretty).? This provides the dispatcher with real time tracking of trains and control of all mainline turnouts via mouse clicks.? As the trains traverse blocks the train name is carried along.? A panel editor component (with a more diagrammatic view as a background) has contact 'dots' for block occupancy and depicts virtual signals on the Western Division (should be ABS type).? This is provided to the engineers.? I have successfully done 'autotraining' with the dispatcher only on the Western division using SSL (which is not actually 'ABS') from e.g. a siding, along the single track, to another siding on a different PanelPro panel.?

BTW: LAMRS.org is another club in the LA area and they use both at the same time (TC for dispatching and JMRI for WiFi throttle support).

Sorry if some of this is off topic,

Martin Booker, Superintendent, Pasadena Model Railroad Museum
www.pmrrc.org


Locked Re: Scripts

 

¿ªÔÆÌåÓý

Gabor,

On the main menu will be an entry for each connection. ?The first sub-menu item is normally used to open a monitor dialog. ?The monitor displays all of the messages passing between JMRI and the hardware.

Check/enable the "Show raw data" and "Show timestamps" options.

You can either copy/paste the contents of the monitor window or create a log file. ?

To create the log file, select "Choose log file". ?This will create an empty file. ?When you are ready to perform the action you select "Start logging". ?When you are done, select "Stop logging¡±. ?Once the file is created, upload it the ProblemsBeingWorkedOn folder.

Dave Sand



On Aug 16, 2018, at 6:03 AM, halasz <halasz.gabor@...> wrote:

Paul was asking me for a log file and promising he would be looking after how my command station handles RailCom with a view of getting, I presume, the exact type of messages JMRI receives. Can anyone tell me how I get such a log file in JMRI?


Locked Re: RPi-JMRI image updated

 

Thanks Steve, I can update the config now I know - I thought that was probably the case. I use a bluetooth keyboard.


Locked Re: RPi-JMRI image updated

 

Hi Andrew, the steps I took to enable the serial interface for the PiSPROG do disable the bluetooth.
You can undo them (referring to the prior post), or I can post the link to the 8/13 image, which was prior to the fix.
What are you using the bluetooth for?
--SteveT


Locked Re: DCC++ Panel Load Errors with Turnouts and Sensors

 

¿ªÔÆÌåÓý

Andrew,

I can only speculate since I don¡¯t have this hardware arrangement available to me.

Here are the steps that I would use after adding "Open JMRI System console" to "Preferences >> Start Up" and re-starting.
  1. Start JMRI without loading the panel xml file.
  2. Check the system console for errors and verify that the proper connection information is displayed.
  3. Go to "Preferences >> Connections" and verify that DCC++ is the only connection listed. ?There should never be an Internal connection when other connections exist.
  4. Go to "Tools >> Tables >> Turnouts" and verify that the proper turnouts were created based on the command station configuration.
  5. Go to ¡°Tools >> Tables >> Sensors¡± and verify that the proper sensors were created based on the command station configuration and that ISCLOCKRUNNING exists and is Active.
  6. For both the turnout and sensor tables, there should be 3 tabs: ?All, DCC++ and Internal.
  7. If everything looks correct, load the panel xml file and see if any other errors occur.
Based on your symptoms, it sounds like you are getting random communication failures.

Dave Sand


On Aug 16, 2018, at 4:00 AM, LMSFAN72 <andrew@...> wrote:

The turnout error can change the referenced turnout but is something like this (my DCC++ turnouts are DT67 through DT98 and I have seen messages on DT67, DT68, DT71 randomly):

"Unexpected error (Exception) while load(/home/pi/.jmri/Barn_Loop/Barn%20Loop.xml) in adaptor of type jmri.jmrix.dccpp.configurexml.DCCppTurnoutManagerXml
Exception: java.lanl.illegalArgumentException: Invalid system name for turnout: DT71 needed IT"


Locked Re: Z21 and POM

 

Paul,
I tested build 2642. Is better than the previous, but there is still a problem in the single CV programmer: if I write a CV value greater than 128, after the POM CV write, textbox value decrease by 128 (I write value 200, I click "Write CV" button, CV is written but the textbox value become 72, if I write value 240, textbox value become 52, if I write value 50, textbox value remain 50).
No problem using a panel of a loco, now I can successfully write many CVs!

Moreno


Locked Athearn Genesis OEM F45 TSU2

 

Could someone add the mentioned loco to the list of choices of locos highlighted when reading the decoder. May have been inadvertently left off ??? just would make helping someone over the phone a little easier. Thanks, Rick.


Locked Re: RPi-JMRI image updated

 

Hi Steve

I installed the image and have it up and running but I have no bluetooth - adapter not found. It is Pi3 B with built in bluetooth. Does the pi3-miniuart-bt overlay affect this? Is it intended to work? Thanks

Andrew


Locked Re: Full timetable automation - AutoDispatcher 2 - abstraction - documentation - scripting

 

Jay,

that is most interesting. I have had a look over the general instructions, which give me an idea of what you have achieved but not so much how you have achieved it, and it would be most useful to know more about the latter.

For example, the instructions refer to NX switches for a system in which the dispatchers click a starting location and an end location and the train will move and be signalled from the former to the latter. Did you have to write full pathfinding code for the selection of the appropriate transits - indeed, did you even use transits for this?

As another example, you have a timetable: is this in any way represented in the control software, or is it just a set of instructions for human operators? If it is represented, did you have to write your own code for parsing the text/XML/etc. file containing the timetable or similar and other things at such a low level, or were you able to use (undocumented?) higher level features of JMRI to achieve this?

To what extent is the code that you have written layout specific and/or timetable specific?

Thank you very much for your post: it was most interesting to read about the Jenzen Family Trains layouts.

James.


Locked Re: Scripts

 

If this is beginning to help, we can discuss what would be next.
Your offer of further help has come at the psychologically right moment when I was feeling discouraged after an attempt, at Ken's suggestion, of applying ReporterFormatter.py in BackAndForth.py. (Similarly as had been the case with your code "at first sight".
No software code of more than a few lines has ever made sense to me "at first sight",
what is intelligible, but a software code can make one no sense much faster!)

I think Ken has underestimated the difficulty of such an application and overestimated the possibilties of a layman.

On the other hand, I am hoping that RailCom is not going to be such a big issue. I can configure my detector to emulate a LocoNet occupancy detector, and for the time being we may assume that it sends data as described in ReporterFormatter (six bytes of which the forth and fifth are decoder addresses?).

Paul was asking me for a log file and promising he would be looking after how my command station handles RailCom with a view of getting, I presume, the exact type of messages JMRI receives. Can anyone tell me how I get such a log file in JMRI?

Now about your questions.
A single loco automatically trundles back and forth between locations named D and G perhaps going through locations E and F. Other trains can intrude at either or both D and G but cannot go into E or into F. Someone is controlling each of those other trains and watching to prevent a collision with the automatically controlled train. Is this an over simplification?
No, this a good way of thinking about it.
Or did you also want the automatically controlled train to wait at E if D is occupied?
No. By the way, this would be a simpler situation needing no RailCom.
In the simplification, "each of these terminal blocks" means locations D and G?
Yes, precisely. By a block I mean in my situation a section of track electrically isolated from the rest where trains can change their movements or, generally, trigger events and supplied by power through a current sensing detector.
?Is there a one-to-one Sensor to Reporter matching as I inferred from the JMRI help webpages at that time?
This is not a question addressed to me.

Thank you for all the information.

Gabor


Locked New file uploaded to [email protected]

[email protected] Notification
 

Hello,

This email message is a notification to let you know that a file has been uploaded to the Files area of the [email protected] group.

File: JMRI TCS Non-WOW Decoder Improvements.zip

Uploaded By: Westaust55

Description:
These three amended files for JMRI DecoderPro (work with V4.12) incorporate a number of CV¡¯s and minor corrections which, as best I can ascertain from past emails with TCS, are valid for TCS non-WOW decoders since firmware V86. The additions and corrections include: 1. Inclusion of the third User ID field (CV104) on the Basic tab 2. Inclusion of CV182 for Keep-Alive and special BEMF features (see below) 3. Moved the ¡°Enable Brake Button Control¡± from the ¡±Lights¡± tab to the ¡°Motor¡± Tab 4. Added ¡°Button Control of Brake Light¡± to the ¡°Lights¡± Tab 5. Added "Special BEMF for 3-Pole Motors" to the "Motor" Tab [uses CV182] 6. Added "Enable Keep-Alive" to the "Motor" Tab [uses CV182] I have not deleted the CV62 which TCS advice is no longer used.

You can access this file at the URL:
/g/jmriusers/files/Decoder%20files/TCS%20decoders/JMRI%20TCS%20Non-WOW%20Decoder%20Improvements.zip

Cheers,
The Groups.io Team


Locked Re: DCC++ Panel Load Errors with Turnouts and Sensors

 

The turnout error can change the referenced turnout but is something like this (my DCC++ turnouts are DT67 through DT98 and I have seen messages on DT67, DT68, DT71 randomly):

"Unexpected error (Exception) while load(/home/pi/.jmri/Barn_Loop/Barn%20Loop.xml) in adaptor of type jmri.jmrix.dccpp.configurexml.DCCppTurnoutManagerXml
Exception: java.lanl.illegalArgumentException: Invalid system name for turnout: DT71 needed IT"


Locked Re: DCC++ Panel Load Errors with Turnouts and Sensors

 

The sensor error I sometimes get is:

"Could not create sensor System name "ISCLOCKRUNNING" in adaptor of type jmri.jmrix.internal.configurexml/ErrorHandler.shtml"


Locked DCC++ Panel Load Errors with Turnouts and Sensors

 

All, I am running

Raspberry Pi with Raspbian Stretch 9
Java 1.8.0_65
Panel Pro 4.12+Rb6a9bb1
DCC++ though Arduino Mega 2650 with Pololu motor shield

I have setup my command stations properly and with the help on here got my turnouts working. However, I am now experiencing intermittent panel load errors. The errors seem to relate to sensors and turnouts but they are inconsistent. I have, however noticed a couple of things:

1. The error on the turnouts seems to be the system expecting a DCC++ turnout to be in internal one - I don't have any IT ones set up
2. When the panel fails to load and I navigate to the Turnout Table, there is no table - the panel is blank
3. When it does load and I go to the Turnout Table I sometimes have 2 internal connection tabs: Internal and Internal2
4. When it has loaded and I navigate to the Preferences -> Defaults pane I have 3 connections: DCC++, Internal and Internal2. I have no options checked for either Internal or Internal2
5. There in only the DCC++ connection set up in Preferences -> Connections

I did create a new profile which initially seemed to fix it, but, now it has reappeared!

I have documented screenshots in a word doc here:

/g/jmriusers/files/ProblemsBeingWorkedOn/DCC++%20Panel%20Load%20Errors%20with%20Turnouts%20and%20Sensors

My immediate thought is that the Turnouts Table is failing to read from the DCC++ station fast enough or at least the tables are loading out of sequence..possible?


Locked Re: Z21 and POM

 

¿ªÔÆÌåÓý

Moreno,


On Aug 15, 2018, at 11:44 AM, Moreno Mazzini <moreno.mazzini@...> wrote:

I downloaded build #2641 and I noted these problems:
1) Simple CV programmer: I have no error, CV is written correctly, but textbox "value" become 1 after each operation (I have "6" in the value textbox, I click "Write CV" button, CV is written but the textbox value become 1; if I re-read CV, I got 6). This is a bit confusing for me.
2) Editing 2 or more CVs on a sheet of a loco and pressing "Write changes on sheet" freeze the window after the second write operation and I have to close the window; is impossible to write 3 or more CVs. This occurs with all decoders (esu, zimo, lenz) I tested.

Please try build 2642 or later.

The first issue above was caused by not interpreting the LocoNet response correctly. ?Strangely, this only impacted the single CV programmer and I had been reading/writing CVs using the CV pane of a decoder definition.

The second issue was a timing issue that allowed one write to start before the previous write was fully completed.

Hopefully this should all be fixed now.

Paul


Locked Re: Detection going crazy

 

Folks

I want to thank you all for your help. Issue solved. By using the system console it became apparent to me that all the issues had to do with one of the AIU's. When I looked at the sensor table for that AIU I realized it was the one where the team had wired things backwards and I had to INVERT the sensors to get it right. Unknown to me the team corrected the wiring. Once I removed the INVERTED status all the indication was correct. So between my changing this and correcting the issues we had with the CAB bus everything is now solved.

Again thanks for all your help.

Albert


Locked Re: Operations

 

Sounds feasible and sensible.? Do backups, and name them so you can easily recover in case you don't like the results.

Dan