Rail3D*

   

 

Single Line Auto Sig



Note: this feature is now implemented in Rail3D as the Block Intermediate option. Scripts may still be required for more complicated situations, as described towards the bottom of this page.

Introduction

One way of increasing the efficiency of single lines with passing loops is to have intermediate automatic signals in the single line section so that multiple trains can pass through in the same direction at the same time. This means that trains travelling in close succession don’t have to wait until the preceding train has cleared the single line section. I understand this sort of system is in use quite a bit in the us (although I may be wrong).

This is quite a complex example of using scripts to achieve correct operation of the signals, so be prepared for a bit of reading!

1 Background

1.1 Comparisons

Consider the following arrangement in which there is perhaps a 15 km section of single line:

Suppose that a train enters the single line section from West End. When it is halfway along the single line section, a second train arrives at West End, and a third train arrives at East End. We now have a situation where trains 2 and 3 must wait for train 1 to clear the entire single line section. If all trains travel at around 100 km/h, then it takes about 10 minutes to traverse the section. Once train 1 has left the single line section, and assuming trains 2 and 3 have been waiting for 5 minutes:

  • If train 2 is allowed to go next, then it will incur a 5 minute total delay and train 3 is delayed by 15 minutes.
  • If train 3 is allowed to go next, then it will incur a 5 minute total delay and train 2 is delayed by 15 minutes.

In each case, the total number of delayed minutes incurred by all trains is 20 minutes.

To help raise the efficiency, we can insert some automatic signals along the single line section:

This time, if the same pattern of three trains arrives, then train 2 will be able to follow train 1 immediately, and train 3 will wait only 10 minutes. The total delay time is then 10 minutes instead of 20.

1.2 Example of operation

Here is an example of how it works. Note that diagrams don’t show every step. Automatic signals are prefixed “M”, and all other signals are controlled. Black line = normal track; red = occupied section; purple = route set; grey = automatically-signalled single line.)

An eastbound train arrives from the west and then enters the single line section:

It proceeds through the single line section, with the automatic signals clearing again behind it. Note that westbound automatic signals are at continuously at stop. A second train is arriving from the east:

The westbound train is brought to a halt at est7 while the first train passes:

After the eastbound train has cleared the section, all of the eastbound automatic signals are placed to stop in preparation for reversal of traffic direction:

Signal est7 then clears and the automatic signals are set up for westbound traffic:

The first westbound train proceeds. A second arrives from the east, but signal est7 cannot yet clear because the first westbound train hasn’t moved far enough yet.

The second westbound train proceeds behind the first, with the automatic signals ensuring it keeps a safe distance behind.

Note that signal wst9 is not an automatic signal, so it remains at stop once a train passes.

2 Modelling in Rail3D

So now you want to model this setup in Rail3D. If you just add signals to the single line section, you may find a number of problems:

  • If you use automatic signals, then sooner or later you’ll end up with a collision as trains from either direction meet head on in the single line section.
  • If you use controlled signals:
    • You will get two trains heading toward each other and an impasse will result as the signals fail to find a route.
    • If you set them to Lock Through then you won’t get any impasses, but this will result in the single line entry signal failing to clear until the train in front is leaving the single line section, which is exactly what we’re not trying to do!

The answer is, of course, to use scripts.

3 How to script it

3.1 Diagram

For this section I’ll be referring to the following diagram:

Note that signals designated “M” are automatic signals.

3.2 Objectives

We should bear in mind some simple objectives:

  1. To avoid impasses.
  2. To avoid having trains stuck anywhere.
  3. To have the intermediate signals behave entirely as automatic signals.

3.3 Layout setup

The great thing about this is, in the Rail3D layout, all the signals that are supposed to be automatic actually are automatic. In other words, we’re not having any psuedo-automatic signals that are really controlled signals or vice-versa.

You can set up the layout with signals exactly as depicted in the diagram, with signals prefixed “M” being automatic signals. The only other thing you need to do is to insert a hidden repeater signal on the next node in advance (i.e. after) signals wst6 and est7, and name them wst20 and est21 respectively.

3.4 The plan

