In other languages: Deutsch 日本語 Русский

Tutorial:Train signals: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Created page with "{{Languages}} This tutorial explains why and when signals are used and how deadlocks can be avoided. Examples of frequent use cases are shown. It is suggested to follow the t...")
 
No edit summary
Line 9: Line 9:
TODO: Image of rail block visualization.
TODO: Image of rail block visualization.


A normal signal is green when there is no train on the block behind it. When a train enters the block, all signals going into the block will turn red. Before entering a block, a train will reach a point where it either has to slow down if the signal is red or it can keep going if the block is free. If the train keeps going, it reserves the block even though it has not entered yet, to indicate this the signals going into the block turn yellow.
A regular signal is green when there is no train on the block behind it. When a train enters the block, all signals going into the block will turn red. When a train is in the process of entering the block, the signal turns yellow.


Signals are placed on the right side of the track. Trains are only allowed to go past signals that are on the right hand side from direction of travel. A train in automatic mode is not allowed to drive on a track if it would pass a signal on the left side unless there is also a signal on the right side.
TODO: Image of signal colors


TODO: Image
Signals are placed on the right side of the track. Trains are only allowed to go past signals that are on the right hand side from direction of travel. A train in automatic mode will not drive on a track if it would pass a signal on the left side unless there is also a signal on the right side at that signal.


Long uninterrupted rail tracks should have signals at regular intervals because this allows more trains to move on the track simultaneously leading to higher throughput. Crossings should be separated from normal track pieces. Inside crossings, signals should be used so that multiple trains can pass through the crossing without slowing down - for example trains going in opposite directions should not have to slow down for one another, so they need to pass through different blocks inside an intersection.
TODO: Image of signal direction


== Chain Signals ==
== Chain Signals ==


Using signals prevents crashing trains but brings with itself other potential issues. Each train will wait until the block in front of it is cleared. In the block there might be another train waiting for a block to clear, so effectively a train is waiting for another train. This becomes a problem if a waiting train happens to stand on an intersection because other trains will have to wait even if they are not going in the same direction. Traffic systems should avoid having trains waiting on intersections. This is where chain signals are used. The operation of chain signals will be explained in the next paragraph but the most important rule concerning chain signals is that a train can not wait for an extended period of time in a block ''after'' a chain signal, whereas it can wait in a block after a normal signal. Since we do not want trains waiting on junctions, this leads to the common rule:  
Using signals prevents trains from crashing into each other but brings with itself other potential issues. Every train will wait until the block in front of it is cleared. So effectively a train is waiting for another train. This becomes a problem if a waiting train happens to stand on an intersection because other trains will have to wait even if they are not going in the same direction. Traffic systems should avoid having trains waiting on intersections.
 
TODO: Image of train on intersection and waiting trains.
 
Chain signals are used to ensure that trains cannot wait on intersections. The operation of chain signals will be explained in the next paragraph but the most important rule is that a train cannot wait for an extended period of time in a block ''after'' a chain signal, whereas it can wait in a block after a regular signal. Since trains should not wait on crossings, this leads to the common rule:  
 
'''Use chain signals on and before crossings and use regular signals at the exits of crossings.'''


'''Use chain signals on and before crossings and use normal signals at the exits of crossings.'''
Whenever a waiting train would block another train that is going on a different track, a chain signal should be used to prevent the train from waiting.


If a train gets to a chain signal, we consider the path the train will take from that signal up to the next regular signal or until it reaches the station, whichever comes first. The train is only allowed to go through if all rail blocks on this path are free. If the train goes through, it will reserve all blocks on this path and allow other trains to pass through a block only after it leaves the block. A chain signal which leads to a block that has only one outgoing signal will always have the same color as that signal. If a block has more than one outgoing signal, it can happen that one outgoing signal is red and the other is green. In that case the chain signal leading into the block will turn blue, indicating that some paths are free while others are not.
TODO: Image of T-junction


To determine if a train is allowed to drive through a chain signal, consider the path the train will take from that signal up to the next regular signal or until it reaches the station, whichever comes first. The train is only allowed to go through if all rail blocks on this path are free. If the train goes through, it will reserve all blocks on this path and allow other trains to pass through a block only after it leaves the block. A chain signal which leads to a block that has only one outgoing signal will always have the same color as that signal. If a block has more than one outgoing signal, it can happen that one outgoing signal is red and the other is green. In that case the chain signal leading into the block will turn blue, indicating that some paths are free while others are not.
TODO: Image of trains chain signal colors.
TODO: Image with trains pathing through chain signals
TODO: Image with trains pathing through chain signals


