Jump to content
 

JMRI Scripts


St. Simon
 Share

Recommended Posts

Hi All,

 

I hope that somebody will be able to help with a JMRI Script I want to write.

 

As part of the signalling system on my new layout, I want a small degree of automation of the train describer and route setting to enable me to work the layout alone (or with a reduced operating crew) at exhibitions during breaks and over lunchtime.

 

At the very basic level, I want the system to do is to identify a train set up in the fiddle yard via RFID (the use of which has already been discussed in this thread), determine an appropriate head code for that train and then set appropriate routes relevant to that head code. I know that all of this can be easily done via the logixs function of JMRI (in fact I have already been able to set this up, minus the RFID part, in JMRI.

 

However, to complicate matters some of my trains can be associated with multiple different head codes and more than on train can be associated with the same head code, so I want the system to automatically identify if a head code is already in use and if so, allocate the next available head code to the train that it has identified.

 

Also, I want a degree of 'conflict resolution' within the system. I.e. if two trains approach a conflict junction from different directions at the same time, then the system will chosen which train to set the route for first based on a pre-defined priority (which I have called the 'weighting factor').

 

An additional factor on the layout is that I have trains which can either run straight through or go into a bay platform and turn back depending on their headcode.

 

I have realised that the best way of doing this so that I can easily add / remove trains or change priorities without having to re-code everything every time is to put all the information into a spreadsheet which a JMRI Script can look up and use the information from to carry out the above operations. Below is a snippet of the speadsheet (forget the formatting, that is just to make it easier to read):

 

1254783961_ARSMatrix.JPG.6c87d13ccba79b7509fc4cfe4c366173.JPG

 

The problem I have is that I have no clue how to write a Jython Script or even where to start, none of the examples on the JMRI website are similar to what I want to do and I can't make head nor tail out of the python and jython reference material online.

 

I know that everything above is achievable (as the Swindon Panel Society have used the same sort of system, although they haven't responded to my emails asking about the subject!), and all the logic is quite simple. I just need a push in the right direction. If it helps, here is a flow chart of what I want the Script to do:

 

1161993827_ScriptFlowChart.JPG.4632fdde34fea69549969b4456fb8dac.JPG

 

If anyone can help that would be fantastic!

 

Simon

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...