It took me a while to figure out how this was all going to work, but this is what I came up with in the end:

  • The intermediate signals (i.e. automatic signals in the single line section) will all be automatic signals with the Hold flag set. The Holds will be released as necessary to allow the signals to operate as automatic signals.
  • Single line entrance signals wst6 and est7 will be Hold signals too.
  • When a train approaches the single line a script checks if the line is “available” for that train to enter the single line.
    • If available, the script changes the direction of traffic (if necessary) to suit the oncoming train and clears and sets/unsets holds on signals as appropriate.
    • If not available, the script registers a “Train Waiting” flag.
  • Trains leaving the single line section trigger a script to check if there are any “Train Waiting” flags, and if there are train(s) waiting, checks if the line is “available” for those train(s) and runs the same process as before.
  • Generally, the line is not available if either:
  1. An oncoming train is in the single line section, or
  2. The single line entrance signal at the other end is cleared.

3.5 Adding some scripts

I’m only going to go through the scripts for the east end of the single line section. The scripts for the other end are entirely reciprocal so you can have some fun figuring them out! A full explanation of what is happening follows the scripts.

Script for M211

OnTrain()
{
	int LineAvailable=1;
	int LineSet=0;

	signal sigEntryWST=GetSigByID("WST6");
	signal sigAutoEa=GetSigByID("M270");
	signal sigAutoEb=GetSigByID("M260");
	signal sigAutoEc=GetSigByID("M250");
	signal sigAutoEd=GetSigByID("M240");

	signal sigEntryEST=GetSigByID("EST7");
	signal sigTWaitEST=GetSigByID("EST21");
	signal sigAutoWa=GetSigByID("M251");
	signal sigAutoWb=GetSigByID("M261");
	signal sigAutoWc=GetSigByID("M271");
	signal sigAutoWd=GetSigByID("M281");

	// Determine current traffic direction

	if(sigAutoEa.IsHold()==1)
	{
		LineSet=1;
	}

	// Condition A: is train in section?
	if(((sigAutoEa.IsOn()==128)||(sigAutoEb.IsOn()==128))||(sigAutoEc.IsOn()==128))
	{
		// Train in section
		if(LineSet==0)
		{
			// Train is oncoming
			LineAvailable=0;
		}
	}

	// Condition B: is opposite entry signal cleared?
	if(sigEntryWST.IsOn()==0)
	{
		// Train cleared for opposing movement
		LineAvailable=0;
	}

	// Condition C: is oncoming train in section before first automatic signal?
	if((sigEntryWST.IsHold()==1)&&LineSet==0)
	{
		// Train in first section (using Hold as a flag)
		LineAvailable=0;
	}

	// Clear signals if possible
	if((LineAvailable==1)&&(LineSet==0))
	{
		// Hold opposing automatic signals at stop
		sigAutoEa.SetHold(1);
		sigAutoEb.SetHold(1);
		sigAutoEc.SetHold(1);
		sigAutoEd.SetHold(1);

		sigEntryWST.SetHold(1);

		// Release automatic signals in this direction
		sigAutoWa.SetHold(0);
		sigAutoWb.SetHold(0);
		sigAutoWc.SetHold(0);
		sigAutoWd.SetHold(0);

		sigEntryEST.SetHold(0);

		// Release hold on hidden "Train Waiting" signal (if necessary)
		sigTWaitEST.SetHold(0);
	}
	if(LineAvailable==0)
	{
		// Set Hold flag on "Train Waiting" signal
		sigTWaitEST.SetHold(1);
	}
}

Script for est21

OnTrain()
{
	signal sigEntryEST=GetSigByID("EST7");
	signal sigTWaitEST=GetSigByID("EST21");

	sigEntryEST.SetHold(1);
	sigTWaitEST.SetHold(0);
}

Script for M261

OnTrain()
{
	signal sigEntryEST=GetSigByID("EST7");

	sigEntryEST.SetHold(0);
}

Script for M210

OnTrain()
{
	signal sigTWaitEST=GetSigByID("EST21");

	// Check if a train was waiting for this train to leave the section
	if(sigTWaitEST.IsHold()==1)
	{
		// COPY SCRIPT FROM SIGNAL M211 TO HERE
		// (remember to omit line defining sigTWaitEST, as it's
		// already been defined above)
	}
}

3.6 Detailed explanation

If you want to know exactly what was going on, then keep reading. If you don’t, then feel free to stop now!

