Jump to content
 

Computer control and Signalman simulation


GWR8700
 Share

Recommended Posts

Hello I'm new to the world of DCC and computer control so I was wondering if anyone could give me any advice about whether what I am proposing is possible?

I am wanting to build a home model railway layout where I am the signalman with the engines driving themselves to a timetable.  I pull the levers in the same way a signalman in control of his box would and communicate with the computer via bell codes.  A bit like the 'automatic crispin' on Buckingham from what I understand.

Is this something that could be done through the power of DCC and computer automation?

  • Like 1
Link to post
Share on other sites

The product I use for automation allows me to run trains 'manually' in a semi-automatic mode, whereby the trains will run with you controlling the speed via your hand-controller yet automatically obey all signals that have been set on the layout. You can also run it fully manual, where you have to obey the signals yourself and stop at them.

 

Is this what you are looking to achieve?

Link to post
Share on other sites

1 hour ago, WIMorrison said:

The product I use for automation allows me to run trains 'manually' in a semi-automatic mode, whereby the trains will run with you controlling the speed via your hand-controller yet automatically obey all signals that have been set on the layout. You can also run it fully manual, where you have to obey the signals yourself and stop at them.

 

Is this what you are looking to achieve?

Yeah that could work, how do they simultaneously obey the signals and the controller?

Link to post
Share on other sites

