Circuit network: Difference between revisions
(Delete old tutorial link) |
(Delete old tutorial link) |
||
Line 117: | Line 117: | ||
*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. | *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). | ** 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 | ** 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. | ||
** 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. | ** 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. | **Multi-network: The arithmetic combinator can be joined to both red and green networks on the input side and will sum their inputs. |
Revision as of 09:51, 4 December 2021
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.
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 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 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 control options |
---|---|---|---|
Transport belts | Transport belts can send their content to the circuit network.
|
Transport belts can be enabled on a condition. | |
Inserters | All inserters can send their held items to the circuit network.
|
All inserters can be enabled on a condition. The inserter stack size can also be overridden from a control signal (configurable). | |
Filter inserter | Same as above. | The filter inserters can additionally set their filters from the circuit network: up to 5 items whose corresponding signal has a positive value are whitelisted. | |
Chests | All chests can send their contents to the circuit network. Logistic chests additionally send their contents to the logistic network. | ||
Requester chest | Same as above. | Its requested items can be set by the circuit network. | |
Storage tank | The storage tank can send its fluid content to the circuit network. | ||
Gate | Gates can send a signal to the circuit network. | Gates can be opened on a condition. | |
Rail signal | Rail signals can send their state to the circuit network.
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 | Rail chain signals can send their state to the circuit network. | ||
Train stop | Train stations 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. |
Train stations 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. | |
Accumulator | It can send its charge level in percent to the circuit network. | ||
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. | ||
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. | |
Pumpjack | It can output the current oil mining rate. | It can be enabled on a condition. | |
Power switch | Power switches can connect power networks on a condition. | ||
Programmable speaker | Shows alerts and plays sounds based on circuit network signals. It can be used to make simple tunes. | ||
Lamp | The lamp can be enabled on a condition. If it receives color signals, it can set the given color. | ||
Offshore pump | The offshore pump can be enabled on a condition. | ||
Pump | The pump can be enabled on a 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. You don't get the wires back.
- 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.
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.
- 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.
Virtual signals
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
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.
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.
When used in both the input and output of a decider combinator, anything will return one of the signals that matched.
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.
Tutorials
- Tutorial:Circuit network cookbook - Example-heavy tutorials; for beginners who want to get to know and use the benefits of the circuit network.
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 proximity to a central roboport.
Some devices can also be connected to the logistic network. If a device has conditions set for circuit and for logistic network, it will become activated if both conditions are true.
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.1:
- One can copy paste circuit network conditions between the inserter, lamp, pump and offshore pump.
- 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.10.0:
- Blueprints copy circuit network connections.
- 0.8.3:
- Circuit network contents info has colored slots to specify the network it represents.
- 0.1.0:
- Introduced