In other languages: Deutsch Español 日本語 Русский 简体中文

Tutorial:Circuit network cookbook: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Added multiple item assembler circuit diagram)
 
(135 intermediate revisions by 33 users not shown)
Line 1: Line 1:
{{cleanup|Combinator GUI and circuit network changed in 2.0}}
''This is a '''beginners''' tutorial. See also the [[Circuit network]] page for an overview over the circuit network and the [[Tutorial:Combinator tutorial]] for an advanced tutorial.''
{{Languages}}
== Foreword ==  
== Foreword ==  
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 in "Alt-mode"" in the Interface/Alt-mode settings has to be checked and "Alt-mode" has to be turned on.
== Lights ==
[[File:LightWiredToChest.png|border|left|430px]]
=== Lamp showing chest content condition ===
This is one of 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.
==== Setting up circuit connection ====
<div style="margin-left:440px;">
* The lamp is connected to the chest.
* The lamp is set to light if the chest contain less than 10 empty barrels.
==== To set the light condition ====
* Open the lamp (left click on it).
* Set the input to barrels.
* Set the operator to < (less than).
* Set the constant number:
** Left click on the constant number
** Move the slider until 10 is shown, or edit the value box directly.
** Press set.
Depending on the condition you set, the lamp may light if the chest is empty, or if it contains the required quantity of items.
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.
</div>
{{clear}}
[[File:ConditionalLights.png|border|left|430px]]
=== Conditional Lights ===
<div style="margin-left:440px;">
* In this circuit we connect a series of [[lamp]]s to a [[storage tank]].
* By setting different conditions on each lamp we can build an indicator strip.
* The Enabled condition of the first lamp is '''Petroleum gas > 100'''.
* The others light up when gas is greater than 200, 300, 400 and 500 respectively.
In this setup you can connect the storage tank to the lamps directly.
</div>
{{clear}}


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.
[[File:ColoredLights.png|border|left|430px]]
 
=== Colored Lights ===
<div style="margin-left:440px;">
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. 
Instead of directly connect the [[lamp]] and the [[Storage tank]] you need:
# Add the arithmetic combinator.
# Connect the [[storage tank]] with the input of the  arithmetic combinator.
# Connect the  output of the [[arithmetic combinator]] with the lamp.
# Set up the arithmetic combinator:
## Setting the input to petroleum Gas + 0 (the constant 0 not the signal 0)
## Set the output to the pink signal (on the bottom row of the last tab of signals.)
# Set up the [[lamp]]:
##  Select the "Use colors" check box on the lamp.
## Set the condition to the pink signal, and what value you want (i.e. > 100)
</div>
{{clear}}


== Oil Setups ==
== Oil Setups ==
[[File:LgtOilCracking.png|left|400x400px]]
Balancing the production of petroleum gas, light oil and heavy oil is one of the most important use cases of the circuit network.
 
[[File:LgtOilCracking.png|border|left|430px]]
 
=== Light Oil Cracking ===
=== Light Oil Cracking ===
<div style="margin-left:440px;">
* This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas.  
* This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas.  
* The [[Small pump]] is connected to the [[Storage tank]] by a [[Red wire]].  
* The [[pump]] is connected to the [[storage tank]] by a [[red wire]].  
* The [[small pump]] has an enabled condition set to '''Light Oil > 2000'''.
* The pump has an enabled condition set to '''Light Oil > 20000'''.
</div>
{{clear}}
{{clear}}


[[File:HvyOilCracking.png|left|400x400px]]
[[File:HvyOilCracking.png|border|left|430px]]


=== Heavy Oil Cracking ===
=== Heavy Oil Cracking ===
<div style="margin-left:440px;">
* This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.
* This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.
* The [[Small pump]] has an enabled condition set to '''Heavy oil > 2000'''.
* The pump has an enabled condition set to '''Heavy oil > 20000'''.
{{clear}}
</div>
 
[[file:BalancedPlasticSulfur.png|left|400x400px]]
 