Firstly, the whole arrangement is set up so that the direction of traffic at any particular time is either westbound or eastbound. For example, if it is eastbound, then all the eastbound signals (M270, M260, M250 & M240) have their Hold flags unset so that they can clear, and the westbound signals (M251, M261, M271 & M281) have their Hold flags set so they remain at danger. In addition to this, the relevant single line entry signal (either wst6 or est7) will have its Hold flag set when traffic is in the opposing direction.

Now, when a train arrives from the east at East End, it passes signal M211. Here’s what that script does:

  • Check direction of traffic - the first automatic signal in the opposite direction is checked to see if its Hold flag is set. If it is, then the traffic direction is correct. The LineSet variable stores this information (1 = correct direction a.k.a. “line set”, 0 = wrong direction).
  • The LineAvailable variable is defined, and if any criteria fail, it is set to zero.
  • Check for trains in section - this is done by seeing if the opposing automatic signals are at Stop. If they are, then it’s because either the line traffic direction is already correct and those signals have the Hold flag set, or because a train is in the section. LineAvailable is set to zero (“not available”) if the line is not set (i.e. traffic direction is wrong) and one or more automatic signals are at stop.
  • Check if opposite entry signal is cleared - if the single line entrance signal at the other end of the single line section is cleared (i.e. not at stop) then a train will be coming in the other direction. When this happens LineAvailable is set to zero.
  • Check if train has just passed opposite entry signal - we can’t use the signal to test if a train is in the section in advance here because it was governed by the entrance signal, which is a controlled signal, so it may well be at stop even though there is no train in advance of it. I have set up a mechanism for determining this, and it will be explained shortly. Essentially, though, if a train is determined to be in that first section (between wst6 and M270) then LineAvailable is set to zero.
  • After the conditions have been evaluated, there are three possible outcomes:
    • Line Available but Line Not Set - automatic signals in the opposite direction are put to stop (by setting them to Hold), automatic signals in this direction (westbound) have their Hold flags removed, the entry signals have their Hold flags adjusted accordingly and the traffic direction is then set up correctly and the signals should clear automatically.
    • Line Available and Line Set - everything is ok for the train to proceed; the signalling system will clear the signals when possible, and the script doesn’t have to do anything at all.
    • Line Not Available - this means that the train will have to wait, due to an oncoming train. That’s ok, but when the line does become available, how will the traffic direction changeover if the train is stopped and not passing any scripted signals to trigger the direction change? This is solved by the script using the hidden repeater signal’s Hold flag as a variable. If a train needs to wait, this Hold flag is set. Trains in the opposite direction read this “variable” once they leave the single line section and enact the traffic direction change (if possible).

If you understood that, then you may be wondering why one of the automatic signals was left out of the checking process for trains in the section (dot point 3). The reason we didn’t check signal M240 is because if a train is in the section between M240 and est10, then est7 cannot possibly clear anyway, and we can safely cancel all the automatic signals without affecting the running of this train.

(It also allows for greater train lengths on the exiting train when there is a train waiting to enter in the opposite direction. You can have long trains, as long as the back of the train is not in rear of M240 when the front is at M210. The same goes for back of a train at M281 and the front at M311.)

So that was the first scripted signal encountered by the train. Assuming that the line was available and the traffic direction had been changed to favour our westbound example train, the next script run is on est21, the hidden repeater:

  • When a train passes, signal est21 sets a Hold on est7 to serve as an indication that a train is in the section est7 - M251. This is required because otherwise there is no other way of determining if a train is in this section of track.

The next script is on signal M261:

  • When a train passes, signal M261 releases the Hold on est7, which means that the train is no longer in the section est7 - M261.
  • We cannot put this script on signal M251 because the track circuit for M251 doesn’t drop until the train passes the next next node in advance of M251. If we did, there would be a brief period of time in which the train would go undetected by the scripts on M211 and M310. I have chosen to put it on M261 rather than specially creating a hidden repeater signal on the next node in advance of M251 just for putting a script on.

The last script triggered by this train is actually on signal M311 as it leaves the single line section. However, because I’ve only shown the scripts at East End, and at the risk of causing confusion, we’ll discuss the script on M210 for eastbound trains instead.

  • When a train exits the single line section and passes the first automatic signal on double track, the script checks to see if any “Train Waiting” signal was registered by a train in the opposite direction. (A Hold flag on the hidden repeater signal constitutes a “Train Waiting” signal.) If an eastbound train passing M210 detects a train waiting at est7, then it executes the same script that the westbound train tried to execute when it passed M211.
    • If the single line is now clear, then the eastbound train will trigger the change of direction for the waiting westbound train.
    • If the single line is still unavailable (another eastbound train following) then nothing will happen, and the following train will trigger this script again.

