-
Contents
- Single line
- Shared tracks
- Passing places
- Passing places with multiple trains (JGRPP)
- Shared tracks revisited
- Double line
Why should one bother with building a complicated network with tons of signals and stuff? This question is asked by most newcomers to the game. The answer is rather simple: You will run out of space for building a dedicated track for each train. And with a simple double tracked line it is easily possible to have more than a dozen trains running on it. When having to change a connection or add access to the next factory, this becomes much easier compared to building a whole new connection. In the long run, you save lots of money that can be invested in vehicles (aka moneymakers).
There is one disadvantage, though. Trains in badly designed networks might get lost or block each other. But these problems can easily be circumvented when keeping some simple basics in mind when building the network. And that is what this page is about.
Single line
Single line setups are the cheapest way to connect two stations. As the name suggests, there is only one track which is used in both directions. On such a line exactly one train can travel, for more trains you need - surprise, surprise - switches and signals.
This most simplistic form can only handle one train that travels between both stations. Between both ends of the line additional stations can be built, but as long as they do not have more than a single platform and appropriate signalling, the capacity of the line is still limited to a single train.
Using path signals in this way enables trains to reserve their path from the left station up into the right one (standard path signals are ignored when crossing from the back side), while trains going left have to wait at the signal until the track becomes available. That allows running two trains on this setup, one waits in the station to the right while the other one is on its way between the stations.
Theoretically one could replace the path signals by two-way block signals. It would not change the fact that only two trains can use these rails, and when later on extending the line one would most likely have to switch to path signals anyway, so it is just easier to use path signals right away.
By extending the station to the left, now up to three trains can run here without blocking each other. One train has reserved the path between the station into the current destination station, the other trains have to wait.
By reserving the paths it will also (at least for three trains) alternate between trains going back and forth: Assume that there are two trains in the station on the left, the third one in the station on the right. That means one of the two trains from the left has to go the right, as there simply is no other possible way. Afterwards, a train from the right hand side has to go to the left, as again only that station has a free track to go to. The tree trains therefore always switch back and forth.
This setup can be expanded, with each new platform allowing one more train. However, as the connection between the stations remains a single line, this is not very useful as trains would wait for a green signal most of the time. It is much more useful to add passing places.
Shared tracks
Usually, lines will meet at stations, or there are parts which will be used by several trains together. It is necessary to place the signals correctly for this to work, as shown in the next images.
Both single track lines to the left and right share the central track. Before being able to use the central track the trains have to reserve a path. When going in the other direction (from the central track to the left or right) no train can block - only one train per line is possible with this setup.
Instead of sharing pieces of track, trains can share a station just as well. Signalling works in the same way. Of course, there is still the limit of only having one train per line, so two trains in total.
Sharing larger stations can be realized in the same way: You just have to take care that trains entering the shared parts (the junction before the station and the station itself) have reserved a path through said area. That is why the signals are all facing the junction area. As long as there is only one train per line, no blockage can happen.
The layout of multiple one-track lines sharing a station can be extended easily, either by adding further one-tracked lines, by adding tracks to a line, or by enlarging the station.
Passing places
Bigger stations at the end of the line do not help much to raise the capacity of the line, as long as trains cannot pass each other outside the station. To make this possible, passing places (sidings) have to be built.
This is how a track with a passing place looks in principle: a one-track line connects the two stations, in the middle there is a double-tracked section (the signals have been left out here on purpose, this will be discussed in the next sections). To make the passing place work, the tracks there have to be long enough to fully accommodate any train traveling on the line, so that they do not block any switch tile when waiting. With such a passing place on the line, two trains can use the line, one on the single-track section to the left, the other one on the right.
You also have to be very careful about signalling here: If trains can block each other at a passing place, they eventually will do just that, forcing the player to manually solve the problem. Still, this can be prevented by adhering to a simple rule:
So how can the rule stated above be fulfilled? There are different options with different signal types, but the only solution that is guaranteed to work is the usage of path signals.
This is one of the places where one-way path signals are necessary. They prevent trains from going through the passing place on the wrong track. This could happen when using the standard path signals, since they can be passed from the wrong side. Using one-way signals forces trains to reserve the correct path into the passing place. Trains going the other direction have to wait until the track becomes available. When there already is a train waiting in the passing place, no other train can follow it because no path can be reserved. This ensures that trains cannot block each other.
JGR's Patch Pack
This setup differs from the plain OpenTTD solution only by the additional no-entry signals which prevent waiting trains from turning around. It does not change anything substantial about the general behavior of the passing place.
In case the realistic train braking feature is enabled, trains will try to reserve paths across multiple signal blocks in order to have enough braking distance reserved. This does not work well with passing places, as usually there are no additional signals on one-tracked lines (which would easily lead to trains blocking each other). In essence, a train would not just reserve a path up to and into the passing place, but further on into the next one-tracked section.
For single-tracked lines with multiple passing places this can lead to a situation where a train would reserve large parts of the line, across multiple passing places, preventing trains going in the opposite direction from continuing their journey and forcing them to wait unnecessarily long. To prevent this from happening, one can place additional path signals with the "reserve through" restriction. This restriction means a train will never stop at those additional signals, but reserve to the next signal without such a restriction.
These additional signals can be placed inside the one-tracked section, but they always have to face the passing place section! The distance between the additional signal and the actual one-way path signal where the train is to stop may differ depending on the maximum speed of the train. The important thing is that a train will try to extend its reserved path at the signal with the programmed restriction, as long as the track ahead is clear. So these additional signals basically decide about when the section after the passing place will be reserved.
This example works exactly as the one before, the only difference is the usage of the "banner-repeater" signals from JGR's multi aspect signal set. These signals have the "reserve through" restriction built in, so there is no manual programming needed. Other signal sets may also have signals with that restriction built in.
For longer single-tracked lines one can build multiple passing places. Each of them needs to be built in the same way and with the same signal layout. The maximum capacity of the line is then equal to the sum of single-track sections between the passing places: In each such section exactly one train can travel.
Instead of having tracks in a passing place, one could also build a station there. One can also increase the size of the passing place / station by adding further tracks to the left and right and placing the signals in the same way for the corresponding driving direction. However, increasing the size is not that useful, one should rather add a second track to the line.
Passing places with multiple trains (JGRPP)
In the previous section it was mentioned that there can only be one train running in a single-tracked section. In the case of JGR's patch pack, this is not the whole truth. As already explained, one cannot simply add more path signals on the single-tracked section, to allow multiple trains through such a section behind each other. This will eventually lead to trains going opposite directions meeting each other on the single-tracked section. That kind of situations is exactly what must not happen. In JGR's patch pack there is a way to prevent it by using slots.
This image shows the track section: A double-tracked line, which has a single-tracked part in the middle. The example is really simple and could be upgraded to a double-tracked line easily, but maybe the actual terrain is really hilly, or some city or industry is in the way, or you simply do not have the money to upgrade the tracks. Whatever the reason, the goal is to make this single-tracked part being used by two trains simultaneously, as long as they are both going the same direction.
To make that work, path signals are needed in the middle, otherwise only a single train can be there anyway. The more complex part follows now, because one still needs to ensure that trains coming from the left and trains coming from the right cannot block each other in the middle. That is where the slot comes into play: The idea is that only trains can enter the middle section if they own a token of that slot. The slot, in our example, is the single-tracked section, and that can only handle two trains at most. That means the slot can only hand out two tokens. However, we also have to be aware that the tokens depend on the driving direction. When handing out a token for a train going left to right, no train with a token for going right to left must be running around, otherwise they will meet in the middle and we are blocked again. Based on this, the following concept can be defined:
- Two slots are needed, one per direction. Each of these can hand out two tokens.
- a token for a driving direction can only be handed to a train under the following circumstances:
- there is a free token for the driving direction
- no token for the opposite direction is in use
As can be seen, setting this up is easily becoming quite complex - in many cases it would be easier to just update the track to remove the single-tracked section and be done with it. But for the sake of the example, let's continue.
First, the slots are created. Both slots get a capacity of two - two trains can be going in the same direction at the same time. It is important to get that number right, otherwise you either waste capacity on the track and do not fully use the advantages of the slot system, or too many trains try to go, which will cause blockages.
The next step is to program the routing restrictions. A train that wants to enter the single-tracked part, can only do so with a token for the corresponding driving direction. It can only get that token, if one is available (the slot is not fully used) and at the same time no token for the opposite direction is in use. At the end of the single-tracked section the train releases its token, so that the next one can use it. In the opposite direction, things work in the same way, just for the opposite direction obviously.
The programming for the entry (at the signal marked "entry") looks like this:
Start
1: If slot occupancy: Slot: right to left is not 0 then
2: wait at path signal
3: Else
4: acquire slot left to right, or wait at path signal
End if
End
What does that now mean? In line 1 it is checked whether trains are going in the opposite directions. They need to have a token for the other direction, meaning the slot occupancy for that direction is not 0. If that is the case, the program ends up in line 2, causing the train to wait at the signal with this restriction until a change in the criteria occurs. If the criterion of line 1 is not fulfilled, meaning the slot is empty - no train running in the opposite direction - we can reserve a path to go into the single-track section ourselves. That happens in lines 3 and 4. In order to enter the section, we still need to acquire a token of the slot of our driving direction. If we cannot do that, meaning there are already two trains before us going in our direction, so the slot is full, we still have to wait, until a token becomes available.
The programming at the end of the single-tracked section (signal marked "exit") is far more simple:
Start
1: Release slot left to right (front of train)
End
Once the train reaches this signal, or more precisely, once the front of the train passes the signal, the token is released and the train simply continues. One could try to play around with a "banner repeater" signal being placed right before the tile where the train gets back on its own track in the double-tracked section and adding a "release slot left to right" at that signal. This would have one concrete advantage: The way the signals are placed here, if there is no free path after the programmed exit signal, a waiting train cannot continue. That means the token would not be released, causing other trains to wait. If the signal block to the right of that signal is free (which should normally be the case, as a double-tracked section should have more capacity than a single-tracked section), this would only make a difference of a couple of milliseconds and should not be an issue.
When testing this, one problem surfaced with lots of traffic: When there was a train running in the single-tracked section, additional trains going the same direction can go right after that train. This could now lead to a situation where a train going the opposite direction has to wait for a long time until there is no further train coming. In computer science, this effect is called "starvation", and various ways have been developed to avoid it. To put it simply, it is about fairness, so that a train - even with lots of traffic - should never wait unnecessarily long, because one direction is preferred over the other.
One can solve that problem with even more programming. There are multiple ways to do it, which however have their individual problems. Two variants are described in more detail (there are probably other solutions as well).
Counters
A simple variant is the usage of counters. These count how many trains per direction have been using the single-tracked section, and if a certain threshold value has been reached, the opposite direction gets precedence. This is comparably simple and easy to set up, one just has to change the programming of the signals at the entry of the single-tracked section.
First, two counters are created and set to the value 0 (for the sake of simplicity I named them the same way as the slots for the different directions). Then, the programming needs to be extended: When a path through the single-tracked section is reserved (meaning the train got a token of the slot), the counter for the direction is increased by 1. The counter for the opposite direction is set to 0. Now one only has to add a check of the counter values around all of that: Only if the counter value for the own driving direction has not yet reached the threshold value, the trains should be allowed to continue. The programming for the other direction is the same, just for the counters and slots of the other direction. That looks like the following:
Start
1: If slot occupancy Slot: right to left is not 0
2: wait at path signal
3: Else
4: If counter value: left to right < 2 then
5: set counter: right to left to 0
6: increment counter: left to right by 1
7: acquire slot left to right, or wait at path signal
8: Else
9: wait at path signal
End If
End If
End
Lines 1 to 3 are the same, they still check if there is a train running the opposite direction. It gets more interesting in line 4, which checks the counter value. If less than 2 trains have been going that direction, the program continues to line 5, otherwise we end up in line 9 and have to wait. The important bits are the counter updates in line 5 and 6. The counter for the opposite direction is set to 0, and the one for our own driving direction is increased by 1. Now we try to retrieve a token for our slot, which already had been in the original program. By resetting the counter in line 5 we effectively count, how many trains have been going our direction since the last train going the opposite direction has been gone. As the program for the other direction looks the same, the counters will always be reset back and forth. The value chosen in line 4 is now up to the player, but it should be the same value for both directions, as long as the traffic is distributed evenly in both directions.
This works well in a test setup: Assuming the maximum value is two, then two trains are going in one direction, then two trains can go in the opposite direction, and so on. This is totally fair, regardless of the direction the train is going, it will be able to continue sooner rather than later, and even if there is lots of "oncoming traffic", there will be a chance to continue. However, there is a new problem: If there is little traffic, there may be a situation where the threshold value has been reached and a train tries to yield for trains of the opposite direction - but there isn't any such train coming. Now the train has to wait for a long time, until finally such a train is coming through and has updated the counter values.
Slots for waiting trains
This solution is more complex, as one has to program restrictions for further signals. The idea is as follows: Using additional slots for both directions one counts whether there are trains waiting to go through the single-tracked section. When reserving the path for the single-tracked section one can check the slot values for these waiting trains, and if there are trains waiting to go in the opposite direction, the train will wait and give way for the trains that have been waiting. If there are no trains waiting, one continues as usual.
To make this work, two additional slots are needed to count how many trains are waiting to go through the single-tracked section. The capacity of these slots can be really high, it is not about limiting the number of trains here, but to count how many are inside the slot. Additionally, there is some programming to be done to manage these waiting slots (the signal is marked as "waiting area entry").
Start
1: Acquire slot waiting left to right, or wait at path signal
End
If the train enters the "waiting area" it needs a corresponding token. The signal "entry" has to be reprogrammed as well, as the train exits the "waiting area" and therefore has to release the corresponding token. On the other end of the single-tracked section, the same things need to be prepared for the opposite direction.
The programming at the entry of the single-tracked section is now more complex:
Start
1: release slot: waiting right to left (back of train)
2: If slot occupancy Slot: left to right is not 0 then
2: wait at path signal
3: Else
4: If slot occupancy Slot: waiting left to right < 2 then
5: acquire slot: right to left, or wait at path signal
6: Else
7: If train is not in slot: right to left then
8: wait at path signal
9: End If
End If
End If
End
The interesting parts here are lines 4 to 8. First, there is a check how many trains are waiting on the other end of the single-tracked section. If less than 2 trains are in
the slot "waiting left to right" - which is the waiting area in the opposite direction - we try to reserve a path through the single-tracked section (line 5). If however 2 or
more trains are waiting, we check whether we already have a slot for our driving direction. This is a question of timing, as the slot is acquired before we actually pass the signal.
So, if we have a token, we have to continue, otherwise or logic is inconsistent. If we do not have a token, so 2 or more trains waiting on the other side and we do not have a token
to continue, then we wait to give preference to the waiting trains (line 8). That way the single-tracked section will eventually become available for the waiting trains. The
program for the opposite direction looks almost the same apart from using the slots for the other direction.
There is one problem now: When there are trains waiting on both sides, trains would always try to give way for the trains waiting on the other side. As can be seen, it does not always pay off to be too courteous... On one side (and really only one side!) the programming has to have a check for that situation to be able to resolve it. That finally looks like this:
Start
1: Release slot: waiting left to right (back of train)
2: If slot occupancy Slot: left to right is not 0 then
2: wait at path signal
3: Else
4: If slot occupancy Slot: waiting left to right < 2 then
5: acquire slot: right to left, or wait at path signal
6: Else
7: If slot occupancy Slot: waiting left to right is 2 then
8: acquire slot: left to right, or wait at path signal
9: End If
10: If train is not in slot: right to left then
11: wait at path signal
12: End If
End If
End If
End
Lines 7 to 9 have been added, the others are the same as before. So, if the occupancy of the waiting slots is 2 for both slots, then this side gets precedence by executing the action in line 8, which is not part of the programming for the other side.
The final result looks like this: Trains go through the single-tracked section one after another. Once there are two trains waiting to go in the other direction (two tokens of the waiting slot are in use), the next train will wait and allow the waiting trains to go. If there are two trains waiting in both directions, trains going left to right will have precedence.
One can now think that it is brilliant and ingenious to be able to do this kind of stuff, one could also shake heads about how absurdly complicated this seemingly simple example has become. In the end, it will be up to the player how to tackle the problem. In most cases it will probably be much easier to just upgrade the line to be double-tracked all the way and ignore the whole programming shenanigans.
Shared tracks revisited
As already briefly discussed in the part about one-tracked lines, adding passing places into the setups might require some changes to signal placing. The examples from above are repeated here with explanations what has to be changed.
When sharing one-tracked lines or stations the two-way signals which separated the different lines have to be removed. Their task is taken over by the signals in the passing places. Trains now always reserve the whole track, including the parts that are shared with the other line.
Sharing larger stations in combination with passing places is easily possible. Just remove the signals at the entry to the junction in front of the station, since their task is taken over by the signals at the passing places. Trains now reserve the whole path from the passing place right into the station.
A possible problem with this setup will be that the trains will reserve the whole track from the passing place, across the junction area in front of the station and into the station itself. That will block the junction section at the station for longer periods and may block other trains for unnecessary long times. One could be tempted to add additional path signals at the station (as in the original layout without passing places): This will fail, as a train may end up waiting in front of a full station, preventing trains from leaving, thus creating a total blockage. Such a setup would violate the base principle for passing places: A train may only leave a passing place and go into a single-track section when it has reserved a way out of that single-track section.
This layout uses passing places directly next to the station to avoid long time blocks of the junction area in front of the station. A train can always leave the station, in the worst case it has to wait at the passing place in front of the single-track section. Still, other trains could then already use the station. The passing place is long enough to allow a train to wait without blocking the junction before the station.
Shared tracks revisited
For large-scale tasks (meaning many trains), single tracks are not enough, because of the increased interference of trains with each other. The capacity of a track that is used in both directions is just too small. The solution is simple: One dedicated track per direction. This will result in two tracks and huge capacities or just about any task. Most railway lines in the real world are built in that way as well.
This is the standard double-tracked line. Noteworthy are the path signals placed in regular distance (one can also use block signals instead, it would not change anything about how the line works, but just placing path signals everywhere on the network makes things much simpler).
These signals act as automatic signal block (that's the term in the real railways) and increase the line capacity. The closer these signals are placed, the sooner a train can follow, and the more trains can run on the line in the same time. In reality, signals are placed several kilometers apart, in the game a distance of about three tiles is usable very well.
Double-tracked lines have enough capacity for most tasks, even with many trains running on them. In order to create a well-working network, well-working junctions will have to be used. This topic is rather complex, therefore it is discussed on an extra page about junctions and crossings.
In real networks, trains can often switch onto the "wrong" lane (the one for the opposite direction) in order to overtake slower trains. This can also be done in the game, although one should only try it on lines with not too much traffic, because that would only lead to train blockages. This system is especially useful if the trains have a huge difference in speed, i.e. for express trains overtaking slow freight trains.
When building switches for the trains to switch tracks one should take care that trains cannot change their direction by doing a 180 degree turnaround - that is unrealistic and can wreak havoc with the traffic on the line. Usually it is a good idea to turn of the feature that trains can run across 90-degree corners anyway.
A double-tracked line with path signals can easily be enhanced to allow switching tracks. One just has to add the track connections, and that's it. Trains now reserve their way using both tracks as possible and return to the correct track after overtaking.
This switching of tracks does not work well on busy lines, as oncoming trains will prevent trains from "overtaking" - same as on a busy road where it becomes almost impossible to overtake as there are always oncoming cars. A solution for such busy lines are dedicated overtaking sections with additional tracks. Their setup and how to do the signalling for it is described in overtaking sections.