=== Petroleum split evenly between plastic and sulphuric acid ===
* 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.
* It has a few elements that work together to do achieve this.
* 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'''.
* Both of the [[Basic inserter]]s are connected to the [[Storage tank]] by [[Red wire]]s.
* The enabled condition on the left inserter is '''Petroleum gas > 100'''
* The enabled condition on the right inserter is '''Petroleum gas < 50'''.
* You will need to insert a single "Raw wood" into the chest to make it all work.  
<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.
{{clear}}
{{clear}}


== Lights ==
=== Alternative Setup for Cracking and Lubricant Production ===
[[File:ConditionalLights.png|left|400x400px]]
This setup compares different fluid levels to each other instead of checking fixed values. It offers some guarantees such as petroleum gas being produced when you have light oil to spare, and light oil not being cracked when you have plenty of petroleum gas, and similar rules for heavy oil cracking and lubricant production.  
=== Conditional Lights ===
* In this circuit we connect a series of [[lamp]]s to a [[Storage Tank]].
* By setting different conditions on each [[lamp]] we can build an indicator strip.  
* The Enabled condition of the first [[lamp]] is '''Petroleum gas > 100'''.
* The others light up when gas is greater than 200, 300, 400 and 500 respectively.
{{clear}}


In this scenario you can connect the storage tank to the lamps directly.
[[File:oil-single-cct.png|border|left|430px]]


<div style="margin-left:440px;">
It takes 4 steps:


[[File:ColoredLights.png|left|400x400px]]
# Have a fluid tank for heavy oil, light oil, petroleum gas, and lubricant. For each fluid, make sure to connect the tank via pipes to every location where the fluid is being produced or consumed.
# For each chemical plant (or each row of them, if you use rows) add a pump to the non-water fluid input pipe to make it possible to block the flow. Note: Alternatively, the blocking pumps could be added to the chemical plant output pipes, but there is no need to add pumps to both inputs and outputs.
# Connect every pump and every fluid tank to a single circuit network of red (or green) wire. The resulting circuit network will know about the fluid level in every storage tank and pass this information to every pump.
# For each connected pump set the circuit “enable condition” to "[input fluid] > [output fluid]" , for its respective chemical plant recipe. E.g. set "heavy oil > light oil" for the heavy oil cracking input pump, set "heavy oil > lubricant" for the lubricant production input pump, and set "light oil > petroleum gas" for the light oil cracking input pump.


=== Colored Lights ===
Done! Now all the pumps will move to equalize the fluid levels to each other. This will prevent fluid system deadlocks where you have plenty of one fluid but you are unable to make any of the other.
* 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. 
</div>
Instead of directly connect  the the lamp and the Petroleum Gas container you need:<BR>
1 Create the [[Arithmetic combinator]].<BR>
2 Connect the Petroleum Gas container with the input of the  [[Arithmetic combinator]].<BR>
3 Connect the  output of the Petroleum Gas container with the lamp.<BR>
4 Set up the [[Arithmetic combinator]]:<BR>
4.1 Setting the input to Petroleum Gas + 0 (the constant 0 not the signal 0)<BR>
4.2 Set the output to the Pink signal (on the bottom row of the last tab of signals.)<BR>
5 Set up the [[Lamp]]<BR>
5.1  Select the "Use colors" check box on the lamp.<BR>
5.2 Set the condition to the Pink signal, and what value you want (i.e. > 100)<BR>
{{clear}}
{{clear}}


== Misc ==
== Misc ==
[[file:MulitipleChestsAndPoles.png|left|400x400px]]
[[file:MulitipleChestsAndPoles.png|border|left|430px]]
=== Multiple Storages ===  
 
* If you connect multiple chests to a pole, the pole displays the sum of items in all the chests.  
=== Multiple Storages ===
* This also works with [[Storage tank]]s and [[roboport]]s.
<div style="margin-left:440px;">
* If you connect multiple chests to a pole, the pole displays the sum of items in all the chests.
* This also works with [[storage tank]]s and [[roboport]]s.
</div>
{{clear}}
{{clear}}


[[File:ConstantComb.png|left|400x400px]]
[[File:ConstantComb.png|border|left|430px]]


=== Constant combinator ===
=== Constant Combinator ===
<div style="margin-left:440px;">
* With a [[constant combinator]] you can generate any signals you may need.  
* With a [[constant combinator]] you can generate any signals you may need.  
* In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine.  
* In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine.  
* Constant combinators are not of much use on their own but we shall use them later.
* Constant combinators are not of much use on their own but we shall use them later.
</div>
{{clear}}
{{clear}}


[[File:LogicGates.png|left|400x400px]]
[[File:ThisASign.png|border|left|430px]]


=== Logic gates ===
=== Constant Combinator Signs (Words) ===
* 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.
<div style="margin-left:440px;">
* You can use [[Decider combinator]]s to make all of the common logic gates.
* 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.
* The output for each should be set to 1 and the signal of your choice.
* Note that to see these letters, Alt-mode must be on and the Interface setting “Show combinator settings in “Alt-Mode”” must also be enabled.
* Use the following settings to create different gates:
</div>
{{clear}}
{{clear}}


    NOT  A=0
[[File:constant_combinator_signs2.png|border|left|430px]]
    NOR  A=0
    NAND A<2
    XOR  A=1
    AND  A=2
    OR  A>0


=== Constant Combinator Signs (Managing Belts) ===
<div style="margin-left:440px;">
* Somewhat similar to the previous example, constant combinator signals can be used with belts to help indicate what items should be on which belts. This is extremely useful when sharing blueprints, as it's possible for blueprints to be shared albeit with no indication on which items are meant for which belts.
</div>
{{clear}}
{{clear}}


[[File:ThisASign.png|left|400x400px]]
[[File:MemoryCell.png|border|left|430px]]


=== Constant combinator signs ===
=== Memory Cell / Counter ===
* 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.
<div style="margin-left:440px;">
* Basic memory cell that counts all the items moved by the inserter
* The [[fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator.
* 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.
* When the fast inserter does pick something up its value is added to the output from the previous tick thus incrementing that item.
</div>
{{clear}}
{{clear}}


[[File:MemoryCell.png|left|400x400px]]
== Inserters ==
[[File:LimitItemsPlacedIntoAChest.png|border|left|430px]]


=== Memory Cell / Counter ===
=== Limit items placed into a chest ===
* Basic memory cell that counts all the items moved by the inserter
<div style="margin-left:440px;">
* The [[Fast inserter]] is connected to '''BOTH''' ends of the arithmetic combinator.
* The [[inserter]] is connected to the [[wooden chest]] using a [[red wire]].
 
*  The inserter's enabled condition is '''Advanced Circuit < 10'''.  
* 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.  
* 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.
* When the [[Fast inserter]] does pick something up its value is added to the output from the previous tick thus incrementing that item.  
*  This effect can be even greater with Stack inserters because of their large carrying capacity.  
* This technique still gives far greater control than limiting the inventory on the chest.
</div>
{{clear}}
{{clear}}


[[File:BalancedChestInsert.png|border|left|430px]]


[[File:BeltCache.png|left|400x400px]]
=== Balanced chest insert ===
<div style="margin-left:440px;">
Goal: Load n chests with approximately the same number of items. This can be used for train stations: [https://www.reddit.com/r/factorio/comments/4e03g2/madzuris_smart_loading_train_station_guide/ MadZuri's smart loading train station]
*  Place n chests and n inserters.  
*  Place 1 [[arithmetic combinator]]
*  Set the combinator to take Each (yellow star) and divide by the negative number of chests. ie &minus;n.
*  Connect all chests to each other and to the input of the combinator using red wire.
*  Connect all inserters to each other and to the output of the combinator using red wire.
*  Connect each inserter to the box it inserts into with green wire.
*  Set the enable condition on each inserter to be Everything (red star) < 0.


=== Automatic Belt-Cache ===
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, i.e. 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.  
* Some intermediate products are huge in demand during peak-production only. To bypass the need of providing a huge amount of factories in order to cover that peaks, a cache-unit can be used. The unit stores items, while the belt has backed up (so theres obviously no current demand downstream) and releases items as soon as the belt gets too empty.
* The blue area are 3 parts of Express belts. According to the wiki, each belt can hold up to 7.11 items. This means the feeding fast belt can not provide 7.11 items for the express belts as long as the belt is moving. (And while the belt is moving, we don't want to cache items, but let regular production run, or even release items from the cache.)
* This means, once the counters on the two express belts are 7.11 each, the belt has backed up, so we can start "caching" items into our storage array.  
* For this purpose, the counters are connected to the arithmetic combinator (A) which multiples the input (*100) into green signals. So, if the belt has backed up, B shows ">1422" green signals.
* This is the activation condition for the Belt (C), which will redirect the input tp the storage array.
* Since items should only be released if the belt starts to clear, the counter (D) is evaluated by the belt (E) which is only activated, if item-count on (D) is smaller than 6 (this number has to be adjusted to personal needs, when the cache should become "active" and release items)
* The layout can be extended to cache whatever amount of items is required. (Some balancing for the release-method would be required ofc.)


Due to inserter stack bonus the count is not exact. If a precise count is needed, set the inserter stack size to 1.
</div>
{{clear}}
{{clear}}


== Inserters ==
[[File:SmartOutpostUnloader.png|border|left|430px]]
[[File:LimitItemsPlacedIntoAChest.png|left|400x400px]]
=== Limit items placed into a chest ===
*  The [[Basic inserter]] is connected to the [[Wooden chest]] using a [[Red wire]].
*  The inserter's enabled condition is '''Advanced Circuit < 10'''.
*  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.
*  This effect can be even greater with Stack inserters because of their large carrying capacity.
*  This technique still gives far greater control than limiting the inventory on the chest.
{{clear}}


[[File:SmartOutpostUnloader.png|left|400x400px]]
=== Keeping outpost stocked with specified items ===
=== Keeping outpost stocked with specified items ===
*  This circuit keeps a [[Storage chest]] at an outpost stocked with customized levels of different items.  
<div style="margin-left:440px;">
*  This circuit keeps a [[storage chest]] at an outpost stocked with customized levels of different items.  
*  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.  
*  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.  
*  The [[storage chest]] is attached to the input of the [[Arithmetic combinator]] (left side in the picture) with a [[Red wire]].  
*  The [[storage chest]] is attached to the input of the [[arithmetic combinator]] (left side in the picture) with a [[red wire]].  
*  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]].  
*  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]].  
*  The [[Arithmetic combinator]] '''multiples''' each input value (from the storage chest) by '''-1'''.  
*  The [[arithmetic combinator]] '''multiplies''' each input value (from the storage chest) by '''-1'''.  
*  Finally the filter stack inserter's mode of operation is set to '''Set filters'''.
*  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 for the first item by inventory order.
*  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.  
</div>
{{clear}}
{{clear}}


 
[[File:SolarAccumalatorBalancer.png|border|left|430px]]
[[File:SolarAccumalatorBalancer.png|left|400x400px]]


=== Balanced Solar panel / Accumulator Production ===
=== Balanced Solar panel / Accumulator Production ===
* This circuit balances production of [[Solar panel]]s and [[Accumulator]]s to a desired ratio in my case 24:20.
<div style="margin-left:440px;">
* The first [[Arithmetic combinator]] takes the number of accumulators in the chest and '''multiples''' it by '''24'''.  
* This circuit balances production of [[solar panel]]s and [[accumulator]]s to a desired ratio in my case 24:20.
* The second [[Arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''.  
* The first [[arithmetic combinator]] takes the number of accumulators in the chest and '''multiplies''' it by '''24'''.  
* The second [[arithmetic combinator]] takes the output of the first combinator and '''divides''' it by '''20'''.  
* This gives us the number of accumulators that we can directly compare to the number of Solar panels in both inserters.  
* This gives us the number of accumulators that we can directly compare to the number of Solar panels in both inserters.  
* 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.  
* 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.  
* 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.
* 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.
</div>
{{clear}}
{{clear}}


== Sushi Belts ==
== Sushi Belts ==
[[File:SushiScience1.png|left|400x400px]]
[[File:SushiScience1.png|border|left|430px]]
 
=== Reading Belt Design ===
=== Reading Belt Design ===
<div style="margin-left:440px;">
* Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold'''  
* Six belts in a row are connected with Red wire and set to '''Read belts contents''' and '''Hold'''  
* This [[Red wire]] is then connected to the inserters that insert onto the belt.  
* This [[red wire]] is then connected to the inserters that insert onto the belt.  
* Read hand contents is unselected for all inserters.
* Read hand contents is unselected for all inserters.
* Mode of operation is set to '''Enable/Disable''' on all inserters.  
* Mode of operation is set to '''Enable/Disable''' on all inserters.  
* The first inserter is enabled when '''Science pack 1 = 0'''
* The first inserter is enabled when '''Automation science pack = 0'''
* The other inserters are set similarly for the other science packs.  
* The other inserters are set similarly for the other science packs.
</div>
{{clear}}
{{clear}}