3.7 Notes

  • If a train approaches M211 or M310 when the traffic direction is wrong, then it will be required to pass a signal at caution, and only then will the next signal clear to green. You can put M211′s or M310′s script on the next signal in the rear (so trains don’t have to slow down so much when approaching the single line section), but you must leave a copy of the script on M211 and M310. Otherwise, numerous trains could potentially bank up and the front trains be left without a script to help them get through.

4 Variations

There are a couple of variations to this arrangement that are worth mentioning, even if only to show that there’s more than one way to do it. The following sections detail these variations. If you know of more, feel free to add them.

5 Uncontrolled automatic signals

5.1 Controlled vs uncontrolled automatic signals

The word “uncontrolled” might sound a bit redundant next to “automatic”, but there is a reason for this combination of seemingly incompatible terminology. Up to this point, the intermediate signals in the single line section have been automatic signals, both in Rail 3D language and real-world railway jargon. However, in railway terms only, these signals are also controlled signals.

Confused? As strange as it might seem, a signal can be both automatic and controlled. In this context where we have power signals (not fully manual semaphores - the term “controlled” in this case has a different meaning again), there is a lever in the signalbox for operating the automatic signal. Typically, the signaller can leave the lever for this signal in the reverse position, which means the signal operates as a normal automatic signal. However, when the lever is placed to the normal position, the signal is held at stop.

Our single line automatic signalling above has been making use of controlled automatic signals. Below is another use of controlled automatic signals, where there are two such signals, Nos. 20 and 42:

107L

These signals are shown on the diagram as normally at stop. In this case, signal 42 has been made a controlled signal because the distance between signal 34 and the junction is very short. There is a danger that, if the signaller were to change the points at the junction, a train that passed signal 34 at danger could run over the points whilst they were changing. As protection, the interlocking prevents the points from being changed unless signal 42, the controlled automatic signal in rear of signal 34, has been placed back to normal. There is a similar arrangement in place for signals 20 and 22.

5.2 Diagram

Returning to uncontrolled automatic signals, another form of automatic signalling is therefore possible on single lines, where the intermediate automatic signals are uncontrolled. This means that the signals in both directions on the single line can be cleared simultaneously, and that they are operated solely by the track circuits. As Mark Hodson has informed me, this system is in use in Holland, and most likely elsewhere too.

If no trains are around, this is what it would look like:

5.3 Example of operation

When a train approaches from the west, signal wst6 clears to allow it into the single line section. Signal est10 clears at the other end to let the train out of the single line section:

As the train moves into the single line, the automatic signals in the other direction begin changing from green to yellow to red. M281 is the first to change:

You can watch the signals in the opposite direction continue to change progressively to red, and then clear again once the train has passed. The signals in the direction of traffic continue to operate normally:

5.4 Layout setup

In terms of how to set up your Rail 3D layout to do this, there is almost nothing different from using controlled automatic signals like we did at the start. The only differences are:

  1. You can’t one of the intermediate automatic signals to determine the direction of traffic.
  2. You don’t need to set/unset holds on the intermediate automatic signals.

To overcome problem #1 you just need a signal somewhere that you can freely set and unset the Hold flag on without interfering with trains. Personally, I would create an isolated invisible section of track somewhere and put a hidden signal on it, and give it a logical name.

5.5 Adding some scripts

Once again, here are the script details for the signals at East End. A couple of points to note:

  • I am using a signal called “TrafficDirection” to keep track of which way the traffic is going. I’m using the convention that a Hold set on this signal indicates the traffic is going in the up direction.
  • We only need to define enough automatic signals in the opposite direction to allow us to check for trains in the section.
  • The scripts for est21, M261 and M210 remain unchanged.

Script for M211

