Jump to content
 

Simulating ETCS using DCC?


St. Simon
 Share

Recommended Posts

Hi,

 

Now that I've mastered conventional signalling on my layout, I have been thinking about another long term project...

 

I would love to build a small layout based on the Cambrian Line, somewhere like Aberystwyth so I can incorporate some 009 on it, and incorporate ETCS Level 2 in.

 

So, here are the things that I would need to figure out:

 

  • Interlocking / Control System - That's easy, I can do that via JMRI and it's Logix functionality.
  • Train Detection - Again, easy using DCC and current detection.
  • Train Positioning - Easy-ish, RFID Readers located  at Balise Position Groups and RFID Tags on the Locos (if I can find RFID readers that are reliable and work with JMRI!)
  • Braking Curves - Easy, DCC provides braking curves in CV4.
  • Train Protection - Now that's the hard bit...

 

The Train Protection is in theory easy as you can use the information about the speed step set by the command station. I.e. if the train is at speed step greater than a value as it passes over an RFID reader, the must be stopped.

 

However, the difficulty is one getting that speed step information from the command station and integrating it in to the interlocking / RBC within JMRI (to not only provide the train protection, but also the Movement Authority Release) and then getting JMRI to send the command station stop messages to the decoders.

 

Of course, the other issue would be providing a DMI interface for the driver.

 

Any suggestions on how one might accomplish it? I'm open to suggestions of using other programs as well.

 

Simon

  • Interesting/Thought-provoking 1
Link to post
Share on other sites

If you search for McKinley Railway and RFID then you will find details of the systems getting used there (and the source code). This works extremely well, although it isn’t integrated with JMRI - that is something you will need to do.

 

Getting the speed step for the loco should be possible by interrogating the interface data between JMRI and the command station as that will be in that data. You may even be able to get the data from with JMRI (I don’t use it ergo don’t know the answer as to whether it is available externally.)

  • Like 1
Link to post
Share on other sites

2 minutes ago, WIMorrison said:

If you search for McKinley Railway and RFID then you will find details of the systems getting used there (and the source code). This works extremely well, although it isn’t integrated with JMRI - that is something you will need to do.

 

Yes, I had seen the success the McKinley Railway has had with RFID on Youtube, but hadn't realised they had published code etc on their website.

 

3 minutes ago, WIMorrison said:

Getting the speed step for the loco should be possible by interrogating the interface data between JMRI and the command station as that will be in that data. You may even be able to get the data from with JMRI (I don’t use it ergo don’t know the answer as to whether it is available externally.)

 

I had assumed the speed step data by 'sniffing' the link between JMRI and the command station, but I can't see a way of actually doing it and harnessing it.

 

I assume that is used in the automation part of JMRI, but I want to control trains manually but using the automation part to provide the train protection.

 

Simon

Link to post
Share on other sites

When you use automation on a layout you connect the command station to a computer and software using an established protocol such as Loconet, XPressnet, etc and anything that is done on the command station is echoed through this protocol to the computer, otherwise they would get out of sync and all sorts of mess could result. In some cases it it only the change in speed step that is broadcast therefore you may need to be constantly sniffing the data to read the last seen speed step for address X, but doable.

 

 

  • Like 1
Link to post
Share on other sites

Hi,

 

You may need to check that your DCC command station will allow the computer software to override operators cabs. Otherwise train protection can be instantly overridden when the operator tries to raise the speed again.

 

Regards

 

Nick

  • Like 1
  • Agree 1
Link to post
Share on other sites

As Nick said, commercially there's Starfishrail,  and as Iain said the McKinley use Eccel Pepper units.    Either will work, though may be tight on 009 stock.  

 

Getting the signals into JMRI isn't hard.  I think Starfishrail has a mechanism (I've not used it).   

 