Line 33: Line 42:
Using signals can lead to trains waiting for other trains. As a consequence, there might be a chain of trains, each waiting for the next, with the last waiting for the first. This situation is called a deadlock, because the trains will wait forever or until the situation is resolved manually. It should be avoided and resolved as soon as possible because every train going through the area will get stuck.
Using signals can lead to trains waiting for other trains. As a consequence, there might be a chain of trains, each waiting for the next, with the last waiting for the first. This situation is called a deadlock, because the trains will wait forever or until the situation is resolved manually. It should be avoided and resolved as soon as possible because every train going through the area will get stuck.


TODO: Image
TODO: Image of deadlock from bad signalling


The most frequent causes of deadlocks are 1) trains waiting on intersections and 2) a rail network that does not allow enough space for trains. We have already talked about the first point.  
The most frequent causes of deadlocks are 1) trains waiting on intersections and 2) a rail network that does not allow enough space for trains. We have already talked about the first point.  


TODO: Image
TODO: Image of deadlock from too many trains


The deadlock in the image happened because there was a circle in the network which was used by more trains than can fit into the circle. Another example occurs when a station does not have enough space for all trains going there so the trains will wait on the main line - see the example waiting area below.
The deadlock in the image happened because there was a circle in the network which was used by more trains than can fit into the circle. Another example occurs when a station does not have enough space for all trains going there so the trains will wait on the main line - see the example waiting area below.
== Splitting Rail Blocks ==
Long uninterrupted rail tracks should have signals at regular intervals because this allows more trains to move on the track simultaneously leading to higher throughput. Crossings should be separated from normal rails with signals. Inside crossings, signals should be used so that multiple trains can pass through the crossing without slowing down - for example trains going in opposite directions should not have to slow down for one another, so they need to pass through different blocks inside an intersection.
== The signal spacing rule==
TODO: Image of deadlock because junctions too close together
The image shows a deadlock between two T-junctions. It happened because while a train was waiting at the intersection, its tail end was still in the last intersection. The junctions when taken individually are signalled correctly, however they are too close to each other so they form one big intersection. There are two ways to fix this: the regular signals between the two junctions could be turned into chain signals or the junctions could be moved further away from each other.
'''After an exit signal of a junction, the next signal must be at least far enough away to fit the ''longest'' train in the rail system between the signals.'''


== Examples ==
== Examples ==
Line 49: Line 70:
Stations should never be on a main rail line as trains waiting there would block other trains for extended periods of time. So usually a single line is split off from the main line to make a station there. There are two variations, one for trains that can only go in one direction and one for trains with locomotives in both directions.
Stations should never be on a main rail line as trains waiting there would block other trains for extended periods of time. So usually a single line is split off from the main line to make a station there. There are two variations, one for trains that can only go in one direction and one for trains with locomotives in both directions.


TODO: Image, explanations
TODO: Image,  
 
The signals in all the examples are done according to the 'chain before, regular after' rule.


=== T-junction ===
=== T-junction ===


TODO: Image. explanation, variations, throughput considerations
TODO: Image.  
 
The first image shows the usual T-junction with basic signals. The second shows an iteration of it which allows more throughput because it sometimes allows multiple trains to be on the intersection simultaneously.


=== Waiting Area ===
=== Waiting Area ===
Line 65: Line 90:
This is a miniature example of a rail network. It contains a few mines with loading stations and a 'main base' with a small waiting area and unloading stations. Trains in the example are comparatively very short.
This is a miniature example of a rail network. It contains a few mines with loading stations and a 'main base' with a small waiting area and unloading stations. Trains in the example are comparatively very short.


== The signal spacing rule==
=== 4-way junctions ===
 
TODO: Image
 
The image shows a deadlock between two T-junctions. It happened because while a train was waiting at the intersection, its tail end was still in the last intersection. The junctions when taken individually are signalled correctly, however they are too close to each other so they form one big intersection. There are two ways to fix this: the regular signals between the two junctions could be turned into chain signals or the junctions could be moved further away from each other.


'''After an exit signal of a junction, the next signal must be at least far enough away to fit the ''longest'' train in the rail system between the signals.'''
TODO: Examples. Forum post for 4-way crossing throughput. Regular signals on crossings.


== See also ==
== See also ==

Revision as of 17:44, 8 July 2018


This tutorial explains why and when signals are used and how deadlocks can be avoided. Examples of frequent use cases are shown. It is suggested to follow the tutorial with the game open so the examples can be tried out ingame.

Regular Signals

Whenever there is more than one train on a track, there is the possibility that trains can crash into one another. To prevent trains from doing this, we place signals at intervals along the track and at crossings. A regular signal protects the rail block behind it, up to the next signal or the end of the track. Signals ensure that only one train can be in any block. Whenever a second train would enter a block that already has a train in it, the train will wait at the signal leading into the block instead. Rail blocks are shown with colors when a player has a signal in hand.

