Model Train Forum banner

1 - 3 of 3 Posts

·
Registered
Joined
·
226 Posts
Discussion Starter #1
I have JMRI running on my Mac Mini attached to a NCE dcc system. So far its been working great.

What I want to do is write a script that will send the engine startup cv to my loco's so they will start up and idle for 3 min, then shutdown. And I want this to happen at a random time between the 1hr to 2hr to simulate proto leaving the engine warm and ready to depart on a moments notice.

As a Linux admin and IT background, i am sure I can write code. With some experience with BASH and a lot of powershell. What I dont know is can JMRI accept it?

Has anyone seen anything like this done? Any advice will be helpful. Any example code showing the commands given to the jrmi would help. I would think that crontab could be used to execute this script at a 15 min interval. And a text file can keep track of when the last command was successfully ran.

Does JMRI have the ability to do this?

John
 

·
Registered
Joined
·
1,402 Posts
Firstly I don't (completely) know the answer but have wondered whether jmri is "scriptable". There's several meanings to that.

I think top of the chart it means it supports its own scripting "procedures" to activate it's functions directly. The script is in total control "within" jmri.

It might help to understand its a big or multi part Java Swing program. Where swing provides the UI.

I don't think -- second meaning -- it's decomposed into a set of "bin" executables intended to be run from the command line so to speak with the idea that you'd create a bunch of bash scripts to do things through it. And that at some point someine wrote a GUI wrapper.

I'm not saying this won't work or can't be made to work. I'm just saying it wasn't (possibly) conceived of in those terms.

So that's two ways it could be scriptable.

But I looked it up. There is section on scriptining.


So it looks like one two of the built in tools provides a place to inject a script so to speak. There may be other options, it looks like it'll take some study.

But the examples shown are python.

Well some explanation. So Java runs on what is called the jvm. There are now a whole lot of jvm languages besides Java. Consequently it's possible to call them from your Java. They show python running on "jython". But it could be another perhaps. (Surely this would take a custom build to include the desired 3rd party libraries for your jvm language)

Anyway so that's what's going on there...

But it's not clear to me you get a kind of separate operator interface... That totally takes control of jmri and provides a kind of artificial replacement for the GUI controls.
 

·
Registered
Joined
·
226 Posts
Discussion Starter #3
So I joined the JMRI group and have asked the question. As I learn if this is possible, and how, I will keep it posted here as well.
 
1 - 3 of 3 Posts
Top