OnTrain()
{
	int LineAvailable=1;
	int LineSet=0;

	signal sigEntryWST=GetSigByID("WST6");

	signal sigEntryEST=GetSigByID("EST7");
	signal sigTWaitEST=GetSigByID("EST21");

	signal sigAutoEa=GetSigByID("M270");
	signal sigAutoEb=GetSigByID("M260");
	signal sigAutoEc=GetSigByID("M250");

	signal sigDirectionUp=GetSigByID("TrafficDirection");

	// Determine current traffic direction

	if(sigDirectionUp.IsHold()==1)
	{
		LineSet=1;
	}

	// Condition A: is train in section?
	if(((sigAutoEa.IsOn()==128)||(sigAutoEb.IsOn()==128))||(sigAutoEc.IsOn()==128))
	{
		// Train in section
		if(LineSet==0)
		{
			// Train is oncoming
			LineAvailable=0;
		}
	}

	// Condition B: is opposite entry signal cleared?
	if(sigEntryWST.IsOn()==0)
	{
		// Train cleared for opposing movement
		LineAvailable=0;
	}

	// Condition C: is oncoming train in section before first automatic signal?
	if((sigEntryWST.IsHold()==1)&&LineSet==0)
	{
		// Train in first section (using Hold as a flag)
		LineAvailable=0;
	}

	// Clear signals if possible
	if((LineAvailable==1)&&(LineSet==0))
	{
		// Swap holds on entry signals
		sigEntryWST.SetHold(1);
		sigEntryEST.SetHold(0);

		// Mark traffic direction on special signal
		sigDirectionUp.SetHold(0);

		// Release hold on hidden "Train Waiting" signal (if necessary)
		sigTWaitEST.SetHold(0);
	}
	if(LineAvailable==0)
	{
		// Set Hold flag on "Train Waiting" signal
		sigTWaitEST.SetHold(1);
	}
}

Note: when you reciprocate this script for use on M310, remember to change the line:

sigDirectionUp.SetHold(0);

to

sigDirectionUp.SetHold(1);

6 Other applications

6.1 Centre track running

Another place you might get bidirectional automatic signalling is in triplicated track areas. The centre line is often bidirectionally-signalled to allow it to be used to help with peak traffic.

This fictitious example has three tracks, and the middle one is signalled in both directions:

The automatic signals on the centre track are prefixed “ha”, and the automatic signals on the other two tracks are prefixed “H”. Note that there are some controlled signals on all three lines to protect the various points.

In the morning peak hour, the centre track would be used for city-bound trains in addition to the normal up track. With no trains around, it might look like this:

Note that all the automatic signals for the up direction on the centre track have been released from stop. However, the signaller would still need to clear the controlled signals ash24 and cxt8 for each train to pass through.

In the afternoon peak, the direction would be reversed, so that outbound trains have two tracks to travel on and city-bound trains have only one:

All the up automatic signals on the centre line have been restored to danger and the down automatic signals have been allowed to clear. Again, for each train, the signaller will still have to clear cxt3 and ash13.

The centre track is sometimes used as an alternative local line during off-peak times to allow some stations to operate from the one physical platform instead of two.

Modelling this in Rail 3D

Modelling this sort of setup in Rail 3D would usually be more difficult than just having a single line with automatic signals. Unless trains are only going to enter and leave the centre track at its ends (i.e. not use any of the intermediate crossovers, like the ones shown at Ashwood and Croxton), it will be more complicated to set up. It’s not impossible, but it certainly isn’t simple.

At the very least, you would need to:

  • Work out whether the centre line will be subdivided into sections (i.e. have the possibility that one part has traffic in one direction and another part has traffic in the other direction — do this only if you really enjoy problem-solving!)
  • Keep track of trains that might be on the centre line but not be detectable by automatic signals (e.g. a train between signals ash24 and ash13 would not be detected by any automatic signals)
  • If trains are to be entering the centre track section midway along its length:
    • you’ll need to have a more complex “Train Waiting” system
    • determine if signals on the local lines need to be held at stop based on whether approaching trains intend to switch to the centre line when the centre line is not available

6.2 Single line with crossing loops

One disadvantage with this type of automatic signalling on single lines is the signals can no longer be set up such that a train leaving a crossing loop on a single line can guarantee itself a path into the next loop by virtue only of the Rail 3D signalling system.

Depending on how flexible your crossing loops are (too much flexibility might be a bad thing in this case) it should be possible to use scripts to ensure that you won’t have two processions of trains happily heading down your scripted single line under automatic signals, but in opposite directions towards the same crossing loop.



import