TODO: Image of rail block visualization.

A regular signal is green when there is no train on the block behind it. When a train enters the block, all signals going into the block will turn red. When a train is in the process of entering the block, the signal turns yellow.

TODO: Image of signal colors

Signals are placed on the right side of the track. Trains are only allowed to go past signals that are on the right hand side from direction of travel. A train in automatic mode will not drive on a track if it would pass a signal on the left side unless there is also a signal on the right side at that signal.

TODO: Image of signal direction

Chain Signals

Using signals prevents trains from crashing into each other but brings with itself other potential issues. Every train will wait until the block in front of it is cleared. So effectively a train is waiting for another train. This becomes a problem if a waiting train happens to stand on an intersection because other trains will have to wait even if they are not going in the same direction. Traffic systems should avoid having trains waiting on intersections.

TODO: Image of train on intersection and waiting trains.

Chain signals are used to ensure that trains cannot wait on intersections. The operation of chain signals will be explained in the next paragraph but the most important rule is that a train cannot wait for an extended period of time in a block after a chain signal, whereas it can wait in a block after a regular signal. Since trains should not wait on crossings, this leads to the common rule:

Use chain signals on and before crossings and use regular signals at the exits of crossings.

Whenever a waiting train would block another train that is going on a different track, a chain signal should be used to prevent the train from waiting.

TODO: Image of T-junction

To determine if a train is allowed to drive through a chain signal, consider the path the train will take from that signal up to the next regular signal or until it reaches the station, whichever comes first. The train is only allowed to go through if all rail blocks on this path are free. If the train goes through, it will reserve all blocks on this path and allow other trains to pass through a block only after it leaves the block. A chain signal which leads to a block that has only one outgoing signal will always have the same color as that signal. If a block has more than one outgoing signal, it can happen that one outgoing signal is red and the other is green. In that case the chain signal leading into the block will turn blue, indicating that some paths are free while others are not.

TODO: Image of trains chain signal colors. TODO: Image with trains pathing through chain signals

Depending on the setup of the rail network this can in principle mean that a very large number of blocks is reserved. This would restrict other trains, reducing throughput in general. So it is often suggested to use regular signals where possible and chain signals only where they are necessary.

Deadlocks

Using signals can lead to trains waiting for other trains. As a consequence, there might be a chain of trains, each waiting for the next, with the last waiting for the first. This situation is called a deadlock, because the trains will wait forever or until the situation is resolved manually. It should be avoided and resolved as soon as possible because every train going through the area will get stuck.

TODO: Image of deadlock from bad signalling

The most frequent causes of deadlocks are 1) trains waiting on intersections and 2) a rail network that does not allow enough space for trains. We have already talked about the first point.

TODO: Image of deadlock from too many trains

The deadlock in the image happened because there was a circle in the network which was used by more trains than can fit into the circle. Another example occurs when a station does not have enough space for all trains going there so the trains will wait on the main line - see the example waiting area below.

Splitting Rail Blocks

Long uninterrupted rail tracks should have signals at regular intervals because this allows more trains to move on the track simultaneously leading to higher throughput. Crossings should be separated from normal rails with signals. Inside crossings, signals should be used so that multiple trains can pass through the crossing without slowing down - for example trains going in opposite directions should not have to slow down for one another, so they need to pass through different blocks inside an intersection.

The signal spacing rule

TODO: Image of deadlock because junctions too close together

The image shows a deadlock between two T-junctions. It happened because while a train was waiting at the intersection, its tail end was still in the last intersection. The junctions when taken individually are signalled correctly, however they are too close to each other so they form one big intersection. There are two ways to fix this: the regular signals between the two junctions could be turned into chain signals or the junctions could be moved further away from each other.

After an exit signal of a junction, the next signal must be at least far enough away to fit the longest train in the rail system between the signals.

Examples

The most common way to build a rail system is using two parallel rails, one for each direction. The examples mostly use this architecture.

Single split off

Stations should never be on a main rail line as trains waiting there would block other trains for extended periods of time. So usually a single line is split off from the main line to make a station there. There are two variations, one for trains that can only go in one direction and one for trains with locomotives in both directions.

TODO: Image,

The signals in all the examples are done according to the 'chain before, regular after' rule.

T-junction

TODO: Image.

The first image shows the usual T-junction with basic signals. The second shows an iteration of it which allows more throughput because it sometimes allows multiple trains to be on the intersection simultaneously.

Waiting Area

Roundabouts

Putting it together

TODO: Image

This is a miniature example of a rail network. It contains a few mines with loading stations and a 'main base' with a small waiting area and unloading stations. Trains in the example are comparatively very short.

4-way junctions

TODO: Examples. Forum post for 4-way crossing throughput. Regular signals on crossings.

See also