The Eccel units work via MQTT (so need a MQTT broker running somewhere, any computer can do that, I use an old-ish Raspberry PI).    The Eccel units send a JSON payload, which isn't immediately usable by JMRI, but its very easy (and I could send someone a bit of trivial Python code which I've used on my Raspberry PI) to monitor one MQTT channel for Eccel reports, and rebroadcast a reformatted message on another MQTT channel for JMRI to pickup.   ( The easy to use format of the payload into JMRI is a string:   itemnumber [space] anyotherdata  ) 

Once inside JMRI (needs the version 5.3.x test releases, or later), the MQTT reports are picked up as "reporter" and will appear in the "IDTag" list as "itemnumber", the "anyotherdata" is accessible via LogixNG or Scripts from the IDTag object.   

 

 

Speed information depends on the DCC system.  Some will broadcast everything and JMRI can see it and can override it (eg. Digitrax/LocoNet, which is what I mostly use).  Others transmit next to nothing for the computer to see or deal with, or don't allow the computer to override things.    

 

 

- Nigel

 

Link to post
Share on other sites

Hi,

 

StaRFIshRail has a number of interfaces including Ethernet which I've used briefly with JMRI.

I've used StaRFIshRail with MERG CBUS via a MERG CANUSB4.

The tags are 6 x 9mm and the vertical range with the smaller of the two aerials they sell is 30mm.

Top speed is 125mph in O.

StaRFIshRail is said to have MQTT but I haven't tried that yet.

 

Regards

 

Nik

Edited by NIK
  • Like 1
Link to post
Share on other sites

  • RMweb Gold

 

11 hours ago, St. Simon said:

Hi,

 

Now that I've mastered conventional signalling on my layout, I have been thinking about another long term project...

 

I would love to build a small layout based on the Cambrian Line, somewhere like Aberystwyth so I can incorporate some 009 on it, and incorporate ETCS Level 2 in.

 

So, here are the things that I would need to figure out:

 

  • Interlocking / Control System - That's easy, I can do that via JMRI and it's Logix functionality.
  • Train Detection - Again, easy using DCC and current detection.
  • Train Positioning - Easy-ish, RFID Readers located  at Balise Position Groups and RFID Tags on the Locos (if I can find RFID readers that are reliable and work with JMRI!)
  • Braking Curves - Easy, DCC provides braking curves in CV4.
  • Train Protection - Now that's the hard bit...

 

The Train Protection is in theory easy as you can use the information about the speed step set by the command station. I.e. if the train is at speed step greater than a value as it passes over an RFID reader, the must be stopped.

 

However, the difficulty is one getting that speed step information from the command station and integrating it in to the interlocking / RBC within JMRI (to not only provide the train protection, but also the Movement Authority Release) and then getting JMRI to send the command station stop messages to the decoders.

 

Of course, the other issue would be providing a DMI interface for the driver.

 

Any suggestions on how one might accomplish it? I'm open to suggestions of using other programs as well.

 

Simon

Hi Simon,

A lot of what you want is already incorporated in train automation systems, particularly the difficult bits like speed.  They work by profiling the engine over a measured distance to equate a particular speed step with and actual speed.  Then they do their own internal speed time calculation to work out where the train should be.  Note the use of ‘should’ - it’s a little limited as engine characteristics vary with whether the loco is warmed up or not and what the load is.  A bit like Big Railway ETCS positional inaccuracy, it gets corrected at the the next train detection point.

The following description is Traincontroller which I use.  I’m sure Ian Morrison will be able to advise whether iTrain can do the same.  What you get with automation is more akin to ETCS with ATO in that it stops the train at the ‘correct’ point.  However, there are other modes where the train can be driven manually and the programme set to intervene either at the braking point or at the stop point (the latter rather dramatic!).  it’s not quite the same as ETCS in that you don’t get the warnings and it adjusts the braking to achieve the target stop rather than needing an overlap and release points etc.  The way the programme works, you have to have the deceleration CV set to minimum and the programme sends out a continuous stream of speed instructions to give the deceleration curve.
There is a Traincontroller display that can do the speedometer part of the DMI which has current speed and a target speed hook on the outer ring.  Can’t do all the look ahead parts of a level 2 display though.

