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

Tutorial:Train signals: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
m (typo)
 
(24 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
[[Rail signal]]s are necessary to run a functioning rail system in Factorio. This tutorial explains why and how signals are used, how chain signals work, what deadlocks are and how they can be avoided. The aim is to enable the reader to keep a rail system running smoothly and fix common issues. Examples of frequent issues and use cases are shown.


This tutorial explains why and when signals are used and how deadlocks can be avoided. Good practices and examples of frequent use cases are shown.  
This tutorial mostly uses rail systems with two parallel rails, one for each direction. For beginners, using this architecture is suggested instead of a single bidirectional rail line, which can lead to issues when more trains are added to the system.


== Regular Signals ==
It is recommended to place radars near intersections to help identify issues quickly. It is also recommended to set up automation for fueling trains as soon as possible whenever a new train or station is added to the system. Trains can either be fueled at one stop on their usual schedule (this may or may not involve transporting fuel to a station) or by adding a separate fuel station to the schedule. Finally, players should choose a maximum train length before designing a rail system.


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. Rail blocks are shown with colors when a player has a signal in hand, as in the picture. 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.
== Regular signals and blocks ==


[[File:Rail_blocks_example.png|1000px]]
[[File:Why_signals.gif]]


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 for a short time before turning red.
Whenever there is more than one train on a track, there is the possibility that trains can crash into one another. To prevent this, we place signals along the track and at crossings. Signals split the tracks into different parts called '''blocks'''. The signals then ensure that '''only one train can be in each block'''. Any signal leading into an already occupied block will display the red color and trains that would enter will wait at the signal instead.


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. This can sometimes cause a "no path" error where the track appears to be connected, but part of the connection is a one way track.
Rail blocks are shown with colors on the rails themselves when a player has a signal in hand. These colors are only for visualization of blocks and are not related to the color of the signal light. The picture shows the block visualization in an example, there are a total of eleven blocks. Rail signals and chain signals break up blocks, train stops do not.  


In the image, the tracks are from top to bottom:
[[File:Rail_blocks_example.png|1000px]]
 
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 shortly before turning red to inform that the block is reserved for the incoming train even though there is no train inside it.


1. left to right,
Signals are placed on the right side of the track and trains are only allowed to go past signals that are on the right hand side from direction of travel. To allow trains to go in both directions one either runs two rail lines in parallel or puts signals on both sides of the track. A train in automatic mode will not drive through 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. This can sometimes cause a "no path" error where the track appears to be connected, but part of the connection is a one way track.
2. right to left,
3. bidirectional,
4. bidirectional,
5. bidirectional on the left side, splitting into a right to left (upper) and a left to right track (lower).


[[File:Signal_directions.png|1000px]]
[[File:Signal_directions.png|1000px]]


== Chain Signals ==
In the image, the tracks are from top to bottom:
# left to right,
# right to left,
# bidirectional,
# bidirectional,
# bidirectional on the left side, splitting into a right to left (upper) and a left to right track (lower).


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 trains are waiting for other trains. This becomes a problem when a train starts waiting on an intersection. In that case other trains will have to wait even if they are not going in the same direction. These trains may in turn cause other trains to wait, resulting in a slowdown of the entire system. Traffic systems should avoid having trains waiting on intersections. In Factorio, chain signals are used to ensure that this cannot happen.
== Chain signals ==
 
If a train waits on an intersection, other trains have to wait for it, even trains that are not going in the same direction. These trains may in turn cause other trains to wait, resulting in a slowdown of the entire system. Traffic systems should avoid having trains waiting on crossings and in Factorio, [[Rail chain signal]]s are used to ensure that this cannot happen.


[[File:Chain-signal-guards-crossroad.png|1000px]]
[[File:Chain-signal-guards-crossroad.png|1000px]]


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 commonly stated rule: Use chain signals on and before crossings and use regular signals at the exits of crossings. In general, 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 block is guarded by a chain signal instead of a rail signal, the train will only enter if it can enter the next block as well. So 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, there is a well known rule: '''Use chain signals in and before crossings and use regular signals at the exits of crossings'''. In general, 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.  


[[File:Double-crossing.gif|1000px]]
[[File:Double-crossing.gif|1000px]]


How do chain signals work? To determine if a train is allowed to drive past 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 not allow other trains to pass through a block until 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 rail line splits up, 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 to indicate that some paths are free while others are not.
If there are multiple chain signals in a row, a train will only enter if its path is clear all the way into a block behind a regular signal (or up to its destination station, whichever comes first). If the train goes past the first chain signal, it will reserve all blocks on the path and not allow other trains to pass through a block until 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 rail line splits up, it can happen that one outgoing signal is red and another is green. In that case the chain signal leading into the block will turn blue and trains are allowed in only if their path doesn't take them into an occupied block. A driver in a train wouldn't know from seeing the blue signal wether they have to wait or not, but the game magically makes it work anyways.  


[[File:Chain_signal_colors.png|1000px]]
[[File:Chain_signal_colors.png|1000px]]


If the rail network contains many chain signals it is possible that a very large number of blocks is reserved when a train drives by a chain signal. This would restrict other trains, reducing throughput in general. Hence it is often suggested to use regular signals whenever possible and chain signals only where they are necessary.
 
=== Splitting rail blocks and increasing throughput ===
If an intersection is one single block with chain signals at the entrances and rail signals at the exits, then there cannot be multiple trains on the intersection on the same time. The intersection will work, but one can break up the intersection into more blocks with signals to allow multiple trains to go through simultaneously. Long straight tracks can also be broken up with signals to allow multiple trains on them, to also increase throughput.
 
If the rail network contains many chain signals it is possible that a very large number of blocks is reserved when a train drives by a chain signal. This would restrict other trains, reducing throughput in general. It is suggested to use regular signals whenever possible and chain signals only where they are necessary.


== Deadlocks ==
== 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. 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.  
Using signals can lead to trains waiting for other trains. It may occur that there is 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. The most frequent causes of deadlocks are  
# trains waiting on intersections and  
# a rail network that does not allow enough space for trains.  


[[File:Signal_deadlock.png|1000px]]


The image above shows a deadlock caused by missing chain signals since only regular rail signals were used. As a result trains can wait on a crossing which leads to a deadlock. Note that a deadlock can happen with as few as two trains. The positions where the regular signals should be replaced by chain signals are marked with hazard concrete.
[[File:Deadlock_anim.gif]]
 
The image above shows a deadlock caused by missing chain signals since only regular rail signals were used. As a result trains can wait on a crossing which leads to a deadlock. A corrected version of this intersection can be found above. The eight signals before and on the intersection should be replaced by chain signals, the ones leading out of the intersection can stay as they are. As stated above, in general chain signals should be used before and on intersections.


[[File:Deadlock_too_many_trains.png|1000px]]
[[File:Deadlock_too_many_trains.png|1000px]]


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. Such circles should be avoided. A related 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 is a circle in the network which was used by more trains than can fit into the circle. The signals are correct; to fix the deadlock the circle must be removed or less trains need to be routed through this area.
 
[[File:Signal_deadlock.png|1000px]]
 
This deadlock also happened because there were too many trains in a too small circle. It shows that a deadlock can happen with as few as two trains. In this case the deadlock could have been avoided by replacing the marked signal with a chain signal, because it would ensure that only one train can enter the offending circle. However this could lead to trains waiting on the main line, which would block other traffic. The station can only have one incoming train without causing issues, so it should have its train limit set to 1 or only one train should be routed to it. An alternative is creating a waiting area for trains heading to the station, see further below.  


== Signal Spacing ==
== Train length and signal spacing ==


[[File:Deadlock_signal_space.png|1000px]]
[[File:Deadlock_signal_space.png|1000px]]


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. One might argue that they form a single 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.  
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 signaled correctly, however, given the length of trains using them, they are too close to each other. One might argue that they form a single big intersection. Here are three 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, or all trains could be shortened.


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. In general, after every regular signal there should be at least that much space.
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. In general, after every regular signal there should be at least that much space.


== Splitting Rail Blocks ==
It is recommended that you choose a maximum train length before designing your rail system, and stick to it. Then rail signal blocks can be spaced according to the maximum length.
 
The following aims to explain where signals should be placed. 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 uninterrupted 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 each other, so they need to pass through different blocks inside an intersection. The examples below all follow these rules.
 


== Examples ==
== Examples ==
The most common way to build a rail system is using two parallel rails, one for each direction. The examples mostly follow this architecture. A single bidirectional rail line should not be used for 'main' rail lines in most situations.


=== T-Junction ===
=== T-Junction ===


This is the most common variation of the three way junction. Rail signals have been placed inside the junction to ensure that more than one train can enter the junction in some cases. For example for one train going left to right and one going right to left, the trains will pass through different blocks: the first will go through the left yellow, the blue and the lower right yellow block; the second will use the upper yellow and upper red blocks. Because they use different blocks, they can use the junction simultaneously. While this is not strictly necessary for a junction to work, it will allow better throughput at a low cost.
The image shows a basic three way junction. Signals have been placed inside the junction to ensure that more than one train can enter the junction in some cases. For example for one train going left to right and one going right to left, the trains will pass through different blocks: the first will go through the left yellow, the blue and the lower right yellow block; the second will use the upper yellow and upper red blocks. Because they use different blocks, they can use the junction simultaneously. While this is not strictly necessary for a junction to work, it will allow better throughput at a low cost.


<gallery mode="nolines" widths=800px heights=800px>
<gallery mode="nolines" widths=800px heights=800px>
Line 76: Line 88:
File:T_junction_9.png|{{BlueprintString|bp-string=0eNqVmOtuqkAUhd9lfmPDHuYCvkrTnFglLYmiAWyOMbz7gaJN4WzjWv9Enc81sy9rO1fzvj+Xp6aqO7O+mmp7rFuzfr2atvqoN/vxve5yKs3aVF15MImpN4fxqdlUe9Mnpqp35V+zlv4tMWXdVV1VTuu/Hy5/6vPhvWyGL8xWrm70xJyO7bDmWI8/NHBW8uITcxleFC9+wO+qptxOn9s++Y9qf6htN3A/PrvVtzCFGyZs/hya4VAHQx0OtTDU49AUhoYf6PbcfJW7R8hbnOKcmCnECMvMYZU5zMQDX8BMPO7jwYNQPO4iWIwyNURBI8KVhCeSwIVE7ByuIyJEcBnhqSQBZeIpL3AdEdUucCERfUngSiI6qE3JFHVzZtSYwlbnAioa1LJeF5Zep3VRm82x289NVT+Gpw/hqmYHdv1bSxEA6TGk3IkaAzUj0XWp5xjpocEC2ZnTUwNCLeixAaBmKT03IFRhbR6BWtbnEWjGGj0CdWwrQaCe7HkIM5C2jDAjacsIMydtGWEWYE8StZ1ok5NLSacHZDphnR6BWtbpEWjGOj0CdWx/ss/tyHnKPsPdPtOlfapJQI579vlo4iI2RXhOaE426YVSrzELkgnMUD4FZ6j79u2we40jXBMBZkZvmUTKfumboZ2Gzji19vm04x14kMVNaLYUqp6Bpy4JohqaQLqwUymR+SscgczLOXvUVRXYqcdHh67VWUjJAwuatCDc/nSIJaXkKoW8INAhjpQiqYrxnJaR8pZMl6LrX3eoifkqm3bqv3m0Npcijbbv/wGVhQXf}}
File:T_junction_9.png|{{BlueprintString|bp-string=0eNqVmOtuqkAUhd9lfmPDHuYCvkrTnFglLYmiAWyOMbz7gaJN4WzjWv9Enc81sy9rO1fzvj+Xp6aqO7O+mmp7rFuzfr2atvqoN/vxve5yKs3aVF15MImpN4fxqdlUe9Mnpqp35V+zlv4tMWXdVV1VTuu/Hy5/6vPhvWyGL8xWrm70xJyO7bDmWI8/NHBW8uITcxleFC9+wO+qptxOn9s++Y9qf6htN3A/PrvVtzCFGyZs/hya4VAHQx0OtTDU49AUhoYf6PbcfJW7R8hbnOKcmCnECMvMYZU5zMQDX8BMPO7jwYNQPO4iWIwyNURBI8KVhCeSwIVE7ByuIyJEcBnhqSQBZeIpL3AdEdUucCERfUngSiI6qE3JFHVzZtSYwlbnAioa1LJeF5Zep3VRm82x289NVT+Gpw/hqmYHdv1bSxEA6TGk3IkaAzUj0XWp5xjpocEC2ZnTUwNCLeixAaBmKT03IFRhbR6BWtbnEWjGGj0CdWwrQaCe7HkIM5C2jDAjacsIMydtGWEWYE8StZ1ok5NLSacHZDphnR6BWtbpEWjGOj0CdWx/ss/tyHnKPsPdPtOlfapJQI579vlo4iI2RXhOaE426YVSrzELkgnMUD4FZ6j79u2we40jXBMBZkZvmUTKfumboZ2Gzji19vm04x14kMVNaLYUqp6Bpy4JohqaQLqwUymR+SscgczLOXvUVRXYqcdHh67VWUjJAwuatCDc/nSIJaXkKoW8INAhjpQiqYrxnJaR8pZMl6LrX3eoifkqm3bqv3m0Npcijbbv/wGVhQXf}}
</gallery>
</gallery>
=== 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. The focus of this section is on the rail intersection. If a station is used by more than one train, it should have a '''waiting area''' - as will be explained in the example later.
[[File:Rail_split_double.png|1000px]]
Blueprint of the junction:
{{BlueprintString|bp-string=0eNqV2N1uozAQBeB38TVUjH8w8CrVqkoTq7WUkAhItVHEuxdCNlvoRJy5TFu+DozHx+Gq3vfncGpi3anqquL2WLeqer2qNn7Um/34s+5yCqpSsQsHlah6cxg/NZu4V32iYr0Lf1VF/Z9EhbqLXQzT9bcPl7f6fHgPzfAHsyvTu56o07EdrjnW4z8anOzFJeqiqrR8cYO+i03YTr/WffIL1Q+07Qb247NLb3X9YlPSE1uso+aBbs/NV9g9I/0k+rloGNHiZWZwmQ5GC9jMYTOHTQ+bFjYL2MTbXqIm3qKxm5iJl0mELU9+deacCE8R3iAyqIkvJILHCF/wBE+RYDIJHiPBrkTiObJzlDi0wHblVP/blt1yW+b2Oyrn7PZzE+un+HObK1lnwtW6eAyeM8GZSmkiqecQjSEPY/1W0SQqWZLrjLbixNRADDtxwCFqLk04BPXSiEPQQjqbCFpKQw5ATSZMOcQkYcohpjSTEFOaSYhpsRHlJ5RLY+OEKYdUmUtTDkG9NOUQtBCOp17fRo0ojf5HXbaMI65dNsMS1MpUki1VvZ5xVgv3qIXpONMITeBIYi14JKH7Ex36xcWxdZKu/8RmJVqOzmWbE3ACsV5GauBLJ3q2c/d7N8t7ZwstRUclz7XGZZKTkl9fM45kqWbZqjT2vJ4+Lm5CnJFVlrOVWRlSsIiTIZT14yud20uf6sc7okR9haaddq7Ca11QmXnd9986QP+/}}
In the image above, a train can enter and leave the station through the same junction. The train will need to have locomotives facing in both directions for this to work. The following image shows a variation where the train enters and leaves via different junctions.
The signals in all the examples are done according to the 'chain before, regular after' rule.
[[File:Rail_splits.png|1000px]]
Upper Junction (entering main line):
{{BlueprintString|bp-string=0eNqV192OgjAQBeB36TUapi0UeJXNZoPYaBOtBtCsMbz78qNmxRrP3Inaj0mnPZSrWO1O9lg734riKlx18I0ovq6icRtf7obv2svRikK41u5FJHy5H67q0u1EFwnn1/ZXFNR9R8L61rXOTuPHi8uPP+1Xtu7/8DRycdMjcT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WZWdt0PlkGdWQ==}}


=== Waiting area ===
=== Waiting area ===


If multiple trains use the same station, the trains might wait on the main rail line, blocking other trains. One way to avoid this is to add waiting areas for trains at each station.
If multiple trains use the same station, the trains will wait on the main rail line which leads to a traffic jam in the network and can cause deadlocks. One way to avoid this is to add waiting areas for trains at each station.


[[File:Train_waiting_area.png|800px]]  
[[File:Train_waiting_area.png|800px]]  


There are two ways to design waiting areas, parallel and sequential. The parallel variation is extendable, takes less space and multiple stations can share a parallel waiting area. The sequential variation as shown below is easier to set up but cannot be shared by multiple stations (and has very minor UPS benefits). Waiting areas are often referred to as (train) stackers.
The image shows a shared waiting area for two stations. The signals leading into the waiting areas are regular signals because this is where trains are expected to wait for an extended time. The signals leading out of the waiting areas are chain signals because the track from the waiting areas to the stations should not be blocked. The stations are also in different blocks to make sure that all stations can be used simultaneously.
 
There are two ways to design waiting areas, parallel (as above) and sequential. The parallel version is easily extendable, takes less space and multiple stations can share a parallel waiting area. The sequential version as shown below is easier to set up but cannot be shared by multiple stations. Waiting areas are often referred to as stackers.


[[File:Train_waiting_area_sequential.png|800px]]
[[File:Train_waiting_area_sequential.png|800px]]
=== Four Way Junctions ===
Roundabouts are a very convenient way to make an extendable intersection. However compared to other intersections they only allow lower throughput and in rare scenarios they can cause deadlocks. The four way junction shown here is serviceable and has decent throughput. There are other designs with more throughput, however the size of the junction goes up by an order of magnitude. There is a [https://forums.factorio.com/viewtopic.php?t=46855 forum post] where a number of four way junctions and their throughput parameters are collected.
<gallery mode="nolines" widths=400px heights=400px>
File:Roundabout.png|{{BlueprintString|bp-string=0eNqVmNtuo0AMht9lriGaMwyvsqpWaYJapIREQKqNIt59IRy2pGbxfxXlwBd77N/2+CHeT7f8WhVlI7KHKA6XshbZr4eoi49yf+o/a+7XXGSiaPKziES5P/fvqn1xEm0kivKY/xGZat8ikZdN0RT58Pzzzf13eTu/51X3g/nJuume/fhs4iciEtdL3T11Kfu/6kixjcS9e9G6baMfGM3F6P9RDGyMpDAWNYakONQ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0QBRi3LRBnBdzEQBxrCBMDPlExsKeaghiyI3fTO97EXd3um+kaE1vbEaN25HqkylEuLGUozPf5HGJDZUmOLO8NGz3VLk2VCiTubzDDaJb55O+ywUP+LUnkiwfAzSQpsmcdE+UuU2qCdKxLr0MLlUv8RLpSocmvqJAzqiIZkseyY1uwgrwmERYVcUtLVrKvgbiyzRJGNVBv+UQQTLZZst9z5cQ85sOYZS7TG8RokQFxXgvjXDjCIpcctHUBIlvkrlpZIdWWNjFggWBtd/bjA8GNC/pXmMi9V6yQelzowxzyqkRKpmGhh3es1o2RZR+mQlyr47maOKS60IJhawzyjE0qXWQQTbIG8FAwrnVpWIelRlLrwkad+AVj4uS7HLnX7z/NXRE3LIxjh+aGdPs03mo61NRdxkEn7NGrUG8gpdrsWBu3/aRZnWeePbbIsPWjwYU9ZdnP5tWRbuwWDOspsL9TQFlTQQumkl920fyuC2H3ffsbIFTIfb8Fo9xXSRzG9WVy+O6Q2R9fNTLpfvTrzaE9LFm17Epc3v3Sn4igZ5Q=}}
</gallery>


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


* [[Tutorials]]
* [[Railway]]
* [[Railway]]
* [[Rail signal]]
* [[Rail signal]]
* [[Rail chain signal]]
* [[Rail chain signal]]

Latest revision as of 15:56, 3 February 2023

Rail signals are necessary to run a functioning rail system in Factorio. This tutorial explains why and how signals are used, how chain signals work, what deadlocks are and how they can be avoided. The aim is to enable the reader to keep a rail system running smoothly and fix common issues. Examples of frequent issues and use cases are shown.

This tutorial mostly uses rail systems with two parallel rails, one for each direction. For beginners, using this architecture is suggested instead of a single bidirectional rail line, which can lead to issues when more trains are added to the system.

It is recommended to place radars near intersections to help identify issues quickly. It is also recommended to set up automation for fueling trains as soon as possible whenever a new train or station is added to the system. Trains can either be fueled at one stop on their usual schedule (this may or may not involve transporting fuel to a station) or by adding a separate fuel station to the schedule. Finally, players should choose a maximum train length before designing a rail system.

Regular signals and blocks

Why signals.gif

Whenever there is more than one train on a track, there is the possibility that trains can crash into one another. To prevent this, we place signals along the track and at crossings. Signals split the tracks into different parts called blocks. The signals then ensure that only one train can be in each block. Any signal leading into an already occupied block will display the red color and trains that would enter will wait at the signal instead.

Rail blocks are shown with colors on the rails themselves when a player has a signal in hand. These colors are only for visualization of blocks and are not related to the color of the signal light. The picture shows the block visualization in an example, there are a total of eleven blocks. Rail signals and chain signals break up blocks, train stops do not.

Rail blocks example.png

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 shortly before turning red to inform that the block is reserved for the incoming train even though there is no train inside it.

Signals are placed on the right side of the track and trains are only allowed to go past signals that are on the right hand side from direction of travel. To allow trains to go in both directions one either runs two rail lines in parallel or puts signals on both sides of the track. A train in automatic mode will not drive through 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. This can sometimes cause a "no path" error where the track appears to be connected, but part of the connection is a one way track.

Signal directions.png

In the image, the tracks are from top to bottom:

  1. left to right,
  2. right to left,
  3. bidirectional,
  4. bidirectional,
  5. bidirectional on the left side, splitting into a right to left (upper) and a left to right track (lower).

Chain signals

If a train waits on an intersection, other trains have to wait for it, even trains that are not going in the same direction. These trains may in turn cause other trains to wait, resulting in a slowdown of the entire system. Traffic systems should avoid having trains waiting on crossings and in Factorio, Rail chain signals are used to ensure that this cannot happen.

Chain-signal-guards-crossroad.png

If a block is guarded by a chain signal instead of a rail signal, the train will only enter if it can enter the next block as well. So 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, there is a well known rule: Use chain signals in and before crossings and use regular signals at the exits of crossings. In general, 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.

Double-crossing.gif

If there are multiple chain signals in a row, a train will only enter if its path is clear all the way into a block behind a regular signal (or up to its destination station, whichever comes first). If the train goes past the first chain signal, it will reserve all blocks on the path and not allow other trains to pass through a block until 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 rail line splits up, it can happen that one outgoing signal is red and another is green. In that case the chain signal leading into the block will turn blue and trains are allowed in only if their path doesn't take them into an occupied block. A driver in a train wouldn't know from seeing the blue signal wether they have to wait or not, but the game magically makes it work anyways.

Chain signal colors.png


Splitting rail blocks and increasing throughput

If an intersection is one single block with chain signals at the entrances and rail signals at the exits, then there cannot be multiple trains on the intersection on the same time. The intersection will work, but one can break up the intersection into more blocks with signals to allow multiple trains to go through simultaneously. Long straight tracks can also be broken up with signals to allow multiple trains on them, to also increase throughput.

If the rail network contains many chain signals it is possible that a very large number of blocks is reserved when a train drives by a chain signal. This would restrict other trains, reducing throughput in general. It is suggested to use regular signals whenever possible and chain signals only where they are necessary.

Deadlocks

Using signals can lead to trains waiting for other trains. It may occur that there is 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. 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.


Deadlock anim.gif

The image above shows a deadlock caused by missing chain signals since only regular rail signals were used. As a result trains can wait on a crossing which leads to a deadlock. A corrected version of this intersection can be found above. The eight signals before and on the intersection should be replaced by chain signals, the ones leading out of the intersection can stay as they are. As stated above, in general chain signals should be used before and on intersections.

Deadlock too many trains.png

The deadlock in the image happened because there is a circle in the network which was used by more trains than can fit into the circle. The signals are correct; to fix the deadlock the circle must be removed or less trains need to be routed through this area.

Signal deadlock.png

This deadlock also happened because there were too many trains in a too small circle. It shows that a deadlock can happen with as few as two trains. In this case the deadlock could have been avoided by replacing the marked signal with a chain signal, because it would ensure that only one train can enter the offending circle. However this could lead to trains waiting on the main line, which would block other traffic. The station can only have one incoming train without causing issues, so it should have its train limit set to 1 or only one train should be routed to it. An alternative is creating a waiting area for trains heading to the station, see further below.

Train length and signal spacing

Deadlock signal space.png

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 signaled correctly, however, given the length of trains using them, they are too close to each other. One might argue that they form a single big intersection. Here are three 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, or all trains could be shortened.

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. In general, after every regular signal there should be at least that much space.

It is recommended that you choose a maximum train length before designing your rail system, and stick to it. Then rail signal blocks can be spaced according to the maximum length.

Examples

T-Junction

The image shows a basic three way junction. Signals have been placed inside the junction to ensure that more than one train can enter the junction in some cases. For example for one train going left to right and one going right to left, the trains will pass through different blocks: the first will go through the left yellow, the blue and the lower right yellow block; the second will use the upper yellow and upper red blocks. Because they use different blocks, they can use the junction simultaneously. While this is not strictly necessary for a junction to work, it will allow better throughput at a low cost.

Waiting area

If multiple trains use the same station, the trains will wait on the main rail line which leads to a traffic jam in the network and can cause deadlocks. One way to avoid this is to add waiting areas for trains at each station.

Train waiting area.png

The image shows a shared waiting area for two stations. The signals leading into the waiting areas are regular signals because this is where trains are expected to wait for an extended time. The signals leading out of the waiting areas are chain signals because the track from the waiting areas to the stations should not be blocked. The stations are also in different blocks to make sure that all stations can be used simultaneously.

There are two ways to design waiting areas, parallel (as above) and sequential. The parallel version is easily extendable, takes less space and multiple stations can share a parallel waiting area. The sequential version as shown below is easier to set up but cannot be shared by multiple stations. Waiting areas are often referred to as stackers.

Train waiting area sequential.png

See also