https://wiki.factorio.com/api.php?action=feedcontributions&user=Stevetrov&feedformat=atomOfficial Factorio Wiki - User contributions [en]2024-03-28T19:57:38ZUser contributionsMediaWiki 1.38.2https://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=184744Railway/Train path finding2021-02-25T15:08:24Z<p>Stevetrov: /* Destination full / No path trains */ Removed repath 128 ticks line as it was misleading / inaccurate after conferring with Boskid.</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a automatic train without a schedule -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated).<br />
* A rail is created and invalidates a signal (all trains are revalidated) .<br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated).<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated).<br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script.<br />
* The train's schedule is changed.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
* The train has waited at a chain signal for a multiple of 5 seconds.<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game considers possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script.<br />
* The train is switched to automatic control when it was previously manually controlled.<br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* A waypoint (train stop without wait condition) is removed from the train's schedule.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* A train fails a revalidation.<br />
* The train stop a train is heading to is renamed or destroyed.<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== Destination full / No path trains === <br />
* A rail gets created.<br />
* A train stop that is part of the train's schedule gets enabled, renamed or created. <br />
* The train limit of a train stop that is part of the train's schedule becomes not full.<br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=183887Railway/Train path finding2020-12-05T15:53:43Z<p>Stevetrov: /* No path trains */</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script.<br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
* The train has waited at a chain signal for a multiple of 5 seconds.<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game considers possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script. <br />
* The train is switched to automatic control when it was previously manually controlled.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* A train fails a revalidation<br />
* The train stop a train is heading to is renamed or destroyed.<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A rail gets created.<br />
* A train stop that is part of train's schedule gets renamed or created. <br />
* A train stop that is in its schedule gets enabled, renamed or created. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=183886Railway/Train path finding2020-12-05T15:53:22Z<p>Stevetrov: /* Path Revalidation */</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script.<br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
* The train has waited at a chain signal for a multiple of 5 seconds.<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game considers possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script. <br />
* The train is switched to automatic control when it was previously manually controlled.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* A train fails a revalidation<br />
* The train stop a train is heading to is renamed or destroyed.<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A rail gets created.<br />
* a train stop that is part of train's schedule gets renamed or created. <br />
* A train stop that is in its schedule gets enabled, renamed or created. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=183885Railway/Train path finding2020-12-05T15:52:34Z<p>Stevetrov: /* Repath events */</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script.<br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game considers possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script. <br />
* The train is switched to automatic control when it was previously manually controlled.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* A train fails a revalidation<br />
* The train stop a train is heading to is renamed or destroyed.<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A rail gets created.<br />
* a train stop that is part of train's schedule gets renamed or created. <br />
* A train stop that is in its schedule gets enabled, renamed or created. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=183884Railway/Train path finding2020-12-05T15:43:13Z<p>Stevetrov: /* No path trains */</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script.<br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game consider possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script. <br />
* The train is switched to automatic control when it was previously manually controlled.<br />
<br />
=== Repaths related to construction / destruction of rail entities === <br />
* A train fails a revalidation<br />
* The train doesn't have a path and a rail gets created.<br />
* The train does not have a path and a train stop that is part of train's schedule gets renamed or created. <br />
* The train stop a train is heading to is renamed or destroyed.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A train stop that is in its schedule gets enabled, renamed or created. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=183838Railway/Train path finding2020-12-03T16:21:56Z<p>Stevetrov: </p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script.<br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game consider possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script. <br />
* The train is switched to automatic control when it was previously manually controlled.<br />
<br />
=== Repaths related to construction / destruction of rail entities === <br />
* A train fails a revalidation<br />
* The train doesn't have a path and a rail gets created.<br />
* The train does not have a path and a train stop that is part of train's schedule gets renamed or created. <br />
* The train stop a train is heading to is renamed or destroyed.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A train stop that is in its schedule gets enabled or renamed. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=183834Railway/Train path finding2020-12-03T16:14:31Z<p>Stevetrov: </p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script.<br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train is switched to automatic control when it was previously manually controlled.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game consider possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script. <br />
<br />
=== Repaths related to construction / destruction of rail entities === <br />
* A train fails a revalidation<br />
* The train doesn't have a path and a rail gets created.<br />
* The train does not have a path and a train stop that is part of train's schedule gets renamed or created. <br />
* The train stop a train is heading to is renamed or destroyed.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A train stop that is in its schedule gets enabled or renamed. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=183826Railway/Train path finding2020-12-03T14:58:48Z<p>Stevetrov: /* Path Revalidation */</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script.<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game consider possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script. <br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train is switched to automatic control when it was previously manually controlled.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
=== Repaths related to construction / destruction of rail entities === <br />
* A train fails a revalidation<br />
* The train doesn't have a path and a rail gets created.<br />
* The train does not have a path and a train stop that is part of train's schedule gets renamed or created. <br />
* The train stop a train is heading to is renamed or destroyed.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A train stop that is in its schedule gets enabled or renamed. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=183825Railway/Train path finding2020-12-03T14:58:13Z<p>Stevetrov: /* User / script generated events */</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game consider possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path(true)] is called on the train by a script. <br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train is switched to automatic control when it was previously manually controlled.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
=== Repaths related to construction / destruction of rail entities === <br />
* A train fails a revalidation<br />
* The train doesn't have a path and a rail gets created.<br />
* The train does not have a path and a train stop that is part of train's schedule gets renamed or created. <br />
* The train stop a train is heading to is renamed or destroyed.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A train stop that is in its schedule gets enabled or renamed. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Infobox:Pumpjack&diff=182687Infobox:Pumpjack2020-09-28T13:02:22Z<p>Stevetrov: </p>
<hr />
<div>{{Infobox<br />
|mining-time = 0.5<br />
|map-color = 006090<br />
|prototype-type = mining-drill<br />
|internal-name = pumpjack<br />
|expensive-total-raw = Time, 27.5 + Copper plate, 20 + Iron plate, 70 + Steel plate, 5<br />
|category = Production<br />
|image=Pumpjack entity<br />
|health = 200<br />
|stack-size =20<br />
|fluid-storage-volume = 1000<br />
|dimensions =3×3<br />
|energy =90 {{Translation|kW}} electric<br />
|mining-speed =1<br />
|mining-area =1<br />
|pollution = 10{{Translation|/m}}<br />
|modules =2<br />
|boosting-technologies = Mining productivity<br />
|recipe = Time, 5 + Electronic circuit, 5 + Iron gear wheel, 10 + Pipe, 10 + Steel plate, 5<br />
|total-raw = Time, 21.25 + Copper plate, 7.5 + Iron plate, 35 + Steel plate, 5<br />
|required-technologies =Oil processing<br />
|producers = Assembling machine + Player<br />
}}<noinclude>[[Category:Infobox page]]</noinclude></div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=182677Railway/Train path finding2020-09-26T16:18:06Z<p>Stevetrov: tweeked the definition of a repath</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game consider possible paths from the trains current location to its destination train stop and will chose the path with the lowest score according to the penalties listed above. <br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script. <br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train is switched to automatic control when it was previously manually controlled.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
=== Repaths related to construction / destruction of rail entities === <br />
* A train fails a revalidation<br />
* The train doesn't have a path and a rail gets created.<br />
* The train does not have a path and a train stop that is part of train's schedule gets renamed or created. <br />
* The train stop a train is heading to is renamed or destroyed.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A train stop that is in its schedule gets enabled or renamed. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player).<br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=182675Railway/Train path finding2020-09-26T10:31:28Z<p>Stevetrov: /* User / script generated events */</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game consider possible paths from the trains current location to its destination train stop and will calculate the best path using the penalties above.<br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()] is called on the train by a script. <br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train is switched to automatic control when it was previously manually controlled.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
=== Repaths related to construction / destruction of rail entities === <br />
* A train fails a revalidation<br />
* The train doesn't have a path and a rail gets created.<br />
* The train does not have a path and a train stop that is part of train's schedule gets renamed or created. <br />
* The train stop a train is heading to is renamed or destroyed.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A train stop that is in its schedule gets enabled or renamed. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player). <br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Railway/Train_path_finding&diff=182674Railway/Train path finding2020-09-26T10:28:11Z<p>Stevetrov: Split repath events into separate sections for revalidation, user / script generated, construction / destruction generated, normal operation</p>
<hr />
<div>{{Languages}}<br />
Before a train moves to a target (in this case, a [[Train stop]]), it calculates the best route based on the railway network at that time.<br />
<br />
== Path finding penalties ==<br />
<br />
For calculation it uses a simple [[WIKIPEDIA:A*_search_algorithm|A*-algorithm]]<sup>[https://www.factorio.com/blog/post/fff-331]</sup>: The pathfinder first builds a list of non-disabled stops that match the name in the schedule, then searches outward from both ends of the train at once, if applicable, in segments. A segment is an uninterrupted plain sequence of rails, with no intersections, stops, or signals (all of which define segment borders). The cost (distance) is calculated using the following weighting rules:<br />
* Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).<br />
* When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.<br />
* When the rail block is guarded by a [[rail signal]] set to red by the [[circuit network]] -> Add a penalty of 1000.<br />
* When the path includes a train stop that is not the destination -> Add a penalty of 2000.<br />
* When the path includes a train stop with a train stopped in it -> Add a penalty of 500.<br />
* When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.<br />
* When the path includes a manually controlled stopped train -> Add a penalty of 2000.<br />
* When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.<br />
* When the path includes a train currently arriving to a train stop -> Add a penalty of 100.<br />
* When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.<br />
* When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.<br />
* When the path includes a train that doesn't have a path -> Add a penalty of 1000.<br />
<br />
== Path Revalidation ==<br />
A rail path will be revalidated if any event happens that could make this trains path invalid. If the path is found to be invalid then the game will repath the train. Path revalidation just confirms that the current path is still valid and does not confirm that it is still the best. <br />
The follow events cause path revalidation<br />
* A rail is destroyed (all trains are revalidated)<br />
* A rail is created and invalidates a signal (all trains are revalidated) <br />
* A signal (chain or regular) is created or destroyed (all trains are revalidated)<br />
* A rail block changes and invalidates a signal (chain or regular) (all trains are revalidated)<br />
<br />
== Repath events ==<br />
There are a number of events that can cause a train to repath listed below. When one of these conditions is met the game consider possible paths from the trains current location to its destination train stop and will calculate the best path using the penalties above.<br />
=== User / script generated events ===<br />
* A locomotive that is part of the train is rotated. <br />
* [https://lua-api.factorio.com/latest/LuaTrain.html#LuaTrain.recalculate_path LuaTrain::recalculate_path()|LuaTrain::recalculate_path()] is called on the train by a script. <br />
* The train is set to go to a station using the "Go to stop" button in the train's GUI.<br />
* The train's schedule is changed.<br />
* The train is switched to automatic control when it was previously manually controlled.<br />
* The train's braking force gets changed and the train is currently driving normally, arriving at a signal (chain or regular) or arriving at a station.<br />
<br />
=== Repaths related to construction / destruction of rail entities === <br />
* A train fails a revalidation<br />
* The train doesn't have a path and a rail gets created.<br />
* The train does not have a path and a train stop that is part of train's schedule gets renamed or created. <br />
* The train stop a train is heading to is renamed or destroyed.<br />
<br />
=== Repaths that happen as part of normal train operation ===<br />
* The train is preparing to stop at a signal (chain or regular) that changes so that the train can now continue. <br />
* The train is braking for a signal (chain or regular) it cant reserve and the train is not inside a chain signal block. <br />
* The train enters a new rail block and can't reserve the next needed signal (chain or regular). <br />
* The train has waited at a chain signal for a multiple of 5 seconds and there are multiple train stops with the same name as the destination. <br />
* The train has waited at a chain signal for a multiple of 30 seconds and there is only a single train stop with the same name as the destination.<br />
* The train wants to depart from a signal (chain or regular) that it stopped at. <br />
* The train wants to depart from a train stop.<br />
* The train is pathing to a train stop that gets disabled.<br />
<br />
=== No path trains === <br />
* A train stop that is in its schedule gets enabled or renamed. <br />
* The train stop that it currently cannot reach gets disabled or destroyed.<br />
* The path is recalculated every 128 ticks.<br />
<br />
=== Others ===<br />
* The train collides with something that is not a train (like a player). <br />
<br />
== History ==<br />
<br />
{{History|0.17.38|<br />
* When a train performs path finding while in a chain signal sequence, the pathfinding will have a constraint to not go through reserved block before exiting the chain sequence. This solves a problem of train intersections being possible to be deadlocked even with proper chain signals usage in cases of using temporary stops or when path is changed because of station is being enabled/disabled by a circuit network. This also allowed us to to let train recalculate path spontaneously even in chain signal sequence, as it shouldn't break anything now.}}<br />
<br />
{{History|0.16.42|<br />
* Added train path finding penalty for train with no path equal to 1000 tiles}}<br />
<br />
{{History|0.16.0|<br />
* The specific penalties can now be found in the utility constants, which allows mods to change them. (Undocumented)}}<br />
<br />
{{History|0.15.0|<br />
* Train station adds 2000 tiles penalty when path finding, so trains try to avoid stations not related to their path.}}<br />
<br />
{{History|0.11.17|<br />
* Increased the pathing penalty for non-moving train in manual mode from 200 to 1000.}}<br />
<br />
{{History|0.11.13|<br />
* Stopped, manually controlled train adds additional penalty (related to train path finding) of 200 tiles to the block it occupies.}}<br />
<br />
{{History|0.11.11|<br />
* The pathfinding is based on penalties for blocked segments now. For trains waiting in station, the more remaining time in the station, the bigger penalty.}}<br />
<br />
== See also ==<br />
<br />
* [https://gist.github.com/Rseding91/c0d4d08d6feaed618ed4a03f6c6a8fe6 Train pathfinding as of version 0.16 (Code)]<br />
* [https://www.factorio.com/blog/post/fff-68 FFF #68]<br />
* [[Railway]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial_talk:Circuit_network_cookbook&diff=182051Tutorial talk:Circuit network cookbook2020-09-03T14:42:25Z<p>Stevetrov: </p>
<hr />
<div>I'm uncertain as to editing practices on this wiki, but wanted to mention something I feel could be worthy of note, a circuit network recipe for controlling usage of uranium-235 and uranium-238 between nuclear fuel and other usages to ensure there is always fuel for the reactor.<br />
<br />
Set up a conveyor with a splitter to create two conveyors, one for uranium-235 and one for uranium-238. Have these two conveyors run by two inserters that each feed a container, each container feeds an inserter delivering its contents to an assembly machine making nuclear fuel. Hook the first two containers up to the inserters feeding them from the conveyor, as well as the tile of conveyor after the tile the inserters are drawing from. Set both the inserters to disable when the amount of uranium (235 or 238, whichever either is taking) in the container reaches X amount, and the conveyors to disable when the amount of uranium is below the same amount. Have the assembly machine deliver its product to a third container, and connect that container to the inserters feeding the assembly machine from the uranium containers, with the enable condition nuclear fuel = 0. This container will be the one that feeds your nuclear reactors.<br />
<br />
With this set-up, the first two inserters will grab uranium until they reach quota, and until they do the conveyors are disabled to ensure the uranium will not pass by them by. Once quota is met the conveyors enable and the inserters disable, allowing excess uranium to continue down the conveyors to other machines. Meanwhile that stored uranium will not be consumed to produce nuclear fuel until you have none left in reserve, at which time the inserters passing the uranium to the assembly machine activate, in turn activating the first two inserters to get more uranium from the conveyor.<br />
<br />
Thus, you always have a stockpile of nuclear fuel and uranium, and when you run out the consumption of uranium by other machines is halted to prioritize production of nuclear fuel. [[User:DrakeyC|DrakeyC]] ([[User talk:DrakeyC|talk]]) 21:33, 1 September 2020 (UTC)<br />
<br />
:This page is mostly maintained by the community. So please feel free to add your circuit with images ofc. If you have any more questions about this page then feel free to contact me (I am on discord / reddit under the same username) [[User:Stevetrov|Stevetrov]] ([[User talk:Stevetrov|talk]]) 14:42, 3 September 2020 (UTC)</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=173477Tutorial:Circuit network cookbook2019-05-20T07:59:47Z<p>Stevetrov: /* Heavy Oil Cracking */</p>
<hr />
<div>{{Languages}}<br />
== Foreword == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple designs that others can use, combine and modify. They are designed to be as easy to understand as possible. To see the settings of combinators without opening them, the option "Show combinator settings when detailed info is on" in the graphics options has to be checked and detailed info has to be turned on.<br />
<br />
==Lamp showing chest content condition==<br />
[[File:LightWiredToChest.png|right]]<br />
<br />
This is the simplest possible use of circuit-network. A lamp is light depending on the number of goods (in this example empty barrels) in a chest.<br />
<br />
===Setting up circuit connection===<br />
* The lamp is connected to the chest<br />
* the lamp is set to light if the chest contain less than 10 empty barrels.<br />
===To set the light condition===<br />
* Open the lamp (left click on it)<br />
* Set the input to barrels<br />
* Set the operator to < (less than)<br />
* Set the constant number:<br />
** Left click on the constant number<br />
** Move the slider until 10 is shown, or edit the value box directly<br />
** Press set<br />
<br />
Depending on the condition you set, the lamp may light if the chest is empty, or if it contains the required quantity of items.<br />
<br />
The drawback with this scenario is that the lamp has a white light , and is therefore difficult to differentiate from an ordinary lamp at night.<br />
{{clear}}<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left|400x400px]]<br />
=== Light Oil Cracking ===<br />
* This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
* The [[Pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
* The [[small pump]] has an enabled condition set to '''Light Oil > 20000''' (nb image is out of date).<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left|400x400px]]<br />
<br />
=== Heavy Oil Cracking ===<br />
* This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
* The [[Pump]] has an enabled condition set to '''Heavy oil > 20000''' (nb image is out of date).<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left|400x400px]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
* This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
* It has a few elements that work together to do achieve this. <br />
* Firstly the [[Pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Pump]] is set to '''Raw wood > 0'''.<br />
* Both of the [[Inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
* The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
* The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
* You will need to insert a single "Raw wood" into the chest to make it all work. <br />
<br /><br />
* It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left|400x400px]]<br />
=== Conditional Lights ===<br />
* In this circuit we connect a series of [[lamp]]s to a [[Storage tank]].<br />
* By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
* The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
* The others light up when gas is greater than 200, 300, 400 and 500 respectively.<br />
{{clear}}<br />
<br />
In this scenario you can connect the storage tank to the lamps directly.<br />
<br />
<br />
[[File:ColoredLights.png|left|400x400px]]<br />
<br />
=== Colored Lights ===<br />
* To light a [[lamp]] with a color rather than white, you need an intermediate device like an [[Arithmetic combinator]] that can send a color signal. <br />
Instead of directly connect the the [[Lamp]] and the [[Storage tank]] you need:<BR><br />
1 Add the [[Arithmetic combinator]].<BR><br />
2 Connect the [[Storage tank]] with the input of the [[Arithmetic combinator]].<BR><br />
3 Connect the output of the [[Arithmetic combinator]] with the [[lamp]].<BR><br />
4 Set up the [[Arithmetic combinator]]:<BR><br />
4.1 Setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0)<BR><br />
4.2 Set the output to the Pink signal (on the bottom row of the last tab of signals.)<BR><br />
5 Set up the [[lamp]]:<BR><br />
5.1 Select the "Use colors" check box on the lamp.<BR><br />
5.2 Set the condition to the Pink signal, and what value you want (i.e. > 100)<BR><br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left|400x400px]]<br />
=== Multiple Storages === <br />
* If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
* This also works with [[Storage tank]]s and [[roboport]]s.<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left|400x400px]]<br />
<br />
=== Constant combinator ===<br />
* With a [[constant combinator]] you can generate any signals you may need. <br />
* In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
* Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[File:LogicGates.png|left|400x400px]]<br />
<br />
=== Logic gates ===<br />
* In each case the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
* You can use [[Decider combinator]]s to make all of the common logic gates.<br />
* The output for each should be set to 1 and the signal of your choice.<br />
* Use the following settings to create different gates:<br />
{{clear}}<br />
<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left|400x400px]]<br />
<br />
=== Constant combinator signs ===<br />
* You can use [[Constant combinator]]s to make signs, just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left|400x400px]]<br />
<br />
=== Memory Cell / Counter ===<br />
* Basic memory cell that counts all the items moved by the inserter<br />
* The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator.<br />
<br />
* If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
* When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
[[File:combinatorMultiplierDetailed.png|left|400x400px]]<br />
<br />
=== Multiplier and Dictionaries/Arrays ===<br />
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.<br />
* A proof is shown below for the equation and why it works.<br />
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.<br />
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of "each = index OUTPUT 1 of each" and plug that in as the input to a dictionary.<br />
[[File:combinatorMultiplierMath.png|left|400x400px]]<br />
<br />
((A+B)^2 - (A-B)^2)/4 = AB<br />
(A+B)^2 - (A-B)^2 = 4AB<br />
(A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB<br />
4AB = 4AB<br />
<br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left|400x400px]]<br />
=== Limit items placed into a chest ===<br />
* The [[Inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up to 3 at once due to stack size bonuses.<br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
=== Balanced chest insert ===<br />
Goal: Load n chests with approximately the same number of items.<br />
* Place n chests and n inserters. <br />
* Place 1 [[Arithmetic combinator]]<br />
* Set the combinator to take Each (yellow star) and divide by the negative number of chests. ie &minus;n.<br />
* Connect all chests to each other and to the input of the combinator using red wire.<br />
* Connect all inserters to each other and to the output of the combinator using red wire.<br />
* Connect each inserter to the box it inserts into with green wire.<br />
* Set the enable condition on each inserter to be Everything (red star) < 0.<br />
<br />
The combinator calculates the average number of items in the chests, and makes it negative. Each inserter gets the amount in the chest it is inserting to and adds the negative average, ie it calculates how many more than the average it has in its chest. Thus if that number is negative, it has less than the average in the chest and it enables. <br />
<br />
Due to inserter stack bonus the count is not exact. If a precise count is needed, set the inserter stack size to 1. <br />
<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left|400x400px]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customized levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wire]]s join the output of the [[Arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[stack filter inserter]]. <br />
* The [[Arithmetic combinator]] '''multiplies''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
* So the input to the [[stack filter inserter]] is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
[[File:SolarAccumalatorBalancer.png|left|400x400px]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
* This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
* The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiplies''' it by '''24'''. <br />
* The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
* This gives us the number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
* If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
* However, if they are equal, neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color, therefore breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left|400x400px]]<br />
=== Reading Belt Design ===<br />
* Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
* This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
* Read hand contents is unselected for all inserters.<br />
* Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
* The first inserter is enabled when '''Science pack 1 = 0'''<br />
* The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left|400x400px]]<br />
=== Memory Cell Design ===<br />
* This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
* Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
* These inserters are connected to the input of the left arithmetic combinator. <br />
* The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
* The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
* The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
* The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left|400x400px]]<br />
=== Backup steam power ===<br />
* The [[steam engine]]s are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
* The [[power switch]] is connected to one of the [[accumulator]]s in the main network. <br />
* The [[power switch]] turns on when A < 10. That is when the [[accumulator]]s are less than 10% full.<br />
{{clear}}<br />
=== Optimal usage of fuel for nuclear power ===<br />
Unlike the normal steam power that adjusts fuel usage based on power usage, the [[Power_production#Nuclear_power|nuclear reactors]] spend fuel in fixed units of time. To be exact, the consumption of 1 fuel cell takes exactly 200 seconds.<br />
<br />
Combined with the fact that creating the nuclear fuel cells are time consuming and expensive to create, it is therefore beneficial to optimize their use to match the actual consumed power.<br />
<br />
[[File:NuclearCircuits.jpg]]<br />
<br />
The above picture shows a setup with 4 reactors, that spend only 1 fuel cell each whenever steam runs low.<br />
<br />
There are a few elements in this setup:<br />
<br />
* Storage tank that provides the [[Steam]] signal. You should only read from one storage tank, and it should have pipe connections to all your other steam storage tanks.<br />
* Chests containing [[Uranium_fuel_cell|Uranium fuel cells]] for the reactor.<br />
* Output inserters that take [[Used_up_uranium_fuel_cell|Empty fuel cells]] from the reactor. This is connected to the storage tank to listen for the steam signal, and to the chests to listen for the uranium fuel cell signal. If the steam level is low and there are uranium fuel cells available, it removes the empty fuel cells from the reactor and sends an empty fuel cell signal (since "Read hand contents" is checked).<br />
* Input inserters that put uranium fuel cells into the reactor. This is connected to the output inserters and listens for the empty fuel cell signal. The "Override stack size" is set to 1, so that it only inserts 1 fuel cell at a time.<br />
<br />
Since this design uses empty fuel cells as a signal to fill the reactor, you need to manually insert 1 uranium fuel cell into the reactor to get it started.<br />
<br />
== Latches ==<br />
=== RS latch - single decider version ===<br />
[https://forums.factorio.com/viewtopic.php?f=193&t=14556 This discussion] on the Factorio forums starts with the common 2 decider RS latch version, but the thread [https://forums.factorio.com/viewtopic.php?p=160896#p160896 goes on to explain] why this single decider version is better. In the thread, the latch is described as an SR latch. However, when both inputs are true, the latch will reset, so it is an RS latch.<br />
==== Backup steam example ====<br />
This example will turn on the steam generator when the Accumulator charge drops to 20%, but will "latch" (remember) the On state until the accumulator is charged to 90%.<br />
<br />
Latching is used to introduce [[Wikipedia:hysteresis|hysteresis]] and avoid the power switch rapidly cycling on and off (as the accumulator falls to 19%, charges to 20%, falls to 19% and so on). <br />
[[File:SR-01-Layout.png|left]]<br />
{{clear}}<br />
{{BlueprintString|bp-string=0eNrFVk1vozAQ/SuVz1ABCaRBq5WqXntKjqsKOTBJR8IGGTtpFPHfd+w0HyU0G6pVewkxnnmemfdmzI4tSgO1QqlZumOYV7Jh6Z8da3AleWnf6W0NLGVrVNrQG49JLuyLvYU/Z63HUBbwxtKw9QZ4zs48o15P1CBObgXkWIDy80osUHJdqTOAUfviMZAaNcI+A7fYZtKIBSiK7YgjoEAjfCgh1wpzv65KoFPqqiHnStrzCdAPA49t6Rm1NrYOWjQY7QrY6FQZwcvyX1jJFajxEYrnuRGmdGW6DCe+jx1KcB9TDYl1raoyW8ArXyM5kFVldG10djObj6zdI0kKHp2Mdiy0PysFIM8pwYKldHyOKjeo3TI8y8Wup93tl7Yv3fiaOC6zjt6z9uk4VqDaR+rY7CvBO2ZGewUec1qiaobVxaE3mtseiwK7EjVXLsaU/SKPobWe7zHrLYVmpM6WqhIZSsJg6ZKXDQyiYkzF9Vhk9xUU3d3kNiaSQUwEB/l9Hw+uZg1YjGzYiPpA1+/vpKuHjk7fRNf7JrJTsZf05MLwoIFbzLvtOvlEFZNjKepqQ5poNqjz10s9jA6N+fk8Ohx/FMFXNXDqxeCC20F901vCJxN07UjVG9K4+x9YQp5M2LUZfbTpq+XDKRsNnG4cuULZcz089HZWD+D0a8Pz52bnNPgPzTj76dlJAnDfNenZp5fHSr4ACp/NZ3fPnHrkDt64qN31vwbVuFIn43GUjCdxHIVt+xcL2lBp}}<br />
{{clear}}<br />
[[File:SR-02-Accumulator.png|left]]Accumulator outputs the current charge level as % on signal [[File:Signal-A.png|21px]]<br />
{{clear}}<br />
[[File:SR-03-RangeDeciders.png|left]]First decider outputs "Set" ([[File:Signal-S.png|21px]] = 1) if Accumulator is less than 20%.<br />
Second decider outputs "Reset" ([[File:Signal-R.png|21px]] = 1) once Accumulator is more than 90% full.<br />
{{clear}}<br />
[[File:SR-04-SRLatch.png|left]]<br />
==== RS Latch configuration ====<br />
'''The central decider and green feedback wire is the actual RS Latch.'''<br />
It latches the Set signal [[File:Signal-S.png|21px]] until the Reset signal [[File:Signal-R.png|21px]] is received (and vice-versa).<br /><br />
NB: the latch expects binary inputs ([[File:Signal-S.png|21px]] & [[File:Signal-R.png|21px]] must be 0 or 1) - this is why the previous two deciders are required.<br /><br />
When both inputs are true, the reset signal takes priority and the latch resets. This means it is an RS latch instead of an SR latch.<br />
<br clear=all><br />
[[File:SR-05-PowerSwitch.png|left]]The Power switch isolates the generator from the rest of the factory until [[File:Signal-S.png|21px]] = 1<br />
<br clear=all> <br />
----<br />
<br />
=== RS latch ===<br />
[[File:SRLatch.png|left|400x400px]]<br />
* This should be familiar to anyone with any background in electronics. <br />
* The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
* The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left|400x400px]]<br />
<br />
=== Usage of RS latch ===<br />
* Here is an example of how you could use an RS latch.<br />
* The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
* Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left|400x400px]]<br />
<br />
=== Belt only latch ===<br />
* To make it work, '''3''' pieces of raw wood must be placed on the inside lane of the belt.<br />
* It will have higher latency than the combinator version, but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left|400x400px]]<br />
=== Numerical Display ===<br />
* Each digit is driven by its own [[Green wire]], that wire holds 15 signals, one for each lamp used in the digit.<br />
* [[Constant combinator]]s are used to define which lamp should light up for each value. <br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left|400x400px]]<br />
<br />
=== Black and White Grid Display ===<br />
* Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
* We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left|400x400px]]<br />
=== Multicolor Display by DaveMcW ===<br />
* To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
* The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
* We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
* There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
* And this enables us to choose the color for each cell. <br />
* Simple!<br />
{{clear}}<br />
<br />
== See Also ==<br />
* [[Arithmetic combinator]]<br />
* [[Constant combinator]]<br />
* [[Decider combinator]]<br />
* [[Circuit network]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=173476Tutorial:Circuit network cookbook2019-05-20T07:59:30Z<p>Stevetrov: /* Light Oil Cracking */</p>
<hr />
<div>{{Languages}}<br />
== Foreword == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple designs that others can use, combine and modify. They are designed to be as easy to understand as possible. To see the settings of combinators without opening them, the option "Show combinator settings when detailed info is on" in the graphics options has to be checked and detailed info has to be turned on.<br />
<br />
==Lamp showing chest content condition==<br />
[[File:LightWiredToChest.png|right]]<br />
<br />
This is the simplest possible use of circuit-network. A lamp is light depending on the number of goods (in this example empty barrels) in a chest.<br />
<br />
===Setting up circuit connection===<br />
* The lamp is connected to the chest<br />
* the lamp is set to light if the chest contain less than 10 empty barrels.<br />
===To set the light condition===<br />
* Open the lamp (left click on it)<br />
* Set the input to barrels<br />
* Set the operator to < (less than)<br />
* Set the constant number:<br />
** Left click on the constant number<br />
** Move the slider until 10 is shown, or edit the value box directly<br />
** Press set<br />
<br />
Depending on the condition you set, the lamp may light if the chest is empty, or if it contains the required quantity of items.<br />
<br />
The drawback with this scenario is that the lamp has a white light , and is therefore difficult to differentiate from an ordinary lamp at night.<br />
{{clear}}<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left|400x400px]]<br />
=== Light Oil Cracking ===<br />
* This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
* The [[Pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
* The [[small pump]] has an enabled condition set to '''Light Oil > 20000''' (nb image is out of date).<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left|400x400px]]<br />
<br />
=== Heavy Oil Cracking ===<br />
* This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
* The [[Pump]] has an enabled condition set to '''Heavy oil > 20000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left|400x400px]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
* This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
* It has a few elements that work together to do achieve this. <br />
* Firstly the [[Pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Pump]] is set to '''Raw wood > 0'''.<br />
* Both of the [[Inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
* The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
* The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
* You will need to insert a single "Raw wood" into the chest to make it all work. <br />
<br /><br />
* It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left|400x400px]]<br />
=== Conditional Lights ===<br />
* In this circuit we connect a series of [[lamp]]s to a [[Storage tank]].<br />
* By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
* The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
* The others light up when gas is greater than 200, 300, 400 and 500 respectively.<br />
{{clear}}<br />
<br />
In this scenario you can connect the storage tank to the lamps directly.<br />
<br />
<br />
[[File:ColoredLights.png|left|400x400px]]<br />
<br />
=== Colored Lights ===<br />
* To light a [[lamp]] with a color rather than white, you need an intermediate device like an [[Arithmetic combinator]] that can send a color signal. <br />
Instead of directly connect the the [[Lamp]] and the [[Storage tank]] you need:<BR><br />
1 Add the [[Arithmetic combinator]].<BR><br />
2 Connect the [[Storage tank]] with the input of the [[Arithmetic combinator]].<BR><br />
3 Connect the output of the [[Arithmetic combinator]] with the [[lamp]].<BR><br />
4 Set up the [[Arithmetic combinator]]:<BR><br />
4.1 Setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0)<BR><br />
4.2 Set the output to the Pink signal (on the bottom row of the last tab of signals.)<BR><br />
5 Set up the [[lamp]]:<BR><br />
5.1 Select the "Use colors" check box on the lamp.<BR><br />
5.2 Set the condition to the Pink signal, and what value you want (i.e. > 100)<BR><br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left|400x400px]]<br />
=== Multiple Storages === <br />
* If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
* This also works with [[Storage tank]]s and [[roboport]]s.<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left|400x400px]]<br />
<br />
=== Constant combinator ===<br />
* With a [[constant combinator]] you can generate any signals you may need. <br />
* In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
* Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[File:LogicGates.png|left|400x400px]]<br />
<br />
=== Logic gates ===<br />
* In each case the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
* You can use [[Decider combinator]]s to make all of the common logic gates.<br />
* The output for each should be set to 1 and the signal of your choice.<br />
* Use the following settings to create different gates:<br />
{{clear}}<br />
<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left|400x400px]]<br />
<br />
=== Constant combinator signs ===<br />
* You can use [[Constant combinator]]s to make signs, just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left|400x400px]]<br />
<br />
=== Memory Cell / Counter ===<br />
* Basic memory cell that counts all the items moved by the inserter<br />
* The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator.<br />
<br />
* If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
* When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
[[File:combinatorMultiplierDetailed.png|left|400x400px]]<br />
<br />
=== Multiplier and Dictionaries/Arrays ===<br />
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.<br />
* A proof is shown below for the equation and why it works.<br />
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.<br />
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of "each = index OUTPUT 1 of each" and plug that in as the input to a dictionary.<br />
[[File:combinatorMultiplierMath.png|left|400x400px]]<br />
<br />
((A+B)^2 - (A-B)^2)/4 = AB<br />
(A+B)^2 - (A-B)^2 = 4AB<br />
(A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB<br />
4AB = 4AB<br />
<br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left|400x400px]]<br />
=== Limit items placed into a chest ===<br />
* The [[Inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up to 3 at once due to stack size bonuses.<br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
=== Balanced chest insert ===<br />
Goal: Load n chests with approximately the same number of items.<br />
* Place n chests and n inserters. <br />
* Place 1 [[Arithmetic combinator]]<br />
* Set the combinator to take Each (yellow star) and divide by the negative number of chests. ie &minus;n.<br />
* Connect all chests to each other and to the input of the combinator using red wire.<br />
* Connect all inserters to each other and to the output of the combinator using red wire.<br />
* Connect each inserter to the box it inserts into with green wire.<br />
* Set the enable condition on each inserter to be Everything (red star) < 0.<br />
<br />
The combinator calculates the average number of items in the chests, and makes it negative. Each inserter gets the amount in the chest it is inserting to and adds the negative average, ie it calculates how many more than the average it has in its chest. Thus if that number is negative, it has less than the average in the chest and it enables. <br />
<br />
Due to inserter stack bonus the count is not exact. If a precise count is needed, set the inserter stack size to 1. <br />
<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left|400x400px]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customized levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wire]]s join the output of the [[Arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[stack filter inserter]]. <br />
* The [[Arithmetic combinator]] '''multiplies''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
* So the input to the [[stack filter inserter]] is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
[[File:SolarAccumalatorBalancer.png|left|400x400px]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
* This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
* The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiplies''' it by '''24'''. <br />
* The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
* This gives us the number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
* If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
* However, if they are equal, neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color, therefore breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left|400x400px]]<br />
=== Reading Belt Design ===<br />
* Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
* This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
* Read hand contents is unselected for all inserters.<br />
* Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
* The first inserter is enabled when '''Science pack 1 = 0'''<br />
* The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left|400x400px]]<br />
=== Memory Cell Design ===<br />
* This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
* Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
* These inserters are connected to the input of the left arithmetic combinator. <br />
* The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
* The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
* The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
* The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left|400x400px]]<br />
=== Backup steam power ===<br />
* The [[steam engine]]s are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
* The [[power switch]] is connected to one of the [[accumulator]]s in the main network. <br />
* The [[power switch]] turns on when A < 10. That is when the [[accumulator]]s are less than 10% full.<br />
{{clear}}<br />
=== Optimal usage of fuel for nuclear power ===<br />
Unlike the normal steam power that adjusts fuel usage based on power usage, the [[Power_production#Nuclear_power|nuclear reactors]] spend fuel in fixed units of time. To be exact, the consumption of 1 fuel cell takes exactly 200 seconds.<br />
<br />
Combined with the fact that creating the nuclear fuel cells are time consuming and expensive to create, it is therefore beneficial to optimize their use to match the actual consumed power.<br />
<br />
[[File:NuclearCircuits.jpg]]<br />
<br />
The above picture shows a setup with 4 reactors, that spend only 1 fuel cell each whenever steam runs low.<br />
<br />
There are a few elements in this setup:<br />
<br />
* Storage tank that provides the [[Steam]] signal. You should only read from one storage tank, and it should have pipe connections to all your other steam storage tanks.<br />
* Chests containing [[Uranium_fuel_cell|Uranium fuel cells]] for the reactor.<br />
* Output inserters that take [[Used_up_uranium_fuel_cell|Empty fuel cells]] from the reactor. This is connected to the storage tank to listen for the steam signal, and to the chests to listen for the uranium fuel cell signal. If the steam level is low and there are uranium fuel cells available, it removes the empty fuel cells from the reactor and sends an empty fuel cell signal (since "Read hand contents" is checked).<br />
* Input inserters that put uranium fuel cells into the reactor. This is connected to the output inserters and listens for the empty fuel cell signal. The "Override stack size" is set to 1, so that it only inserts 1 fuel cell at a time.<br />
<br />
Since this design uses empty fuel cells as a signal to fill the reactor, you need to manually insert 1 uranium fuel cell into the reactor to get it started.<br />
<br />
== Latches ==<br />
=== RS latch - single decider version ===<br />
[https://forums.factorio.com/viewtopic.php?f=193&t=14556 This discussion] on the Factorio forums starts with the common 2 decider RS latch version, but the thread [https://forums.factorio.com/viewtopic.php?p=160896#p160896 goes on to explain] why this single decider version is better. In the thread, the latch is described as an SR latch. However, when both inputs are true, the latch will reset, so it is an RS latch.<br />
==== Backup steam example ====<br />
This example will turn on the steam generator when the Accumulator charge drops to 20%, but will "latch" (remember) the On state until the accumulator is charged to 90%.<br />
<br />
Latching is used to introduce [[Wikipedia:hysteresis|hysteresis]] and avoid the power switch rapidly cycling on and off (as the accumulator falls to 19%, charges to 20%, falls to 19% and so on). <br />
[[File:SR-01-Layout.png|left]]<br />
{{clear}}<br />
{{BlueprintString|bp-string=0eNrFVk1vozAQ/SuVz1ABCaRBq5WqXntKjqsKOTBJR8IGGTtpFPHfd+w0HyU0G6pVewkxnnmemfdmzI4tSgO1QqlZumOYV7Jh6Z8da3AleWnf6W0NLGVrVNrQG49JLuyLvYU/Z63HUBbwxtKw9QZ4zs48o15P1CBObgXkWIDy80osUHJdqTOAUfviMZAaNcI+A7fYZtKIBSiK7YgjoEAjfCgh1wpzv65KoFPqqiHnStrzCdAPA49t6Rm1NrYOWjQY7QrY6FQZwcvyX1jJFajxEYrnuRGmdGW6DCe+jx1KcB9TDYl1raoyW8ArXyM5kFVldG10djObj6zdI0kKHp2Mdiy0PysFIM8pwYKldHyOKjeo3TI8y8Wup93tl7Yv3fiaOC6zjt6z9uk4VqDaR+rY7CvBO2ZGewUec1qiaobVxaE3mtseiwK7EjVXLsaU/SKPobWe7zHrLYVmpM6WqhIZSsJg6ZKXDQyiYkzF9Vhk9xUU3d3kNiaSQUwEB/l9Hw+uZg1YjGzYiPpA1+/vpKuHjk7fRNf7JrJTsZf05MLwoIFbzLvtOvlEFZNjKepqQ5poNqjz10s9jA6N+fk8Ohx/FMFXNXDqxeCC20F901vCJxN07UjVG9K4+x9YQp5M2LUZfbTpq+XDKRsNnG4cuULZcz089HZWD+D0a8Pz52bnNPgPzTj76dlJAnDfNenZp5fHSr4ACp/NZ3fPnHrkDt64qN31vwbVuFIn43GUjCdxHIVt+xcL2lBp}}<br />
{{clear}}<br />
[[File:SR-02-Accumulator.png|left]]Accumulator outputs the current charge level as % on signal [[File:Signal-A.png|21px]]<br />
{{clear}}<br />
[[File:SR-03-RangeDeciders.png|left]]First decider outputs "Set" ([[File:Signal-S.png|21px]] = 1) if Accumulator is less than 20%.<br />
Second decider outputs "Reset" ([[File:Signal-R.png|21px]] = 1) once Accumulator is more than 90% full.<br />
{{clear}}<br />
[[File:SR-04-SRLatch.png|left]]<br />
==== RS Latch configuration ====<br />
'''The central decider and green feedback wire is the actual RS Latch.'''<br />
It latches the Set signal [[File:Signal-S.png|21px]] until the Reset signal [[File:Signal-R.png|21px]] is received (and vice-versa).<br /><br />
NB: the latch expects binary inputs ([[File:Signal-S.png|21px]] & [[File:Signal-R.png|21px]] must be 0 or 1) - this is why the previous two deciders are required.<br /><br />
When both inputs are true, the reset signal takes priority and the latch resets. This means it is an RS latch instead of an SR latch.<br />
<br clear=all><br />
[[File:SR-05-PowerSwitch.png|left]]The Power switch isolates the generator from the rest of the factory until [[File:Signal-S.png|21px]] = 1<br />
<br clear=all> <br />
----<br />
<br />
=== RS latch ===<br />
[[File:SRLatch.png|left|400x400px]]<br />
* This should be familiar to anyone with any background in electronics. <br />
* The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
* The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left|400x400px]]<br />
<br />
=== Usage of RS latch ===<br />
* Here is an example of how you could use an RS latch.<br />
* The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
* Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left|400x400px]]<br />
<br />
=== Belt only latch ===<br />
* To make it work, '''3''' pieces of raw wood must be placed on the inside lane of the belt.<br />
* It will have higher latency than the combinator version, but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left|400x400px]]<br />
=== Numerical Display ===<br />
* Each digit is driven by its own [[Green wire]], that wire holds 15 signals, one for each lamp used in the digit.<br />
* [[Constant combinator]]s are used to define which lamp should light up for each value. <br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left|400x400px]]<br />
<br />
=== Black and White Grid Display ===<br />
* Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
* We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left|400x400px]]<br />
=== Multicolor Display by DaveMcW ===<br />
* To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
* The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
* We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
* There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
* And this enables us to choose the color for each cell. <br />
* Simple!<br />
{{clear}}<br />
<br />
== See Also ==<br />
* [[Arithmetic combinator]]<br />
* [[Constant combinator]]<br />
* [[Decider combinator]]<br />
* [[Circuit network]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=173475Tutorial:Circuit network cookbook2019-05-20T07:58:48Z<p>Stevetrov: /* Oil Setups */</p>
<hr />
<div>{{Languages}}<br />
== Foreword == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple designs that others can use, combine and modify. They are designed to be as easy to understand as possible. To see the settings of combinators without opening them, the option "Show combinator settings when detailed info is on" in the graphics options has to be checked and detailed info has to be turned on.<br />
<br />
==Lamp showing chest content condition==<br />
[[File:LightWiredToChest.png|right]]<br />
<br />
This is the simplest possible use of circuit-network. A lamp is light depending on the number of goods (in this example empty barrels) in a chest.<br />
<br />
===Setting up circuit connection===<br />
* The lamp is connected to the chest<br />
* the lamp is set to light if the chest contain less than 10 empty barrels.<br />
===To set the light condition===<br />
* Open the lamp (left click on it)<br />
* Set the input to barrels<br />
* Set the operator to < (less than)<br />
* Set the constant number:<br />
** Left click on the constant number<br />
** Move the slider until 10 is shown, or edit the value box directly<br />
** Press set<br />
<br />
Depending on the condition you set, the lamp may light if the chest is empty, or if it contains the required quantity of items.<br />
<br />
The drawback with this scenario is that the lamp has a white light , and is therefore difficult to differentiate from an ordinary lamp at night.<br />
{{clear}}<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left|400x400px]]<br />
=== Light Oil Cracking ===<br />
* This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
* The [[Pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
* The [[small pump]] has an enabled condition set to '''Light Oil > 20000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left|400x400px]]<br />
<br />
=== Heavy Oil Cracking ===<br />
* This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
* The [[Pump]] has an enabled condition set to '''Heavy oil > 20000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left|400x400px]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
* This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
* It has a few elements that work together to do achieve this. <br />
* Firstly the [[Pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Pump]] is set to '''Raw wood > 0'''.<br />
* Both of the [[Inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
* The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
* The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
* You will need to insert a single "Raw wood" into the chest to make it all work. <br />
<br /><br />
* It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left|400x400px]]<br />
=== Conditional Lights ===<br />
* In this circuit we connect a series of [[lamp]]s to a [[Storage tank]].<br />
* By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
* The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
* The others light up when gas is greater than 200, 300, 400 and 500 respectively.<br />
{{clear}}<br />
<br />
In this scenario you can connect the storage tank to the lamps directly.<br />
<br />
<br />
[[File:ColoredLights.png|left|400x400px]]<br />
<br />
=== Colored Lights ===<br />
* To light a [[lamp]] with a color rather than white, you need an intermediate device like an [[Arithmetic combinator]] that can send a color signal. <br />
Instead of directly connect the the [[Lamp]] and the [[Storage tank]] you need:<BR><br />
1 Add the [[Arithmetic combinator]].<BR><br />
2 Connect the [[Storage tank]] with the input of the [[Arithmetic combinator]].<BR><br />
3 Connect the output of the [[Arithmetic combinator]] with the [[lamp]].<BR><br />
4 Set up the [[Arithmetic combinator]]:<BR><br />
4.1 Setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0)<BR><br />
4.2 Set the output to the Pink signal (on the bottom row of the last tab of signals.)<BR><br />
5 Set up the [[lamp]]:<BR><br />
5.1 Select the "Use colors" check box on the lamp.<BR><br />
5.2 Set the condition to the Pink signal, and what value you want (i.e. > 100)<BR><br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left|400x400px]]<br />
=== Multiple Storages === <br />
* If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
* This also works with [[Storage tank]]s and [[roboport]]s.<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left|400x400px]]<br />
<br />
=== Constant combinator ===<br />
* With a [[constant combinator]] you can generate any signals you may need. <br />
* In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
* Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[File:LogicGates.png|left|400x400px]]<br />
<br />
=== Logic gates ===<br />
* In each case the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
* You can use [[Decider combinator]]s to make all of the common logic gates.<br />
* The output for each should be set to 1 and the signal of your choice.<br />
* Use the following settings to create different gates:<br />
{{clear}}<br />
<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left|400x400px]]<br />
<br />
=== Constant combinator signs ===<br />
* You can use [[Constant combinator]]s to make signs, just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left|400x400px]]<br />
<br />
=== Memory Cell / Counter ===<br />
* Basic memory cell that counts all the items moved by the inserter<br />
* The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator.<br />
<br />
* If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
* When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
[[File:combinatorMultiplierDetailed.png|left|400x400px]]<br />
<br />
=== Multiplier and Dictionaries/Arrays ===<br />
* Multiplying two signals together is simple and requires only a single combinator, however multiplying a set of signals is more complicated.<br />
* A proof is shown below for the equation and why it works.<br />
* A dictionary is a system that allows a value on a specific signal to be accessed. For example, A can contain many signals (either from a constant combinator or memory cell) and B can contain 1 of a specific signal (such as blue signal). What remains is the blue-signal value from A. This is because all the other signals are multiplied by 0.<br />
* Arrays are similar to dictionaries, but instead of using a signal as a key, we use a number. Constant combinators are placed mapping each signal to a unique number (such as 1 yellow belt, 2 red belt, 3 blue belt, 4 burner inserter, etc). Then, use a combinator of "each = index OUTPUT 1 of each" and plug that in as the input to a dictionary.<br />
[[File:combinatorMultiplierMath.png|left|400x400px]]<br />
<br />
((A+B)^2 - (A-B)^2)/4 = AB<br />
(A+B)^2 - (A-B)^2 = 4AB<br />
(A^2 + 2AB + B^2) - (A^2 - 2AB + B^2) = 4AB<br />
4AB = 4AB<br />
<br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left|400x400px]]<br />
=== Limit items placed into a chest ===<br />
* The [[Inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up to 3 at once due to stack size bonuses.<br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
=== Balanced chest insert ===<br />
Goal: Load n chests with approximately the same number of items.<br />
* Place n chests and n inserters. <br />
* Place 1 [[Arithmetic combinator]]<br />
* Set the combinator to take Each (yellow star) and divide by the negative number of chests. ie &minus;n.<br />
* Connect all chests to each other and to the input of the combinator using red wire.<br />
* Connect all inserters to each other and to the output of the combinator using red wire.<br />
* Connect each inserter to the box it inserts into with green wire.<br />
* Set the enable condition on each inserter to be Everything (red star) < 0.<br />
<br />
The combinator calculates the average number of items in the chests, and makes it negative. Each inserter gets the amount in the chest it is inserting to and adds the negative average, ie it calculates how many more than the average it has in its chest. Thus if that number is negative, it has less than the average in the chest and it enables. <br />
<br />
Due to inserter stack bonus the count is not exact. If a precise count is needed, set the inserter stack size to 1. <br />
<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left|400x400px]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customized levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wire]]s join the output of the [[Arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[stack filter inserter]]. <br />
* The [[Arithmetic combinator]] '''multiplies''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
* So the input to the [[stack filter inserter]] is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
[[File:SolarAccumalatorBalancer.png|left|400x400px]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
* This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
* The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiplies''' it by '''24'''. <br />
* The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
* This gives us the number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
* If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
* However, if they are equal, neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color, therefore breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left|400x400px]]<br />
=== Reading Belt Design ===<br />
* Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
* This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
* Read hand contents is unselected for all inserters.<br />
* Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
* The first inserter is enabled when '''Science pack 1 = 0'''<br />
* The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left|400x400px]]<br />
=== Memory Cell Design ===<br />
* This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
* Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
* These inserters are connected to the input of the left arithmetic combinator. <br />
* The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
* The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
* The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
* The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left|400x400px]]<br />
=== Backup steam power ===<br />
* The [[steam engine]]s are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
* The [[power switch]] is connected to one of the [[accumulator]]s in the main network. <br />
* The [[power switch]] turns on when A < 10. That is when the [[accumulator]]s are less than 10% full.<br />
{{clear}}<br />
=== Optimal usage of fuel for nuclear power ===<br />
Unlike the normal steam power that adjusts fuel usage based on power usage, the [[Power_production#Nuclear_power|nuclear reactors]] spend fuel in fixed units of time. To be exact, the consumption of 1 fuel cell takes exactly 200 seconds.<br />
<br />
Combined with the fact that creating the nuclear fuel cells are time consuming and expensive to create, it is therefore beneficial to optimize their use to match the actual consumed power.<br />
<br />
[[File:NuclearCircuits.jpg]]<br />
<br />
The above picture shows a setup with 4 reactors, that spend only 1 fuel cell each whenever steam runs low.<br />
<br />
There are a few elements in this setup:<br />
<br />
* Storage tank that provides the [[Steam]] signal. You should only read from one storage tank, and it should have pipe connections to all your other steam storage tanks.<br />
* Chests containing [[Uranium_fuel_cell|Uranium fuel cells]] for the reactor.<br />
* Output inserters that take [[Used_up_uranium_fuel_cell|Empty fuel cells]] from the reactor. This is connected to the storage tank to listen for the steam signal, and to the chests to listen for the uranium fuel cell signal. If the steam level is low and there are uranium fuel cells available, it removes the empty fuel cells from the reactor and sends an empty fuel cell signal (since "Read hand contents" is checked).<br />
* Input inserters that put uranium fuel cells into the reactor. This is connected to the output inserters and listens for the empty fuel cell signal. The "Override stack size" is set to 1, so that it only inserts 1 fuel cell at a time.<br />
<br />
Since this design uses empty fuel cells as a signal to fill the reactor, you need to manually insert 1 uranium fuel cell into the reactor to get it started.<br />
<br />
== Latches ==<br />
=== RS latch - single decider version ===<br />
[https://forums.factorio.com/viewtopic.php?f=193&t=14556 This discussion] on the Factorio forums starts with the common 2 decider RS latch version, but the thread [https://forums.factorio.com/viewtopic.php?p=160896#p160896 goes on to explain] why this single decider version is better. In the thread, the latch is described as an SR latch. However, when both inputs are true, the latch will reset, so it is an RS latch.<br />
==== Backup steam example ====<br />
This example will turn on the steam generator when the Accumulator charge drops to 20%, but will "latch" (remember) the On state until the accumulator is charged to 90%.<br />
<br />
Latching is used to introduce [[Wikipedia:hysteresis|hysteresis]] and avoid the power switch rapidly cycling on and off (as the accumulator falls to 19%, charges to 20%, falls to 19% and so on). <br />
[[File:SR-01-Layout.png|left]]<br />
{{clear}}<br />
{{BlueprintString|bp-string=0eNrFVk1vozAQ/SuVz1ABCaRBq5WqXntKjqsKOTBJR8IGGTtpFPHfd+w0HyU0G6pVewkxnnmemfdmzI4tSgO1QqlZumOYV7Jh6Z8da3AleWnf6W0NLGVrVNrQG49JLuyLvYU/Z63HUBbwxtKw9QZ4zs48o15P1CBObgXkWIDy80osUHJdqTOAUfviMZAaNcI+A7fYZtKIBSiK7YgjoEAjfCgh1wpzv65KoFPqqiHnStrzCdAPA49t6Rm1NrYOWjQY7QrY6FQZwcvyX1jJFajxEYrnuRGmdGW6DCe+jx1KcB9TDYl1raoyW8ArXyM5kFVldG10djObj6zdI0kKHp2Mdiy0PysFIM8pwYKldHyOKjeo3TI8y8Wup93tl7Yv3fiaOC6zjt6z9uk4VqDaR+rY7CvBO2ZGewUec1qiaobVxaE3mtseiwK7EjVXLsaU/SKPobWe7zHrLYVmpM6WqhIZSsJg6ZKXDQyiYkzF9Vhk9xUU3d3kNiaSQUwEB/l9Hw+uZg1YjGzYiPpA1+/vpKuHjk7fRNf7JrJTsZf05MLwoIFbzLvtOvlEFZNjKepqQ5poNqjz10s9jA6N+fk8Ohx/FMFXNXDqxeCC20F901vCJxN07UjVG9K4+x9YQp5M2LUZfbTpq+XDKRsNnG4cuULZcz089HZWD+D0a8Pz52bnNPgPzTj76dlJAnDfNenZp5fHSr4ACp/NZ3fPnHrkDt64qN31vwbVuFIn43GUjCdxHIVt+xcL2lBp}}<br />
{{clear}}<br />
[[File:SR-02-Accumulator.png|left]]Accumulator outputs the current charge level as % on signal [[File:Signal-A.png|21px]]<br />
{{clear}}<br />
[[File:SR-03-RangeDeciders.png|left]]First decider outputs "Set" ([[File:Signal-S.png|21px]] = 1) if Accumulator is less than 20%.<br />
Second decider outputs "Reset" ([[File:Signal-R.png|21px]] = 1) once Accumulator is more than 90% full.<br />
{{clear}}<br />
[[File:SR-04-SRLatch.png|left]]<br />
==== RS Latch configuration ====<br />
'''The central decider and green feedback wire is the actual RS Latch.'''<br />
It latches the Set signal [[File:Signal-S.png|21px]] until the Reset signal [[File:Signal-R.png|21px]] is received (and vice-versa).<br /><br />
NB: the latch expects binary inputs ([[File:Signal-S.png|21px]] & [[File:Signal-R.png|21px]] must be 0 or 1) - this is why the previous two deciders are required.<br /><br />
When both inputs are true, the reset signal takes priority and the latch resets. This means it is an RS latch instead of an SR latch.<br />
<br clear=all><br />
[[File:SR-05-PowerSwitch.png|left]]The Power switch isolates the generator from the rest of the factory until [[File:Signal-S.png|21px]] = 1<br />
<br clear=all> <br />
----<br />
<br />
=== RS latch ===<br />
[[File:SRLatch.png|left|400x400px]]<br />
* This should be familiar to anyone with any background in electronics. <br />
* The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
* The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left|400x400px]]<br />
<br />
=== Usage of RS latch ===<br />
* Here is an example of how you could use an RS latch.<br />
* The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
* Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left|400x400px]]<br />
<br />
=== Belt only latch ===<br />
* To make it work, '''3''' pieces of raw wood must be placed on the inside lane of the belt.<br />
* It will have higher latency than the combinator version, but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left|400x400px]]<br />
=== Numerical Display ===<br />
* Each digit is driven by its own [[Green wire]], that wire holds 15 signals, one for each lamp used in the digit.<br />
* [[Constant combinator]]s are used to define which lamp should light up for each value. <br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left|400x400px]]<br />
<br />
=== Black and White Grid Display ===<br />
* Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
* We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left|400x400px]]<br />
=== Multicolor Display by DaveMcW ===<br />
* To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
* The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
* We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
* There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
* And this enables us to choose the color for each cell. <br />
* Simple!<br />
{{clear}}<br />
<br />
== See Also ==<br />
* [[Arithmetic combinator]]<br />
* [[Constant combinator]]<br />
* [[Decider combinator]]<br />
* [[Circuit network]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Debug_mode&diff=172852Debug mode2019-05-02T16:47:03Z<p>Stevetrov: /* List of debug-options and their function */</p>
<hr />
<div>{{Languages}}<br />
The ''debug mode'' is used mainly by developers and modders to analyze the running state of the game. It can be enabled to show detailed information about the game world. The default key to enable debug mode is {{keybinding|F5}}.<br />
<br />
For example, one can:<br />
* See the path the [[biter]]s are coming from and where they plan to target,<br />
* See the position / coordinates of the cursor,<br />
* See a grid-overlay for the [[map structure|tile]]s and [[chunk]]s,<br />
* See the blocks in a railway network,<br />
* See additional non-game related information, such as Updates Per Second and FPS.<br />
<br />
== Activate the debug mode ==<br />
<br />
There are 4 debug-levels:<br />
<br />
* '''Always''' - This is the default mode, if no mode is active. Keep very few things active here.<br />
* '''Debug''' - Toggled by pressing {{keybinding|F5}}. Allows to toggle the debug overlays.<br />
<br />
== Configuring the debug mode ==<br />
<br />
To configure the 2 modes, press {{keybinding|F4}}. This opens up a menu with many options. You can move this menu with the mouse, if it hides some interesting underlying thing. You can switch between 2 folders, which reflects the option for that debug-mode ("always", "debug"). The options are the same for each mode. Each mode can be configured to the user's liking, the different modes are only for convenience. A search function ({{Keybinding|ctrl|F}}) is available.<br />
<br />
== List of debug-options and their function ==<br />
{| class="wikitable"<br />
|-<br />
! Option !! Description<br />
|-<br />
| show-fps || Will show the current frames-per-second and updates per second, short <abbr title="Frames Per Second">FPS</abbr> and <abbr title="Updates Per Second">UPS</abbr>. Should be normally about 60.<br />
|-<br />
| show-detailed-info ||<br />
* Shows the cursor position in [[Tile (unit)|tile]]s (and subdivisions of that).<br />
* Current resolution and zoom.<br />
* How many objects are on the screen (painted by the graphic card).<br />
* How many entities, chunks and paths are in the game and used.<br />
|-<br />
| show-time-usage ||<br />
* Internal statistics about how long some calculations take, in milliseconds per [[Game-tick|tick]].<br />
* Time is shown as average/min/max of the last 100 ticks, interval can be changed with /perf-avg-frames.<br />
* Minimum values exclude zeroes (e.g. from ticks where no mod hooks were run).<br />
* Overall calculation delays (some are parallel) must be under 16.6 ms to maintain normal framerate at 1x speed with 60 ticks per second.<br />
|-<br />
| show-gpu-time-usage ||<br />
|-<br />
| show-sprite-counts || The counts of each sprite rendered on screen.<br />
|-<br />
| show-lua-object-statistics ||<br />
|-<br />
| show-multiplayer-waiting-icon || When in a multiplayer game: if the game is currently waiting for the server to process.<br />
|-<br />
| show-multiplayer-statistics || The latency information when in multiplayer.<br />
|-<br />
| show-multiplayer-selection-rectangles || Allows to view selection rectangles of other players in multiplayer.<br />
|-<br />
| show-debug-info-in-tooltips || Shows additional information in the tooltips of entities, items, recipes, tiles etc. <br />
|-<br />
| show-tile-grid || Shows the borders of the [[Tile (unit)|tile]]s and [[chunk]]s.<br />
|-<br />
| show-collision-rectangles || Shows the collision boxes of each entity (red).<br />
|-<br />
| show-selection-rectangles || Shows the a blue box over each entity, if you hover over it, it will be selected.<br />
|-<br />
| show-entity-positions ||<br />
|-<br />
| show-entity-velocities ||<br />
|-<br />
| show-selected-entity-advanced-tiles ||<br />
|-<br />
| show-selected-input-transport-belts ||<br />
|-<br />
| show-paths || The calculated paths for the biters in different colors.<br />
|-<br />
| show-path-requests ||<br />
|-<br />
| show-next-waypoint-bb || Shows waypoints for biters (in green), nearly the same info as the next.<br />
|-<br />
| show-target || Shows the current target of the biters (red).<br />
|-<br />
| show-unit-group-info || Biter groups, which belong together (circles and lines belonging together)<br />
|-<br />
| show-unit-behavior-info ||<br />
|-<br />
| show-last-path-detail || The A*-algorithm at work, calculating new paths.<br />
|-<br />
| show-path-cache || The source-positions of a path and about the length (?)<br />
|-<br />
| show-path-cache-paths ||<br />
|-<br />
| show-rail-paths || Which path a train will follow.<br />
|-<br />
| show-rolling-stock-count || Shows inserter positions<br />
|-<br />
| show-rail-connections || Shows rail connections.<br />
|-<br />
| show-rail-joints ||<br />
|-<br />
| show-rail-signal-states || Shows signal color on map view. <br />
|-<br />
| show-train-stop-point || When a train slows down it shows the calculated point where it should halt<br />
|-<br />
| show-train-braking-distance || The distance a train will take to stop at its current speed<br />
|-<br />
| show-train-signals ||<br />
|-<br />
| show-network-connected-entities || Displays the network-id of the electric network that a pole is connected to<br />
|-<br />
| show-circuit-network-numbers || Shows the number (and color) of circuit networks<br />
|-<br />
| show-energy-sources-networks || Which network-id an entity is connected to.<br />
|-<br />
| show-active-state || Inserters, fish, turrets are turned to passive, if not used; Red = inactive, Purple = inactive when enemies aren't around (turrets etc), Green = inactive when player isn't around (fish). Passive entities consume less CPU power.<br />
|-<br />
| show-wakeup-lists || When an entity is sleeping in another entity it shows which entities it's sleeping in.<br />
|-<br />
| show-transport-lines ||<br />
|-<br />
| show-transport-line-gaps ||<br />
|-<br />
| show-pollution-values || Shows the numeric pollution amount on each chunk.<br />
|-<br />
| show-active-entities-on-chunk-counts ||<br />
Shows counts of active entities per chunk. They are devided into three categories:<br />
* Red = active (e.g. furnaces)<br />
* Blue = active when a player is around (e.g. fish)<br />
* Green = active when enemies are around (e.g. turrets)<br />
|-<br />
| show-active-chunks || Shows in the map view, which chunks are "on", unmarked chunks are not calculated.<br />
|-<br />
| show-polluted-chunks || Shows which chunks have pollution.<br />
|-<br />
| show-enemy-expansion-candidate-chunks || Where is space left to spread the brood?. Goes from red (nearly no space) to green (space to expand).<br />
|-<br />
| show-enemy-expansion-candidate-chunk-values || Which chunks the enemies will try to expand into.<br />
|-<br />
| show-bad-attack-chunks ||<br />
|-<br />
| show-tile-variations || Shows, which tile-variation (1, 2 or 4 tile sized) is painted for which area of the map. Quite confusing, zoom in to see the meaning.<br />
|-<br />
| show-raw-tile-transitions || Turns connected textures for land and water off, so the distinction can easily be made.<br />
|-<br />
| show-fluid-box-fluid-info || How much fluid is in a pipe/storage tank, shows flow of liquid in pipes.<br />
|-<br />
| show-environment-sound-info || Displays which sound of which entity is played and how loud.<br />
|-<br />
| show-logistic-robot-targets ||<br />
|-<br />
| show-logistic-robots-on-map ||<br />
|-<br />
| show-player-robots ||<br />
|-<br />
| show-fire-info ||<br />
|-<br />
| show-sticker-info ||<br />
|-<br />
| show-map-generator-info ||<br />
|-<br />
| show-decorative-names ||<br />
|-<br />
| show-decorative-collision-rectangles ||<br />
|-<br />
| allow-increased-zoom ||<br />
|-<br />
|}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Debug_mode&diff=161877Debug mode2018-07-18T12:59:04Z<p>Stevetrov: /* List of debug-options and their function */</p>
<hr />
<div>{{Languages}}<br />
The ''debug mode'' is used mainly by developers and modders to analyze the running state of the game. It can be enabled to show detailed information about the game world, and its information varies based on which level is active. The default keys to enable debug mode are f5 through f7.<br />
<br />
For example, one can:<br />
* See the path the [[Biter]]s are coming from and where they plan to target,<br />
* See the position / coordinates of the cursor,<br />
* See a grid-overlay for the [[Tile]]s and [[Chunk]]s,<br />
* See the blocks in a railway network,<br />
* See additional non-game related information, such as Updates Per Second and FPS.<br />
<br />
== Activate the debug mode ==<br />
<br />
There are 4 debug-levels:<br />
<br />
* '''Always''' - This is the default mode, if no mode is active. Keep very few things active here.<br />
* '''Basic''' - The first mode, accessed by pressing {{keybinding|F5}}. What power users often use.<br />
* '''Detailed''' - The second mode, accessed by pressing {{keybinding|F6}}. The most commonly used for modders and developers.<br />
* '''Full''' - The third mode, accessed by pressing {{keybinding|F7}}. Shows literally everything, tends to be unreadable.<br />
<br />
To switch back to "always" you need to press the previous key again. Example: Press F5 to go to "basic", then press F6 to watch "detailed" and then press F6 again to switch back to "always".<br />
<br />
== Configuring the debug mode ==<br />
<br />
To configure the 4 modes, press {{keybinding|F4}}. This opens up a menu with many options. You can move this menu with the mouse, if it hides some interesting underlying thing. You can switch between 4 folders, which reflects the option for that debug-mode ("always", "basic", "detailed", "full"). The options are the same for each mode. Each mode can be configured to the user's liking, the different modes are only for convenience. A search function ({{Keybinding|ctrl|F}}) is available.<br />
<br />
== List of debug-options and their function ==<br />
{| class="wikitable"<br />
|-<br />
! Option !! Description<br />
|-<br />
| show-fps || Will show the current frames-per-second and updates per second, short <abbr title="Frames Per Second">FPS</abbr> and <abbr title="Updates Per Second">UPS</abbr>. Should be normally about 60.<br />
|-<br />
| show-detailed-info ||<br />
* Shows the cursor position in [[Tile]]s (and subdivisions of that), [[Chunk]]s and [[Region]]<br />
* Current resolution and zoom<br />
* How many objects are on the screen (painted by the graphic card)<br />
* How many entities, chunks and paths are in the game and used.<br />
|-<br />
| show-tile-properties-in-detailed-info ||<br />
|-<br />
| show-time-usage || Many important internal statistics about how much time each calculation takes.<br />
|-<br />
| show-sprite-counts || The counts of each sprite rendered on screen.<br />
|-<br />
| show-multiplayer-waiting-icon || When in a multiplayer game: if the game is currently waiting for the server to process.<br />
|-<br />
| show-multiplayer-statistics || The latency information when in multiplayer.<br />
|-<br />
| show-multiplayer-selection-rectangles || Allows to view selection rectangles of other players in multiplayer.<br />
|-<br />
| show-tile-grid || Shows the borders of the [[Tile]]s and [[Chunk]]s.<br />
|-<br />
| show-collision-rectangles || Shows the collision boxes of each entity (red).<br />
|-<br />
| show-selection-rectangles || Shows the a blue box over each entity, if you hover over it, it will be selected.<br />
|-<br />
| show-paths || The calculated paths for the biters in different colors.<br />
|-<br />
| show-next-waypoint-bb || Shows waypoints for biters (in green), nearly the same info as the next.<br />
|-<br />
| show-target || Shows the current target of the biters (red).<br />
|-<br />
| show-unit-group-info || Biter groups, which belong together (circles and lines belonging together)<br />
|-<br />
| show-unit-behavior-info ||<br />
|-<br />
| show-last-path-detail || The A*-algorithm at work, calculating new paths.<br />
|-<br />
| show-path-cache || The source-positions of a path and about the length (?)<br />
|-<br />
| show-path-cache-paths ||<br />
|-<br />
| show-rail-paths || Which path a train will follow.<br />
|-<br />
| show-rolling-stock-count || Shows inserter positions<br />
|-<br />
| show-rail-connections || Shows rail connections.<br />
|-<br />
| show-rail-joints ||<br />
|-<br />
| show-rail-signal-states || Shows signal color on map view. <br />
|-<br />
| show-train-stop-point || When a train slows down it shows the calculated point where it should halt<br />
|-<br />
| show-train-braking-distance || The distance a train will take to stop at its current speed<br />
|-<br />
| show-train-signals ||<br />
|-<br />
| show-network-connected-entities || Displays the network-id of the electric network that a pole is connected to<br />
|-<br />
| show-circuit-network-numbers || Shows the number (and color) of circuit networks<br />
|-<br />
| show-energy-sources-networks || Which network-id an entity is connected to.<br />
|-<br />
| show-active-state || Inserters, fish, turrets are turned to passive, if not used; Red = inactive, Purple = inactive until enemies aren't around (turrets etc), Green = inactive until player isn't around (fish). Passive entities consume less CPU power.<br />
|-<br />
| show-wakeup-lists || When an entity is sleeping in another entity it shows which entities it's sleeping in.<br />
|-<br />
| show-transport-lines ||<br />
|-<br />
| show-transport-line-gaps ||<br />
|-<br />
| show-pollution-values || Shows the numeric pollution amount on each chunk.<br />
|-<br />
| show-active-entities-on-chunk-counts ||<br />
Shows counts of active entities per chunk. They are devided into three categories:<br />
* Red = active (e.g. furnaces)<br />
* Blue = active when a player is around (e.g. fish)<br />
* Green = active when enemies are around (e.g. turrets)<br />
|-<br />
| show-active-chunks || Shows in the map view, which chunks are "on", unmarked chunks are not calculated.<br />
|-<br />
| show-polluted-chunks || Shows which chunks have pollution.<br />
|-<br />
| show-enemy-expansion-candidate-chunks || Where is space left to spread the brood?. Goes from red (nearly no space) to green (space to expand).<br />
|-<br />
| show-enemy-expansion-candidate-chunk-values || Which chunks the enemies will try to expand into.<br />
|-<br />
| show-bad-attack-chunks ||<br />
|-<br />
| show-tile-variations || Shows, which tile-variation (1, 2 or 4 tile sized) is painted for which area of the map. Quite confusing, zoom in to see the meaning.<br />
|-<br />
| show-raw-tile-transitions || Turns connected textures for land and water off, so the distinction can easily be made.<br />
|-<br />
| show-tile-correction-previews || When in the map editor it shows what tiles will be corrected to what variations when painting tiles.<br />
|-<br />
| show-fluid-box-fluid-info || How much fluid is in a pipe/storage tank, shows flow of liquid in pipes.<br />
|-<br />
| show-environment-sound-info || Displays which sound of which entity is played and how loud.<br />
|-<br />
| show-logistic-robot-targets ||<br />
|-<br />
| show-fire-info ||<br />
|-<br />
| show-sticker-info ||<br />
|-<br />
| show-map-generator-info ||<br />
|-<br />
| show-decorative-names ||<br />
|-<br />
| allow-increased-zoom ||<br />
|-<br />
|}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Rocket_part&diff=134924Rocket part2017-03-08T22:54:01Z<p>Stevetrov: Corrected typo</p>
<hr />
<div>{{:Rocket part/infobox}}<br />
<br />
'''Rocket parts''' are created inside of the [[rocket silo]]. Each completed part contributes 1% towards the completion of the rocket. Once all 100 rocket parts have been completed the rocket silo will display a rocket ready to be launched within the silo and the rocket silo interface will contain a LAUNCH button. Before launching, a [[satellite]] can be placed into the rocket.<br />
<br />
== Building the Rocket ==<br />
<br />
The rocket needs 100 parts; each part needs 3 ingredients; those ingredients need other ingredients; etc. In total, one rocket(sans satellite) will need 100 rocket parts, which requires the following raw resources (assuming [[Advanced oil processing]] and cracking are used):<br />
<br />
* 9,500 [[Coal]]<br />
* 35,648.148 [[Water]]<br />
* 39,907.407 [[Crude oil]]<br />
* 77,500 [[Copper ore]]<br />
* 89,100 [[Iron ore]]<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
100 Rocket part<br />
500 [[Sulfur]]<br />
500 [[Sulfuric acid]]<br />
1 000 [[Low density structure]]<br />
1 000 [[Processing unit]]<br />
1 000 [[Rocket control unit]]<br />
1 000 [[Rocket fuel]]<br />
1 000 [[Speed module]]<br />
3 990.741 [[Heavy oil]]<br />
7 000 [[Advanced circuit]]<br />
9 500 [[Coal]]<br />
10 000 [[Solid fuel]]<br />
10 000 [[Steel plate]]<br />
19 000 [[Plastic bar]]<br />
20 951.389 [[Light oil]]<br />
29 250 [[Petroleum gas]]<br />
35 648.148 [[Water]]<br />
39 000 [[Electronic circuit]]<br />
39 907.407 [[Crude oil]]<br />
89 100 [[Iron ore]]<br />
89 100 [[Iron plate]]<br />
77 500 [[Copper ore]]<br />
77 500 [[Copper plate]]<br />
145 000 [[Copper cable]]<br />
</div></div><br />
<br />
Note: To win the game (or to update the Rockets Sent counter in the left top), you additionally need a satellite. When you hover over it, it mentions the "total raw" already. However, this does not include the material needed for Processing Units, Batteries and Steel since these are seen as "raw ingredients" (they cannot be crafted by hand). Still, you can't make a battery (or steel, or processing units) without iron plates, so you still need to mine the ore.<br />
The total raw cost for the satellite is:<br />
<br />
* 450 [[Coal]]<br />
* 7,157.407 [[Water]]<br />
* 3,620.37 [[Crude oil]]<br />
* 7,785.5 [[Copper ore]]<br />
* 12,435 [[Iron ore]]<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
5 [[Radar]]<br />
25 [[Iron gear wheel]]<br />
50 [[Rocket fuel]]<br />
100 [[Accumulator]]<br />
100 [[Low density structure]]<br />
100 [[Processing unit]]<br />
100 [[Solar panel]]<br />
200 [[Advanced circuit]]<br />
362.037 [[Heavy oil]]<br />
450 [[Coal]]<br />
500 [[Battery]]<br />
500 [[Solid fuel]]<br />
900 [[Plastic bar]]<br />
1 050 [[Sulfur]]<br />
1 050 [[Sulfuric acid]]<br />
1 500 [[Steel plate]]<br />
1 900.694 [[Light oil]]<br />
2 925 [[Petroleum gas]]<br />
3 620.37 [[Crude oil]]<br />
7 157.407 [[Water]]<br />
3 925 [[Electronic circuit]]<br />
7 785.5 [[Copper ore]]<br />
7 785.5 [[Copper plate]]<br />
12 435 [[Iron ore]]<br />
12 435 [[Iron plate]]<br />
12 575 [[Copper cable]]<br />
</div></div><br />
<br />
Added up together, each complete rocket launched will cost:<br />
<br />
* 9,950 [[Coal]]<br />
* 42,805.555 [[Water]]<br />
* 43,527.778 [[Crude oil]]<br />
* 85,285.5 [[Copper ore]]<br />
* 101,535 [[Iron ore]]<br />
<br />
== Building the Rocket With Productivity3 Modules ==<br />
<br />
Maximum [[Productivity module 3]] in Rocket silo and every assembly machine and furnace. <br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
5 [[Radar]]<br />
25 [[Iron gear wheel]]<br />
100 [[Accumulator]]<br />
100 [[Solar panel]]<br />
362 [[Heavy oil]]<br />
500 [[Battery]]<br />
610 [[Processing unit]]<br />
764 [[Rocket fuel]]<br />
814 [[Low density structure]]<br />
876 [[Sulfur]]<br />
1,051 [[Sulfuric Acid]]<br />
3,249 [[Coal]]<br />
3,423 [[Advanced circuit]]<br />
4,549 [[Light oil]]<br />
5,459 [[Solid fuel]]<br />
6,316 [[Steel plate]]<br />
7,798 [[Plastic bar]]<br />
10,842 [[Petroleum gas]]<br />
12,289 [[Crude oil]]<br />
17,375 [[Copper ore]]<br />
17,683 [[Electronic circuit]]<br />
20,850 [[Copper plate]]<br />
33,189 [[Iron ore]]<br />
39,826 [[Iron plate]]<br />
47,671 [[Copper cable]]<br />
</div></div><br />
<br />
Raw Products Required<br />
<br />
* 3,249 [[Coal]]<br />
* 12,289 [[Crude oil]]<br />
* 17,375 [[Copper ore]]<br />
* 33,189 [[Iron ore]]<br />
<br />
== See also ==<br />
* [[Satellite]]<br />
* [[Rocket silo]]<br />
<br />
[[Category:Items]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Console&diff=134277Console2017-01-26T11:04:04Z<p>Stevetrov: /* Large Screenshots */</p>
<hr />
<div>{{Languages}}<br />
<br />
== Overview ==<br />
The in-game console is used for:<br />
<br />
* chatting with other players<br />
* running commands / scripts / cheats<br />
* occasional status updates<br />
<br />
There are three types of command:<br />
<br />
* '''Multiplayer''' - message filtering, banning users, etc.<br />
* '''Information''' - display various information about the game<br />
* '''Scripting/Cheating''' - run small Lua scripts (but they <span style="color:#FF0000">disable achievements for the save game</span>)<br />
<br />
=== Using the console ===<br />
The console display can be toggled with the '''/''' (slash) or '''~''' (tilde) keys.<br />
<br />
You can customise the keys via '''Options Menu -> Keyboard -> Toggle Lua console'''.<br />
<br />
When the console is open, you'll see a blinking cursor at the bottom of the screen; type your message or command and hit '''Return''' to send it (this will also close the console). Documentation about message and command prefixes can be found further down this page.<br />
<br />
When console is closed, only the most recent messages/commands will be displayed, but they will gradually fade away (opening the console will immediately redisplay all recent messages).<br />
<br />
You can set the fade out time via '''Options Menu -> Other Settings -> Message Delay'''.<br />
<br />
If you want to immediately hide the console, open the console and then press '''Escape''' key (or press '''Return''' without entering any message/command). This not only closes the console, but it also hides all the recent messages/commands.<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32389 Factorio 0.14.5 and later], you can clear the console with the '''/clear''' command.<br />
<br />
=== Console history ===<br />
<br />
The console has an inbuilt history; it's a bit like a text editor where only one line of text is displayed at a time.<br />
<br />
Use the '''up arrow''' and '''down arrow''' keys to scroll through the console history.<br />
<br />
Use the '''left arrow''' and '''right arrow''' keys to cursor through the currently displayed message or command, which you can edit (delete, insert, etc.) and resend (by pressing '''Return''').<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32389 Factorio 0.14.5 and later], the '''Tab''' key will autocomplete commands and player ids.<br />
<br />
== Multiplayer Chat ==<br />
<br />
Send private message to specific player with '''/whisper''' (or '''/w'''):<br />
<br />
/whisper <playerId> <message><br />
<br />
Reply to the most recently received private message with '''/reply''' (or '''/r'''):<br />
<br />
/reply <message><br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32248 Factorio 0.14.4 and later], group chat works like this:<br />
<br />
hello my team!<br />
<br />
/s hello all players!<br />
/shout same as /s<br />
<br />
In Factorio 0.14.3 and earlier, group chat worked like this:<br />
<br />
hello all players!<br />
<br />
/team hello my team!<br />
<br />
These are just the main chat features - there are also options for banning, ignoring and muting players; see the console '''/help''' for a full list.<br />
<br />
<br />
== Commands ==<br />
To see a list of all available commands, enter '''/help''' (or '''/h''') in to the console. The available commands will depend on Factorio version and game setup.<br />
<br />
/help<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32248 Factorio 0.14.4 and later], the '''/help''' command will just display a list of commands - to get full details for a command add the command name (without slash) after '''/help''' (or '''/h'''), for example if you want help on the '''/evolution''' command, you'd type:<br />
<br />
/h evolution<br />
<br />
=== Scripting and cheat commands ===<br />
You can run Lua script commands via the console. It works similarly to any command line interface or the JavaScript console for your browser.<br />
<br />
This is a very powerful feature, which also allows cheating, and as such <span style="color:#FF0000">achievements will be permanently disabled for the save</span> as soon as you use a script command.<br />
<br />
To run a script, prefix it with '''/command''' (or '''/c'''), for example:<br />
<br />
/c game.player.print 'hello me!'<br />
<br />
If you're in a multiplayer game, the command will be echoed to all other players (so they can see if you're cheating).<br />
<br />
In [https://forums.factorio.com/viewtopic.php?p=203991#p203991 Factorio 0.14.5 and later], multiplayer server admins can use '''/silent-command''' (only via RCON/server console) instead of '''/c''' to avoid the command being echoed to all players.<br />
<br />
/silent-command game.player.print 'only admins can use (and see) silent commands'<br />
<br />
Mod developers can also take advantage of the special '''/measured-command''' which is like '''/c''' but will time how long the command takes to run. This is very useful for performance tuning your scripts.<br />
<br />
/measured-command game.player.print 'how much time does this take to run?'<br />
<br />
The game ignores newlines when pasting "scriptlets" in the console. This means they can be written in a human readable form in an editor and copy/pasted into the console, making understanding and editing a bit easier.<br />
<br />
You can essentially fire any Lua command here, just as you would from a Lua program - Factorio [[Mods]] are merely Lua commands. Therefore you don't necessarily need "cheats" active per-se, as the console allows you full access to the game's internals. You only need a familiarity with the commands and types, as shown in the below examples and the [[Modding]] section.<br />
<br />
<br />
==Basic Command Examples==<br />
<br />
=== Large Screenshots ===<br />
<br />
This is how you would take a large HD screenshot. As usual, replace the X and Y with the values you wish.<br />
<br />
The file is put into a folder called "script-output", which is located in the same location as the mods folder. These pictures can be quite large.<br />
<br />
/c game.take_screenshot{resolution = {x = XPOS, y = YPOS}}<br />
<br />
or (showing guis like open chests)<br />
<br />
/c game.take_screenshot{showgui = true, resolution = {x = XPOS, y = YPOS}}<br />
<br />
or (Show alt info)<br />
<br />
/c game.take_screenshot{show_entity_info = true, resolution = {x = XPOS, y = YPOS}}<br />
<br />
or (with custom zoom)<br />
<br />
/c game.take_screenshot{resolution = {x = XPOS, y = YPOS}, zoom = Z}<br />
<br />
=== Use it as calculator ===<br />
<br />
/c game.player.print(1234 * 5678)<br />
<br />
=== Mine faster ===<br />
<br />
/c game.player.force.manual_mining_speed_modifier=1000<br />
<br />
=== Craft faster ===<br />
<br />
/c game.player.force.manual_crafting_speed_modifier=1000<br />
<br />
=== Unlock and Research all Technology ===<br />
<br />
/c game.player.force.research_all_technologies()<br />
<br />
Undo this with:<br />
<br />
for _, tech in pairs(game.player.force.technologies) do tech.researched=false end<br />
<br />
=== Reset any modifiers to default ===<br />
This includes Tech and speed alterations.<br />
<br />
/c game.player.force.reset()<br />
<br />
=== Zoom beyond normal bounds ===<br />
Note that zooming too far out can cause performance hits. Be careful.<br />
<br />
/c game.player.zoom = 0.1<br />
<br />
<br />
== Inventory Manipulation ==<br />
<br />
=== Refill resources (refill oil, iron etc.) ===<br />
While holding the cursor over a resource tile in-game<br />
/c game.player.selected.amount=7500<br />
<br />
=== Add items to the player's inventory ===<br />
Replace iron-plate with the internal name of the item desired.<br />
<br />
/c game.player.insert{name="iron-plate", count=100}<br />
<br />
=== Cheat mode ===<br />
Allows for infinite free crafting. Disable by replacing true with false.<br />
<br />
/c game.player.cheat_mode=true<br />
<br />
<br />
== World Manipulation ==<br />
<br />
=== Turn off night ===<br />
Enables eternal day.<br />
/c game.surfaces[1].always_day=true<br />
<br />
=== Change Game Speed ===<br />
0.5 is half speed, 1 is default, 2 is double speed, etc. This can be used for a lot of things like when you know you will have to wait for long periods of time for something to complete. Increasing will decrease performance, be careful.<br />
<br />
/c game.speed = X<br />
<br />
=== Freeze Time Passage ===<br />
Stops the advancement of the time if true is passed, or unfreezes it if false is passed.<br />
<br />
/c game.player.surface.freeze_daytime(BOOL)<br />
<br />
=== Add new resource patch ===<br />
This creates a new 5x5 patch of resources, centered on the player character. For resources other than stone, just change "stone" to "iron-ore", "copper-ore", or "coal"<br />
<br />
/c local surface = game.player.surface;<br />
for y=-2,2 do<br />
for x=-2,2 do<br />
surface.create_entity({name="stone", amount=5000, position={game.player.position.x+x, game.player.position.y+y}})<br />
end<br />
end<br />
<br />
=== Add new oil patch ===<br />
This creates 16 crude oil patches in a 4x4 square that is easy to blueprint. <br />
<br />
/c for y=0,3 do <br />
for x=0,3 do <br />
game.player.surface.create_entity({name="crude-oil", amount=50000, position={game.player.position.x+x*5, game.player.position.y+y*5}}) <br />
end <br />
end<br />
<br />
=== Count Entities ===<br />
Counts all entities whose name includes the string in local entity.<br />
<br />
/c <br />
local entity = "belt"<br />
<br />
local surface = game.player.surface<br />
local count = 0<br />
for c in surface.get_chunks() do<br />
for key, ent in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, force= game.player.force})) do<br />
if string.find(ent.name,entity) then<br />
count = count + 1<br />
end<br />
end<br />
end<br />
game.player.print(count)<br />
<br />
== Enemy/Evolution ==<br />
=== Check how far the biters have evolved ===<br />
Note that commands that do not start with "/c" do not disable achievements.<br />
/evolution<br />
<br />
=== Set evolution factor ===<br />
Ranges from 0 (new game) to 1.<br />
<br />
/c game.evolution_factor=X<br />
<br />
=== Disable time-based evolution & increases pollution-based evolution ===<br />
/c game.map_settings.enemy_evolution.time_factor = 0<br />
/c game.map_settings.enemy_evolution.pollution_factor = game.map_settings.enemy_evolution.pollution_factor * 2<br />
<br />
The "2" at the end of the last command will double the default pollution factor. You can substitute another number to increase (or decrease) the pollution factor further.<br />
<br />
=== Kill all biters on the "enemy" force ===<br />
Note that this will kill only mobile units and worms, spawners will not be killed.<br />
/c game.forces["enemy"].kill_all_units()<br />
<br />
=== Kill all enemies ===<br />
This will kill all biters, bases and worms. Anything that is an enemy will be completely destroyed. This only affects enemies in the explored world, so any unexplored parts of the map which still need to be generated will still have enemies.<br />
<br />
/c local surface = game.player.surface<br />
for c in surface.get_chunks() do<br />
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, force= "enemy"})) do<br />
entity.destroy()<br />
end<br />
end<br />
<br />
=== Enable peaceful mode ===<br />
Peaceful mode prevents biter attacks until provoked. Substitute false for true to disable.<br />
/c game.player.surface.peaceful_mode = true<br />
<br />
=== Disable biter expansion ===<br />
This prevents biters from creating new spawners.<br />
/c game.map_settings.enemy_expansion.enabled = false<br />
<br />
== Player Character ==<br />
Commands concerning the player directly.<br />
=== Get Player Position ===<br />
Prints coordinates of your current position.<br />
<br />
/c game.player.print({"", "(", game.player.position.x, ", ", game.player.position.y, ")"})<br />
<br />
=== Teleport player ===<br />
Moves the player to the specified location. You should be able to teleport to a specific player if you obtain their coordinates via them executing the previous command and giving them to you.<br />
<br />
/c game.player.teleport({X, Y})<br />
<br />
To teleport to the world's origin, use 0,0.<br />
<br />
=== Spawn a player character ===<br />
This is useful for escaping god mode. (see [[Console#Enable_god_mode]].) This will spawn a new player at the spawn point of the world, and connect your controls to it.<br />
<br />
/c game.player.character = game.player.surface.create_entity{name="player", position = {0,0}, force = game.forces.player}<br />
<br />
=== Change Player color ===<br />
Note that commands that do not start with "/c" do not disable achievements. Replace COLOR with the name of a color.<br />
/color COLOR<br />
<br />
=== Enable god mode ===<br />
God mode removes your player character allowing you to fly over obstacles and take no damage.<br />
<br />
Disassociate your controls from the player:<br />
<br />
/c game.player.character = nil<br />
<br />
Then, hover the mouse over the useless player and destroy it by typing:<br />
<br />
/c game.player.selected.destroy()<br />
<br />
To undo<br />
<br />
/c game.player.create_character()<br />
<br />
== Research ==<br />
=== Enable faster research ===<br />
/c game.player.force.laboratory_speed_modifier = 1<br />
1 is normal speed, 2 is double speed 3 is triple etc. I think it goes up to 100.<br />
<br />
=== Enabling specific technologies ===<br />
[http://www.factorioforums.com/forum/viewtopic.php?f=18&t=6633 Enabling technologies] (forums)<br />
/c game.player.force.technologies['electric-energy-distribution-1'].researched=true<br />
/c game.player.force.technologies['steel-processing'].researched=true<br />
<br />
=== Enabling specific recipes ===<br />
/c game.player.force.recipes["electric-energy-interface"].enabled = true<br />
/c game.player.force.recipes["rocket-silo"].enabled = true<br />
<br />
=== Finish research immediately ===<br />
/c for name,technology in pairs(game.player.force.technologies) do technology.researched=technology.enabled end<br />
<br />
== Command Line Parameters ==<br />
'''As of Game Version 0.14.21'''<br />
<br />
Command line parameters can be used to set settings in the command line before the game launches, this is useful mainly for advanced users or server hosts.<br />
<br />
General options:<br />
-h [ --help ] display help<br />
--version show version information<br />
-v [ --verbose ] enable verbose logging<br />
-c [ --config ] PATH config file to use<br />
--no-log-rotation don't rotate log file<br />
--mod-directory PATH Mod directory to use<br />
<br />
Running options:<br />
-s [ --map2scenario ] arg map to scenario conversion<br />
-m [ --scenario2map ] arg scenario to map conversion<br />
--apply-update arg immediately apply update package<br />
--create FILE create a new map<br />
--map-gen-settings FILE Map generation settings for use with<br />
--create. See data/map-gen-settings.exampl<br />
e.json<br />
--start-server FILE start a multiplayer server<br />
--start-server-load-scenario FILE start a multiplayer server and load the<br />
specified scenario<br />
--start-server-load-latest start a multiplayer server and load the<br />
latest available save<br />
--until-tick TICK run a save until given map tick<br />
--mp-connect ADDRESS start factorio and connect to address<br />
--load-game FILE start Factorio and load a game in<br />
singleplayer<br />
--benchmark FILE load save and run benchmark<br />
--benchmark-ticks N (=1,000) number of ticks for benchmarking. Default<br />
is 1000<br />
--force-opengl use OpenGL for rendering<br />
--force-d3d use Direct3D for rendering<br />
<br />
Server options:<br />
--port N network port to use<br />
--bind ADDRESS[:PORT] IP address (and optionally port) to bind<br />
to<br />
--rcon-port N Port to use for RCON<br />
--rcon-password PASSWORD Password for RCON<br />
--server-settings FILE Path to file with server settings. See<br />
data/server-settings.example.json<br />
<br />
=== Multiplayer ===<br />
<br />
--start-server SAVE<br />
<br />
Will start a Headless (Dedicated) server, with no GUI.<br />
<br />
--mp-load-game SAVE<br />
<br />
SAVE is the filename of the save file. For instance, for saves/MySave.zip: ./factorio --mp-load-game MySave.zip<br />
<br />
--mp-connect ADDRESS<br />
ADDRESS is the ip:port of the remote host. Port is optional.<br />
Examples:<br />
<br />
./factorio --mp-connect 192.168.1.101<br />
./factorio --mp-connect 192.168.1.101:2345<br />
<br />
As above, port can be specified by placing the port number after a colon in the address.<br />
<br />
--map2scenario SAVE<br />
Converts a save game to a User Scenario, allows saved game state to be loaded into map editor. Assuming that save game name is "foo.zip", executing './factorio --map2scenario s1' will result in Factorio loading, opening the save file, and saving the scenario into the scenario folder.<br />
<br />
== See also ==<br />
<br />
* http://lua-api.factorio.com/latest/ - Factorio API reference for latest version<br />
* http://lua-api.factorio.com/ - links to specific versions of API reference<br />
[[Category:Console]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Console&diff=133711Console2017-01-04T19:02:55Z<p>Stevetrov: /* Add new oil patch */</p>
<hr />
<div>{{Languages}}<br />
<br />
== Overview ==<br />
The in-game console is used for:<br />
<br />
* chatting with other players<br />
* running commands / scripts / cheats<br />
* occasional status updates<br />
<br />
There are three types of command:<br />
<br />
* '''Multiplayer''' - message filtering, banning users, etc.<br />
* '''Information''' - display various information about the game<br />
* '''Scripting/Cheating''' - run small Lua scripts (but they <span style="color:#FF0000">disable achievements for the save game</span>)<br />
<br />
=== Using the console ===<br />
The console display can be toggled with the '''/''' (slash) or '''~''' (tilde) keys.<br />
<br />
You can customise the keys via '''Options Menu -> Keyboard -> Toggle Lua console'''.<br />
<br />
When the console is open, you'll see a blinking cursor at the bottom of the screen; type your message or command and hit '''Return''' to send it (this will also close the console). Documentation about message and command prefixes can be found further down this page.<br />
<br />
When console is closed, only the most recent messages/commands will be displayed, but they will gradually fade away (opening the console will immediately redisplay all recent messages).<br />
<br />
You can set the fade out time via '''Options Menu -> Other Settings -> Message Delay'''.<br />
<br />
If you want to immediately hide the console, open the console and then press '''Escape''' key (or press '''Return''' without entering any message/command). This not only closes the console, but it also hides all the recent messages/commands.<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32389 Factorio 0.14.5 and later], you can clear the console with the '''/clear''' command.<br />
<br />
=== Console history ===<br />
<br />
The console has an inbuilt history; it's a bit like a text editor where only one line of text is displayed at a time.<br />
<br />
Use the '''up arrow''' and '''down arrow''' keys to scroll through the console history.<br />
<br />
Use the '''left arrow''' and '''right arrow''' keys to cursor through the currently displayed message or command, which you can edit (delete, insert, etc.) and resend (by pressing '''Return''').<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32389 Factorio 0.14.5 and later], the '''Tab''' key will autocomplete commands and player ids.<br />
<br />
== Multiplayer Chat ==<br />
<br />
Send private message to specific player with '''/whisper''' (or '''/w'''):<br />
<br />
/whisper <playerId> <message><br />
<br />
Reply to the most recently received private message with '''/reply''' (or '''/r'''):<br />
<br />
/reply <message><br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32248 Factorio 0.14.4 and later], group chat works like this:<br />
<br />
hello my team!<br />
<br />
/s hello all players!<br />
/shout same as /s<br />
<br />
In Factorio 0.14.3 and earlier, group chat worked like this:<br />
<br />
hello all players!<br />
<br />
/team hello my team!<br />
<br />
These are just the main chat features - there are also options for banning, ignoring and muting players; see the console '''/help''' for a full list.<br />
<br />
<br />
== Commands ==<br />
To see a list of all available commands, enter '''/help''' (or '''/h''') in to the console. The available commands will depend on Factorio version and game setup.<br />
<br />
/help<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32248 Factorio 0.14.4 and later], the '''/help''' command will just display a list of commands - to get full details for a command add the command name (without slash) after '''/help''' (or '''/h'''), for example if you want help on the '''/evolution''' command, you'd type:<br />
<br />
/h evolution<br />
<br />
=== Scripting and cheat commands ===<br />
You can run Lua script commands via the console. It works similarly to any command line interface or the JavaScript console for your browser.<br />
<br />
This is a very powerful feature, which also allows cheating, and as such <span style="color:#FF0000">achievements will be permanently disabled for the save</span> as soon as you use a script command.<br />
<br />
To run a script, prefix it with '''/command''' (or '''/c'''), for example:<br />
<br />
/c game.player.print 'hello me!'<br />
<br />
If you're in a multiplayer game, the command will be echoed to all other players (so they can see if you're cheating).<br />
<br />
In [https://forums.factorio.com/viewtopic.php?p=203991#p203991 Factorio 0.14.5 and later], multiplayer server admins can use '''/silent-command''' (only via RCON/server console) instead of '''/c''' to avoid the command being echoed to all players.<br />
<br />
/silent-command game.player.print 'only admins can use (and see) silent commands'<br />
<br />
Mod developers can also take advantage of the special '''/measured-command''' which is like '''/c''' but will time how long the command takes to run. This is very useful for performance tuning your scripts.<br />
<br />
/measured-command game.player.print 'how much time does this take to run?'<br />
<br />
The game ignores newlines when pasting "scriptlets" in the console. This means they can be written in a human readable form in an editor and copy/pasted into the console, making understanding and editing a bit easier.<br />
<br />
You can essentially fire any Lua command here, just as you would from a Lua program - Factorio [[Mods]] are merely Lua commands. Therefore you don't necessarily need "cheats" active per-se, as the console allows you full access to the game's internals. You only need a familiarity with the commands and types, as shown in the below examples and the [[Modding]] section.<br />
<br />
<br />
==Basic Command Examples==<br />
<br />
=== Use it as calculator ===<br />
<br />
/c game.player.print(1234 * 5678)<br />
<br />
=== Mine faster ===<br />
<br />
/c game.player.force.manual_mining_speed_modifier=1000<br />
<br />
=== Craft faster ===<br />
<br />
/c game.player.force.manual_crafting_speed_modifier=1000<br />
<br />
=== Unlock and Research all Technology ===<br />
<br />
/c game.player.force.research_all_technologies()<br />
<br />
Undo this with:<br />
<br />
for _, tech in pairs(game.player.force.technologies) do tech.researched=false end<br />
<br />
=== Reset any modifiers to default ===<br />
This includes Tech and speed alterations.<br />
<br />
/c game.player.force.reset()<br />
<br />
=== Zoom beyond normal bounds ===<br />
Note that zooming too far out can cause performance hits. Be careful.<br />
<br />
/c game.player.zoom = 0.1<br />
<br />
<br />
== Inventory Manipulation ==<br />
<br />
=== Refill resources (refill oil, iron etc.) ===<br />
While holding the cursor over a resource tile in-game<br />
/c game.player.selected.amount=7500<br />
<br />
=== Add items to the player's inventory ===<br />
Replace iron-plate with the internal name of the item desired.<br />
<br />
/c game.player.insert{name="iron-plate", count=100}<br />
<br />
=== Cheat mode ===<br />
Allows for infinite free crafting. Disable by replacing true with false.<br />
<br />
/c game.player.cheat_mode=true<br />
<br />
<br />
== World Manipulation ==<br />
<br />
=== Turn off night ===<br />
Enables eternal day.<br />
/c game.surfaces[1].always_day=true<br />
<br />
=== Change Game Speed ===<br />
0.5 is half speed, 1 is default, 2 is double speed, etc. This can be used for a lot of things like when you know you will have to wait for long periods of time for something to complete. Increasing will decrease performance, be careful.<br />
<br />
/c game.speed = X<br />
<br />
=== Freeze Time Passage ===<br />
Stops the advancement of the time if true is passed, or unfreezes it if false is passed.<br />
<br />
/c game.player.surface.freeze_daytime(BOOL)<br />
<br />
=== Add new resource patch ===<br />
This creates a new 5x5 patch of resources, centered on the player character. For resources other than stone, just change "stone" to "iron-ore", "copper-ore", or "coal"<br />
<br />
/c local surface = game.player.surface;<br />
for y=-2,2 do<br />
for x=-2,2 do<br />
surface.create_entity({name="stone", amount=5000, position={game.player.position.x+x, game.player.position.y+y}})<br />
end<br />
end<br />
<br />
=== Add new oil patch ===<br />
This creates 16 crude oil patches in a 4x4 square that is easy to blueprint. <br />
<br />
/c for y=0,3 do <br />
for x=0,3 do <br />
game.player.surface.create_entity({name="crude-oil", amount=50000, position={game.player.position.x+x*5, game.player.position.y+y*5}}) <br />
end <br />
end<br />
<br />
=== Count Entities ===<br />
Counts all entities whose name includes the string in local entity.<br />
<br />
/c <br />
local entity = "belt"<br />
<br />
local surface = game.player.surface<br />
local count = 0<br />
for c in surface.get_chunks() do<br />
for key, ent in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, force= game.player.force})) do<br />
if string.find(ent.name,entity) then<br />
count = count + 1<br />
end<br />
end<br />
end<br />
game.player.print(count)<br />
<br />
== Enemy/Evolution ==<br />
=== Check how far the biters have evolved ===<br />
Note that commands that do not start with "/c" do not disable achievements.<br />
/evolution<br />
<br />
=== Set evolution factor ===<br />
Ranges from 0 (new game) to 1.<br />
<br />
/c game.evolution_factor=X<br />
<br />
=== Disable time-based evolution & increases pollution-based evolution ===<br />
/c game.map_settings.enemy_evolution.time_factor = 0<br />
/c game.map_settings.enemy_evolution.pollution_factor = game.map_settings.enemy_evolution.pollution_factor * 2<br />
<br />
The "2" at the end of the last command will double the default pollution factor. You can substitute another number to increase (or decrease) the pollution factor further.<br />
<br />
=== Kill all biters on the "enemy" force ===<br />
Note that this will kill only mobile units and worms, spawners will not be killed.<br />
/c game.forces["enemy"].kill_all_units()<br />
<br />
=== Kill all enemies ===<br />
This will kill all biters, bases and worms. Anything that is an enemy will be completely destroyed. This only affects enemies in the explored world, so any unexplored parts of the map which still need to be generated will still have enemies.<br />
<br />
/c local surface = game.player.surface<br />
for c in surface.get_chunks() do<br />
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, force= "enemy"})) do<br />
entity.destroy()<br />
end<br />
end<br />
<br />
=== Enable peaceful mode ===<br />
Peaceful mode prevents biter attacks until provoked. Substitute false for true to disable.<br />
/c game.player.surface.peaceful_mode = true<br />
<br />
=== Disable biter expansion ===<br />
This prevents biters from creating new spawners.<br />
/c game.map_settings.enemy_expansion.enabled = false<br />
<br />
== Player Character ==<br />
Commands concerning the player directly.<br />
=== Get Player Position ===<br />
Prints coordinates of your current position.<br />
<br />
/c game.player.print({"", "(", game.player.position.x, ", ", game.player.position.y, ")"})<br />
<br />
=== Teleport player ===<br />
Moves the player to the specified location. You should be able to teleport to a specific player if you obtain their coordinates via them executing the previous command and giving them to you.<br />
<br />
/c game.player.teleport({X, Y})<br />
<br />
To teleport to the world's origin, use 0,0.<br />
<br />
=== Spawn a player character ===<br />
This is useful for escaping god mode. (see [[Console#Enable_god_mode]].) This will spawn a new player at the spawn point of the world, and connect your controls to it.<br />
<br />
/c game.player.character = game.player.surface.create_entity{name="player", position = {0,0}, force = game.forces.player}<br />
<br />
=== Change Player color ===<br />
Note that commands that do not start with "/c" do not disable achievements. Replace COLOR with the name of a color.<br />
/color COLOR<br />
<br />
=== Enable god mode ===<br />
God mode removes your player character allowing you to fly over obstacles and take no damage.<br />
<br />
Disassociate your controls from the player:<br />
<br />
/c game.player.character = nil<br />
<br />
Then, hover the mouse over the useless player and destroy it by typing:<br />
<br />
/c game.player.selected.destroy()<br />
<br />
To undo<br />
<br />
/c game.player.create_character()<br />
<br />
== Research ==<br />
=== Enable faster research ===<br />
/c game.player.force.laboratory_speed_modifier = 1<br />
1 is normal speed, 2 is double speed 3 is triple etc. I think it goes up to 100.<br />
<br />
=== Enabling specific technologies ===<br />
[http://www.factorioforums.com/forum/viewtopic.php?f=18&t=6633 Enabling technologies] (forums)<br />
/c game.player.force.technologies['electric-energy-distribution-1'].researched=true<br />
/c game.player.force.technologies['steel-processing'].researched=true<br />
<br />
=== Finish research immediately ===<br />
/c for name,technology in pairs(game.player.force.technologies) do technology.researched=technology.enabled end<br />
<br />
== Large Screenshots ==<br />
<br />
This is how you would take a large HD screenshot. As usual, replace the X and Y with the values you wish.<br />
<br />
The file is put into a folder called "script-output", which is located in the same location as the mods folder. These pictures can be quite large.<br />
<br />
/c game.take_screenshot{resolution = {x = XPOS, y = YPOS}}<br />
<br />
or (showing guis like open chests)<br />
<br />
/c game.take_screenshot{showgui = true, resolution = {x = XPOS, y = YPOS}}<br />
<br />
or (Show alt info)<br />
<br />
/c game.take_screenshot{show_entity_info = true, resolution = {x = XPOS, y = YPOS}}<br />
<br />
<br />
== Command Line Parameters ==<br />
'''As of Game Version 0.12.7'''<br />
<br />
Command line parameters can be used to set settings in the command line before the game launches, this is useful mainly for advanced users or server hosts.<br />
<br />
General options:<br />
-h [ --help ] display help<br />
--wait-to-close arg Wait until the specified process finishes.<br />
--version show version information<br />
-c [ --config ] PATH config file to use<br />
<br />
Running options:<br />
-s [ --map2scenario ] arg map to scenario conversion<br />
-v [ --convert ] SAVE[, SAVE...] convert maps from previous versions to current version<br />
--apply-update arg immediately apply update package<br />
--create SAVE create a new map<br />
--start-server SAVE start a multiplayer server<br />
--mp-load-game SAVE start factorio and load game for multiplayer<br />
--mp-connect ADDRESS start factorio and connect to address<br />
--benchmark SAVE load save and run benchmark<br />
--benchmark-ticks N (=1,000) number of ticks for benchmarking. Default is 1000<br />
<br />
Server options:<br />
--latency N multiplayer server latency, in ticks<br />
--latency-ms N multiplayer server latency, in milliseconds<br />
--autosave-interval N (=2) server autosave interval, in minutes<br />
--autosave-slots N (=3) server autosave slots<br />
--disallow-commands disallow use of the command console<br />
--peer-to-peer use peer-to-peer communication<br />
<br />
=== Multiplayer ===<br />
<br />
--start-server SAVE<br />
<br />
Will start a Headless (Dedicated) server, with no GUI.<br />
<br />
--mp-load-game SAVE<br />
<br />
SAVE is the filename of the save file. For instance, for saves/MySave.zip: ./factorio --mp-load-game MySave.zip<br />
<br />
--mp-connect ADDRESS<br />
ADDRESS is the ip:port of the remote host. Port is optional.<br />
Examples:<br />
<br />
./factorio --mp-connect 192.168.1.101<br />
./factorio --mp-connect 192.168.1.101:2345<br />
<br />
As above, port can be specified by placing the port number after a colon in the address.<br />
<br />
--map2scenario SAVE<br />
Converts a save game to a User Scenario, allows saved game state to be loaded into map editor. Assuming that save game name is "foo.zip", executing './factorio --map2scenario s1' will result in Factorio loading, opening the save file, and saving the scenario into the scenario folder.<br />
<br />
<br />
= See also =<br />
<br />
* http://lua-api.factorio.com/latest/ - Factorio API reference for latest version<br />
* http://lua-api.factorio.com/ - links to specific versions of API reference<br />
[[Category:Console]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Console&diff=133710Console2017-01-04T19:01:43Z<p>Stevetrov: </p>
<hr />
<div>{{Languages}}<br />
<br />
== Overview ==<br />
The in-game console is used for:<br />
<br />
* chatting with other players<br />
* running commands / scripts / cheats<br />
* occasional status updates<br />
<br />
There are three types of command:<br />
<br />
* '''Multiplayer''' - message filtering, banning users, etc.<br />
* '''Information''' - display various information about the game<br />
* '''Scripting/Cheating''' - run small Lua scripts (but they <span style="color:#FF0000">disable achievements for the save game</span>)<br />
<br />
=== Using the console ===<br />
The console display can be toggled with the '''/''' (slash) or '''~''' (tilde) keys.<br />
<br />
You can customise the keys via '''Options Menu -> Keyboard -> Toggle Lua console'''.<br />
<br />
When the console is open, you'll see a blinking cursor at the bottom of the screen; type your message or command and hit '''Return''' to send it (this will also close the console). Documentation about message and command prefixes can be found further down this page.<br />
<br />
When console is closed, only the most recent messages/commands will be displayed, but they will gradually fade away (opening the console will immediately redisplay all recent messages).<br />
<br />
You can set the fade out time via '''Options Menu -> Other Settings -> Message Delay'''.<br />
<br />
If you want to immediately hide the console, open the console and then press '''Escape''' key (or press '''Return''' without entering any message/command). This not only closes the console, but it also hides all the recent messages/commands.<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32389 Factorio 0.14.5 and later], you can clear the console with the '''/clear''' command.<br />
<br />
=== Console history ===<br />
<br />
The console has an inbuilt history; it's a bit like a text editor where only one line of text is displayed at a time.<br />
<br />
Use the '''up arrow''' and '''down arrow''' keys to scroll through the console history.<br />
<br />
Use the '''left arrow''' and '''right arrow''' keys to cursor through the currently displayed message or command, which you can edit (delete, insert, etc.) and resend (by pressing '''Return''').<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32389 Factorio 0.14.5 and later], the '''Tab''' key will autocomplete commands and player ids.<br />
<br />
== Multiplayer Chat ==<br />
<br />
Send private message to specific player with '''/whisper''' (or '''/w'''):<br />
<br />
/whisper <playerId> <message><br />
<br />
Reply to the most recently received private message with '''/reply''' (or '''/r'''):<br />
<br />
/reply <message><br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32248 Factorio 0.14.4 and later], group chat works like this:<br />
<br />
hello my team!<br />
<br />
/s hello all players!<br />
/shout same as /s<br />
<br />
In Factorio 0.14.3 and earlier, group chat worked like this:<br />
<br />
hello all players!<br />
<br />
/team hello my team!<br />
<br />
These are just the main chat features - there are also options for banning, ignoring and muting players; see the console '''/help''' for a full list.<br />
<br />
<br />
== Commands ==<br />
To see a list of all available commands, enter '''/help''' (or '''/h''') in to the console. The available commands will depend on Factorio version and game setup.<br />
<br />
/help<br />
<br />
In [https://forums.factorio.com/viewtopic.php?f=3&t=32248 Factorio 0.14.4 and later], the '''/help''' command will just display a list of commands - to get full details for a command add the command name (without slash) after '''/help''' (or '''/h'''), for example if you want help on the '''/evolution''' command, you'd type:<br />
<br />
/h evolution<br />
<br />
=== Scripting and cheat commands ===<br />
You can run Lua script commands via the console. It works similarly to any command line interface or the JavaScript console for your browser.<br />
<br />
This is a very powerful feature, which also allows cheating, and as such <span style="color:#FF0000">achievements will be permanently disabled for the save</span> as soon as you use a script command.<br />
<br />
To run a script, prefix it with '''/command''' (or '''/c'''), for example:<br />
<br />
/c game.player.print 'hello me!'<br />
<br />
If you're in a multiplayer game, the command will be echoed to all other players (so they can see if you're cheating).<br />
<br />
In [https://forums.factorio.com/viewtopic.php?p=203991#p203991 Factorio 0.14.5 and later], multiplayer server admins can use '''/silent-command''' (only via RCON/server console) instead of '''/c''' to avoid the command being echoed to all players.<br />
<br />
/silent-command game.player.print 'only admins can use (and see) silent commands'<br />
<br />
Mod developers can also take advantage of the special '''/measured-command''' which is like '''/c''' but will time how long the command takes to run. This is very useful for performance tuning your scripts.<br />
<br />
/measured-command game.player.print 'how much time does this take to run?'<br />
<br />
The game ignores newlines when pasting "scriptlets" in the console. This means they can be written in a human readable form in an editor and copy/pasted into the console, making understanding and editing a bit easier.<br />
<br />
You can essentially fire any Lua command here, just as you would from a Lua program - Factorio [[Mods]] are merely Lua commands. Therefore you don't necessarily need "cheats" active per-se, as the console allows you full access to the game's internals. You only need a familiarity with the commands and types, as shown in the below examples and the [[Modding]] section.<br />
<br />
<br />
==Basic Command Examples==<br />
<br />
=== Use it as calculator ===<br />
<br />
/c game.player.print(1234 * 5678)<br />
<br />
=== Mine faster ===<br />
<br />
/c game.player.force.manual_mining_speed_modifier=1000<br />
<br />
=== Craft faster ===<br />
<br />
/c game.player.force.manual_crafting_speed_modifier=1000<br />
<br />
=== Unlock and Research all Technology ===<br />
<br />
/c game.player.force.research_all_technologies()<br />
<br />
Undo this with:<br />
<br />
for _, tech in pairs(game.player.force.technologies) do tech.researched=false end<br />
<br />
=== Reset any modifiers to default ===<br />
This includes Tech and speed alterations.<br />
<br />
/c game.player.force.reset()<br />
<br />
=== Zoom beyond normal bounds ===<br />
Note that zooming too far out can cause performance hits. Be careful.<br />
<br />
/c game.player.zoom = 0.1<br />
<br />
<br />
== Inventory Manipulation ==<br />
<br />
=== Refill resources (refill oil, iron etc.) ===<br />
While holding the cursor over a resource tile in-game<br />
/c game.player.selected.amount=7500<br />
<br />
=== Add items to the player's inventory ===<br />
Replace iron-plate with the internal name of the item desired.<br />
<br />
/c game.player.insert{name="iron-plate", count=100}<br />
<br />
=== Cheat mode ===<br />
Allows for infinite free crafting. Disable by replacing true with false.<br />
<br />
/c game.player.cheat_mode=true<br />
<br />
<br />
== World Manipulation ==<br />
<br />
=== Turn off night ===<br />
Enables eternal day.<br />
/c game.surfaces[1].always_day=true<br />
<br />
=== Change Game Speed ===<br />
0.5 is half speed, 1 is default, 2 is double speed, etc. This can be used for a lot of things like when you know you will have to wait for long periods of time for something to complete. Increasing will decrease performance, be careful.<br />
<br />
/c game.speed = X<br />
<br />
=== Freeze Time Passage ===<br />
Stops the advancement of the time if true is passed, or unfreezes it if false is passed.<br />
<br />
/c game.player.surface.freeze_daytime(BOOL)<br />
<br />
=== Add new resource patch ===<br />
This creates a new 5x5 patch of resources, centered on the player character. For resources other than stone, just change "stone" to "iron-ore", "copper-ore", or "coal"<br />
<br />
/c local surface = game.player.surface;<br />
for y=-2,2 do<br />
for x=-2,2 do<br />
surface.create_entity({name="stone", amount=5000, position={game.player.position.x+x, game.player.position.y+y}})<br />
end<br />
end<br />
<br />
=== Add new oil patch ===<br />
This creates 16 crude oil patches in a 4x4 square that is easy to blueprint. <br />
<br />
/c for y=0,3 do <br />
for x=0,3 do <br />
game.player.surface.create_entity({name="crude-oil", amount=5000, position={game.player.position.x+x*5, game.player.position.y+y*5}}) <br />
end <br />
end<br />
<br />
=== Count Entities ===<br />
Counts all entities whose name includes the string in local entity.<br />
<br />
/c <br />
local entity = "belt"<br />
<br />
local surface = game.player.surface<br />
local count = 0<br />
for c in surface.get_chunks() do<br />
for key, ent in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, force= game.player.force})) do<br />
if string.find(ent.name,entity) then<br />
count = count + 1<br />
end<br />
end<br />
end<br />
game.player.print(count)<br />
<br />
== Enemy/Evolution ==<br />
=== Check how far the biters have evolved ===<br />
Note that commands that do not start with "/c" do not disable achievements.<br />
/evolution<br />
<br />
=== Set evolution factor ===<br />
Ranges from 0 (new game) to 1.<br />
<br />
/c game.evolution_factor=X<br />
<br />
=== Disable time-based evolution & increases pollution-based evolution ===<br />
/c game.map_settings.enemy_evolution.time_factor = 0<br />
/c game.map_settings.enemy_evolution.pollution_factor = game.map_settings.enemy_evolution.pollution_factor * 2<br />
<br />
The "2" at the end of the last command will double the default pollution factor. You can substitute another number to increase (or decrease) the pollution factor further.<br />
<br />
=== Kill all biters on the "enemy" force ===<br />
Note that this will kill only mobile units and worms, spawners will not be killed.<br />
/c game.forces["enemy"].kill_all_units()<br />
<br />
=== Kill all enemies ===<br />
This will kill all biters, bases and worms. Anything that is an enemy will be completely destroyed. This only affects enemies in the explored world, so any unexplored parts of the map which still need to be generated will still have enemies.<br />
<br />
/c local surface = game.player.surface<br />
for c in surface.get_chunks() do<br />
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, force= "enemy"})) do<br />
entity.destroy()<br />
end<br />
end<br />
<br />
=== Enable peaceful mode ===<br />
Peaceful mode prevents biter attacks until provoked. Substitute false for true to disable.<br />
/c game.player.surface.peaceful_mode = true<br />
<br />
=== Disable biter expansion ===<br />
This prevents biters from creating new spawners.<br />
/c game.map_settings.enemy_expansion.enabled = false<br />
<br />
== Player Character ==<br />
Commands concerning the player directly.<br />
=== Get Player Position ===<br />
Prints coordinates of your current position.<br />
<br />
/c game.player.print({"", "(", game.player.position.x, ", ", game.player.position.y, ")"})<br />
<br />
=== Teleport player ===<br />
Moves the player to the specified location. You should be able to teleport to a specific player if you obtain their coordinates via them executing the previous command and giving them to you.<br />
<br />
/c game.player.teleport({X, Y})<br />
<br />
To teleport to the world's origin, use 0,0.<br />
<br />
=== Spawn a player character ===<br />
This is useful for escaping god mode. (see [[Console#Enable_god_mode]].) This will spawn a new player at the spawn point of the world, and connect your controls to it.<br />
<br />
/c game.player.character = game.player.surface.create_entity{name="player", position = {0,0}, force = game.forces.player}<br />
<br />
=== Change Player color ===<br />
Note that commands that do not start with "/c" do not disable achievements. Replace COLOR with the name of a color.<br />
/color COLOR<br />
<br />
=== Enable god mode ===<br />
God mode removes your player character allowing you to fly over obstacles and take no damage.<br />
<br />
Disassociate your controls from the player:<br />
<br />
/c game.player.character = nil<br />
<br />
Then, hover the mouse over the useless player and destroy it by typing:<br />
<br />
/c game.player.selected.destroy()<br />
<br />
To undo<br />
<br />
/c game.player.create_character()<br />
<br />
== Research ==<br />
=== Enable faster research ===<br />
/c game.player.force.laboratory_speed_modifier = 1<br />
1 is normal speed, 2 is double speed 3 is triple etc. I think it goes up to 100.<br />
<br />
=== Enabling specific technologies ===<br />
[http://www.factorioforums.com/forum/viewtopic.php?f=18&t=6633 Enabling technologies] (forums)<br />
/c game.player.force.technologies['electric-energy-distribution-1'].researched=true<br />
/c game.player.force.technologies['steel-processing'].researched=true<br />
<br />
=== Finish research immediately ===<br />
/c for name,technology in pairs(game.player.force.technologies) do technology.researched=technology.enabled end<br />
<br />
== Large Screenshots ==<br />
<br />
This is how you would take a large HD screenshot. As usual, replace the X and Y with the values you wish.<br />
<br />
The file is put into a folder called "script-output", which is located in the same location as the mods folder. These pictures can be quite large.<br />
<br />
/c game.take_screenshot{resolution = {x = XPOS, y = YPOS}}<br />
<br />
or (showing guis like open chests)<br />
<br />
/c game.take_screenshot{showgui = true, resolution = {x = XPOS, y = YPOS}}<br />
<br />
or (Show alt info)<br />
<br />
/c game.take_screenshot{show_entity_info = true, resolution = {x = XPOS, y = YPOS}}<br />
<br />
<br />
== Command Line Parameters ==<br />
'''As of Game Version 0.12.7'''<br />
<br />
Command line parameters can be used to set settings in the command line before the game launches, this is useful mainly for advanced users or server hosts.<br />
<br />
General options:<br />
-h [ --help ] display help<br />
--wait-to-close arg Wait until the specified process finishes.<br />
--version show version information<br />
-c [ --config ] PATH config file to use<br />
<br />
Running options:<br />
-s [ --map2scenario ] arg map to scenario conversion<br />
-v [ --convert ] SAVE[, SAVE...] convert maps from previous versions to current version<br />
--apply-update arg immediately apply update package<br />
--create SAVE create a new map<br />
--start-server SAVE start a multiplayer server<br />
--mp-load-game SAVE start factorio and load game for multiplayer<br />
--mp-connect ADDRESS start factorio and connect to address<br />
--benchmark SAVE load save and run benchmark<br />
--benchmark-ticks N (=1,000) number of ticks for benchmarking. Default is 1000<br />
<br />
Server options:<br />
--latency N multiplayer server latency, in ticks<br />
--latency-ms N multiplayer server latency, in milliseconds<br />
--autosave-interval N (=2) server autosave interval, in minutes<br />
--autosave-slots N (=3) server autosave slots<br />
--disallow-commands disallow use of the command console<br />
--peer-to-peer use peer-to-peer communication<br />
<br />
=== Multiplayer ===<br />
<br />
--start-server SAVE<br />
<br />
Will start a Headless (Dedicated) server, with no GUI.<br />
<br />
--mp-load-game SAVE<br />
<br />
SAVE is the filename of the save file. For instance, for saves/MySave.zip: ./factorio --mp-load-game MySave.zip<br />
<br />
--mp-connect ADDRESS<br />
ADDRESS is the ip:port of the remote host. Port is optional.<br />
Examples:<br />
<br />
./factorio --mp-connect 192.168.1.101<br />
./factorio --mp-connect 192.168.1.101:2345<br />
<br />
As above, port can be specified by placing the port number after a colon in the address.<br />
<br />
--map2scenario SAVE<br />
Converts a save game to a User Scenario, allows saved game state to be loaded into map editor. Assuming that save game name is "foo.zip", executing './factorio --map2scenario s1' will result in Factorio loading, opening the save file, and saving the scenario into the scenario folder.<br />
<br />
<br />
= See also =<br />
<br />
* http://lua-api.factorio.com/latest/ - Factorio API reference for latest version<br />
* http://lua-api.factorio.com/ - links to specific versions of API reference<br />
[[Category:Console]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Rocket_part&diff=133709Rocket part2017-01-04T16:42:57Z<p>Stevetrov: /* Building the Rocket With Productivity3 Modules */</p>
<hr />
<div>{{:Rocket part/infobox}}<br />
<br />
'''Rocket parts''' are created inside of the [[rocket silo]]. Each completed part contributes 1% towards the completion of the rocket. Once all 100 rocket parts have been completed the rocket silo will display a rocket ready to be launched within the silo and the rocket silo interface will contain a LAUNCH button. Before launching, a [[satellite]] can be placed into the rocket.<br />
<br />
== Building the Rocket ==<br />
<br />
The rocket needs 100 parts; each part needs 3 ingredients; those ingredients need other ingredients; etc. In total, one rocket(sans satellite) will need 100 rocket parts, which requires the following raw resources (assuming [[Advanced oil processing]] and cracking are used):<br />
<br />
* 9,500 [[Coal]]<br />
* 35,648.148 [[Water]]<br />
* 39,907.407 [[Crude oil]]<br />
* 77,500 [[Copper ore]]<br />
* 89,100 [[Iron ore]]<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
100 Rocket part<br />
500 [[Sulfur]]<br />
500 [[Sulfuric acid]]<br />
1 000 [[Low density structure]]<br />
1 000 [[Processing unit]]<br />
1 000 [[Rocket control unit]]<br />
1 000 [[Rocket fuel]]<br />
1 000 [[Speed module]]<br />
3 990.741 [[Heavy oil]]<br />
7 000 [[Advanced circuit]]<br />
9 500 [[Coal]]<br />
10 000 [[Solid fuel]]<br />
10 000 [[Steel plate]]<br />
19 000 [[Plastic bar]]<br />
20 951.389 [[Light oil]]<br />
29 250 [[Petroleum gas]]<br />
35 648.148 [[Water]]<br />
39 000 [[Electronic circuit]]<br />
39 907.407 [[Crude oil]]<br />
89 100 [[Iron ore]]<br />
89 100 [[Iron plate]]<br />
77 500 [[Copper ore]]<br />
77 500 [[Copper plate]]<br />
145 000 [[Copper cable]]<br />
</div></div><br />
<br />
Note: To win the game (or to update the Rockets Sent counter in the left top), you additionally need a satellite. When you hover over it, it mentions the "total raw" already. However, this does not include the material needed for Processing Units, Batteries and Steel since these are seen as "raw ingredients" (they cannot be crafted by hand). Still, you can't make a battery (or steel, or processing units) without iron plates, so you still need to mine the ore.<br />
The total raw cost for the satellite is:<br />
<br />
* 450 [[Coal]]<br />
* 7,157.407 [[Water]]<br />
* 3,620.37 [[Crude oil]]<br />
* 7,785.5 [[Copper ore]]<br />
* 12,435 [[Iron ore]]<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
5 [[Radar]]<br />
25 [[Iron gear wheel]]<br />
50 [[Rocket fuel]]<br />
100 [[Accumulator]]<br />
100 [[Low density structure]]<br />
100 [[Processing unit]]<br />
100 [[Solar panel]]<br />
200 [[Advanced circuit]]<br />
362.037 [[Heavy oil]]<br />
450 [[Coal]]<br />
500 [[Battery]]<br />
500 [[Solid fuel]]<br />
900 [[Plastic bar]]<br />
1 050 [[Sulfur]]<br />
1 050 [[Sulfuric acid]]<br />
1 500 [[Steel plate]]<br />
1 900.694 [[Light oil]]<br />
2 925 [[Petroleum gas]]<br />
3 620.37 [[Crude oil]]<br />
7 157.407 [[Water]]<br />
3 925 [[Electronic circuit]]<br />
7 785.5 [[Copper ore]]<br />
7 785.5 [[Copper plate]]<br />
12 435 [[Iron ore]]<br />
12 435 [[Iron plate]]<br />
12 575 [[Copper cable]]<br />
</div></div><br />
<br />
Added up together, each complete rocket launched will cost:<br />
<br />
* 9,950 [[Coal]]<br />
* 42,805.555 [[Water]]<br />
* 43,527.778 [[Crude oil]]<br />
* 85,285.5 [[Copper ore]]<br />
* 101,535 [[Iron ore]]<br />
<br />
== Building the Rocket With Productivity3 Modules ==<br />
<br />
Maximum [[Productivity module 3]] in Rocket silo and every assembly machine and furnace. <br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
5 [[Radar]]<br />
25 [[Iron gear wheel]]<br />
100 [[Accumulator]]<br />
100 [[Solar panel]]<br />
362 [[Heavy oil]]<br />
500 [[Battery]]<br />
610 [[Processing unit]]<br />
764 [[Rocket fuel]]<br />
814 [[Low density structure]]<br />
876 [[Sulfur]]<br />
1,051 [[Sulfuric Acid]]<br />
3,249 [[Coal]]<br />
3,423 [[Advanced circuit]]<br />
5,459 [[Solid fuel]]<br />
6,316 [[Steel plate]]<br />
7,798 [[Plastic bar]]<br />
10,842 [[Light oil]]<br />
10,842 [[Petroleum gas]]<br />
12,289 [[Crude oil]]<br />
17,375 [[Copper ore]]<br />
17,683 [[Electronic circuit]]<br />
20,850 [[Copper plate]]<br />
33,189 [[Iron ore]]<br />
39,826 [[Iron plate]]<br />
47,671 [[Copper cable]]<br />
</div></div><br />
<br />
Raw Products Required<br />
<br />
* 3,249 [[Coal]]<br />
* 12,289 [[Crude oil]]<br />
* 17,375 [[Copper ore]]<br />
* 33,189 [[Iron ore]]<br />
<br />
== See also ==<br />
* [[Satellite]]<br />
* [[Rocket silo]]<br />
<br />
[[Category:Items]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Rocket_part&diff=133184Rocket part2016-11-27T16:08:52Z<p>Stevetrov: /* Building the Rocket With Productivity3 Modules */</p>
<hr />
<div>{{:Rocket part/infobox}}<br />
<br />
'''Rocket parts''' are created inside of the [[rocket silo]]. Each completed part contributes 1% towards the completion of the rocket. Once all 100 rocket parts have been completed the rocket silo will display a rocket ready to be launched within the silo and the rocket silo interface will contain a LAUNCH button. Before launching, a [[satellite]] can be placed into the rocket.<br />
<br />
== Building the Rocket ==<br />
<br />
The rocket needs 100 parts; each part needs 3 ingredients; those ingredients need other ingredients; etc. In total, one rocket(sans satellite) will need 100 rocket parts, which requires the following raw resources (assuming [[Advanced oil processing]] and cracking are used):<br />
<br />
* 9,500 [[Coal]]<br />
* 35,648.148 [[Water]]<br />
* 39,907.407 [[Crude oil]]<br />
* 77,500 [[Copper ore]]<br />
* 89,100 [[Iron ore]]<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
100 Rocket part<br />
500 [[Sulfur]]<br />
500 [[Sulfuric acid]]<br />
1 000 [[Low density structure]]<br />
1 000 [[Processing unit]]<br />
1 000 [[Rocket control unit]]<br />
1 000 [[Rocket fuel]]<br />
1 000 [[Speed module]]<br />
3 990.741 [[Heavy oil]]<br />
7 000 [[Advanced circuit]]<br />
9 500 [[Coal]]<br />
10 000 [[Solid fuel]]<br />
10 000 [[Steel plate]]<br />
19 000 [[Plastic bar]]<br />
20 951.389 [[Light oil]]<br />
29 250 [[Petroleum gas]]<br />
35 648.148 [[Water]]<br />
39 000 [[Electronic circuit]]<br />
39 907.407 [[Crude oil]]<br />
89 100 [[Iron ore]]<br />
89 100 [[Iron plate]]<br />
77 500 [[Copper ore]]<br />
77 500 [[Copper plate]]<br />
145 000 [[Copper cable]]<br />
</div></div><br />
<br />
Note: To win the game (or to update the Rockets Sent counter in the left top), you additionally need a satellite. When you hover over it, it mentions the "total raw" already. However, this does not include the material needed for Processing Units, Batteries and Steel since these are seen as "raw ingredients" (they cannot be crafted by hand). Still, you can't make a battery (or steel, or processing units) without iron plates, so you still need to mine the ore.<br />
The total raw cost for the satellite is:<br />
<br />
* 450 [[Coal]]<br />
* 7,157.407 [[Water]]<br />
* 3,620.37 [[Crude oil]]<br />
* 7,785.5 [[Copper ore]]<br />
* 12,435 [[Iron ore]]<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
5 [[Radar]]<br />
25 [[Iron gear wheel]]<br />
50 [[Rocket fuel]]<br />
100 [[Accumulator]]<br />
100 [[Low density structure]]<br />
100 [[Processing unit]]<br />
100 [[Solar panel]]<br />
200 [[Advanced circuit]]<br />
362.037 [[Heavy oil]]<br />
450 [[Coal]]<br />
500 [[Battery]]<br />
500 [[Solid fuel]]<br />
900 [[Plastic bar]]<br />
1 050 [[Sulfur]]<br />
1 050 [[Sulfuric acid]]<br />
1 500 [[Steel plate]]<br />
1 900.694 [[Light oil]]<br />
2 925 [[Petroleum gas]]<br />
3 620.37 [[Crude oil]]<br />
7 157.407 [[Water]]<br />
3 925 [[Electronic circuit]]<br />
7 785.5 [[Copper ore]]<br />
7 785.5 [[Copper plate]]<br />
12 435 [[Iron ore]]<br />
12 435 [[Iron plate]]<br />
12 575 [[Copper cable]]<br />
</div></div><br />
<br />
Added up together, each complete rocket launched will cost:<br />
<br />
* 9,950 [[Coal]]<br />
* 42,805.555 [[Water]]<br />
* 43,527.778 [[Crude oil]]<br />
* 85,285.5 [[Copper ore]]<br />
* 101,535 [[Iron ore]]<br />
<br />
== Building the Rocket With Productivity3 Modules ==<br />
<br />
Maximum [[Productivity module 3]] in Rocket silo and every assembly machine and furnace. <br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
5 [[Radar]]<br />
25 [[Iron gear wheel]]<br />
100 [[Accumulator]]<br />
100 [[Solar panel]]<br />
362 [[Heavy oil]]<br />
500 [[Battery]]<br />
610 [[Processing unit]]<br />
764 [[Rocket fuel]]<br />
814 [[Low density structure]]<br />
876 [[Sulfur]]<br />
900 [[Plastic bar]]<br />
1,051 [[Sulfuric Acid]]<br />
3,249 [[Coal]]<br />
3,423 [[Advanced circuit]]<br />
5,459 [[Solid fuel]]<br />
6,316 [[Steel plate]]<br />
10,842 [[Light oil]]<br />
10,842 [[Petroleum gas]]<br />
12,289 [[Crude oil]]<br />
17,375 [[Copper ore]]<br />
17,683 [[Electronic circuit]]<br />
20,850 [[Copper plate]]<br />
33,189 [[Iron ore]]<br />
39,826 [[Iron plate]]<br />
47,671 [[Copper cable]]<br />
</div></div><br />
<br />
Raw Products Required<br />
<br />
* 3,249 [[Coal]]<br />
* 12,289 [[Crude oil]]<br />
* 17,375 [[Copper ore]]<br />
* 33,189 [[Iron ore]]<br />
<br />
== See also ==<br />
* [[Satellite]]<br />
* [[Rocket silo]]<br />
<br />
[[Category:Items]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Rocket_part&diff=133183Rocket part2016-11-27T16:06:48Z<p>Stevetrov: </p>
<hr />
<div>{{:Rocket part/infobox}}<br />
<br />
'''Rocket parts''' are created inside of the [[rocket silo]]. Each completed part contributes 1% towards the completion of the rocket. Once all 100 rocket parts have been completed the rocket silo will display a rocket ready to be launched within the silo and the rocket silo interface will contain a LAUNCH button. Before launching, a [[satellite]] can be placed into the rocket.<br />
<br />
== Building the Rocket ==<br />
<br />
The rocket needs 100 parts; each part needs 3 ingredients; those ingredients need other ingredients; etc. In total, one rocket(sans satellite) will need 100 rocket parts, which requires the following raw resources (assuming [[Advanced oil processing]] and cracking are used):<br />
<br />
* 9,500 [[Coal]]<br />
* 35,648.148 [[Water]]<br />
* 39,907.407 [[Crude oil]]<br />
* 77,500 [[Copper ore]]<br />
* 89,100 [[Iron ore]]<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
100 Rocket part<br />
500 [[Sulfur]]<br />
500 [[Sulfuric acid]]<br />
1 000 [[Low density structure]]<br />
1 000 [[Processing unit]]<br />
1 000 [[Rocket control unit]]<br />
1 000 [[Rocket fuel]]<br />
1 000 [[Speed module]]<br />
3 990.741 [[Heavy oil]]<br />
7 000 [[Advanced circuit]]<br />
9 500 [[Coal]]<br />
10 000 [[Solid fuel]]<br />
10 000 [[Steel plate]]<br />
19 000 [[Plastic bar]]<br />
20 951.389 [[Light oil]]<br />
29 250 [[Petroleum gas]]<br />
35 648.148 [[Water]]<br />
39 000 [[Electronic circuit]]<br />
39 907.407 [[Crude oil]]<br />
89 100 [[Iron ore]]<br />
89 100 [[Iron plate]]<br />
77 500 [[Copper ore]]<br />
77 500 [[Copper plate]]<br />
145 000 [[Copper cable]]<br />
</div></div><br />
<br />
Note: To win the game (or to update the Rockets Sent counter in the left top), you additionally need a satellite. When you hover over it, it mentions the "total raw" already. However, this does not include the material needed for Processing Units, Batteries and Steel since these are seen as "raw ingredients" (they cannot be crafted by hand). Still, you can't make a battery (or steel, or processing units) without iron plates, so you still need to mine the ore.<br />
The total raw cost for the satellite is:<br />
<br />
* 450 [[Coal]]<br />
* 7,157.407 [[Water]]<br />
* 3,620.37 [[Crude oil]]<br />
* 7,785.5 [[Copper ore]]<br />
* 12,435 [[Iron ore]]<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
5 [[Radar]]<br />
25 [[Iron gear wheel]]<br />
50 [[Rocket fuel]]<br />
100 [[Accumulator]]<br />
100 [[Low density structure]]<br />
100 [[Processing unit]]<br />
100 [[Solar panel]]<br />
200 [[Advanced circuit]]<br />
362.037 [[Heavy oil]]<br />
450 [[Coal]]<br />
500 [[Battery]]<br />
500 [[Solid fuel]]<br />
900 [[Plastic bar]]<br />
1 050 [[Sulfur]]<br />
1 050 [[Sulfuric acid]]<br />
1 500 [[Steel plate]]<br />
1 900.694 [[Light oil]]<br />
2 925 [[Petroleum gas]]<br />
3 620.37 [[Crude oil]]<br />
7 157.407 [[Water]]<br />
3 925 [[Electronic circuit]]<br />
7 785.5 [[Copper ore]]<br />
7 785.5 [[Copper plate]]<br />
12 435 [[Iron ore]]<br />
12 435 [[Iron plate]]<br />
12 575 [[Copper cable]]<br />
</div></div><br />
<br />
Added up together, each complete rocket launched will cost:<br />
<br />
* 9,950 [[Coal]]<br />
* 42,805.555 [[Water]]<br />
* 43,527.778 [[Crude oil]]<br />
* 85,285.5 [[Copper ore]]<br />
* 101,535 [[Iron ore]]<br />
<br />
== Building the Rocket With Productivity3 Modules ==<br />
<br />
<div class="mw-collapsible mw-collapsed" style="width:30em"><br />
Complete list of all intermediate products:<br />
<div class="mw-collapsible-content"><br />
5 [[Radar]]<br />
25 [[Iron gear wheel]]<br />
100 [[Accumulator]]<br />
100 [[Solar panel]]<br />
362 [[Heavy oil]]<br />
500 [[Battery]]<br />
610 [[Processing unit]]<br />
764 [[Rocket fuel]]<br />
814 [[Low density structure]]<br />
876 [[Sulfur]]<br />
900 [[Plastic bar]]<br />
1,051 [[Sulfuric Acid]]<br />
3,249 [[Coal]]<br />
3,423 [[Advanced circuit]]<br />
5,459 [[Solid fuel]]<br />
6,316 [[Steel plate]]<br />
10,842 [[Light oil]]<br />
10,842 [[Petroleum gas]]<br />
12,289 [[Crude oil]]<br />
17,375 [[Copper ore]]<br />
17,683 [[Electronic circuit]]<br />
20,850 [[Copper plate]]<br />
33,189 [[Iron ore]]<br />
39,826 [[Iron plate]]<br />
47,671 [[Copper cable]]<br />
</div></div><br />
<br />
Raw Products Required<br />
<br />
* 3,249 [[Coal]]<br />
* 12,289 [[Crude oil]]<br />
* 17,375 [[Copper ore]]<br />
* 33,189 [[Iron ore]]<br />
<br />
== See also ==<br />
* [[Satellite]]<br />
* [[Rocket silo]]<br />
<br />
[[Category:Items]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Circuit_network_(research)&diff=133182Circuit network (research)2016-11-27T15:36:31Z<p>Stevetrov: /* See also */</p>
<hr />
<div>{{Languages}}<br />
{{:Circuit network (research)/infobox}}<br />
The circuit network allows you to better control machines in your base by interconnecting them with circuit wires and sending special signals.<br />
<br />
== See also ==<br />
* [[Circuit network]]<br />
* [[Research#Technologies|Technologies]]<br />
* [[Circuit-network Cookbook]]<br />
[[Category:Technology]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Circuit_network_(research)&diff=133181Circuit network (research)2016-11-27T15:36:06Z<p>Stevetrov: /* See also */</p>
<hr />
<div>{{Languages}}<br />
{{:Circuit network (research)/infobox}}<br />
The circuit network allows you to better control machines in your base by interconnecting them with circuit wires and sending special signals.<br />
<br />
== See also ==<br />
* [[Circuit network]]<br />
* [[Research#Technologies|Technologies]]<br />
* [[Circuit-network_Cookbook]]<br />
[[Category:Technology]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Circuit_network_(research)&diff=133180Circuit network (research)2016-11-27T15:35:34Z<p>Stevetrov: /* See also */</p>
<hr />
<div>{{Languages}}<br />
{{:Circuit network (research)/infobox}}<br />
The circuit network allows you to better control machines in your base by interconnecting them with circuit wires and sending special signals.<br />
<br />
== See also ==<br />
* [[Circuit network]]<br />
* [[Research#Technologies|Technologies]]<br />
* [[Circuit network cookbook]]<br />
[[Category:Technology]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Circuit_network_(research)&diff=133179Circuit network (research)2016-11-27T15:35:19Z<p>Stevetrov: /* See also */</p>
<hr />
<div>{{Languages}}<br />
{{:Circuit network (research)/infobox}}<br />
The circuit network allows you to better control machines in your base by interconnecting them with circuit wires and sending special signals.<br />
<br />
== See also ==<br />
* [[Circuit network]]<br />
* [[Research#Technologies|Technologies]]<br />
* [[Circuit-network cookbook]]<br />
[[Category:Technology]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Circuit_network_(research)&diff=133178Circuit network (research)2016-11-27T15:35:10Z<p>Stevetrov: /* See also */</p>
<hr />
<div>{{Languages}}<br />
{{:Circuit network (research)/infobox}}<br />
The circuit network allows you to better control machines in your base by interconnecting them with circuit wires and sending special signals.<br />
<br />
== See also ==<br />
* [[Circuit network]]<br />
* [[Research#Technologies|Technologies]]<br />
* [[Circuit-network cookbook]<br />
[[Category:Technology]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133177Tutorial:Circuit network cookbook2016-11-27T15:34:46Z<p>Stevetrov: </p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[Basic inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tank]]s.<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wire]]s join the output of the [[Arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[stack filter inserter]]. <br />
* The [[Arithmetic combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the [[stack filter inserter]] is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engine]]s are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumulator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumulator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}<br />
<br />
== See Also ==<br />
*[[Arithmetic combinator]]<br />
*[[Constant Combinator]]<br />
*[[Decider Combinator]]<br />
*[[Circuit network]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&diff=133176Tutorial:Combinator tutorial2016-11-27T15:33:52Z<p>Stevetrov: /* See Also */</p>
<hr />
<div><br />
== Introduction ==<br />
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. Combinator logic works because Factorio only updates the circut network in discrete steps at 60 times per second, such that combinators analyze their logic only once in each step, and then sum the resulting output values on the next step.<br />
<br />
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it's output value will not take effect on the circuit network until the next step. This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.<br />
<br />
Red & Green inputs will be summed at all combinators, so if you have a chest connected to a network by red & green its contents will be seen doubled at connected combinators.<br />
<br />
When cross-connecting combinators it's good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network. Combinators will sum the red & green inputs prior to calculation, so either color can be used when wiring the output back to the input.<br />
<br />
There is also an example heavy [[Circuit-network_Cookbook]] that you may find helpful to learn about circuit networks.<br />
<br />
== Input Isolator & Gate ==<br />
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network's inputs.<br />
<br />
A decider combinator set to (Out: Everything, Input-> Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or 'gate' inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.<br />
<br />
== Set/Reset Latching Switch ==<br />
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You'll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.<br />
<br />
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider's input channel. That's it! Whenever your set conditional is reached, the decider will output a '1', and the bias of the arithmetic combinator will be applied. This will 'hold' the output true until the value goes back below the reset point.<br />
<br />
Here's a more specific example : <br />
i want the pump to run when petrol reach 2000, and turn off when reach 200.<br><br />
only with green wire<br><br />
Tank -> in decider<br><br />
out decider-> in arithmetic<br><br />
out arithmetic -> in decider<br><br />
green wire from in decider, to pump<br><br />
<br />
Pump have the same condition as the decider (Petrol > 2000)<br />
<br />
Decider : Petrol > 2000<br><br />
out : A = 1<br><br />
Arithmetic : A x 1800 (2000 - 200 )<br><br />
out : petrol<br><br />
[[File:Factorio combinator switch.png]]<br />
<br />
== Comparing Outputs ==<br />
<br />
== Addressing Outposts ==<br />
<br />
== Smart Train Loading ==<br />
<br />
Intially designed by [https://www.youtube.com/user/Darkphade MadZuri],<br />
<br />
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.<br />
<br />
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. '''Wire all the chests used, to the input of the Arithmetic Combinator'''. '''Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator''', this will average the amount of items within the chests. Lastly, '''wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest'''. '''Have the inserters enabled when Logistics Item < 1'''.<br />
<br />
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].<br />
<br />
Explanation of why this works:<br />
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.<br />
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.<br />
<br />
== Oil Control ==<br />
<br />
== Memory ==<br />
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -> output will 'hold' a value, as long as all other inputs on the network are zero.<br />
<br />
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.<br />
<br />
== Basic Clocks ==<br />
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.<br />
<br />
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.<br />
<br />
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (<) and Input -> Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.<br />
<br />
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.<br />
<br />
== Pulse Generators ==<br />
<br />
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input->output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.<br />
<br />
== Counter ==<br />
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -> output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator's contents.<br />
<br />
== Logic Gates ==<br />
'''Unary NOT'''<br />
<br />
[[Decider Combinator]] set to "Input = 0"<br />
<br />
'''Binary OR'''<br />
<br />
[[Decider Combinator]] set to "Inputs > 0"<br />
<br />
'''Binary NOR'''<br />
<br />
[[Decider Combinator]] set to "Inputs < 1"<br />
<br />
'''Binary XOR'''<br />
<br />
[[Decider Combinator]] set to "Inputs = 1"<br />
<br />
'''Binary AND'''<br />
<br />
[[Arithmetic Combinator]] set to "A * B"<br />
<br />
'''Binary NAND'''<br />
<br />
[[Decider Combinator]] set to "Inputs < 2"<br />
<br />
'''Binary XAND'''<br />
<br />
[[Decider Combinator]] set to "A = B"<br />
<br />
== Memory Cells ==<br />
'''Binary Cell'''<br />
<br />
RS NOR Latch<br />
[[File:RS-NOR.png|500px]]<br />
<br />
<br />
<br />
'''Advanced Cell'''<br />
<br />
Cell for storing a positive value:<br />
<br />
[[File:AdvancedMemoryCell.png|500px]]<br />
<br />
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.<br />
<br />
'''Address Enable Switch'''<br />
<br />
== See Also ==<br />
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&t=14556 Combinators 101 (Tutorial)]<br />
*[[Arithmetic combinator]]<br />
*[[Constant Combinator]]<br />
*[[Decider Combinator]]<br />
*[[Circuit network]]<br />
*[[Circuit-network_Cookbook]]<br />
[[Category:Tutorial]]<br />
[[Category:English page]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Combinator_tutorial&diff=133175Tutorial:Combinator tutorial2016-11-27T15:33:39Z<p>Stevetrov: /* Introduction */</p>
<hr />
<div><br />
== Introduction ==<br />
Combinator logic is achieved by cross-connecting outputs to inputs in such a way to achieve the desired logic. While advanced logic requires a multitude of combinators, some very useful basic logic can be achieved using only a handful of combinators. Combinator logic works because Factorio only updates the circut network in discrete steps at 60 times per second, such that combinators analyze their logic only once in each step, and then sum the resulting output values on the next step.<br />
<br />
When logic values are computed by combinators, the outputs are not recognized by the circuit network until the following step. So when a decider combinator is used to detect a certain input condition, it's output value will not take effect on the circuit network until the next step. This behavior is important to remember and can result in sequencing errors and significant delays when multiple combinators are connected in series.<br />
<br />
Red & Green inputs will be summed at all combinators, so if you have a chest connected to a network by red & green its contents will be seen doubled at connected combinators.<br />
<br />
When cross-connecting combinators it's good practice to use the unused color to cross-connect, this will split the input and output networks and prevent unwanted inputs from accidentally connecting to a larger circuit network. Combinators will sum the red & green inputs prior to calculation, so either color can be used when wiring the output back to the input.<br />
<br />
There is also an example heavy [[Circuit-network_Cookbook]] that you may find helpful to learn about circuit networks.<br />
<br />
== Input Isolator & Gate ==<br />
An arithmetic combinator set to (In: Each + 0, Out: Each) can be used to swap wire colors and as an isolator to prevent downstream logic from backfeeding into the circuit network's inputs.<br />
<br />
A decider combinator set to (Out: Everything, Input-> Output) will also function as an isolator as long as the set logic condition is true. This can also selectively pass or 'gate' inputs only when desired. This could be used to sequentially poll remote train stations for their chest contents, and include only desired stations.<br />
<br />
== Set/Reset Latching Switch ==<br />
You want something to SET a trigger at some quantity, but then STAY on until that quantity hits some other value, the RESET value. You'll need one decider combinator and one arithmetic combinator. Two decider combinators and a constant combinator can also be used for more complex multi-channel conditions.<br />
<br />
Setup the first decider combinator to the desired set conditional and to output a 1. Then connect the output to the input of an arithmetic combinator, and configure it to multiply by the bias value, the difference between the set and reset values, and wire the arithmetic output to the input of the decider. The arithmetic output channel MUST be set the same as the decider's input channel. That's it! Whenever your set conditional is reached, the decider will output a '1', and the bias of the arithmetic combinator will be applied. This will 'hold' the output true until the value goes back below the reset point.<br />
<br />
Here's a more specific example : <br />
i want the pump to run when petrol reach 2000, and turn off when reach 200.<br><br />
only with green wire<br><br />
Tank -> in decider<br><br />
out decider-> in arithmetic<br><br />
out arithmetic -> in decider<br><br />
green wire from in decider, to pump<br><br />
<br />
Pump have the same condition as the decider (Petrol > 2000)<br />
<br />
Decider : Petrol > 2000<br><br />
out : A = 1<br><br />
Arithmetic : A x 1800 (2000 - 200 )<br><br />
out : petrol<br><br />
[[File:Factorio combinator switch.png]]<br />
<br />
== Comparing Outputs ==<br />
<br />
== Addressing Outposts ==<br />
<br />
== Smart Train Loading ==<br />
<br />
Intially designed by [https://www.youtube.com/user/Darkphade MadZuri],<br />
<br />
This solves the problem of loading logistics into chests, which tend to be unequal and is slower in the rate of loading logistics into the cargo of trains.<br />
<br />
To setup the design, you require an Arithmetic Combinator, as well as Red and Green wires. '''Wire all the chests used, to the input of the Arithmetic Combinator'''. '''Then write (Logistics Item / -Amount of chests) and as the output as the Logistics Item in the Arithmetic Combinator''', this will average the amount of items within the chests. Lastly, '''wire all the inserters used to the output of the Arithmetic Combinator and have the other color of the wire be wired to the adjacent chest'''. '''Have the inserters enabled when Logistics Item < 1'''.<br />
<br />
A more visual representation as well as questions for the design can be found [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ here].<br />
<br />
Explanation of why this works:<br />
It compares the average amount of total items within the chests and the chest adjacent to the inserter so that it activates when the average number of items is higher than the amount within the chest.<br />
The reason for why the division denominator is negative is because if the items in the chests are 0, it basically makes it so that it adds 1 to the equation.<br />
<br />
== Oil Control ==<br />
<br />
== Memory ==<br />
How to store a constant value for later use, either for a basic counter or for more advanced logic. A decider combinator wired output tied to input and configured greater than zero (for positive values), input -> output will 'hold' a value, as long as all other inputs on the network are zero.<br />
<br />
Any non-zero input condition will create a basic clock; incrementing the stored value by the sum of all connected input values every cycle. A single pulse of an input will cause a single increment by the pulsed value. Reset to zero occurs whenever the set condition is no longer met, or if a negative pulse equal to the input occurs.<br />
<br />
== Basic Clocks ==<br />
Clocks are constructed by having the output of a combinator tied back to its own input, such that every cycle advances its own count. Either the arithmetic combinator or the decider combinator can be used.<br />
<br />
An arithmetic combinator tied to itself is fun to watch and will happily run-away, but requires additional control logic to reset.<br />
<br />
A self-resetting clock requires just a single decider combinator with output wired to input and configured with Less Than (<) and Input -> Output. When a constant combinator is then connected to the input, every cycle it will count up by the value of the Constant Combinator until the set conditional value is reached, then output a zero which will be summed with the constant combinator, and reset the process.<br />
<br />
The clock sequence will not include zero, will begin at the value set by the constant combinator, and will include whatever value eventually causes the conditional to be false. An arithmetic combinator can modify the clock sequence but remember its outputs will occur one cycle later than the clock cycle values.<br />
<br />
== Pulse Generators ==<br />
<br />
Connecting an additional (=) decider combinator to the output of a basic clock will create a pulse generator, and will pulse a single output every time the clock cycles through the set condition. Any output value can be used, either directly from the clock sequence (input->output), a 1, or some value on a separate logic channel on the circuit network, such as set by a constant combinator. or by the circuit network.<br />
<br />
== Counter ==<br />
A counter is used to count the number of input events, and output the sum of that count. Any pulsing input into a decider combinator configured input -> output and wired between output and input will create a counter, but this input must be zero at all other times or else the combinator will run away like a clock. A pulse generator is normally used to accomplish this. Combining several gating decider isolators set with sequential conditionals, a clock, and a pulse generator to the input of a counter will allow remote polling and counting of each isolator's contents.<br />
<br />
== Logic Gates ==<br />
'''Unary NOT'''<br />
<br />
[[Decider Combinator]] set to "Input = 0"<br />
<br />
'''Binary OR'''<br />
<br />
[[Decider Combinator]] set to "Inputs > 0"<br />
<br />
'''Binary NOR'''<br />
<br />
[[Decider Combinator]] set to "Inputs < 1"<br />
<br />
'''Binary XOR'''<br />
<br />
[[Decider Combinator]] set to "Inputs = 1"<br />
<br />
'''Binary AND'''<br />
<br />
[[Arithmetic Combinator]] set to "A * B"<br />
<br />
'''Binary NAND'''<br />
<br />
[[Decider Combinator]] set to "Inputs < 2"<br />
<br />
'''Binary XAND'''<br />
<br />
[[Decider Combinator]] set to "A = B"<br />
<br />
== Memory Cells ==<br />
'''Binary Cell'''<br />
<br />
RS NOR Latch<br />
[[File:RS-NOR.png|500px]]<br />
<br />
<br />
<br />
'''Advanced Cell'''<br />
<br />
Cell for storing a positive value:<br />
<br />
[[File:AdvancedMemoryCell.png|500px]]<br />
<br />
Connect the desired value as signal 3 on the right side to set the memory cell and connect a negative value as signal 3 to reset the cell.<br />
<br />
'''Address Enable Switch'''<br />
<br />
== See Also ==<br />
*[http://www.factorioforums.com/forum/viewtopic.php?f=18&t=14556 Combinators 101 (Tutorial)]<br />
*[[Arithmetic combinator]]<br />
*[[Constant Combinator]]<br />
*[[Decider Combinator]]<br />
*[[Circuit network]]<br />
<br />
[[Category:Tutorial]]<br />
[[Category:English page]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Constant_combinator&diff=133174Constant combinator2016-11-27T15:31:49Z<p>Stevetrov: /* See Also */</p>
<hr />
<div>{{Languages}}<br />
{{:Constant combinator/infobox}}<br />
<br />
The constant combinator is part of the circuit network and one of three types of combinators available in the game. It constantly outputs the selected signal(s) to all connected wire networks, and can be turned on/off in the GUI manually. <br />
<br />
== History ==<br />
<br />
{{history|0.13.0|<br />
* Connected wires are highlighted when hovering over a combinator connected to the [[circuit network]].<br />
* Combinators show input and output in alt mode.<br />
* More virtual signals for combinators.<br />
* Constant combinator can be rotated.<br />
* Decider combinator "input count" option makes the combinator copy the count of the specified output signal from the input signals, instead of copying the count from the condition.<br />
* New combinator graphics. }}<br />
<br />
{{history|0.12.5|<br />
* Combinators now emit light.}}<br />
<br />
{{history|0.12.2|<br />
* Combinators no longer turn off when no wires are connected.}}<br />
<br />
{{history|0.12.0|<br />
* Introduced}}<br />
<br />
== See Also ==<br />
* [[Arithmetic combinator]]<br />
* [[Decider Combinator]]<br />
* [[Combinator Tutorial]]<br />
* [[Circuit network]]<br />
* [[Circuit-network_Cookbook]]<br />
{{LogisticsNav}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Decider_combinator&diff=133173Decider combinator2016-11-27T15:31:26Z<p>Stevetrov: /* See Also */</p>
<hr />
<div>{{Languages}}<br />
{{:Decider combinator/infobox}}<br />
<br />
The {{PAGENAME}} is part of the circuit network and one of three types of combinators available in the game. It is used to make comparisons of signals on the network. Signals can be compared using "is greater than" (>), "is less than" (<) or "is equal to" (=).<br />
Input contacts are to the left in the above picture, outputs on the right.<br />
<br />
== Function ==<br />
The internal logic process has three steps:<br />
<br />
1) Values for each individual input signal(s) (items of the same name) on the red and green wires are summed within the combinator.<br />
<br />
2) The Decider combinator GUI specifies a "first" input signal, a comparison (>, <, =), and a "second" input signal or constant.<br />
<br />
3) If the comparison returns true, the output is a new signal (any name) with either the input value of the selected signal, or 1.<br />
<br />
4) Using the Everything output with input -> output will pass all nonzero input values to the output as long as the condition is true. Using the Everything output with "1" will output 1 ONLY for all non-zero inputs.<br />
<br />
5) The Each input will re-apply the comparison for each input signal individually, and will pass the selected output for each input that passes the conditional.<br />
<br />
6) The Everything input functions as a logical AND, and will return true only if ALL non-zero inputs pass the conditional.<br />
<br />
7) The Anything input functions as a logical OR, and will return true if ANY non-zero input passes the conditional.<br />
<br />
The decider combinator can handle [[Automatic control/Virtual signals#Special signals|special signals]].<br />
<br />
With both the Arithmetic and Decider combinator, there is one tick (60th of a second) of latency before the output signal is ready to be used as an input into a circuit network.<br />
<br />
== History ==<br />
<br />
{{history|0.13.0|<br />
* Connected wires are highlighted when hovering over a combinator connected to the [[circuit network]].<br />
* Combinators show input and output in alt mode.<br />
* More virtual signals for combinators.<br />
* Constant combinator can be rotated.<br />
* Decider combinator "input count" option makes the combinator copy the count of the specified output signal from the input signals, instead of copying the count from the condition.<br />
* New combinator graphics. }}<br />
<br />
{{history|0.12.5|<br />
* Combinators now emit light.}}<br />
<br />
{{history|0.12.2|<br />
* Combinators no longer turn off when no wires are connected.}}<br />
<br />
{{history|0.12.0|<br />
* Introduced}}<br />
<br />
== See Also ==<br />
* [[Arithmetic combinator]]<br />
* [[Constant Combinator]]<br />
* [[Combinator Tutorial]] <-- Description of Combinator Logic Gates<br />
* [[Circuit network]]<br />
* [[Circuit-network_Cookbook]]<br />
{{LogisticsNav}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Arithmetic_combinator&diff=133172Arithmetic combinator2016-11-27T15:31:06Z<p>Stevetrov: /* See Also */</p>
<hr />
<div>{{Languages}}<br />
{{:Arithmetic combinator/infobox}}<br />
<br />
<br />
<br />
The arithmetic combinator is part of the circuit network and one of three types of combinators available in the game. It is used to perform simple mathematical operations on signals, capable of addition, subtraction, multiplication, or division. The arithmetic combinator accepts two input connections (red and green wires), and sends its output to both output connections. The input wires connect to the nubs on the left side of the above sprite, while the output is on the opposite side.<br />
<br />
==Function==<br />
The internal logic process has three steps:<br />
<br />
1) All input signals on the red and green wires are summed within the combinator.<br />
<br />
2) The specified operation (+, -, *, or /) is performed on the selected signal(s).<br />
<br />
3) The result of this operation is output as the selected output signal.<br />
<br />
The arithmetic combinator can handle [[Automatic control/Virtual signals#Each|special signals]]. Notice that when using division as operation the result is truncated.<br />
<br />
== History ==<br />
<br />
{{history|0.13.0|<br />
* Connected wires are highlighted when hovering over a combinator connected to the [[circuit network]].<br />
* Combinators show input and output in alt mode.<br />
* More virtual signals for combinators.<br />
* Constant combinator can be rotated.<br />
* Decider combinator "input count" option makes the combinator copy the count of the specified output signal from the input signals, instead of copying the count from the condition.<br />
* New combinator graphics. }}<br />
<br />
{{history|0.12.5|<br />
* Combinators now emit light.}}<br />
<br />
{{history|0.12.2|<br />
* Combinators no longer turn off when no wires are connected.}}<br />
<br />
{{history|0.12.0|<br />
* Introduced}}<br />
<br />
==See Also==<br />
*[[Decider Combinator]]<br />
*[[Constant Combinator]]<br />
*[[Combinator Tutorial]]<br />
*[[Circuit network]]<br />
*[[Circuit-network_Cookbook]]<br />
<br />
{{LogisticsNav}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Circuit_network&diff=133171Circuit network2016-11-27T15:30:23Z<p>Stevetrov: /* Examples (outdated) */</p>
<hr />
<div>{{Languages}}<br />
'''Circuit networks''' are built using red or green wire, and enable the control of [[Automatic control/Devices#Receiver|receiver devices]], based upon information broadcast onto the network by connected [[Automatic control/Devices#Sender|sender devices]]. Most senders are storage devices, and broadcast their information onto a specific channel, based on the item or liquid the storage device contains. Each circuit network contains a channel for every kind of item, as well as 45 extra [[Automatic control/Virtual signals|Virtual signals]] which act as user-definable channels.<br />
<br />
[[File:InnerOfGreenCable.jpg|right|400px]]<br />
<br />
== Physical network structure ==<br />
A circuit network consists only of those devices connected together with the same color wire. Wire can be strung directly from device to device, or across any intervening power poles.<br />
<br />
Note that each connected set of wires forms a separate network. For example, it's entirely possible to have four red-wire networks and three green-wire networks. Red and green networks will remain separate and do not link up if red and green wires happen to touch the same power pole or device.<br />
<br />
* To connect wires or cables to a power pole, drag the wire to the base of the pole.<br />
* To erase a wire or cable connection, drag the same color wire over an existing connection. You don't get the wire/cable back.<br />
* To remove '''all''' connections from a power pole, shift-click on the pole. The first shift-click will remove all electrical connections, and the second will remove all red and green wires. You don't get the wires back.<br />
* When connecting to a [[Arithmetic Combinator]] or [[Decider Combinator]], take care to drag the wire to the correct input or output side. Use ALT-Key-Mode to see direction of combinator.<br />
<br />
== Broadcast Information ==<br />
[[Automatic control/Devices#Sender|Sending devices]] broadcast the amount of [[Items]] or [[Liquids system|Fluids]] they contain or other data definable by the player. Each amount is broadcast as a numeric value on a 'channel' corresponding to the item they contain. For example, a Storage Tank containing 1000 Crude Oil will broadcast 1000 on the Crude Oil channel.<br />
<br />
Multiple broadcasts of the same item or fluid are additive: if there are two connected Storage Tanks with 1000 Crude Oil each, the value of the Crude Oil channel will be 2000.<br />
<br />
Wires which are connected together by a junction will pass their signals to the other wires of the same color. For example, if two red wires are connected to the same combinator input, each wire receives the content from the other. This can result in feedback if care is not taken; see Feedback (under Arithmetic Combinator, below) for discussion.<br />
<br />
== Use of Information ==<br />
[[File:smart_inserter.png|thumb|250px|Example condition: "Work only if the count of Iron plates is lower than the count of Steel plates."]]<br />
[[Automatic control/Devices#Receiver|Receiving devices]] can use broadcast information, in most cases to enable/disable the device.<br />
<br />
They can either compare results between different channels, or compare a channel to a specific value. The pictured inserter works if the count of [[Iron plate|Iron plates]] is lower than the count of [[Steel plate|Steel plates]].<br />
<br />
Receiving devices sum all signals from each wire connected to them, even red and green wires. For example, if an inserter is connected to a red wire carrying a signal for 20 iron plates, a green wire with 10 copper plates and another green wire with 5 iron plates, the input signal set for that receiver will be 25 iron plates and 10 copper plates.<br />
<br />
== Basic ==<br />
[[File:circuit-network-example-1.png|thumb|256px|A basic circuit network usable to fill a chest with a defined amount of items.]]<br />
<br />
The simplest network is to connect an inserter with a chest next to it, to control the limit amount of items the inserter will put into the chest. <br><br />
(Note that you do not have to connect them using a power pole as the picture shows; you can connect them directly.)<br />
<br />
Similar methods are possible for gating fluid by connecting a [[storage tank]] to a [[small pump]], or gating electricity by connecting [[accumulators]] to a [[power switch]] to the respective network.<br />
<br />
== Combinators ==<br />
Combinators can function as both receiving and sending devices and allow more advanced functions to be used on a circuit network.<br />
<br />
*The [[Constant Combinator]] broadcasts up to 15 values on any of the channels for whatever networks it is connected to. (You cannot currently specify whether a value should be red or green; if you need different values, use two combinators, one for each color wire.) You can use any item channel or any of the [[Automatic control/Virtual signals|virtual signal]] channels.<br />
**Note that using two of the 15 slots to broadcast values on the '''same''' channel is the same as broadcasting the sum of the two values from one slot.<br />
<br />
*The [[Arithmetic Combinator]] performs arithmetic operations on input values and broadcasts the result to the specified output channel. The input and output channels can be any item channel or any of the virtual signal channels.<br />
** Connecting: The Arithmetic Combinator connects to a red or green network on its '''input''' side (the terminals are set into the main body and look like spark plugs) and performs an arithmetic calculation which is broadcast into the specified channel on its '''output''' side (the output wires appear to stretch out a bit from the body of the device). <br />
** Feedback: Note that the input network and the output network '''are not the same network'''. Connecting the output network back to the input network will result in a feedback loop. For example, adding 1 to the value for Copper Plates and broadcasting it as Copper Plates is an action that results in an infinite loop if output is connected back to input. The value for Copper Plates will rapidly (but not instantly) shoot upward. This technique can be combined with Decider Combinator logic to make electronic clocks, gates, and other systems; see [[Combinator Tutorial]] for advanced techniques.<br />
** Each: This combinator can use the 'Each' signal for both input and output, in which case '''all''' non-zero input channels will have the combinator's operation performed and broadcast on the output side. Having Each signals for input and output and using a non-changing operation (like adding zero) is equivalent to having a 'one-way' wire; all the information from the input network is copied to the output network, but the reverse is not true.<br />
**Multi-network: The Arithmetic Combinator can be joined to both red and green networks on the input side and will sum their inputs.<br />
<br />
*The [[Decider Combinator]] functions much like an Arithmetic Combinator, but is designed to compare values. In terms of Connecting, Feedback, and the Each signal it functions as specified above. In addition, it can handle the Everything and Anything signals, and performs more complex functions than summing when attached to multiple networks. See the [[Decider Combinator]] page for more details on how to use this.<br />
<br />
== Logistic Network ==<br />
The Logistic network used by [[Logistic robot|Logistic Robots]] is essentially a third network (a wireless one), along with the green and red wired network. The Logistic Network is based on proximity to a central [[Roboport]].<br />
<br />
Some devices can also be connected to the logistic network. If a device has conditions set for circuit and for logistic network, it will become activated if both conditions are true.<br />
<br />
See [[Logistic network]] for more information.<br />
<br />
== [[Automatic_control/Devices|Items/Devices]] ==<br />
In v0.13 the factorio developers made many devices connectable to the circuit network, so there are many possibilities to control and program your factory based on conditions.<br />
<br />
=== Examples (0.14.x) ===<br />
[[Circuit-network_Cookbook]]<br />
<br />
=== Examples (''outdated'') ===<br />
* [http://www.factorioforums.com/forum/viewtopic.php?f=5&t=3149 Forum article about the basic usage]<br />
* [http://www.factorioforums.com/forum/viewtopic.php?f=9&t=696&p=24183#p24183 About comparison of the circuit wires with examples from the real world]* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=348 Logic Gates, Edge Detector]<br />
* [http://www.factorioforums.com/forum/viewtopic.php?f=6&t=4728&p=37251#p37157 Logic gates revisited]<br />
* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=3211&p=23692#p23676 Evenly fill two item onto one lane]<br />
* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=298 Material splitters]<br />
* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=6839 Logic gates using side inserter mod]<br />
<br />
== See also ==<br />
* [[Circuit network (research)]]<br />
* [[Transport network]]<br />
* [[Combinators]]<br />
* [[Automatic control/Virtual signals]]<br />
<br />
[[Category: Networks]] [[Category: Circuit network]] [[Category: Transport network]]</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133170Tutorial:Circuit network cookbook2016-11-27T15:28:05Z<p>Stevetrov: /* Backup steam power */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[Basic inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tank]]s.<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wire]]s join the output of the [[Arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[stack filter inserter]]. <br />
* The [[Arithmetic combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the [[stack filter inserter]] is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engine]]s are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumulator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumulator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133169Tutorial:Circuit network cookbook2016-11-27T15:27:31Z<p>Stevetrov: /* Keeping outpost stocked with specified items */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[Basic inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tank]]s.<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wire]]s join the output of the [[Arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[stack filter inserter]]. <br />
* The [[Arithmetic combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the [[stack filter inserter]] is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engines]] are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumalator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumalator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133168Tutorial:Circuit network cookbook2016-11-27T15:26:56Z<p>Stevetrov: /* Keeping outpost stocked with specified items */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[Basic inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tank]]s.<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wire]]s join the output of the [[Arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[filter stack inserter]]. <br />
* The [[Arithmetic combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the [[filter stack inserter]] is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engines]] are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumalator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumalator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133167Tutorial:Circuit network cookbook2016-11-27T15:26:43Z<p>Stevetrov: /* Keeping outpost stocked with specified items */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[Basic inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tank]]s.<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wires]] join the output of the [[Arithmetic combinator]] (right side) to the [[constant combinator]] and to the [[filter stack inserter]]. <br />
* The [[Arithmetic combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the [[filter stack inserter]] is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engines]] are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumalator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumalator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133166Tutorial:Circuit network cookbook2016-11-27T15:25:57Z<p>Stevetrov: /* Multiple Storages */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[Basic inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tank]]s.<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetric combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wires]] join the output of the [[Arithmetric combinator]] (right side) to the [[constant combinator]] and to the [[filter stack inserter]]. <br />
* The [[Arithmetric combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the filter stack inserter is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engines]] are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumalator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumalator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133165Tutorial:Circuit network cookbook2016-11-27T15:25:42Z<p>Stevetrov: /* Petroleum split evenly between plastic and sulphuric acid */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[Basic inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tanks]].<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetric combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wires]] join the output of the [[Arithmetric combinator]] (right side) to the [[constant combinator]] and to the [[filter stack inserter]]. <br />
* The [[Arithmetric combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the filter stack inserter is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engines]] are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumalator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumalator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133164Tutorial:Circuit network cookbook2016-11-27T15:25:14Z<p>Stevetrov: /* Light Oil Cracking */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[basic inserters]] are connected to the [[Storage tank]] by [[Red Wires]]. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tanks]].<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetric combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wires]] join the output of the [[Arithmetric combinator]] (right side) to the [[constant combinator]] and to the [[filter stack inserter]]. <br />
* The [[Arithmetric combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the filter stack inserter is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engines]] are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumalator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumalator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133163Tutorial:Circuit network cookbook2016-11-27T15:24:59Z<p>Stevetrov: </p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs and some not so simple that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The [[Small pump]] is connected to the [[Storage tank]] by a [[Red Wire]]. <br />
*The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the [[Small pump]] is connected to the [[Wooden chest]] by a [[Red wire]] and the enabled condition on the [[Small pump]] is set to '''Raw wood > 0'''.<br />
*Both of the [[basic inserters]] are connected to the [[Storage tank]] by [[Red Wires]]. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with [[decider combinator]]s instead of the inserters, belt and the Wood chest or even just belts.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].<br />
*By setting different conditions on each [[lamp]] we can build an indicator strip. <br />
*The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a [[lamp]] with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas signal into a pink signal. <br />
*We can do this with an [[Arithmetic combinator]], setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with [[Storage tanks]].<br />
*and [[roboport]]s<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
=== Constant combinator ===<br />
*With a [[constant combinator]] you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two [[Constant combinator]]s each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use [[Decider combinator]]s to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use [[Constant combinator]]s to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell / Counter ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the [[Fast inserter]] hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]]. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a [[Storage chest]] at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The [[storage chest]] is attached to the input of the [[Arithmetric combinator]] (left side in the picture) with a [[Red wire]]. <br />
* Another couple of [[Red wires]] join the output of the [[Arithmetric combinator]] (right side) to the [[constant combinator]] and to the [[filter stack inserter]]. <br />
* The [[Arithmetric combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the filter stack inserter is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This [[Red wire]] is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right [[Arithmetic combinator]] is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left [[Arithmetic combinator]]. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The [[steam engines]] are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The [[power switch]] is connected to one of the [[accumalator]]s in the main network. <br />
*The [[power switch]] turns on when A < 10. That is when the [[accumalator]]s are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133162Tutorial:Circuit network cookbook2016-11-27T15:12:45Z<p>Stevetrov: /* Numerical Display */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The Small pump is connected to the Storage tank by a Red Wire. <br />
*The small pump has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The Small pump has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the Small pump is connected to the Wooden chest by a Red wire and the enabled condition on the Small pump is set to '''Raw wood > 0'''.<br />
*Both of the basic inserters are connected to the Storage tank by Red Wires. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with combinators instead of the inserters, belt and the Wood chest.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of lights to a Storage Tank.<br />
*By setting different conditions on each light we can build an indicator strip. <br />
*The Enabled condition of the first light is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a lamp with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas singal into a pink signal. <br />
*We can do this with an Arithmetic combinator, setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with Storage tanks.<br />
*and roboports<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
=== Constant combinator ===<br />
*With a constant combinator you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two constant combinators each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use decider combinators to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use constant combinators to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The Fast inserter is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the fast inserter hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the fast inserter does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The Basic inserter is connected to the Wooden chest using a Red wire. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a storage chest at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The storage chest is attached to the input of the Arithmetric combinator (left side in the picture) with a Red wire. <br />
* Another couple of Red wires join the output of the Arithmetric combinator (right side) to the constant combinator and to the filter stack inserter. <br />
* The Arithmetric combinator '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the filter stack inserter is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This Red wire is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left Arithmetic combinator multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right Arithmetic combinator is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left Arithmetic combinator. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The steam engines are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The power switch is connected to one of the accumalators in the main network. <br />
*The power switch turns on when A < 10. That is when the accumalators are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the constant combinators on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
*Blueprint string indcluding decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]<br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133161Tutorial:Circuit network cookbook2016-11-27T15:08:22Z<p>Stevetrov: /* Displays */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The Small pump is connected to the Storage tank by a Red Wire. <br />
*The small pump has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The Small pump has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the Small pump is connected to the Wooden chest by a Red wire and the enabled condition on the Small pump is set to '''Raw wood > 0'''.<br />
*Both of the basic inserters are connected to the Storage tank by Red Wires. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with combinators instead of the inserters, belt and the Wood chest.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of lights to a Storage Tank.<br />
*By setting different conditions on each light we can build an indicator strip. <br />
*The Enabled condition of the first light is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a lamp with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas singal into a pink signal. <br />
*We can do this with an Arithmetic combinator, setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with Storage tanks.<br />
*and roboports<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
=== Constant combinator ===<br />
*With a constant combinator you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two constant combinators each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use decider combinators to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use constant combinators to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The Fast inserter is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the fast inserter hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the fast inserter does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The Basic inserter is connected to the Wooden chest using a Red wire. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a storage chest at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The storage chest is attached to the input of the Arithmetric combinator (left side in the picture) with a Red wire. <br />
* Another couple of Red wires join the output of the Arithmetric combinator (right side) to the constant combinator and to the filter stack inserter. <br />
* The Arithmetric combinator '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the filter stack inserter is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This Red wire is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left Arithmetic combinator multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right Arithmetic combinator is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left Arithmetic combinator. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The steam engines are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The power switch is connected to one of the accumalators in the main network. <br />
*The power switch turns on when A < 10. That is when the accumalators are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the constant combinators on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png|left]]<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=Tutorial:Circuit_network_cookbook&diff=133160Tutorial:Circuit network cookbook2016-11-27T15:08:08Z<p>Stevetrov: /* Displays */</p>
<hr />
<div>== Introduction == <br />
<br />
This page provides examples of simple circuit network designs that others can use, combine and modify. They are designed to be as easy to understand as possible.<br />
<br />
Some of these designs are mine and some are based on ones I have seen on the forums or Reddit.<br />
<br />
If you wish to make a suggestion please reply to my post on reddit. https://www.reddit.com/r/factorio/comments/5e6b5n/circuitnetwork_cookbook/<br />
<br />
== Change log ==<br />
27/10/2016 - Added:<br />
<br />
*Steam backup power<br />
*Priority splitter<br />
*More latches<br />
*Displays<br />
<br />
== Oil Setups ==<br />
[[File:LgtOilCracking.png|left]]<br />
=== Light Oil Cracking ===<br />
*This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas. <br />
*The Small pump is connected to the Storage tank by a Red Wire. <br />
*The small pump has an enabled condition set to '''Light Oil > 2000'''.<br />
{{clear}}<br />
<br />
[[File:HvyOilCracking.png|left]]<br />
=== Heavy Oil Cracking ===<br />
*This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.<br />
*The Small pump has an enabled condition set to '''Heavy oil > 2000'''.<br />
{{clear}}<br />
<br />
[[file:BalancedPlasticSulfur.png|left]]<br />
<br />
=== Petroleum split evenly between plastic and sulphuric acid ===<br />
*This circuit buffers gas in the tank until there is at least 100, then it lets the tank drain until there is less than 50 and the cycle repeats.<br />
*It has a few elements that work together to do achieve this. <br />
*Firstly the Small pump is connected to the Wooden chest by a Red wire and the enabled condition on the Small pump is set to '''Raw wood > 0'''.<br />
*Both of the basic inserters are connected to the Storage tank by Red Wires. <br />
*The enabled condition on the left inserter is '''Petroleum gas > 100''' <br />
*The enabled condition on the right inserter is '''Petroleum gas < 50'''. <br />
*You will need to insert a single "Raw wood" into the chest to make it all work. <br />
*<br />
*It is also possible to do this with combinators instead of the inserters, belt and the Wood chest.<br />
{{clear}}<br />
<br />
== Lights ==<br />
[[File:ConditionalLights.png|left]]<br />
=== Conditional Lights ===<br />
*In this circuit we connect a series of lights to a Storage Tank.<br />
*By setting different conditions on each light we can build an indicator strip. <br />
*The Enabled condition of the first light is '''Petroleum gas > 100'''.<br />
*The others light up when gas is greater than 200, 300, 400 & 500 respectively.<br />
{{clear}}<br />
<br />
[[File:ColoredLights.png|left]]<br />
<br />
=== Colored Lights ===<br />
*To light a lamp with a color rather than white, you need to do two things. <br />
*1. Send a colored signal to the lamp <br />
*2. Select the "Use colors" checkbox on the lamp. <br />
*In this case we want to convert a Petroleum gas singal into a pink signal. <br />
*We can do this with an Arithmetic combinator, setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0) and set the output to the Pink signal (on the bottom row of the last tab of signals.)<br />
{{clear}}<br />
<br />
== Misc ==<br />
[[file:MulitipleChestsAndPoles.png|left]]<br />
=== Multiple Storages === <br />
*If you connect multiple chests to a pole, the pole displays the sum of items in all the chests. <br />
*This also works with Storage tanks.<br />
*and roboports<br />
{{clear}}<br />
<br />
[[File:ConstantComb.png|left]]<br />
=== Constant combinator ===<br />
*With a constant combinator you can generate any signals you my need. <br />
*In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine. <br />
*Constant combinators are not of much use on their own but we shall use them later.<br />
{{clear}}<br />
<br />
[[file:LogicGates.png|left]]<br />
=== Logic gates ===<br />
*In each case the the two inputs can be connected with the same color wire or different colors. The inputs are powered by two constant combinators each of them output an A signal with value 1 for true and nothing or false.<br />
*You can use decider combinators to make all of the common logic gates.<br />
*The output for each should be set to 1 and the signal of your choice.<br />
*Use the following settings to create different gates<br />
NOT A=0<br />
NOR A=0<br />
NAND A<2<br />
XOR A=1<br />
AND A=2<br />
OR A>0<br />
{{clear}}<br />
<br />
[[File:ThisASign.png|left]]<br />
<br />
=== Constant combinator signs ===<br />
*You can use constant combinators to make signs.<br />
*just set the letter signals in the combinator, each combinator can display 2 characters side by side.<br />
{{clear}}<br />
<br />
[[File:MemoryCell.png|left]]<br />
<br />
=== Memory Cell ===<br />
*Basic memory cell that counts all the items moved by the inserter<br />
*The Fast inserter is connected to '''BOTH''' ends of the arithmetic combinator. <br />
*<br />
*If the fast inserter hasn't picked anything up this tick the input to the Arithmetic combinator is the same as and output and hence the values are persisted. <br />
*When the fast inserter does pick something up its value is added to the output from the previous tick thus incrementing that item. <br />
{{clear}}<br />
<br />
== Inserters ==<br />
[[File:LimitItemsPlacedIntoAChest.png|left]]<br />
=== Limit items placed into a chest ===<br />
* The Basic inserter is connected to the Wooden chest using a Red wire. <br />
* The inserter's enabled condition is '''Advanced Circuit < 10'''. <br />
* In reality this means the inserter may place more than 10 Advanced circuits in the chest because it could pick up-to 3 at once. <br />
* This effect can be even greater with Stack inserters because of their large carrying capacity. <br />
* This technique still gives far greater control than limiting the inventory on the chest.<br />
{{clear}}<br />
<br />
[[File:SmartOutpostUnloader.png|left]]<br />
=== Keeping outpost stocked with specified items ===<br />
* This circuit keeps a storage chest at an outpost stocked with customised levels of different items. <br />
* For example you could keep an outpost stocked with 50 laser turrets and 200 piercing magazine rounds but not have to worry about it being over filled. <br />
* The storage chest is attached to the input of the Arithmetric combinator (left side in the picture) with a Red wire. <br />
* Another couple of Red wires join the output of the Arithmetric combinator (right side) to the constant combinator and to the filter stack inserter. <br />
* The Arithmetric combinator '''multiples''' each input value (from the storage chest) by '''-1'''. <br />
* Finally the filter stack inserter's mode of operation is set to '''Set filters'''.<br />
*<br />
* So the input to the filter stack inserter is '''<Constant combinator> - <Storage chest contents>''' and the filter is set to filter the item of greatest demand. <br />
{{clear}}<br />
<br />
<br />
[[File:SolarAccumalatorBalancer.png|left]]<br />
<br />
=== Balanced Solar panel / Accumulator Production ===<br />
*This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.<br />
*The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''. <br />
*The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''. <br />
*This gives us the a number of accumulators that we can directly compare to the number of Solar panels in both inserters. <br />
*If the number of accumulators is greater we enable the Solar panels inserter, if the number of Solar panels is greater we enable the accumulators inserter. <br />
*However, if they are equal neither machine does anything. So we add a single accumulator to one of the inserters using a constant combinator and a wire of the other color thus breaking the deadlock.<br />
{{clear}}<br />
<br />
== Sushi Belts ==<br />
[[File:SushiScience1.png|left]]<br />
=== Reading Belt Design ===<br />
*Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold''' <br />
*This Red wire is then connected to the inserters that insert onto the belt. <br />
*Read hand contents is unselected for all inserters.<br />
*Mode of operation is set to '''Enable/Disable''' on all inserters. <br />
*The first inserter is enabled when '''Science pack 1 = 0'''<br />
*The other inserters are set similarly for the other science packs. <br />
{{clear}}<br />
<br />
[[File:SushiScience2.png|left]]<br />
=== Memory Cell Design ===<br />
*This circuit counts the number of items of each type on a looping belt by counting the numbers that are added and removed from the belt by inserters.<br />
*Each inserter that takes items off the belt is connected together with Red wire and each of these inserters is set to '''Mode of operation none, Read hand content selected''' and '''Hand read mode pulse'''. <br />
*These inserters are connected to the input of the left arithmetic combinator. <br />
*The left Arithmetic combinator multiples '''each''' input by '''-1''' and outputs it to '''each'''. <br />
*The right Arithmetic combinator is a '''memory cell''' as above.<br />
*The memory cell's input is connected to the inserters that are placing items on the belt and the output of the left Arithmetic combinator. <br />
*The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.<br />
{{clear}}<br />
<br />
== Splitters ==<br />
[[file:CondSplitter.png|left]]<br />
=== Conditional splitter ===<br />
*This is the most simple circuit you can have for "controlling" a splitter.<br />
*A signal X=1 is transmitted from off screen when the items need to be sent down the belt.<br />
*The belt on the left is enabled when X=1.<br />
*The belt on the right is enabled when X=0.<br />
*The two belts are wired together and to a pole. <br />
{{clear}}<br />
<br />
[[File:PrioritySplitter.png|left]]<br />
=== Priority Splitter ===<br />
*This circuit prioritises items to the belt going of the screen to the left but will send items straight on if the belt to the left is backedup up.<br />
*Its not perfect and will leak some items but its good enough for most applications. <br />
*The balancer means it will work even if the supply or demand is uneven. <br />
*<br />
*It is critical that the belts are setup as in this picture otherwise it may not work. <br />
{{clear}}<br />
<br />
== Power ==<br />
[[File:SteamBackup.png|left]]<br />
=== Backup steam power ===<br />
*The steam engines are not directly connected to the power network. They are connected to the power network through a [[Power switch]]. <br />
*The power switch is connected to one of the accumalators in the main network. <br />
*The power switch turns on when A < 10. That is when the accumalators are less than 10% full.<br />
{{clear}}<br />
<br />
== Latches ==<br />
[[File:SRLatch.png|left]]<br />
=== SR latch ===<br />
*This should be familiar to anyone with any background in electronics. <br />
*The signal is set and reset with the constant combinators on the left by setting an A=1 signal. <br />
*The latch "remembers" which one was last set and the light stays on until another signal is received.<br />
{{clear}}<br />
<br />
[[File:SRlatchinaction.png|left]]<br />
=== Usage of SR latch ===<br />
*Here is an example of how you could use an SR latch.<br />
*The two extra [[Decider combinator]]s provide the set and reset conditions. <br />
*Petroleum gas < 50 and petroleum gas > 100. <br />
{{clear}}<br />
<br />
[[File:BeltLatch.png|left]]<br />
=== Belt only latch ===<br />
*This is the most compact latch I am aware of. <br />
*To make it work you need to place '''3''' raw wood on the inside lane of the belt.<br />
*I believe it will have higher latency than the combinator version but in most situations you will not notice the difference. <br />
{{clear}}<br />
<br />
== Displays ==<br />
[[File:5digitDisplay.png|left]]<br />
=== Numerical Display ===<br />
*Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.<br />
*[[Constant combinator]]s are used to define which lamp should light up for each value. <br />
{{clear}}<br />
<br />
[[File:BWDisplay.png|left]]<br />
=== Black and White Grid Display ===<br />
*Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.<br />
*We turn each light on by just setting or clearing the relevant signal.<br />
{{clear}}<br />
<br />
[[File:MultiColoredDisplay.png<br />
=== Multicolor Display by DaveMcW ===<br />
*To understand how this works, you first need to understand how color lights choose which color to light up when there are multiple colored signals. <br />
*The [[lamp]] will light up with the colored signal that is greater than zero and earliest in this list: Red, Green, Blue, Yellow, Pink, Cyan, White. <br />
*We have a [[Red wire]] per column, that wire has each of the colored signals on it at different values and a numbered signal for each row. <br />
*There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals. <br />
*And this enables us to choose the color for each cell. <br />
*Simple!<br />
{{clear}}</div>Stevetrovhttps://wiki.factorio.com/index.php?title=File:MultiColoredDisplay.png&diff=133159File:MultiColoredDisplay.png2016-11-27T14:59:08Z<p>Stevetrov: </p>
<hr />
<div></div>Stevetrov