In other languages: Čeština Deutsch Français Italiano 日本語 Polski Português, Brasil Русский Українська 简体中文

Circuit network: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(→‎Devices: Fuel reported also includes what's currently being burned.)
 
(114 intermediate revisions by 39 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
[[Circuit network]]s (CCNet) enables the control of devices based on the amount of [[Items]] and Fluids stored in all [[Chests]] and [[Storage tank|Storage tanks]] connected to the same network via red or green wires.
'''Circuit networks''' are built using [[Red wire|red]] or [[green wire]], and enable the control of receivers, based upon information broadcast onto the network by connected senders.  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 48 extra [[#Virtual signals|virtual signals]] which act as user-definable channels. '<span style="color:#FF6666">Everything</span>', '<span style="color:#99FF99">Anything</span>' and '<span style="color:#FFFF99">Each</span>' are also available wildcards.


:[[File:InnerOfGreenCable.jpg|400px]]
[[File:shared_circuit_network.png|thumb|600px|right|Two circuit networks shared over one [[small electric pole]].]]
A more technical explanation is, that the circuit network is a standardized bus-system. '''See [[Automatic control/Smart bus|this explanation]].


Even if the circuit network looks quite different to the [[Logistic network]], the [[Automatic control/Smart bus|bus]] is principally the same beccause the information is the same. '''The basic difference between them is that, in a logistic network, everything which is covered by a roboport pops up as content, but in the circuit network only the connected chests and storage tanks were considered.
== Usage ==
=== Send information ===
Senders broadcast the amount of items or 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. For example, a Storage Tank containing 1000 Crude Oil will broadcast 1000 on the Crude Oil channel.


== Items/Devices ==
The channels are separated from each other, so each network can simultaneously carry a number for each item and fluid in the game, and for each of the extra user-defined channels (digits 0-9, letters A-Z, and 9 different colors). All unused channels have the value zero.
{| class="wikitable"
 
| {{imagelink|red-wire|Red wire}} || Wires used to connect smart devices to a red network.
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 within the network will be 2000.
 
All wires of the same color which are connected together by junctions form a network, i.e. they will pass their signals to each other.  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 [[#Combinators|arithmetic combinator]], below) for discussion.
 
Numbers are in the signed 32 bit integer range, i.e. from -2147483648 to 2147483647 inclusive, and are encoded in [https://en.wikipedia.org/wiki/Two%27s_complement two's complement representation]. The numbers wrap around on overflow, so e.g. 2147483647 + 10 becomes -2147483639. When entering a number in a combinator it can appear to exceed the 32 bit limit until the GUI is closed, at which point the number will overflow/underflow. [https://forums.factorio.com/58419]
 
=== Control devices ===
Receivers can use broadcast information, in most cases to enable/disable the device. They can either compare results between different channels, or compare a channel to a specific value.
 
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 copper plates and a green wire with 10 copper plates, the input signal set for that receiver will be 30 copper plates.
 
Multiple wires of the same color will share & sum their signals. For example, 3 chests A, B and C connected in a row (A -> B -> C) with green wire will output the sum of their contents along any green wire connected to any of the chests. However, if a red wire connects chest A to an inserter, that inserter will only be given the contents of A as its input signal.
 
== Devices ==
<!-- Todo: need signal icons D, P, V. Probably need to compile all crafting machines and turrets into one word, similar to belts & inserters  -->
 
Each device that is able to be connected to a circuit network has a [[File:Circuit network panel.png]] icon located in the top right corner of its info pane. Clicking this icon will display the available circuit network options for that device (note: a red or green wire must be connected, otherwise the message "not connected" will display instead). Clicking the [[File:Logistic network panel.png]] icon next to it, the device can be connected to a logistic network if in range of one, which also allows conditions to be set.
 
Conditions can be set for both circuit (signals of red and green wires are summed) and logistic network, which will together act as a logical AND.
 
The following devices can be connected to a circuit network:
 
{| class="wikitable mw-collapsible"
|-
! Icon !! Name !! Possible output signals !! Possible circuit control !! Possible logistic network control
|-
| {{Icon|Transport belt||Transport belts}} || [[Transport belts]] || Transport belts can send their content to the circuit network.
*''Pulse mode'': The signal is sent for only 1 tick when the item enters the belt.
*''Hold mode'': The signal is sent continuously as long as the items are on the belt.
*''Hold mode'' (All belts): The signal is sent continuously for all items on the entire transport belt line. The count continues through underground belts, but not splitters or side loading.
|| Transport belts can be enabled on a condition.
|| Transport belts can be enabled on a logistic network condition.
|-
| {{Icon|Inserter||Inserters}} || [[Inserters]] || All inserters can send their held items to the circuit network.
*''Pulse mode'': The signal is sent for only 1 tick when the item is picked up.
*''Hold mode'': The signal is sent continuously as long as the inserter is holding the item.
|| All inserters can be enabled on a condition. The inserter stack size can also be overridden from a control signal (configurable; values less than 1 are treated as 1). Filters can be set on a signal.
|| All inserters can be enabled on a logistic network condition.
|-
| {{Icon|Assembling machine}} {{Icon|Oil refinery}} {{Icon|Chemical plant}} {{Icon|Centrifuge}} {{Icon|Crusher|space-age=yes}} {{Icon|Foundry|space-age=yes}} {{Icon|Electromagnetic plant|space-age=yes}} {{Icon|Biochamber|space-age=yes}} {{Icon|Cryogenic plant|space-age=yes}} || [[Assembling machine]]s, [[Oil refinery]], [[Chemical plant]], [[Centrifuge]], [[Crusher]], [[Foundry]], [[Electromagnetic plant]], [[Biochamber]], [[Cryogenic plant]] || All crafting machines can output their contents, output the ingredients of a set recipe, set a given signal when working, and send a given signal when a recipe completes || All crafting machines can enable on a condition and set the recipe based on a signal
||
|-
| {{Icon|Wooden chest||Chests}} || [[Chests]] || All chests can send their contents to the circuit network. Logistic chests automatically send their contents to the [[logistic network]]. Logistics chests can be enabled on a condition. ||
|-
| {{Icon|Cargo landing pad}} || [[Cargo landing pad]] || The landing pad can send its contents to the circuit network. || The landing pad can have its requests set by the circuit network.{{SA}} ||
|-
| {{Icon|Rocket silo}} || [[Rocket silo]] || The rocket silo can output its contents or requests from space platforms.{{SA}} ||
||
|-
| {{Icon|Space platform hub|space-age=yes}} || [[Space platform hub]] || Can output its contents, destination and source planet, current speed, and damage taken
*''Default'': Read Speed = Signal ''V''
*''Default'': Read Damage Taken = Signal ''D''
| Platform hub can be sent the contents of the circuit network to use for wait conditions
||
|-
| {{Icon|Asteroid collector|space-age=yes}} || [[Asteroid collector]] || Can output its contents to the circuit network || Can enable on a condition and set filters on a signal ||
|-
| {{Icon|Requester chest}} || [[Requester chest]] || Can send its contents to the circuit network. Does ''not'' send its content to the [[logistic network]]. || Its requested items can be set by the circuit network. ||
|-
| {{Icon|Storage tank}} || [[Storage tank]] || The storage tank can send its fluid content to the circuit network. ||
|-
| {{Icon|Gate}} || [[Gate]] || Gates can send a signal to the circuit network.
*''Default'': Player detected = [[File:Signal-G.png|16px]]
|| Gates can be opened on a condition. ||
|-
| {{Icon|Nuclear reactor}} {{Icon|Heating tower|space-age=yes}} || [[Nuclear reactor]], [[Heating tower]] || The reactor and heating tower can output any fuel, including the fuel currently being burned, to the circuit network, as well as its current temperature
*''Default'': Read temperature = [[File:Signal-T.png|16px]]
||
|-
| {{Icon|Agricultural tower|space-age=yes}} || [[Agricultural tower]] || Can output any seeds and harvested plants in its inventory || Agricultural tower can be enabled on a condition || Can be enabled on a logistic network condition
|-
| {{Icon|Gun turret}} {{Icon|Laser turret}} {{Icon|Flamethrower turret}} {{Icon|Rocket turret|space-age=yes}} {{Icon|Tesla turret|space-age=yes}} {{Icon|Railgun turret|space-age=yes}} || [[Gun turret]], [[Laser turret]], [[Flamethrower turret]], [[Rocket turret]], [[Tesla turret]], [[Railgun turret]] || Can send their respective ammunition to the circuit network
* Laser and tesla turrets will not send any signal if this option is selected, due to not using ammo
|| Can enable, set priorities, and ignore priorities on a condition || Can be enabled on a logistic network condition
|-
| {{Icon|Artillery turret}} || [[Artillery turret]] || Can send its ammunition to the circuit network || Can be enabled on a condition || Can be enabled on a logistic network condition
|-
|-
| {{imagelink|green-wire|Green wire}} || Wires used to connect smart devices to a green network.
| {{Icon|Rail signal}} || [[Rail signal]] || Rail signals can send their state to the circuit network.
*''Default'': [[File:Signal-Red.png|16px]][[File:Signal-Yellow.png|16px]][[File:Signal-Green.png|16px]]
Note: If red due to circuit network, does NOT output red signal
|| Rail signals can be set to red on a condition. ||
|-
|-
| {{imagelink|smart-chest|Smart chest}} || The most basic chest connectable to '''Circuit networks'''. Its content will be sent to the network.
| {{Icon|Rail chain signal}} || [[Rail chain signal]] || Rail chain signals can send their state to the circuit network.
*''Default'': [[File:Signal-Red.png|16px]][[File:Signal-Yellow.png|16px]][[File:Signal-Green.png|16px]][[File:Signal-Blue.png|16px]]
||
|-
|-
| {{imagelink|Provider-chest|Active Provider chest}} || A chest connectable to '''Circuit networks''' and participating in the [[Logistic network]]. Its content will be sent to the network.
| {{Icon|Train stop}} || [[Train stop]] || Train stops can send the contents of a stopped train to the circuit network as well as read a unique train identifier code. The amount of trains going to the train stop can be read by the circuit network.<br>When reading the content of a stopped train, fluid amounts are rounded down to the nearest integer, except when the fluid amount is < 1, then it is is rounded to 1.
*''Default'': Train Count (en route) = [[File:Signal-C.png|16px]]
*''Default'': Stopped Train ID = [[File:Signal-T.png|16px]]
|| Train stops can send the contents of the circuit network to the train to use it for wait conditions, as well as enable/disable the stop itself. The maximum amount of trains that can go to the train stop ("train limit") can be set by the circuit network, as well as the stop priority.
*''Default'': Set Limit = [[File:Signal-L.png|16px]]
*''Default'': Set Priority = Signal ''P''
|| Train stops can be enabled on a logistic network condition.
|-
|-
| {{imagelink|Logistic-chest-passive-provider|Passive Provider chest}} || A chest connectable to '''Circuit networks''' and participating in the [[Logistic network]]. Its content will be sent to the network.
| {{Icon|Accumulator}} || [[Accumulator]] || It can send its charge level in percent to the circuit network.
*''Default'': Charge % = [[File:Signal-A.png|16px]]
||
||
|-
|-
| {{imagelink|requester-chest|Requester chest}} || A chest connectable to '''Circuit networks''' and participating in the [[Logistic network]]. Its content will be sent to the network.
| {{Icon|Roboport}} || [[Roboport]] || It can send its logistic network contents and/or its robot statistics to the circuit network. The signals used for robot statistics are configurable.
*''Default'': Available Logistics Bots = [[File:Signal-X.png|16px]]
*''Default'': Total Logistics Bots = [[File:Signal-Y.png|16px]]
*''Default'': Available Construction Bots = [[File:Signal-Z.png|16px]]
*''Default'': Total Construction Bots = [[File:Signal-T.png|16px]]
*''Default'': Roboports in Network = [[File:Signal-R.png|16px]]
||
|-
|-
| {{imagelink|storage-chest|Storage chest}} || A chest connectable to '''Circuit networks''' and participating in the [[Logistic network]]. Its content will be sent to the network.
| {{Icon|Radar}} || [[Radar]] || Radars will transmit any signals passed into it to all other radars on the same planet.
Unlike other machine outputs, signals from red and green wires are transmitted separately.
||
||
|-
|-
| {{imagelink|storage-tank|Storage tank}} || The storage tank is also connectable to '''Circuit networks''' (since ''v0.12''). Its fluid content will be sent to the network.
| {{Icon|Display panel}} || [[Display panel]] || || Can display a label and/or custom message on a condition ||
|-
|-
| {{imagelink|smart-inserter|Smart inserter}} || The only inserter connectable to '''Circuit networks''' and [[Logistic network]]s. The condition when the inserter is working is configurable in the menu.
| {{Icon|Burner mining drill}} || [[Mining drill]]s || All mining drills can send the expected resources, either from the drill itself or from the whole ore patch the drill is on. || Mining drills can be enabled on a condition. || Mining drills can be enabled on a logistic network condition.
|-
|-
| {{imagelink|small-lamp|Lamp}} || The lamp is connectable to '''Circuit networks'''. The condition when the lamp is shining is configurable in the menu.
| {{Icon|Pumpjack}} || [[Pumpjack]] || It can output the current oil mining rate. || It can be enabled on a condition. || It can be enabled on a logistic network condition.
|-
|-
| {{imagelink|small-pump|Small pump}} || The small pump is connectable to '''Circuit networks'''. The condition when the pump is working is configurable in the menu.
| {{Icon|Power switch}} || [[Power switch]] || || Power switches can connect power networks on a condition. || It can be enabled on a logistic network condition.
|-
|-
| {{imagelink|offshore-pump|Offshore Pump}} || The offshore pump is connectable to '''Circuit networks'''. The condition when the pump is working is configurable in the menu.
| {{Icon|Programmable speaker}} || [[Programmable speaker]] || || Shows alerts and plays sounds based on circuit network signals. It can be used to make simple tunes.
|-
|-
| {{imagelink|constant-combinator|Constant Combinator}} || The constant combinator is connectable to '''Circuit networks'''. You can set up to 15 signals in its GUI which will be sent to the network (like a chest that contains pseudo items). It has several outputs for red and green wires.
| {{Icon|Lamp}} || [[Lamp]] || || The lamp can be enabled on a condition.
*''Color mapping'': The color is set based on the provided color signals
*''Color components'': The color is set based on the values of incoming red, green, and blue color signals, which should be between 0 and 255
*''Packed RGB'': The color is set based on a single hex encoded RGB color on the white color signal. It should be between 0 and 16777215
|| The lamp can be enabled on a logistic network condition.
|-
|-
| {{imagelink|arithmetic-combinator|Arithmetic Combinator}} || The arithmetic combinator is connectable to '''Circuit networks'''. It can perform mathematical operations (+, -, *, /) based on the amounts of the inputs signals (red and green wire signals are summed).
| {{Icon|Offshore pump}} || [[Offshore pump]] || || The offshore pump can be enabled on a condition. || The offshore pump can be enabled on a logistic network condition.
|-
|-
| {{imagelink|decider-combinator|Decider Combinator}} || The decider combinator is connectable to '''Circuit networks'''. It acts like any signal controlled device. You can compare the input signals (red and green wire signals are summed) by using "less than", "bigger than" or "equal to". If the condition is true, it will output a configurable signal.
| {{Icon|Pump}} || [[Pump]] || || The pump can be enabled on a condition and set its filter on a signal || The pump can be enabled on a logistic network condition.
|}
|}


== Basic ==
== Physical network structure ==
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. Wire length is limited by its previous connection.
 
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. If red and green wires happen to touch the same power pole or device, the red and green networks will remain separate and will not link up. However, two red cables or two green cables will link if they touch. Use different colored cables to separate networks in close proximity.
 
* To connect wires or cables to a power pole, simply click on one entity, then on the base of the power pole.
* To erase a wire or cable connection, place the same color wire over an existing connection. You don't get the wire/cable back.
* 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.
* When connecting to a [[arithmetic combinator]] or [[decider combinator]], take care to connect the wire to the correct input or output side. Use "Show details" mode to see the orientation of the combinator.
* Hovering the mouse cursor over an item will highlight all wires which connect to the item.
* Hovering the mouse cursor over a power pole which is part of a network will display the signals on its network. Some items like combinators will also display their input and output signals when hovered over.
* Cut-pasting entities tries to preserve all wire connections to external entities and reconnect the new ghost to all its previous connection points, even when pasted multiple times, making it easy to rearrange entities without breaking connections.
* Deconstructing a power pole tries to keep all affected wire connections intact, forming new wires between previously-connected entities as needed. This can result in redundant wire connections forming when cut-pasting or undoing deconstruction. Note that this doesn't happen when the power pole is destroyed, though its ghost remains connected.
 
== Combinators ==
Combinators can function as both receiving and sending devices and allow more advanced functions to be used on a circuit network.
 
*The [[constant combinator]] broadcasts up to 20 values on any of the channels for whatever networks it is connected to.  (You cannot currently specify whether a value should be on the red or green channel; if you need different values, use two combinators, one for each color wire.)  You can use any item channel or any of the [[#Virtual signals|virtual signal]] channels.
**Note that using two of the 20 slots to broadcast values on the '''same''' channel is the same as broadcasting the sum of the two values from one slot.
*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.
** 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).
** 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. (The rate at which it climbs is determined by the current tick rate.) This technique can be combined with decider combinator logic to make electronic clocks, gates, and other systems; see [[Tutorial:Combinator tutorial|Combinator Tutorial]] for advanced techniques.
** 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.
**Multi-network: The arithmetic combinator can be joined to both red and green networks on the input side and will sum their inputs.
*The [[decider combinator]] functions much like an arithmetic combinator, but is designed to compare values. Essentially, it is a conditional. 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.
* The [[selector combinator]] has various functions designed for filtering out and analyzing specific signals from its inputs. It is able to output the largest or smallest signal in a series of inputs, output the stack size of items, count the number of inputs, and output a random input every certain number of game ticks. If [[Space Age]]{{SA}} is enabled, it has three more functions for detecting an item's rocket capacity, and filtering/transferring [[quality]]{{SA}} grades.
 
== Virtual signals ==
[[File:Virtual Signals dialog box.png|thumb|Virtual Signals available for use in the circuit network]]
Virtual signals are special non-item signals. Other than the three logic signals, virtual signals do not behave differently from item signals.
 
48 virtual signals can be sent over a network. They include the digits zero through nine, the letters A through Z, a check-mark, dot and info icon, and the colors red, green, blue, yellow, magenta, cyan, white, gray and black.
 
=== Logic signals ===
[[File:logic_signals.png|300px|thumb|The icons of the three logic signals]]
Three of the virtual signals cannot be sent over a network but apply special logic to multiple signals.
 
==== Everything ====
''<span style="color:#FF6666">Everything</span>'' can be used on the left side in conditionals. The condition will be true when the condition is true for each input signal. The condition is also true if there are no signals. This means that the ''everything'' signal behaves as [[:Wikipedia:universal quantification|universal quantification]].
 
If a signal (rather than a constant number) is used on the right side of the comparison with ''everything'', it is implicitly excluded from the set of signals that ''everything'' checks, so the signal is not matched against itself. That means it is meaningful test e.g. ''everything'' > ''X'', without getting a trivially false result on ''X'' > ''X''.
 
The output of a [[decider combinator]] may also use ''everything'', unless the input is set to ''each''. When used, the combinator will output signal on every channel with non-zero input as long as the condition is true; the value will either be the input value or 1, depending on the corresponding setting.
 
==== Anything ====
''<span style="color:#99FF99">Anything</span>'' can be used on the left side of conditions. It will be false when there are no inputs. The condition will be true when the condition is true for at least one signal. This means the ''anything'' signal behaves as [[:Wikipedia:existential quantification|existential quantification]].
 
If a signal (rather than a constant number) is used on the right side of the comparison with ''anything'', it is implicitly excluded from the set of signals that ''anything'' checks, so the signal is not matched against itself. That means it is meaningful test e.g. ''anything'' >= ''X'', without getting a trivially true result on ''X'' >= ''X''.
 
When used in both the input and output of a decider combinator, ''anything'' will return the first matching signal following the order of precendence as they appear in Factoriopedia, [[wooden chest]] being first in line.
 
==== Each ====
''<span style="color:#FFFF99">Each</span>'' can only be used in left input side and output of [[decider combinator|decider]] and [[arithmetic combinator|arithmetic]] combinators. The signal can only be used as an output when also used as an input. When used in both the input and output, it makes a combinator perform its action on each input signal individually. The combinator will output the sum of each of the actions if only used in the input.
 
A combinator using ''each'' is like a stack of combinators with all inputs connected and all outputs connected in parallel. For example, if there are signals "copper" and "iron" present, one combinator would be evaluating conditions for copper, and the other combinator would be evaluating conditions for iron. The different output signals would then be added together on the shared wire.
 
Unlike ''everything'' and ''anything'' above, if a signal is used on the right hand side of an ''each'' operation, it is NOT implicitly excluded. So if you e.g. have ''each'' * ''X'' then you will also get ''X'' multiplied with itself in the output.
 
Each as an input will only be processed on signals that have a non-zero value. If you have a [[decider combinator|decider]] condition that inputs and output each, but wants to output only one value for an input signal that passes the condition, it will never output 1 for a signal which has a zero value, even if the condition is one that would be passed for a zero value.
 
== Tutorials ==
*'''[[Tutorial:Circuit network cookbook]]''' - ''Example-heavy tutorials; for beginners who want to get to know and use the benefits of the circuit network.''
*'''[[Tutorial:Combinator tutorial]]''' - ''Mainly textual and detailed tutorials.''
 
== Logistic network ==
The logistic network used by [[logistic robot]]s is essentially a third network (a wireless one), along with the green and red wired networks. The logistic network is based on coverage by [[roboport]]s.


[[File:circuit-network-example-1.png|thumb|256px|A basic circuit network usable to fill a chest with a defined amount of items. '''Watch exactly, how the red wires are connected!''' To connect a wire with the pole take a wire and drag it from the base of a pole to the target entity!]]
Some devices can also be connected to the logistic network and enabled based on a condition. If a device has conditions set for circuit and for logistic network, it will become activated if both conditions are true. Devices that can also be controlled with the logistic network:
* Transport belts
* Inserters
* Train stop
* Mining drills
* Pumpjack
* Power switch
* Lamp
* Offshore pump
* Pump


The circuit network is often use to control the amount of certain items or fluids in the factory. Before the storage tank, lamp, small and offshore pump were included to the circuit network, the basic usage was to connect a smart inserter with a chest next to it to control the amount of items in the chest.
See the [[logistic network]] and [[roboport]] articles for more information.


== Advanced ==
== History ==


[[File:circuit-network.jpg|256px|thumb|The picture shows a circuit network that contains over 42,000 coal and 12,000 iron plates.]]
{{history|0.15.0|
* Significantly improved circuit network performance. Up to 25 times less CPU usage and 10% less memory usage.
* Added the Programmable Speaker: it shows alerts and plays sounds based on circuit network signals. It can be used to make simple songs.
* Train Stop can output the contents of the stopped train's cargo.
* Train Stop can be disabled using the circuit network. Trains will skip disabled Train Stops, allowing simple train control.
* Mining Drills can be turned on and off using the circuit network. They can also output the remaining expected resources.
* Pumpjacks can be turned on and off using the circuit network. They can also output the current oil mining rate.
* Added Modulo, Power, Left Bit Shift, Right Bit Shift, Bitwise AND, Bitwise OR and Bitwise XOR to the Arithmetic Combinator.
* Added additional operators to the Decider Combinator and Circuit Conditions.}}


The [[Automatic control/Smart bus|smart bus]] page explains the function of the bus.
{{history|0.13.0|
* Many machines are now connectible to the circuit network.
* Wire disconnecting is incorporated into the latency hiding.
* Wires are now highlighted on entity mouseover.
* Reduced memory usage of circuit network.}}


There are several links into the forum (''outdated''):
{{history|0.12.33|
* Fluid values are rounded to the closest value instead of rounding down when transmitted to circuit network.}}


* [http://www.factorioforums.com/forum/viewtopic.php?f=5&t=3149 Forum article about the basic usage]
{{history|0.12.1|
* [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]
* One can copy paste circuit network conditions between the [[inserter]], [[lamp]], [[pump]] and [[offshore pump]]. }}


=== Receivers ===
{{history|0.12.0|
[[File:smart_inserter.png|thumb|250px|Example condition: "Work only if the count of [[Iron plate]]s is lower than the amount of [[Steel plate]]s." Instead of the steel plate you can use a constant value.]]
* Improvements to circuit network connection, one can connect multiple wires of the same color to the same entity.
[[Smart inserter]]s, [[Lamp]]s, [[Small pump]]s and [[Offshore pump]]s are currently the only devices connectable to the circuit network. If a circuit condition is set, they only work if this condition is true.
* The [[lamp]], [[storage tank]], [[pump]] and [[offshore pump]] can be connected to the circuit network.
When it is connected to the network, it is possible to set up the condition in three parts:
}}
* Item or fluid. To check the condition, the amount of the given item or fluid in the connected circuit network is taken.
* Type of the condition: less than, bigger than, equal
* Item or fluid. To check the condition, the amount of the given item or fluid in the connected circuit network is taken.
Both values will be compared by using the given type of the condition.


=== Multiple networks ===
{{history|0.10.0|
It is possible to establish multiple distinct networks of the same color. Just make sure that there is no wire connection between them and they will be treated as separate networks.
* [[Blueprint]]s copy circuit network connections.}}


=== Examples (''outdated'') ===
{{history|0.8.3|
* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=348 Logic Gates, Edge Detector]
* Circuit network contents info has colored slots to specify the network it represents.}}
* [http://www.factorioforums.com/forum/viewtopic.php?f=6&t=4728&p=37251#p37157 Logic gates revisited]
* [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=3211&p=23692#p23676 Evenly fill two item onto one lane]
* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=298 Material splitters]
* [http://www.factorioforums.com/forum/viewtopic.php?f=8&t=6839 Logic gates using side inserter mod]


== See also ==
{{history|0.1.0|
* [[Circuit network (research)]]
* Introduced}}
* [[Transport network]]
* [[Combinators]]
* [[Virtual signals]]


[[Category: Networks]] [[Category: Circuit network]] [[Category: Transport network]]
{{C|Logistics{{!}}#Circuit network}} {{C|Circuit network{{!}}#Circuit network}}

Latest revision as of 03:05, 18 November 2024

Circuit networks are built using red or green wire, and enable the control of receivers, based upon information broadcast onto the network by connected senders. 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 48 extra virtual signals which act as user-definable channels. 'Everything', 'Anything' and 'Each' are also available wildcards.

Two circuit networks shared over one small electric pole.

Usage

Send information

Senders broadcast the amount of items or 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. For example, a Storage Tank containing 1000 Crude Oil will broadcast 1000 on the Crude Oil channel.

The channels are separated from each other, so each network can simultaneously carry a number for each item and fluid in the game, and for each of the extra user-defined channels (digits 0-9, letters A-Z, and 9 different colors). All unused channels have the value zero.

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 within the network will be 2000.

All wires of the same color which are connected together by junctions form a network, i.e. they will pass their signals to each other. 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.

Numbers are in the signed 32 bit integer range, i.e. from -2147483648 to 2147483647 inclusive, and are encoded in two's complement representation. The numbers wrap around on overflow, so e.g. 2147483647 + 10 becomes -2147483639. When entering a number in a combinator it can appear to exceed the 32 bit limit until the GUI is closed, at which point the number will overflow/underflow. [1]

Control devices

Receivers can use broadcast information, in most cases to enable/disable the device. They can either compare results between different channels, or compare a channel to a specific value.

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 copper plates and a green wire with 10 copper plates, the input signal set for that receiver will be 30 copper plates.

Multiple wires of the same color will share & sum their signals. For example, 3 chests A, B and C connected in a row (A -> B -> C) with green wire will output the sum of their contents along any green wire connected to any of the chests. However, if a red wire connects chest A to an inserter, that inserter will only be given the contents of A as its input signal.

Devices

Each device that is able to be connected to a circuit network has a Circuit network panel.png icon located in the top right corner of its info pane. Clicking this icon will display the available circuit network options for that device (note: a red or green wire must be connected, otherwise the message "not connected" will display instead). Clicking the Logistic network panel.png icon next to it, the device can be connected to a logistic network if in range of one, which also allows conditions to be set.

Conditions can be set for both circuit (signals of red and green wires are summed) and logistic network, which will together act as a logical AND.

The following devices can be connected to a circuit network:

Icon Name Possible output signals Possible circuit control Possible logistic network control
Transport belt.png
Transport belts Transport belts can send their content to the circuit network.
  • Pulse mode: The signal is sent for only 1 tick when the item enters the belt.
  • Hold mode: The signal is sent continuously as long as the items are on the belt.
  • Hold mode (All belts): The signal is sent continuously for all items on the entire transport belt line. The count continues through underground belts, but not splitters or side loading.
Transport belts can be enabled on a condition. Transport belts can be enabled on a logistic network condition.
Inserter.png
Inserters All inserters can send their held items to the circuit network.
  • Pulse mode: The signal is sent for only 1 tick when the item is picked up.
  • Hold mode: The signal is sent continuously as long as the inserter is holding the item.
All inserters can be enabled on a condition. The inserter stack size can also be overridden from a control signal (configurable; values less than 1 are treated as 1). Filters can be set on a signal. All inserters can be enabled on a logistic network condition.
Assembling machine 1.png
Oil refinery.png
Chemical plant.png
Centrifuge.png
Crusher.png
Foundry.png
Electromagnetic plant.png
Biochamber.png
Cryogenic plant.png
Assembling machines, Oil refinery, Chemical plant, Centrifuge, Crusher, Foundry, Electromagnetic plant, Biochamber, Cryogenic plant All crafting machines can output their contents, output the ingredients of a set recipe, set a given signal when working, and send a given signal when a recipe completes All crafting machines can enable on a condition and set the recipe based on a signal
Wooden chest.png
Chests All chests can send their contents to the circuit network. Logistic chests automatically send their contents to the logistic network. Logistics chests can be enabled on a condition.
Cargo landing pad.png
Cargo landing pad The landing pad can send its contents to the circuit network. The landing pad can have its requests set by the circuit network.
Rocket silo.png
Rocket silo The rocket silo can output its contents or requests from space platforms.
Space platform hub.png
Space platform hub Can output its contents, destination and source planet, current speed, and damage taken
  • Default: Read Speed = Signal V
  • Default: Read Damage Taken = Signal D
Platform hub can be sent the contents of the circuit network to use for wait conditions
Asteroid collector.png
Asteroid collector Can output its contents to the circuit network Can enable on a condition and set filters on a signal
Requester chest.png
Requester chest Can send its contents to the circuit network. Does not send its content to the logistic network. Its requested items can be set by the circuit network.
Storage tank.png
Storage tank The storage tank can send its fluid content to the circuit network.
Gate.png
Gate Gates can send a signal to the circuit network.
  • Default: Player detected = Signal-G.png
Gates can be opened on a condition.
Nuclear reactor.png
Heating tower.png
Nuclear reactor, Heating tower The reactor and heating tower can output any fuel, including the fuel currently being burned, to the circuit network, as well as its current temperature
  • Default: Read temperature = Signal-T.png
Agricultural tower.png
Agricultural tower Can output any seeds and harvested plants in its inventory Agricultural tower can be enabled on a condition Can be enabled on a logistic network condition
Gun turret.png
Laser turret.png
Flamethrower turret.png
Rocket turret.png
Tesla turret.png
Railgun turret.png
Gun turret, Laser turret, Flamethrower turret, Rocket turret, Tesla turret, Railgun turret Can send their respective ammunition to the circuit network
  • Laser and tesla turrets will not send any signal if this option is selected, due to not using ammo
Can enable, set priorities, and ignore priorities on a condition Can be enabled on a logistic network condition
Artillery turret.png
Artillery turret Can send its ammunition to the circuit network Can be enabled on a condition Can be enabled on a logistic network condition
Rail signal.png
Rail signal Rail signals can send their state to the circuit network.
  • Default: Signal-Red.pngSignal-Yellow.pngSignal-Green.png

Note: If red due to circuit network, does NOT output red signal

Rail signals can be set to red on a condition.
Rail chain signal.png
Rail chain signal Rail chain signals can send their state to the circuit network.
  • Default: Signal-Red.pngSignal-Yellow.pngSignal-Green.pngSignal-Blue.png
Train stop.png
Train stop Train stops can send the contents of a stopped train to the circuit network as well as read a unique train identifier code. The amount of trains going to the train stop can be read by the circuit network.
When reading the content of a stopped train, fluid amounts are rounded down to the nearest integer, except when the fluid amount is < 1, then it is is rounded to 1.
  • Default: Train Count (en route) = Signal-C.png
  • Default: Stopped Train ID = Signal-T.png
Train stops can send the contents of the circuit network to the train to use it for wait conditions, as well as enable/disable the stop itself. The maximum amount of trains that can go to the train stop ("train limit") can be set by the circuit network, as well as the stop priority.
  • Default: Set Limit = Signal-L.png
  • Default: Set Priority = Signal P
Train stops can be enabled on a logistic network condition.
Accumulator.png
Accumulator It can send its charge level in percent to the circuit network.
  • Default: Charge % = Signal-A.png
Roboport.png
Roboport It can send its logistic network contents and/or its robot statistics to the circuit network. The signals used for robot statistics are configurable.
  • Default: Available Logistics Bots = Signal-X.png
  • Default: Total Logistics Bots = Signal-Y.png
  • Default: Available Construction Bots = Signal-Z.png
  • Default: Total Construction Bots = Signal-T.png
  • Default: Roboports in Network = Signal-R.png
Radar.png
Radar Radars will transmit any signals passed into it to all other radars on the same planet.

Unlike other machine outputs, signals from red and green wires are transmitted separately.

Display panel.png
Display panel Can display a label and/or custom message on a condition
Burner mining drill.png
Mining drills All mining drills can send the expected resources, either from the drill itself or from the whole ore patch the drill is on. Mining drills can be enabled on a condition. Mining drills can be enabled on a logistic network condition.
Pumpjack.png
Pumpjack It can output the current oil mining rate. It can be enabled on a condition. It can be enabled on a logistic network condition.
Power switch.png
Power switch Power switches can connect power networks on a condition. It can be enabled on a logistic network condition.
Programmable speaker.png
Programmable speaker Shows alerts and plays sounds based on circuit network signals. It can be used to make simple tunes.
Lamp.png
Lamp The lamp can be enabled on a condition.
  • Color mapping: The color is set based on the provided color signals
  • Color components: The color is set based on the values of incoming red, green, and blue color signals, which should be between 0 and 255
  • Packed RGB: The color is set based on a single hex encoded RGB color on the white color signal. It should be between 0 and 16777215
The lamp can be enabled on a logistic network condition.
Offshore pump.png
Offshore pump The offshore pump can be enabled on a condition. The offshore pump can be enabled on a logistic network condition.
Pump.png
Pump The pump can be enabled on a condition and set its filter on a signal The pump can be enabled on a logistic network condition.

Physical network structure

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. Wire length is limited by its previous connection.

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. If red and green wires happen to touch the same power pole or device, the red and green networks will remain separate and will not link up. However, two red cables or two green cables will link if they touch. Use different colored cables to separate networks in close proximity.

  • To connect wires or cables to a power pole, simply click on one entity, then on the base of the power pole.
  • To erase a wire or cable connection, place the same color wire over an existing connection. You don't get the wire/cable back.
  • 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.
  • When connecting to a arithmetic combinator or decider combinator, take care to connect the wire to the correct input or output side. Use "Show details" mode to see the orientation of the combinator.
  • Hovering the mouse cursor over an item will highlight all wires which connect to the item.
  • Hovering the mouse cursor over a power pole which is part of a network will display the signals on its network. Some items like combinators will also display their input and output signals when hovered over.
  • Cut-pasting entities tries to preserve all wire connections to external entities and reconnect the new ghost to all its previous connection points, even when pasted multiple times, making it easy to rearrange entities without breaking connections.
  • Deconstructing a power pole tries to keep all affected wire connections intact, forming new wires between previously-connected entities as needed. This can result in redundant wire connections forming when cut-pasting or undoing deconstruction. Note that this doesn't happen when the power pole is destroyed, though its ghost remains connected.

Combinators

Combinators can function as both receiving and sending devices and allow more advanced functions to be used on a circuit network.

  • The constant combinator broadcasts up to 20 values on any of the channels for whatever networks it is connected to. (You cannot currently specify whether a value should be on the red or green channel; if you need different values, use two combinators, one for each color wire.) You can use any item channel or any of the virtual signal channels.
    • Note that using two of the 20 slots to broadcast values on the same channel is the same as broadcasting the sum of the two values from one slot.
  • 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.
    • 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).
    • 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. (The rate at which it climbs is determined by the current tick rate.) This technique can be combined with decider combinator logic to make electronic clocks, gates, and other systems; see Combinator Tutorial for advanced techniques.
    • 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.
    • Multi-network: The arithmetic combinator can be joined to both red and green networks on the input side and will sum their inputs.
  • The decider combinator functions much like an arithmetic combinator, but is designed to compare values. Essentially, it is a conditional. 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.
  • The selector combinator has various functions designed for filtering out and analyzing specific signals from its inputs. It is able to output the largest or smallest signal in a series of inputs, output the stack size of items, count the number of inputs, and output a random input every certain number of game ticks. If Space Age is enabled, it has three more functions for detecting an item's rocket capacity, and filtering/transferring quality grades.

Virtual signals

Virtual Signals available for use in the circuit network

Virtual signals are special non-item signals. Other than the three logic signals, virtual signals do not behave differently from item signals.

48 virtual signals can be sent over a network. They include the digits zero through nine, the letters A through Z, a check-mark, dot and info icon, and the colors red, green, blue, yellow, magenta, cyan, white, gray and black.

Logic signals

The icons of the three logic signals

Three of the virtual signals cannot be sent over a network but apply special logic to multiple signals.

Everything

Everything can be used on the left side in conditionals. The condition will be true when the condition is true for each input signal. The condition is also true if there are no signals. This means that the everything signal behaves as universal quantification.

If a signal (rather than a constant number) is used on the right side of the comparison with everything, it is implicitly excluded from the set of signals that everything checks, so the signal is not matched against itself. That means it is meaningful test e.g. everything > X, without getting a trivially false result on X > X.

The output of a decider combinator may also use everything, unless the input is set to each. When used, the combinator will output signal on every channel with non-zero input as long as the condition is true; the value will either be the input value or 1, depending on the corresponding setting.

Anything

Anything can be used on the left side of conditions. It will be false when there are no inputs. The condition will be true when the condition is true for at least one signal. This means the anything signal behaves as existential quantification.

If a signal (rather than a constant number) is used on the right side of the comparison with anything, it is implicitly excluded from the set of signals that anything checks, so the signal is not matched against itself. That means it is meaningful test e.g. anything >= X, without getting a trivially true result on X >= X.

When used in both the input and output of a decider combinator, anything will return the first matching signal following the order of precendence as they appear in Factoriopedia, wooden chest being first in line.

Each

Each can only be used in left input side and output of decider and arithmetic combinators. The signal can only be used as an output when also used as an input. When used in both the input and output, it makes a combinator perform its action on each input signal individually. The combinator will output the sum of each of the actions if only used in the input.

A combinator using each is like a stack of combinators with all inputs connected and all outputs connected in parallel. For example, if there are signals "copper" and "iron" present, one combinator would be evaluating conditions for copper, and the other combinator would be evaluating conditions for iron. The different output signals would then be added together on the shared wire.

Unlike everything and anything above, if a signal is used on the right hand side of an each operation, it is NOT implicitly excluded. So if you e.g. have each * X then you will also get X multiplied with itself in the output.

Each as an input will only be processed on signals that have a non-zero value. If you have a decider condition that inputs and output each, but wants to output only one value for an input signal that passes the condition, it will never output 1 for a signal which has a zero value, even if the condition is one that would be passed for a zero value.

Tutorials

Logistic network

The logistic network used by logistic robots is essentially a third network (a wireless one), along with the green and red wired networks. The logistic network is based on coverage by roboports.

Some devices can also be connected to the logistic network and enabled based on a condition. If a device has conditions set for circuit and for logistic network, it will become activated if both conditions are true. Devices that can also be controlled with the logistic network:

  • Transport belts
  • Inserters
  • Train stop
  • Mining drills
  • Pumpjack
  • Power switch
  • Lamp
  • Offshore pump
  • Pump

See the logistic network and roboport articles for more information.

History

  • 0.15.0:
    • Significantly improved circuit network performance. Up to 25 times less CPU usage and 10% less memory usage.
    • Added the Programmable Speaker: it shows alerts and plays sounds based on circuit network signals. It can be used to make simple songs.
    • Train Stop can output the contents of the stopped train's cargo.
    • Train Stop can be disabled using the circuit network. Trains will skip disabled Train Stops, allowing simple train control.
    • Mining Drills can be turned on and off using the circuit network. They can also output the remaining expected resources.
    • Pumpjacks can be turned on and off using the circuit network. They can also output the current oil mining rate.
    • Added Modulo, Power, Left Bit Shift, Right Bit Shift, Bitwise AND, Bitwise OR and Bitwise XOR to the Arithmetic Combinator.
    • Added additional operators to the Decider Combinator and Circuit Conditions.
  • 0.13.0:
    • Many machines are now connectible to the circuit network.
    • Wire disconnecting is incorporated into the latency hiding.
    • Wires are now highlighted on entity mouseover.
    • Reduced memory usage of circuit network.
  • 0.12.33:
    • Fluid values are rounded to the closest value instead of rounding down when transmitted to circuit network.
  • 0.12.0:
    • Improvements to circuit network connection, one can connect multiple wires of the same color to the same entity.
    • The lamp, storage tank, pump and offshore pump can be connected to the circuit network.
  • 0.8.3:
    • Circuit network contents info has colored slots to specify the network it represents.