I think you may end up having to make/design some things yourself.   Running from bells, and running to signals, not exactly how most automation tools are setup to work.   (And the main commercial automation software isn't written by UK-based people, so expecting them to understand UK working is a big-ask). 

 

I have a friend with a layout with bell-codes linked into Arduinos which are programmed with the timetable, so present the next train to be handled as bells which the operator is expected to reply to (correctly) before a train is released, etc..   As its currently arranged, human drivers move the trains, but there have been serious discussions about computer driving some of the movements (particularly into fiddle yards).  

Link to post
Share on other sites

38 minutes ago, Nigelcliffe said:

I think you may end up having to make/design some things yourself.   Running from bells, and running to signals, not exactly how most automation tools are setup to work.   (And the main commercial automation software isn't written by UK-based people, so expecting them to understand UK working is a big-ask). 

 

I have a friend with a layout with bell-codes linked into Arduinos which are programmed with the timetable, so present the next train to be handled as bells which the operator is expected to reply to (correctly) before a train is released, etc..   As its currently arranged, human drivers move the trains, but there have been serious discussions about computer driving some of the movements (particularly into fiddle yards).  

That's really interesting, I'd rather just do the signals but could always get in someone to do the train driving.

Link to post
Share on other sites

The basic method for having trains running automatically with manual signalling is described in the TrainController manual at pages 360-1. In essence, what you need to do is lock the exits of the blocks that immediately precede on the train's path the blocks that you want to control as a signaller, and then set up a route manually in the software that is one of the routes that the train, under automatic control, is programmed to be able to take. If you configure the system to unlock the block at the same time as a route is set, because TrainController will always prefer the route that has already been set, this is the route that will be taken.

 

I have so far implemented this successfully for a part of my layout (and have only done a part so far as I have only recently finished wiring it and not yet finished adding the hardware addresses into the software). However, my layout is set in the 1980s using modern signalling systems with computerised NX ("eNtry eXit") control, which does work more easily with TrainController's systems. I have not tested this with a functional representation of mechanical signalling (or a form of signalling controlled by individual levers rather than route setting), but I believe that it should in principle be possible.

 

What you would do in such a case is have levers for the individual turnouts in a straightforward way, and have all the route setting logic in the lever controlling the signal that you have to pull off for the train to be given authority to proceed. Imagine for these purposes a simple double junction: a train on the diverging route may be signalled either to point A or point B or may be held at the signal.

 

The block immediately preceding the signal controlling the double junction would be locked (for more sophistication, you could have a switch, either in hardware or software, to unlock this if you want fully automatic operation for any reason). A train would therefore be held at the stop marker in the block, which you would set up to be at a realistic distance from the signal controlling the block. You could then pull the levers for setting the route either to A or B. In a semaphore signalling world, you would have two different signal arms, one for route A and one for route B. You could set up logic so that you can only pull off the route B arm if the points are set for route B, the arm for route A is on, and the track is unoccupied. Pulling the route B arm could then trigger (1) the setting of a route through the junction to the block beyond for route B; (2) the movement of the signal itself; and (3) the unlocking of the block behind the signal. Depending on how you had set up the train's schedule (i.e., whether it is allowed to take both route or only one), setting the wrong route would either allow the train to take the wrong route, or the train would simply refuse to move even with a clear signal if the wrong route had been set.

 

You would then do the same for route A, and set up the block behind the signal on the diverging route to re-lock automatically (if your "full automation" switch is not set to on) as soon as the block switches from being occupied to unoccupied. You would also do the same on the converging routes, save that there is only one route through the junction for these routes. This system would simulate a mechanical signalbox with track circuits in that there is an interlock to track occupancy built-in. I am sure that it would be possible to simulate the operation without track circuits, probably by using fewer occupancy sensors, giving a realistic possibility of collision should the signaller get things wrong!

 

Communication with neighbouring signal-boxes is more complex; I have not done this yet, but I believe that this is likely to be possible. What you would do is set up logic to simulate the entry of the train in question to the next signalbox down the line. Imagine again our double junction and a train approaching on the diverging line, and imagine a layout with just the double junction and fiddle yards on the plain track beyond this section. For each train movement between the fiddle yard and the diverging line, you would set up a macro triggered by a timetable event (or any other kind of event, such as a button press) that would trigger a sequence of events when it is time for a train to approach. You would set a variable representing occupancy of the preceding section of track by a train, would prevent any other train from being offered until the line had cleared. You would then set a sound to play representing a bell code for the class of train in question (using variables and flow control logic; you would assign a variable to the train in the macro that starts it defining its class, e.g., ordinary passenger). This would just be a recording of a sound, either from a real signalbox, or a recording that you could put together from a bell that you can find somewhere. You need then to set up a button in TrainController to constitute the acceptance of a train from the signalbox in rear. The one thing that would be very difficult to do (not impossible by using an Arduino or similar - but would require a lot of work) is make TrainController recognise actual timed bell codes, so that pressing a button in a tap-tap-wait-tap sequence means one thing and pressing tap-wait-tap-tap means something else. So, unless you could set up an Arduino or similar to encode these signals, you would have to compromise on the interface a little, and just have different buttons to represent sending different bell codes to different boxes - but you could make up for it by having the system play a recording of the right pattern of taps when you do this.

 

On acceptance, a macro would run with a timer representing the time that it takes for the train to pass out of the section in rear and up to your outer home (if you have one), or up to the point when the train would be ready to enter the scenic section. Assuming the simpler case with no outer home, the expiry of the timer would trigger the start of a "schedule" on the actual layout, causing the train physically to enter the scenic section and either wait behind the signal if at danger or proceed if it is at clear. With a little more sophistication, you could also set it up so that, if you had pulled off your distant in time, the train would arrive into your section much faster than if you had not.

 

Some care would need to be taken to ensure that trains scheduled to enter the section in rear but which cannot because that section is occupied do not become lost: you would probably have to program a queue system or similar. Note that you cannot rely on macros running with timers and repeats, etc. to store information, as macros are terminated and the data in them lost whenever the system is paused or TrainController exits, so you will need to use macros that run periodically and check global variables that have a persistent state.

 

So, as indicated, this is possible, but it takes quite a bit of programming work in TrainController as there are no built-in systems set up to do this easily.

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

6 hours ago, GWR8700 said:

Does traincontroller work with block bells?  That's something I would like to implement

It's easy enough for computer equipment to ring a block bell - all your interface has to do is send a pulse to a single-stroke bell, and to repeat that as many times as appropriate for the code you want to send. with appropriately timed gaps between the pulses 

A block instrument is even easier, and a commutator on a pegging block can be recognised as a simple 3-poisiton switch.

 

What is more difficult is to automate is recognising a code sent by a human using a tapper, although it can be done.   That's because different operators send codes at different speeds, and the software has to measure the timing of the gap between pulses to distinguish 4 from 3-1 for example.   I have successfully done that in the past using a program I wrote in Qbasic to address the serial port of an obsolete 286 desktop computer; I have also done it using a PIC (microchip) circuit.

 

If you are looking at software packages to drive the trains, there are a number on the market.  I would say the leading two are iTrain and  Traincontroller, and people have differing opinions on which is the best.  You need to choose not only the software package but the DCC hardware you are going to use.  Both the packages mentioned will interface to a wide range of DCC Command stations, and the DCC command station in turn will need to interface to accessory modules to connect bells, indicators etc (though most modellers only want them to control point motors and signals/lighting.  Roco Z21 and DIgikeijs DR5000 are perhaps the more popular choices of serious command stations in Europe (Americans tend to prefer other brands); these will interface to most makes of accessory modules.  The software needs to keep track of where trains are, so that it knows when the train approaches a signal at danger and can instruct the loco (via the command station) to slow & stop at the right place and to start up again when required.  This means feedback detectors (the modelling equivalent of a track circuit), or which there are several different types and a range of brands available. 

 

You indicate you are not familiar with DCC - I assume however you do already appreciate that you will have to fit a decoder to all your locos, so that trains can respond to instructions sent to them, whether by the control software or by a hand-held equivalent to the controllers typically used in DC modelling, .  

 

 

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

Yes, it is possible.  Go look at my thread on Long Marton, there is video of me doing exactly what you are asking.

It took me treating RR&Co 5.7 as a starting for an overlay layer of Ladder Logic for me to do it, but it is workable.  

 

I suspect that JMRI would be a better starting place- at least, if I was starting again, that's where I'd go now.  Mostly because the overlay layer in RR&Co does so much of the computing, rather than the native logic in RR&Co.  


James

Link to post
Share on other sites

I did look into using JMRI, but found that it lacked many of the necessary abstractions (such as a schedule) necessary for full automation without having in effect to write a very substantial piece of software from the ground up in JMRI's scripting language, which would be very vulnerable to breaking with any major update to JMRI.

 

Edit: Incidentally, I should also note that iTrain lacks variables, which means that one cannot do the same thing as I described above using TrainController.

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

Interesting comments from all sides but I would like to push the discussion back a bit, to the underlying layout. The thing is that layouts in even medium sized rooms tend to have a station or freight feature on one long side and a fiddle yard, which is a replacement for a linear railway, on the other. To have a layout with a justified requirement for 2 signal boxes one operated manually one virtually (maybe 2) will be a challenge in its own right. 

 

This leads me to wonder if half the layout can be stored in the computer for communication purposes..

Link to post
Share on other sites

2 hours ago, RobinofLoxley said:

Interesting comments from all sides but I would like to push the discussion back a bit, to the underlying layout. The thing is that layouts in even medium sized rooms tend to have a station or freight feature on one long side and a fiddle yard, which is a replacement for a linear railway, on the other. To have a layout with a justified requirement for 2 signal boxes one operated manually one virtually (maybe 2) will be a challenge in its own right. 

 

This leads me to wonder if half the layout can be stored in the computer for communication purposes..

 

Do you mean a virtual extension to a real layout? This is certainly possible - I already have this in progress on my layout, albeit with modern signalling.

Link to post
Share on other sites

9 hours ago, jamespetts said:

 

Do you mean a virtual extension to a real layout? This is certainly possible - I already have this in progress on my layout, albeit with modern signalling.

Yes. Removes the problem of the physical layout being incompatible with the OP's idea.  I'm not an automation expert at all although it's an interest area for me.

Link to post
Share on other sites

On 27/10/2021 at 15:13, jamespetts said:

The basic method for having trains running automatically with manual signalling is described in the TrainController manual at pages 360-1. In essence, what you need to do is lock the exits of the blocks that immediately precede on the train's path the blocks that you want to control as a signaller, and then set up a route manually in the software that is one of the routes that the train, under automatic control, is programmed to be able to take. If you configure the system to unlock the block at the same time as a route is set, because TrainController will always prefer the route that has already been set, this is the route that will be taken.

 

I have so far implemented this successfully for a part of my layout (and have only done a part so far as I have only recently finished wiring it and not yet finished adding the hardware addresses into the software). However, my layout is set in the 1980s using modern signalling systems with computerised NX ("eNtry eXit") control, which does work more easily with TrainController's systems. I have not tested this with a functional representation of mechanical signalling (or a form of signalling controlled by individual levers rather than route setting), but I believe that it should in principle be possible.

 

What you would do in such a case is have levers for the individual turnouts in a straightforward way, and have all the route setting logic in the lever controlling the signal that you have to pull off for the train to be given authority to proceed. Imagine for these purposes a simple double junction: a train on the diverging route may be signalled either to point A or point B or may be held at the signal.

 

The block immediately preceding the signal controlling the double junction would be locked (for more sophistication, you could have a switch, either in hardware or software, to unlock this if you want fully automatic operation for any reason). A train would therefore be held at the stop marker in the block, which you would set up to be at a realistic distance from the signal controlling the block. You could then pull the levers for setting the route either to A or B. In a semaphore signalling world, you would have two different signal arms, one for route A and one for route B. You could set up logic so that you can only pull off the route B arm if the points are set for route B, the arm for route A is on, and the track is unoccupied. Pulling the route B arm could then trigger (1) the setting of a route through the junction to the block beyond for route B; (2) the movement of the signal itself; and (3) the unlocking of the block behind the signal. Depending on how you had set up the train's schedule (i.e., whether it is allowed to take both route or only one), setting the wrong route would either allow the train to take the wrong route, or the train would simply refuse to move even with a clear signal if the wrong route had been set.

 

You would then do the same for route A, and set up the block behind the signal on the diverging route to re-lock automatically (if your "full automation" switch is not set to on) as soon as the block switches from being occupied to unoccupied. You would also do the same on the converging routes, save that there is only one route through the junction for these routes. This system would simulate a mechanical signalbox with track circuits in that there is an interlock to track occupancy built-in. I am sure that it would be possible to simulate the operation without track circuits, probably by using fewer occupancy sensors, giving a realistic possibility of collision should the signaller get things wrong!

 

Communication with neighbouring signal-boxes is more complex; I have not done this yet, but I believe that this is likely to be possible. What you would do is set up logic to simulate the entry of the train in question to the next signalbox down the line. Imagine again our double junction and a train approaching on the diverging line, and imagine a layout with just the double junction and fiddle yards on the plain track beyond this section. For each train movement between the fiddle yard and the diverging line, you would set up a macro triggered by a timetable event (or any other kind of event, such as a button press) that would trigger a sequence of events when it is time for a train to approach. You would set a variable representing occupancy of the preceding section of track by a train, would prevent any other train from being offered until the line had cleared. You would then set a sound to play representing a bell code for the class of train in question (using variables and flow control logic; you would assign a variable to the train in the macro that starts it defining its class, e.g., ordinary passenger). This would just be a recording of a sound, either from a real signalbox, or a recording that you could put together from a bell that you can find somewhere. You need then to set up a button in TrainController to constitute the acceptance of a train from the signalbox in rear. The one thing that would be very difficult to do (not impossible by using an Arduino or similar - but would require a lot of work) is make TrainController recognise actual timed bell codes, so that pressing a button in a tap-tap-wait-tap sequence means one thing and pressing tap-wait-tap-tap means something else. So, unless you could set up an Arduino or similar to encode these signals, you would have to compromise on the interface a little, and just have different buttons to represent sending different bell codes to different boxes - but you could make up for it by having the system play a recording of the right pattern of taps when you do this.

 

On acceptance, a macro would run with a timer representing the time that it takes for the train to pass out of the section in rear and up to your outer home (if you have one), or up to the point when the train would be ready to enter the scenic section. Assuming the simpler case with no outer home, the expiry of the timer would trigger the start of a "schedule" on the actual layout, causing the train physically to enter the scenic section and either wait behind the signal if at danger or proceed if it is at clear. With a little more sophistication, you could also set it up so that, if you had pulled off your distant in time, the train would arrive into your section much faster than if you had not.

 

Some care would need to be taken to ensure that trains scheduled to enter the section in rear but which cannot because that section is occupied do not become lost: you would probably have to program a queue system or similar. Note that you cannot rely on macros running with timers and repeats, etc. to store information, as macros are terminated and the data in them lost whenever the system is paused or TrainController exits, so you will need to use macros that run periodically and check global variables that have a persistent state.

 

So, as indicated, this is possible, but it takes quite a bit of programming work in TrainController as there are no built-in systems set up to do this easily.

That was very informative, thank you

  • Like 1
Link to post
Share on other sites

On 27/10/2021 at 20:27, Michael Hodgson said:

It's easy enough for computer equipment to ring a block bell - all your interface has to do is send a pulse to a single-stroke bell, and to repeat that as many times as appropriate for the code you want to send. with appropriately timed gaps between the pulses 

A block instrument is even easier, and a commutator on a pegging block can be recognised as a simple 3-poisiton switch.

 

What is more difficult is to automate is recognising a code sent by a human using a tapper, although it can be done.   That's because different operators send codes at different speeds, and the software has to measure the timing of the gap between pulses to distinguish 4 from 3-1 for example.   I have successfully done that in the past using a program I wrote in Qbasic to address the serial port of an obsolete 286 desktop computer; I have also done it using a PIC (microchip) circuit.

 

If you are looking at software packages to drive the trains, there are a number on the market.  I would say the leading two are iTrain and  Traincontroller, and people have differing opinions on which is the best.  You need to choose not only the software package but the DCC hardware you are going to use.  Both the packages mentioned will interface to a wide range of DCC Command stations, and the DCC command station in turn will need to interface to accessory modules to connect bells, indicators etc (though most modellers only want them to control point motors and signals/lighting.  Roco Z21 and DIgikeijs DR5000 are perhaps the more popular choices of serious command stations in Europe (Americans tend to prefer other brands); these will interface to most makes of accessory modules.  The software needs to keep track of where trains are, so that it knows when the train approaches a signal at danger and can instruct the loco (via the command station) to slow & stop at the right place and to start up again when required.  This means feedback detectors (the modelling equivalent of a track circuit), or which there are several different types and a range of brands available. 

 

You indicate you are not familiar with DCC - I assume however you do already appreciate that you will have to fit a decoder to all your locos, so that trains can respond to instructions sent to them, whether by the control software or by a hand-held equivalent to the controllers typically used in DC modelling, .  

 

 

Thank you for that.  Yeah I know the basics of DCC from online tutorials but have limited experience using it myself.

Link to post
Share on other sites

On 27/10/2021 at 20:59, peach james said:

Yes, it is possible.  Go look at my thread on Long Marton, there is video of me doing exactly what you are asking.

It took me treating RR&Co 5.7 as a starting for an overlay layer of Ladder Logic for me to do it, but it is workable.  

 

I suspect that JMRI would be a better starting place- at least, if I was starting again, that's where I'd go now.  Mostly because the overlay layer in RR&Co does so much of the computing, rather than the native logic in RR&Co.  


James

Thank you, I will check out that thread

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