[[File:SushiScience2.png|left]|400x400px]]
[[File:SushiScience2.png|border|left|430px]]
 
=== Memory Cell Design ===
=== Memory Cell Design ===
* 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.
<div style="margin-left:440px;">
* 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'''.  
* This recipe produces a rolling sum of the number of items of each type, as they added or removed from a looping conveyor belt. Inserters placing items onto the belt can use this sum to turn on or off as needed.
* These inserters are connected to the input of the left arithmetic combinator.  
* It achieves this through two networks, one red (subtraction) and one green (addition), connected to their own inserters, and two arithmetic combinators: one basic [[arithmetic combinator]] to do the subtraction, and one memory cell, to update and persist the values.
* The left [[Arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''.  
&nbsp;
* The right [[Arithmetic combinator]] is a '''memory cell''' as above.
* Each inserter that takes items '''from''' the belt is connected with Red wire. Each of these inserters is set to '''Mode of operation: None''', '''Read hand contents is checked''', and Hand read mode is set to '''Pulse''' (sends 1 each time an item is picked up).  
* 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]].  
* These red wire inserters are connected to the input of the subtraction arithmetic combinator, in this example, it is the one on the left.
* The inserters that place items onto the belt have an enabled condition that is based on the number of items on the belt.
* The left [[arithmetic combinator]] multiples '''each''' input by '''-1''' and outputs it to '''each'''. This subtracts 1 each time an inserter removes an item from the belt, for the specific type of item taken.
* The right [[arithmetic combinator]] is the '''memory cell'''.
* The memory cell's input is connected to: 1. A green wire network of inserters placing items onto the belt (the addition), 2. The output of the left [[arithmetic combinator]] (the subtraction).
* The memory cell's output should be connected to its input, so that each time an update is sent from either the addition network (green wire) or subtraction network (red wire), the updated value is persisted.
* When a Green wire inserter adds an item to the belt, that item's count in the memory cell is increased by 1.
* The inserters that place items onto the belt (green wire) should be set to: '''Enable/disable''', '''Read hand contents is checked''' and '''Hand read mode is set to Pulse'''.
* The '''Enable/disable''' condition is set based on the number of items you'd like picked up by the red wire inserters, e.g. Automation science pack <= 16 (one pack for each lab in the example shown here).
</div>
{{clear}}
{{clear}}


== Splitters ==
== Power ==
[[file:CondSplitter.png|left|400x400px]]
[[File:SteamBackup.png|border|left|430px]]
=== Conditional splitter ===
 
* This is the most simple circuit you can have for "controlling" a splitter.
=== Backup steam power ===
* A signal X=1 is transmitted from off screen when the items need to be sent down the belt.
<div style="margin-left:440px;">
* The belt on the left is enabled when X=1.
* The [[steam engine]]s are not directly connected to the power network. They are connected to the power network through a [[power switch]].  
* The belt on the right is enabled when X=0.
* The [[power switch]] is connected to one of the [[accumulator]]s in the main network.  
* The two belts are wired together and to a pole.
* The [[power switch]] turns on when A < 10. That is when the [[accumulator]]s are less than 10% full.
</div>
{{clear}}
{{clear}}


[[File:PrioritySplitter.png|left|400x400px]]
=== Optimal usage of fuel for nuclear power ===
=== Priority Splitter ===
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.
* This circuit prioritizes items to the belt going of the screen to the left but will send items straight on if the belt to the left is backed up.
 
* Its not perfect and will leak some items but its good enough for most applications.  
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.
* The balancer means it will work even if the supply or demand is uneven.  
 
<br />
[[File:NuclearCircuits.png|border|left|430px]]
* It is critical that the belts are setup as in this picture otherwise it may not work.  
<div style="margin-left:440px;">
This picture shows a setup with 4 reactors, that spend only 1 fuel cell each whenever steam runs low.<br>
''Note: The GUI in the image above has been altered to make sure all important info fits within the image size.''
 
There are a few elements in this setup:
* 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.
* Chests containing [[uranium fuel cell]]s for the reactor.
* Output inserter that takes [[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).
* Input inserter that put uranium fuel cells into the reactor. This is connected to the output inserter 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.
* If you are using multiple reactors you should only wire one output inserter to one steam tank, and then connect all input inserters to the single output inserter. This will synchronize fuel insertion to maximize the reactor neighbour heat bonus. The other reactors can have "dumb" output inserters that remove [[Used_up_uranium_fuel_cell|empty fuel cells]] immediately.
 
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.
</div>
{{clear}}
{{clear}}


== Power ==
 
[[File:SteamBackup.png|left|400x400px]]
=== Prioritize usage of uranium towards nuclear fuel production ===
=== Backup steam power ===
Because a continuous supply of [[uranium fuel cell]]s is critical to maintaining a [[nuclear reactor]], the circuit network can be used to set up a system where [[uranium-235]] and [[uranium-238]] are conserved for the production of nuclear fuel before other uses.
* The [[steam engine]]s are not directly connected to the power network. They are connected to the power network through a [[Power switch]].  
 
* The [[power switch]] is connected to one of the [[accumulator]]s in the main network.  
[[File:Nuclear Fuel Circuit Network.png|border|left|430px]]
* The [[power switch]] turns on when A < 10. That is when the [[accumulator]]s are less than 10% full.
<div style="margin-left:440px;">
 
Using a [[splitter]], divert the two types of uranium onto two parallel conveyors, with an [[inserter]] positioned to gather uranium from each conveyor (a [[long-handed inserter]] will be needed for the far belt). Each of these inserters deposits their load into a container, from which two more inserters deliver the contents to an [[assembling machine]] making nuclear fuel. An inserter delivers the produced fuel to a third container, from which inserter(s) delivers the fuel to your nuclear reactor. Wire the two inserters gathering from the conveyors to the container each of them is delivering to, and to the tile of conveyor immediately after the tile the inserter is gathering from. Set each inserter's enable condition to "less than or equal to X amount of uranium", using the appropriate type of uranium the inserter is gathering and X being the number of reserve uranium desired (optimally, one uranium-235 and nineteen uranium-238, the amount needed to produce nuclear fuel; the amount may be increased if a greater stockpile is desired). Set each conveyor's enable condition to "greater than or equal to X amount of uranium" in the same manner. Finally, connect the inserters delivering uranium to the assembly machine up to the container the assembly machine is delivering nuclear fuel to, and set each of their enable conditions to "nuclear fuel = 0 (the enable condition can be set to "less than or equal to X amount of nuclear fuel" if a larger stockpile is desired).
 
This set-up accomplishes the following:
 
* When there is sufficient nuclear fuel and uranium stockpiled, the inserters will deactivate and the conveyors activate, allowing the uranium to continue down the conveyors to other facilities.
* When the nuclear fuel stockpile hits zero (or decreases below the desired amount), the inserters delivering to the assembly machine will activate and deliver uranium to resume production of nuclear fuel until quota is reached again.
* When there is not enough uranium stockpiled to produce a batch of nuclear fuel, the inserters gathering uranium will activate and and resume gathering uranium until they reach their quota. The conveyors carrying uranium will stop past the inserters, cutting off other facilities from that type of uranium until its respective inserter reaches quota.
* The assembly machine will only be provided with uranium when the stockpile of nuclear fuel hits zero (or decreases below the desired amount), preventing over-production of nuclear fuel and thus over-consumption of uranium.
</div>
{{clear}}
{{clear}}
== Railway network ==
=== Set train routing ===
The circuit network can be used to allow deeper micromanagement of [[train]]s. Circuits can be used to adjust train limits for [[Train stop|stops]], effectively disabling a stop when a resource is not available for loading, or if an unloading station already has more than enough of a resource. Note that adjusting train limits runs into fewer problems than fully enabling/disabling stops; see [https://factorio.com/blog/post/fff-361 Friday Facts #361 - Train stop limit, Tips and tricks] and the [[Train stop]] page for additional information about using train limits.
=== Player safety ===
The circuit network can be used to ensure the player's safety when crossing train tracks so they do not get hit. Place [[gate]]s at designated crossing areas and connect an adjacent [[wall]] to [[rail signal]]s near the gate. Set the gate to "read sensor" and the signal to "close signal" with the condition being the signal the gate sends out being "1". This means that when the gate is closed, the signal will be green and trains can pass freely, but when the player approaches the gate and it opens for them, the train signal will be turned red and trains will be stopped until the player clears the area.
Alternatively, this system can be reversed - by setting the gate to "open gate" and the train signal set to "read signal", the gate will remain open normally and will close when a train is approaching, preventing the player from crossing until it is safe.
In lieu of gates, the player can connect a [[programmable speaker]] to the train signals to broadcast a warning siren when a train is approaching the area.


== Latches ==
== Latches ==
[[File:SRLatch.png|left|400x400px]]
=== RS latch - single decider version ===
=== SR latch ===
[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 later a [https://forums.factorio.com/viewtopic.php?p=111192#p111192 single decider version was proposed]. The thread [https://forums.factorio.com/viewtopic.php?p=160896#p160896 goes on to explain] why this 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.
 
==== Backup steam example ====
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%.
 
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).
[[File:SR-01-Layout.png|850px|left]]
{{clear}}
{{BlueprintString|bp-string=0eNrFVk1vozAQ/SuVz1ABCaRBq5WqXntKjqsKOTBJR8IGGTtpFPHfd+w0HyU0G6pVewkxnnmemfdmzI4tSgO1QqlZumOYV7Jh6Z8da3AleWnf6W0NLGVrVNrQG49JLuyLvYU/Z63HUBbwxtKw9QZ4zs48o15P1CBObgXkWIDy80osUHJdqTOAUfviMZAaNcI+A7fYZtKIBSiK7YgjoEAjfCgh1wpzv65KoFPqqiHnStrzCdAPA49t6Rm1NrYOWjQY7QrY6FQZwcvyX1jJFajxEYrnuRGmdGW6DCe+jx1KcB9TDYl1raoyW8ArXyM5kFVldG10djObj6zdI0kKHp2Mdiy0PysFIM8pwYKldHyOKjeo3TI8y8Wup93tl7Yv3fiaOC6zjt6z9uk4VqDaR+rY7CvBO2ZGewUec1qiaobVxaE3mtseiwK7EjVXLsaU/SKPobWe7zHrLYVmpM6WqhIZSsJg6ZKXDQyiYkzF9Vhk9xUU3d3kNiaSQUwEB/l9Hw+uZg1YjGzYiPpA1+/vpKuHjk7fRNf7JrJTsZf05MLwoIFbzLvtOvlEFZNjKepqQ5poNqjz10s9jA6N+fk8Ohx/FMFXNXDqxeCC20F901vCJxN07UjVG9K4+x9YQp5M2LUZfbTpq+XDKRsNnG4cuULZcz089HZWD+D0a8Pz52bnNPgPzTj76dlJAnDfNenZp5fHSr4ACp/NZ3fPnHrkDt64qN31vwbVuFIn43GUjCdxHIVt+xcL2lBp}}
{{clear}}
[[File:SR-02-Accumulator.png|left]]Accumulator outputs the current charge level as % on signal [[File:Signal-A.png|21px]]
{{clear}}
[[File:SR-03-RangeDeciders.png|left]]First decider outputs "Set" ([[File:Signal-S.png|21px]] = 1) if Accumulator is less than 20%.
Second decider outputs "Reset" ([[File:Signal-R.png|21px]] = 1) once Accumulator is more than 90% full.
{{clear}}
[[File:SR-04-SRLatch.png|left]]
 
==== RS Latch configuration ====
'''The central decider and green feedback wire is the actual RS Latch.'''
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 />
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 />
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 clear=all>
[[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 clear=all>
----
 
[[File:SRLatch.png|border|left|430px]]
 
=== RS latch ===
<div style="margin-left:440px;">
* This should be familiar to anyone with any background in electronics.  
* This should be familiar to anyone with any background in electronics.  
* The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal.  
* The signal is set and reset with the [[constant combinator]]s on the left by setting an A=1 signal.  
* The latch "remembers" which one was last set and the light stays on until another signal is received.
* The latch "remembers" which one was last set and the light stays on until another signal is received.
</div>
{{clear}}
{{clear}}


[[File:SRlatchinaction.png|left|400x400px]]
[[File:SRlatchinaction.png|border|left|430px]]
=== Usage of SR latch ===
 
* Here is an example of how you could use an SR latch.
=== Usage of RS latch ===
* The two extra [[Decider combinator]]s provide the set and reset conditions.  
<div style="margin-left:440px;">
* Petroleum gas < 50 and petroleum gas > 100.  
* Here is an example of how you could use an RS latch.
* The two extra [[decider combinator]]s provide the set and reset conditions.  
* Petroleum gas < 50 and petroleum gas > 100.
</div>
{{clear}}
{{clear}}


[[File:BeltLatch.png|left|400x400px]]
[[File:BeltLatch.png|border|left|430px]]
 
=== Belt only latch ===
=== Belt only latch ===
* This is the most compact latch I am aware of.
<div style="margin-left:440px;">
* To make it work you need to place '''3''' raw wood on the inside lane of the belt.
* To make it work, '''3''' pieces of raw wood must be placed on the inside lane of the belt.
* I believe it will have higher latency than the combinator version but in most situations you will not notice the difference.  
* It will have higher latency than the combinator version, but in most situations you will not notice the difference.
</div>
{{clear}}
{{clear}}


== Displays ==
== Displays ==
[[File:5digitDisplay.png|left|400x400px]]
[[File:5digitDisplay.png|border|left|430px]]
 
=== Numerical Display ===
=== Numerical Display ===
* Each digit is driven by its own [[Green wire]], that wire holds 15 signals one for each lamp used in the digit.
<div style="margin-left:440px;">
* [[Constant combinator]]s are used to define which lamp should light up for each value.  
* Each digit is driven by its own [[green wire]], that wire holds 15 signals, one for each lamp used in the digit.
* Blueprint string including decoder [https://www.dropbox.com/s/5o13xuwthalzzfe/Brain2.txt?dl=0]
* [[constant combinator]]s are used to define which lamp should light up for each value.
</div>
{{clear}}
{{clear}}


[[File:BWDisplay.png|left|400x400px]]
[[File:BWDisplay.png|border|left|430px]]


=== Black and White Grid Display ===
=== Black and White Grid Display ===
* Each row has its own [[Red wire]] connection and within that row each light has a numbered signal 0-9.
<div style="margin-left:440px;">
* Each row has its own [[red wire]] connection and within that row each light has a numbered signal 0-9.
* We turn each light on by just setting or clearing the relevant signal.
* We turn each light on by just setting or clearing the relevant signal.
</div>
{{clear}}
{{clear}}


[[File:MultiColoredDisplay.png|left|400x400px]]
[[File:MultiColoredDisplay.png|border|left|430px]]
 
=== Multicolor Display by DaveMcW ===
=== Multicolor Display by DaveMcW ===
<div style="margin-left:440px;">
* 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.  
* 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.  
* 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.   
* 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.   
* 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.  
* 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.  
* There is a [[Arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals.  
* There is a [[arithmetic combinator]] for each cell that subtracts the "row" value from each of the colored signals.  
* And this enables us to choose the color for each cell.  
* And this enables us to choose the color for each cell.  
* Simple!
* Simple!
</div>
{{clear}}
== Setting Recipes ==
[[File:MultipleItemAssembler.png|border|left|430px]]
=== Multiple Item Assembling Machine ===
<div style="margin-left:440px;">
* This circuit allows a user to have a single [[assembling machine]] produce several different items that all use mostly the same ingredients. This is a convenient way to avoid routing the same set of inputs to multiple assembly machines for items that need automated, but not constant production. For example, [[medium electric pole]]s and [[big electric pole]]s share the same ingredients, or the [[pumpjack]], [[oil refinery]], and [[chemical plant]] take mostly the same inputs.
* To use this, the player opens the [[constant combinator]] and selects which items and what quantities to make.
* This signal goes into the green wire input of the [[decider combinator]], where it is compared to the quantity of items in the logistics chest connected to the combinator input on the red wire.
* The decider combinator uses the "each" signal, so each signal on the green wire is compared to each signal on the red wire, and if there are fewer of any item in the chest than are set by the constant combinator, the decider combinator will output a signal on that item's channel.
* The assembling machine then is configured to set the recipe based on incoming signals and so will produce whatever items are needed to fulfill the settings on the constant combinator.
* The assembly machine outputs items to the steel chest, which then loads them into the requester chest, which feeds back into the assembly machine. This is because when a new recipe is loaded, any extra input items of the previous recipe must be unloaded from the machine, and this loop will supply those unloaded items back into the assembly machine, otherwise input materials will fill up the output storage, preventing new items from being produced.
</div>
{{clear}}
{{clear}}


== See Also ==
== See Also ==
* [[Arithmetic combinator]]
* [[Arithmetic combinator]]
* [[Constant Combinator]]
* [[Constant combinator]]
* [[Decider Combinator]]
* [[Decider combinator]]
* [[Circuit network]]
* [[Circuit network]]

Latest revision as of 15:56, 27 November 2024

Not-enough-repair-packs-icon.png
Page "Circuit network cookbook" has been recommended for clean-up. Reason: Combinator GUI and circuit network changed in 2.0
This may mean fixing grammar or broken links, providing better explanations, or removing incorrect/outdated info.
Further recommendations for this page's clean-up can be made at Tutorial talk:Circuit network cookbook.

This is a beginners tutorial. See also the Circuit network page for an overview over the circuit network and the Tutorial:Combinator tutorial for an advanced tutorial.

Foreword

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 in "Alt-mode"" in the Interface/Alt-mode settings has to be checked and "Alt-mode" has to be turned on.

Lights

LightWiredToChest.png

Lamp showing chest content condition

This is one of 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.

Setting up circuit connection

  • The lamp is connected to the chest.
  • The lamp is set to light if the chest contain less than 10 empty barrels.

To set the light condition

  • Open the lamp (left click on it).
  • Set the input to barrels.
  • Set the operator to < (less than).
  • Set the constant number:
    • Left click on the constant number
    • Move the slider until 10 is shown, or edit the value box directly.
    • Press set.

Depending on the condition you set, the lamp may light if the chest is empty, or if it contains the required quantity of items.

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.

ConditionalLights.png

Conditional Lights

  • In this circuit we connect a series of lamps to a storage tank.
  • By setting different conditions on each lamp we can build an indicator strip.
  • The Enabled condition of the first lamp is Petroleum gas > 100.
  • The others light up when gas is greater than 200, 300, 400 and 500 respectively.

In this setup you can connect the storage tank to the lamps directly.

ColoredLights.png

Colored Lights

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. Instead of directly connect the lamp and the Storage tank you need:

  1. Add the arithmetic combinator.
  2. Connect the storage tank with the input of the arithmetic combinator.
  3. Connect the output of the arithmetic combinator with the lamp.
  4. Set up the arithmetic combinator:
    1. Setting the input to petroleum Gas + 0 (the constant 0 not the signal 0)
    2. Set the output to the pink signal (on the bottom row of the last tab of signals.)
  5. Set up the lamp:
    1. Select the "Use colors" check box on the lamp.
    2. Set the condition to the pink signal, and what value you want (i.e. > 100)

Oil Setups

Balancing the production of petroleum gas, light oil and heavy oil is one of the most important use cases of the circuit network.

LgtOilCracking.png

Light Oil Cracking

  • This circuit provides balanced light oil and petroleum gas production by cracking excess light oil into gas.
  • The pump is connected to the storage tank by a red wire.
  • The pump has an enabled condition set to Light Oil > 20000.
HvyOilCracking.png

Heavy Oil Cracking

  • This circuit extends on the previous circuit by adding optional heavy oil cracking to provide lubricant etc.
  • The pump has an enabled condition set to Heavy oil > 20000.

Alternative Setup for Cracking and Lubricant Production

This setup compares different fluid levels to each other instead of checking fixed values. It offers some guarantees such as petroleum gas being produced when you have light oil to spare, and light oil not being cracked when you have plenty of petroleum gas, and similar rules for heavy oil cracking and lubricant production.

Oil-single-cct.png

It takes 4 steps:

  1. Have a fluid tank for heavy oil, light oil, petroleum gas, and lubricant. For each fluid, make sure to connect the tank via pipes to every location where the fluid is being produced or consumed.
  2. For each chemical plant (or each row of them, if you use rows) add a pump to the non-water fluid input pipe to make it possible to block the flow. Note: Alternatively, the blocking pumps could be added to the chemical plant output pipes, but there is no need to add pumps to both inputs and outputs.
  3. Connect every pump and every fluid tank to a single circuit network of red (or green) wire. The resulting circuit network will know about the fluid level in every storage tank and pass this information to every pump.
  4. For each connected pump set the circuit “enable condition” to "[input fluid] > [output fluid]" , for its respective chemical plant recipe. E.g. set "heavy oil > light oil" for the heavy oil cracking input pump, set "heavy oil > lubricant" for the lubricant production input pump, and set "light oil > petroleum gas" for the light oil cracking input pump.

Done! Now all the pumps will move to equalize the fluid levels to each other. This will prevent fluid system deadlocks where you have plenty of one fluid but you are unable to make any of the other.

Misc

MulitipleChestsAndPoles.png

Multiple Storages

  • If you connect multiple chests to a pole, the pole displays the sum of items in all the chests.
  • This also works with storage tanks and roboports.
ConstantComb.png

Constant Combinator

  • With a constant combinator you can generate any signals you may need.
  • In this example we have generated a signal of 50 Laser turrets and 200 Piercing round magazine.
  • Constant combinators are not of much use on their own but we shall use them later.
ThisASign.png

Constant Combinator Signs (Words)

  • You can use constant combinators to make signs, just set the letter signals in the combinator, each combinator can display 2 characters side by side.
  • Note that to see these letters, Alt-mode must be on and the Interface setting “Show combinator settings in “Alt-Mode”” must also be enabled.
Constant combinator signs2.png

Constant Combinator Signs (Managing Belts)

  • Somewhat similar to the previous example, constant combinator signals can be used with belts to help indicate what items should be on which belts. This is extremely useful when sharing blueprints, as it's possible for blueprints to be shared albeit with no indication on which items are meant for which belts.
MemoryCell.png

Memory Cell / Counter

  • Basic memory cell that counts all the items moved by the inserter
  • The fast inserter is connected to BOTH ends of the arithmetic combinator.
  • 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.
  • When the fast inserter does pick something up its value is added to the output from the previous tick thus incrementing that item.

Inserters

LimitItemsPlacedIntoAChest.png

Limit items placed into a chest

  • The inserter is connected to the wooden chest using a red wire.
  • The inserter's enabled condition is Advanced Circuit < 10.
  • 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.
  • This effect can be even greater with Stack inserters because of their large carrying capacity.
  • This technique still gives far greater control than limiting the inventory on the chest.
BalancedChestInsert.png

Balanced chest insert

Goal: Load n chests with approximately the same number of items. This can be used for train stations: MadZuri's smart loading train station

  • Place n chests and n inserters.
  • Place 1 arithmetic combinator
  • Set the combinator to take Each (yellow star) and divide by the negative number of chests. ie −n.
  • Connect all chests to each other and to the input of the combinator using red wire.
  • Connect all inserters to each other and to the output of the combinator using red wire.
  • Connect each inserter to the box it inserts into with green wire.
  • Set the enable condition on each inserter to be Everything (red star) < 0.

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, i.e. 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.

Due to inserter stack bonus the count is not exact. If a precise count is needed, set the inserter stack size to 1.

SmartOutpostUnloader.png

Keeping outpost stocked with specified items

  • This circuit keeps a storage chest at an outpost stocked with customized levels of different items.
  • 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.
  • The storage chest is attached to the input of the arithmetic combinator (left side in the picture) with a red wire.
  • Another couple of red wires join the output of the arithmetic combinator (right side) to the constant combinator and to the stack filter inserter.
  • The arithmetic combinator multiplies each input value (from the storage chest) by -1.
  • Finally the filter stack inserter's mode of operation is set to Set filters.
  • So the input to the stack filter inserter is <constant combinator> - <storage chest contents> and the filter is set to filter for the first item by inventory order.
SolarAccumalatorBalancer.png

Balanced Solar panel / Accumulator Production

  • This circuit balances production of solar panels and accumulators to a desired ratio in my case 24:20.
  • The first arithmetic combinator takes the number of accumulators in the chest and multiplies it by 24.
  • The second arithmetic combinator takes the output of the first combinator and divides it by 20.
  • This gives us the number of accumulators that we can directly compare to the number of Solar panels in both inserters.
  • 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.
  • 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.

Sushi Belts

SushiScience1.png

Reading Belt Design

  • Six belts in a row are connected with Red wire and set to Read belts contents and Hold
  • This red wire is then connected to the inserters that insert onto the belt.
  • Read hand contents is unselected for all inserters.
  • Mode of operation is set to Enable/Disable on all inserters.
  • The first inserter is enabled when Automation science pack = 0
  • The other inserters are set similarly for the other science packs.
SushiScience2.png

Memory Cell Design

  • This recipe produces a rolling sum of the number of items of each type, as they added or removed from a looping conveyor belt. Inserters placing items onto the belt can use this sum to turn on or off as needed.
  • It achieves this through two networks, one red (subtraction) and one green (addition), connected to their own inserters, and two arithmetic combinators: one basic arithmetic combinator to do the subtraction, and one memory cell, to update and persist the values.

 

  • Each inserter that takes items from the belt is connected with Red wire. Each of these inserters is set to Mode of operation: None, Read hand contents is checked, and Hand read mode is set to Pulse (sends 1 each time an item is picked up).
  • These red wire inserters are connected to the input of the subtraction arithmetic combinator, in this example, it is the one on the left.
  • The left arithmetic combinator multiples each input by -1 and outputs it to each. This subtracts 1 each time an inserter removes an item from the belt, for the specific type of item taken.
  • The right arithmetic combinator is the memory cell.
  • The memory cell's input is connected to: 1. A green wire network of inserters placing items onto the belt (the addition), 2. The output of the left arithmetic combinator (the subtraction).
  • The memory cell's output should be connected to its input, so that each time an update is sent from either the addition network (green wire) or subtraction network (red wire), the updated value is persisted.
  • When a Green wire inserter adds an item to the belt, that item's count in the memory cell is increased by 1.
  • The inserters that place items onto the belt (green wire) should be set to: Enable/disable, Read hand contents is checked and Hand read mode is set to Pulse.
  • The Enable/disable condition is set based on the number of items you'd like picked up by the red wire inserters, e.g. Automation science pack <= 16 (one pack for each lab in the example shown here).

Power

SteamBackup.png

Backup steam power

Optimal usage of fuel for nuclear power

Unlike the normal steam power that adjusts fuel usage based on power usage, the nuclear reactors spend fuel in fixed units of time. To be exact, the consumption of 1 fuel cell takes exactly 200 seconds.

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.

NuclearCircuits.png

This picture shows a setup with 4 reactors, that spend only 1 fuel cell each whenever steam runs low.
Note: The GUI in the image above has been altered to make sure all important info fits within the image size.

There are a few elements in this setup:

  • 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.
  • Chests containing uranium fuel cells for the reactor.
  • Output inserter that takes 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).
  • Input inserter that put uranium fuel cells into the reactor. This is connected to the output inserter 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.
  • If you are using multiple reactors you should only wire one output inserter to one steam tank, and then connect all input inserters to the single output inserter. This will synchronize fuel insertion to maximize the reactor neighbour heat bonus. The other reactors can have "dumb" output inserters that remove empty fuel cells immediately.

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.


Prioritize usage of uranium towards nuclear fuel production

Because a continuous supply of uranium fuel cells is critical to maintaining a nuclear reactor, the circuit network can be used to set up a system where uranium-235 and uranium-238 are conserved for the production of nuclear fuel before other uses.

Nuclear Fuel Circuit Network.png

Using a splitter, divert the two types of uranium onto two parallel conveyors, with an inserter positioned to gather uranium from each conveyor (a long-handed inserter will be needed for the far belt). Each of these inserters deposits their load into a container, from which two more inserters deliver the contents to an assembling machine making nuclear fuel. An inserter delivers the produced fuel to a third container, from which inserter(s) delivers the fuel to your nuclear reactor. Wire the two inserters gathering from the conveyors to the container each of them is delivering to, and to the tile of conveyor immediately after the tile the inserter is gathering from. Set each inserter's enable condition to "less than or equal to X amount of uranium", using the appropriate type of uranium the inserter is gathering and X being the number of reserve uranium desired (optimally, one uranium-235 and nineteen uranium-238, the amount needed to produce nuclear fuel; the amount may be increased if a greater stockpile is desired). Set each conveyor's enable condition to "greater than or equal to X amount of uranium" in the same manner. Finally, connect the inserters delivering uranium to the assembly machine up to the container the assembly machine is delivering nuclear fuel to, and set each of their enable conditions to "nuclear fuel = 0 (the enable condition can be set to "less than or equal to X amount of nuclear fuel" if a larger stockpile is desired).

This set-up accomplishes the following:

  • When there is sufficient nuclear fuel and uranium stockpiled, the inserters will deactivate and the conveyors activate, allowing the uranium to continue down the conveyors to other facilities.
  • When the nuclear fuel stockpile hits zero (or decreases below the desired amount), the inserters delivering to the assembly machine will activate and deliver uranium to resume production of nuclear fuel until quota is reached again.
  • When there is not enough uranium stockpiled to produce a batch of nuclear fuel, the inserters gathering uranium will activate and and resume gathering uranium until they reach their quota. The conveyors carrying uranium will stop past the inserters, cutting off other facilities from that type of uranium until its respective inserter reaches quota.
  • The assembly machine will only be provided with uranium when the stockpile of nuclear fuel hits zero (or decreases below the desired amount), preventing over-production of nuclear fuel and thus over-consumption of uranium.

Railway network

Set train routing

The circuit network can be used to allow deeper micromanagement of trains. Circuits can be used to adjust train limits for stops, effectively disabling a stop when a resource is not available for loading, or if an unloading station already has more than enough of a resource. Note that adjusting train limits runs into fewer problems than fully enabling/disabling stops; see Friday Facts #361 - Train stop limit, Tips and tricks and the Train stop page for additional information about using train limits.

Player safety

The circuit network can be used to ensure the player's safety when crossing train tracks so they do not get hit. Place gates at designated crossing areas and connect an adjacent wall to rail signals near the gate. Set the gate to "read sensor" and the signal to "close signal" with the condition being the signal the gate sends out being "1". This means that when the gate is closed, the signal will be green and trains can pass freely, but when the player approaches the gate and it opens for them, the train signal will be turned red and trains will be stopped until the player clears the area.

Alternatively, this system can be reversed - by setting the gate to "open gate" and the train signal set to "read signal", the gate will remain open normally and will close when a train is approaching, preventing the player from crossing until it is safe.

In lieu of gates, the player can connect a programmable speaker to the train signals to broadcast a warning siren when a train is approaching the area.

Latches

RS latch - single decider version

This discussion on the Factorio forums starts with the common 2 decider RS latch version, but later a single decider version was proposed. The thread goes on to explain why this 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.

Backup steam example

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%.

Latching is used to introduce 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).

SR-01-Layout.png
Blueprint.png  Copy blueprint string

0eNrFVk1vozAQ/SuVz1ABCaRBq5WqXntKjqsKOTBJR8IGGTtpFPHfd+w0HyU0G6pVewkxnnmemfdmzI4tSgO1QqlZumOYV7Jh6Z8da3AleWnf6W0NLGVrVNrQG49JLuyLvYU/Z63HUBbwxtKw9QZ4zs48o15P1CBObgXkWIDy80osUHJdqTOAUfviMZAaNcI+A7fYZtKIBSiK7YgjoEAjfCgh1wpzv65KoFPqqiHnStrzCdAPA49t6Rm1NrYOWjQY7QrY6FQZwcvyX1jJFajxEYrnuRGmdGW6DCe+jx1KcB9TDYl1raoyW8ArXyM5kFVldG10djObj6zdI0kKHp2Mdiy0PysFIM8pwYKldHyOKjeo3TI8y8Wup93tl7Yv3fiaOC6zjt6z9uk4VqDaR+rY7CvBO2ZGewUec1qiaobVxaE3mtseiwK7EjVXLsaU/SKPobWe7zHrLYVmpM6WqhIZSsJg6ZKXDQyiYkzF9Vhk9xUU3d3kNiaSQUwEB/l9Hw+uZg1YjGzYiPpA1+/vpKuHjk7fRNf7JrJTsZf05MLwoIFbzLvtOvlEFZNjKepqQ5poNqjz10s9jA6N+fk8Ohx/FMFXNXDqxeCC20F901vCJxN07UjVG9K4+x9YQp5M2LUZfbTpq+XDKRsNnG4cuULZcz089HZWD+D0a8Pz52bnNPgPzTj76dlJAnDfNenZp5fHSr4ACp/NZ3fPnHrkDt64qN31vwbVuFIn43GUjCdxHIVt+xcL2lBp

SR-02-Accumulator.png

Accumulator outputs the current charge level as % on signal Signal-A.png

SR-03-RangeDeciders.png

First decider outputs "Set" (Signal-S.png = 1) if Accumulator is less than 20%.

Second decider outputs "Reset" (Signal-R.png = 1) once Accumulator is more than 90% full.

SR-04-SRLatch.png

RS Latch configuration

The central decider and green feedback wire is the actual RS Latch. It latches the Set signal Signal-S.png until the Reset signal Signal-R.png is received (and vice-versa).
NB: the latch expects binary inputs (Signal-S.png & Signal-R.png must be 0 or 1) - this is why the previous two deciders are required.
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.

SR-05-PowerSwitch.png

The Power switch isolates the generator from the rest of the factory until Signal-S.png = 1



SRLatch.png

RS latch

  • This should be familiar to anyone with any background in electronics.
  • The signal is set and reset with the constant combinators on the left by setting an A=1 signal.
  • The latch "remembers" which one was last set and the light stays on until another signal is received.
SRlatchinaction.png

Usage of RS latch

  • Here is an example of how you could use an RS latch.
  • The two extra decider combinators provide the set and reset conditions.
  • Petroleum gas < 50 and petroleum gas > 100.
BeltLatch.png

Belt only latch

  • To make it work, 3 pieces of raw wood must be placed on the inside lane of the belt.
  • It will have higher latency than the combinator version, but in most situations you will not notice the difference.

Displays

5digitDisplay.png

Numerical Display

  • Each digit is driven by its own green wire, that wire holds 15 signals, one for each lamp used in the digit.
  • constant combinators are used to define which lamp should light up for each value.
BWDisplay.png

Black and White Grid Display

  • Each row has its own red wire connection and within that row each light has a numbered signal 0-9.
  • We turn each light on by just setting or clearing the relevant signal.
MultiColoredDisplay.png

Multicolor Display by DaveMcW

  • 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.
  • 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.
  • 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.
  • There is a arithmetic combinator for each cell that subtracts the "row" value from each of the colored signals.
  • And this enables us to choose the color for each cell.
  • Simple!

Setting Recipes

MultipleItemAssembler.png

Multiple Item Assembling Machine

  • This circuit allows a user to have a single assembling machine produce several different items that all use mostly the same ingredients. This is a convenient way to avoid routing the same set of inputs to multiple assembly machines for items that need automated, but not constant production. For example, medium electric poles and big electric poles share the same ingredients, or the pumpjack, oil refinery, and chemical plant take mostly the same inputs.
  • To use this, the player opens the constant combinator and selects which items and what quantities to make.
  • This signal goes into the green wire input of the decider combinator, where it is compared to the quantity of items in the logistics chest connected to the combinator input on the red wire.
  • The decider combinator uses the "each" signal, so each signal on the green wire is compared to each signal on the red wire, and if there are fewer of any item in the chest than are set by the constant combinator, the decider combinator will output a signal on that item's channel.
  • The assembling machine then is configured to set the recipe based on incoming signals and so will produce whatever items are needed to fulfill the settings on the constant combinator.
  • The assembly machine outputs items to the steel chest, which then loads them into the requester chest, which feeds back into the assembly machine. This is because when a new recipe is loaded, any extra input items of the previous recipe must be unloaded from the machine, and this loop will supply those unloaded items back into the assembly machine, otherwise input materials will fill up the output storage, preventing new items from being produced.

See Also