As mentioned by others, manual operation needs a bit of care - my Digitrax controller continues to send out a speed step zero at intervals until I release the loco, I haven’t tested to see if it sends out a repeat non-zero speed but I suspect it might.  That would mean using the on-screen manual controller rather than a walk around one.

I wonder if you are looking too much to having active balise groups.  By all means model them on the ground, but if I were doing it I would use other methods, e.g. a train detection boundary (and combine short sections internally into one TPR for display purposes) or LDR detector input.  After all, you don’t have an on-board computer doing it’s clever stuff, you have a combined interlocking/RBC/on-board computer all running in the controlling laptop.

Interlocking happens by default in Traincontroller although it doesn’t do overlaps as it doesn’t need them - no SPaDs!  I have successfully implemented overlap locking on trailing points, although the the display of overlap locking is WR E10k style not modern style.

Regarding automation programmes, technically I think Traincontroller is the best, but I have concerns about the commercial aspects, especially post Brexit, and long term technical support (the latest version does seem to be a bit buggy if you do fancy stuff with it).

Food for thought I hope.

Paul.

  • Like 1
  • Interesting/Thought-provoking 1
Link to post
Share on other sites

@5BarVT, you are correct that iTrain will do all of this (and an awful lot more), however as @St. Simon had said he was using JMRI to control the actual signals that if he wanted automation then he would use JMRI to achieve the automation ☺️

 

As to which commercial program is better, I have also have my preference, however it is fair to say that they can all achieve the same, or certainly similar, things - just in different ways, using different descriptions 😉

  • Agree 2
Link to post
Share on other sites

3 hours ago, WIMorrison said:

@5BarVT, you are correct that iTrain will do all of this (and an awful lot more), however as @St. Simon had said he was using JMRI to control the actual signals that if he wanted automation then he would use JMRI to achieve the automation ☺️

 

As to which commercial program is better, I have also have my preference, however it is fair to say that they can all achieve the same, or certainly similar, things - just in different ways, using different descriptions 😉

 

Hi,

 

Thanks to Iain and Paul, that's very interesting. 

 

The only reason for wanting to use JMRI is that I know how to get the full interlocking logic in that software, although I know that it can be a pain to work with and have it's bugs. I also know that there is a possibility of it not supporting the extra functions required for ETCS, particularly the DMI interface graphics!

 

I'm perfectly happy to consider other pieces of software to achieve ETCS.

 

Simon

Link to post
Share on other sites

12 minutes ago, St. Simon said:

The only reason for wanting to use JMRI ...... I also know that there is a possibility of it not supporting the extra functions required for ETCS, particularly the DMI interface graphics!

 

 

I think the GUI is the easy bit.   Assuming the ETCS/DMI is just a display, then if you can draw it in a drawing package (clearly you can) and if you can chop it into icons which change following underlying data changes (think that likely), then it can be done within the "panel" elements of JMRI.   
That is just a matter of stacking icons on top of each other in layers, and changing which icon is shown/hidden based on the underlying data change(s).   

 

 

- Nigel 
(professional background is in UI design, so that's why I find it the "easy bit" ).  

 

  • Informative/Useful 1
Link to post
Share on other sites

  • 3 weeks later...
On 10/04/2023 at 12:49, Nigelcliffe said:

 

I think the GUI is the easy bit.   Assuming the ETCS/DMI is just a display, then if you can draw it in a drawing package (clearly you can) and if you can chop it into icons which change following underlying data changes (think that likely), then it can be done within the "panel" elements of JMRI.   
That is just a matter of stacking icons on top of each other in layers, and changing which icon is shown/hidden based on the underlying data change(s).   

 

 

- Nigel 
(professional background is in UI design, so that's why I find it the "easy bit" ).  

 


Hi Nigel,

 

This is what the UI would have to resemble:

 

 

I know that the language is not English, but the symbols are exactly the same.

 

Ideally, I would like the driver ID entry to be used to select the DCC address, and then the train data to be selected from that (although not actually sent to the decoder, just used in the background logic)


The tricky thing I can see is how to animate the speedometer smoothly, and get JMRI to show the various menus on top of each other.

 

I think that the rest is doable, as long as I can get the DCC data from the bus.

 

Simon

Edited by St. Simon
  • Like 1
Link to post
Share on other sites

Hi,

 

This was I while ago but when I asked JMRI group about animation in JMRI Panel Pro I was recommended to  use another program running a better language for animation in parallel and the JMRI script to talk to it via Sockets.

 

Maybe MQTT would now provide another data link for a language better suited to graphics to listen to JMRI.

 

Regards

 

Nik

Link to post
Share on other sites

Simon,  

 

Menus are just layered graphic elements - one layer stacked above another, so the upper layer is visible over the lower ones.  Upper layers not in use are replaced with a transparent graphic. 

 

Your display shows locomotive speed.   That's not the same as "throttle setting" (on a model and on the real thing).    So, eventually, you need loco speed from the layout, either via trackside speed sensors, or using RailCom and decoders which will report their running speed back to a RailCom reader.  

 

- Nigel

Link to post
Share on other sites

On 27/04/2023 at 08:04, Nigelcliffe said:

Simon,  

 

Menus are just layered graphic elements - one layer stacked above another, so the upper layer is visible over the lower ones.  Upper layers not in use are replaced with a transparent graphic. 

 

Your display shows locomotive speed.   That's not the same as "throttle setting" (on a model and on the real thing).    So, eventually, you need loco speed from the layout, either via trackside speed sensors, or using RailCom and decoders which will report their running speed back to a RailCom reader.  

 

- Nigel

 

Hi Nigel,

 

Yes, I did think about the loco speed v speed step, so I would probably show the speed step commanded to the decoder in the speedometer rather than actual speed. This makes more senses as the 'train protection' would be based on speed step rather than physical speed.

 

Simon

Link to post
Share on other sites

  • 1 month later...

Hi All,

 

I'm slowing getting my head around how to do this, it's clear I can do everything relatively easily except for one thing.

 

I can't find any reference to getting speed step data from my Digitrax Command Station into a Memory within JMRI so that I can use it within Logix. I know that several members have said it is possible, not I have yet to find any practical ways of doing it!

 

Simon

Link to post
Share on other sites

  • RMweb Gold

What sort of command station?  If it’s one with external throttles, they must communicate the speed step to the command station over loconet.  Could you do a loconet sniffer to pick them out?  I think it just transmits with a slot number so you would also need to pick up when locos are allocated a slot.

As to ‘how’ I don’t know.

Paul.

Link to post
Share on other sites

32 minutes ago, 5BarVT said:

What sort of command station?  If it’s one with external throttles, they must communicate the speed step to the command station over loconet.  Could you do a loconet sniffer to pick them out?  I think it just transmits with a slot number so you would also need to pick up when locos are allocated a slot.

As to ‘how’ I don’t know.

Paul.

 

Hi Paul,

 

I use a Digitrax Zephyr (the older style one), but I use Smart Phones connected to it via Withrottle through JMRI and the Raspberry Pi, so JMRI already effectively contains the speed step, address and throttle data, so it should just be a matter of writing a script to copy the data into a Memory.

 

The problem is there is no simply guide to writing a JMRI Script other than 'here are some examples, go figure'

 

Simon

Link to post
Share on other sites

2 hours ago, St. Simon said:

Hi All,

 

I'm slowing getting my head around how to do this, it's clear I can do everything relatively easily except for one thing.

 

I can't find any reference to getting speed step data from my Digitrax Command Station into a Memory within JMRI so that I can use it within Logix. I know that several members have said it is possible, not I have yet to find any practical ways of doing it!

 

Simon

 

Simon, 

 

you're getting into moderately advanced JMRI scripting/Logix things to achieve this.  I don't think there is something built in as a menu item to use immediately.  

But, the data is there from Loconet/Digitrax systems, so it is do-able.   

 

The one concept you've got to keep clear is the Digitrax slot model.    A slot is one of many (potentially hundred plus) slots which the command station holds.   For controlling a single loco address, that loco is occupying a slot.   
You can look at the slots (with the "slot monitor" inside JMRI), and from looking through which loco is in each slot, find the loco of interest.   And then find its speed, or function on/off states, etc..   
They key thing is you can't directly look up the loco address, you need to find which slot it is in first, and then get the information.  

 

 

A few approaches to making JMRI do what you want: 

 

a )   working things out for yourself.   There's an example script in the JMRI distribution (so on your PC in the JMRI directory in the program files), called " LocoNetSlotsReadCSV.py  "   That is reading the LocoNet slots, and accessing the loco speed and other data.   So, has the elements you require, though its not currently doing what you need.   It may be a starting point for experimentation and learning.    And it may not be a massive amount of work to modify the script to write the loco address and speed to other places (such as memory variables), or using a modified script from LogixNG or Logix.  

 

b )   post question(s) on the jmriusers forum on groups.io, which is where all the support really happens.   If the question is well explained, and attracts attention, then you'll get sample script code which works (I suspect a clear question might attract Bob Jacobsen's interest, and as he probably knows more about JMRI than anyone else, you'll be on the home straight for this approach).    

 

c )  similar to (c), but ask for the ability to access the LocoNet Slots to be added to LogixNG.   The development of LogixNG is currently very rapid, so a new feature is likely to be added in days if it attracts the attention of the relevant developer.   I find LogixNG to be easier to deal with than scripting.   

 

 

 

 

 

 

 

  • Informative/Useful 2
Link to post
Share on other sites

16 hours ago, Nigelcliffe said:

 

Simon, 

 

you're getting into moderately advanced JMRI scripting/Logix things to achieve this.  I don't think there is something built in as a menu item to use immediately.  

But, the data is there from Loconet/Digitrax systems, so it is do-able.   

 

The one concept you've got to keep clear is the Digitrax slot model.    A slot is one of many (potentially hundred plus) slots which the command station holds.   For controlling a single loco address, that loco is occupying a slot.   
You can look at the slots (with the "slot monitor" inside JMRI), and from looking through which loco is in each slot, find the loco of interest.   And then find its speed, or function on/off states, etc..   
They key thing is you can't directly look up the loco address, you need to find which slot it is in first, and then get the information.  

 

 

A few approaches to making JMRI do what you want: 

 

a )   working things out for yourself.   There's an example script in the JMRI distribution (so on your PC in the JMRI directory in the program files), called " LocoNetSlotsReadCSV.py  "   That is reading the LocoNet slots, and accessing the loco speed and other data.   So, has the elements you require, though its not currently doing what you need.   It may be a starting point for experimentation and learning.    And it may not be a massive amount of work to modify the script to write the loco address and speed to other places (such as memory variables), or using a modified script from LogixNG or Logix.  

 

b )   post question(s) on the jmriusers forum on groups.io, which is where all the support really happens.   If the question is well explained, and attracts attention, then you'll get sample script code which works (I suspect a clear question might attract Bob Jacobsen's interest, and as he probably knows more about JMRI than anyone else, you'll be on the home straight for this approach).    

 

c )  similar to (c), but ask for the ability to access the LocoNet Slots to be added to LogixNG.   The development of LogixNG is currently very rapid, so a new feature is likely to be added in days if it attracts the attention of the relevant developer.   I find LogixNG to be easier to deal with than scripting.   

 

Hi Nigel,

 

Thanks for the info, I'll have a look at the JMRI users forum and see what I come up with, I was weary of asking the MERG or JMRI forum simply because I usually get a totally different response to the one I was searching for!. 

 

Interesting about the example script, I hadn't realised that the whole slot thing, so I'll have a look at that. I've had a look at the Logix NG stuff and to me as a person who has no idea about programming other than simple Arduino code, I can't get on with it at all!

 

I can do the rest of logic and leave the train protection portion out of it whilst I get this bit sorted!

 

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...