Circuit-Controlled Routers
Adds a belt-based router network to the game. Make a network of smart routers, connected by belts and by green circuit wires. Request items from the network, or provide items to the network, using I/O terminals connected to chests. This mod is intended to provide another logistics option for complex mods, such as Seablock, Krastorio 2, Space Exploration, Industrial Revolution 3, or Pyanodon's.
Description
Circuit-controlled router
Development version
Please note that this is a development release. Feedback is greatly appreciated. However, the mod may see significant changes, possibly requiring a rebuild of your router network.
Introduction
This mod introduces two types of circuit-controlled belt routers for moving items around your base. These buildings act somewhat like 4-way splitters, with belts of items going into them and coming out of them.
However, there are several important differences to splitters:
- Routers can have multiple filters set per port.
- Routers can be circuit-controlled.
- Splitters preserve lanes, but routers do not.
- Splitters try to divide items fairly, but routers do not.
- Splitters can send items to a backup port if the main one is blocked, but routers cannot.
Manual routers (currently disabled)
Manual routers are currently in a rougher state than smart ones, and are disabled.
Manual routers are controlled by a constant combinator on each port. Every item signaled as >0 on that port will be accepted. If the default signal is set on a port, then it will also receive any items that are not accepted by other ports. Using the "rotate" key on a port will toggle the default signal.
Manual routers do not have any form of priority. An item is either requested by a port, or it is not.
Smart routers and I/O terminals
The screenshot shows a simple network which uses smart routers to direct the manufacturing of blue chips. First the green-chip station requests iron and copper; the red-chip station requests copper, plastic and green chips; the blue-chip station requests green chips, red chips, iron, sulfur and water barrels (to make sulfuric acid), and the barrel-filler station requests empty barrels. Finally, a station at the left requests the blue chips. All of these are routed automatically through the network.
Smart routers and I/O terminals are designed to form a network, routing items from terminals that provide them to terminals that request them. The routers and the terminals form a network connected by green wires. When two smart routers are connected together, their port lights will turn from red to green, and when a router port is connected to a terminal, the router's port light will turn blue.
Each terminal has a set of items it requests. You can adjust this using the constant combinator that's integrated into the terminal, or through the circuit network. External request signals must be connected to terminal *body* strictly by green wire. The terminal can also set the threshold at which it starts providing items, which is useful for adjusting its priority.
Smart routers use a fancy communication protocol over the green wires. It is recommended not to add your own signals to these. The routers also track how many items have been from one smart router to another, so that they don't send too many. It is therefore important not to divert these items, either with splitters or by picking them up off the belt.
Since the circuit network doesn't update instantaneously, it is possible that slightly too many of an item will be sent. Reducing this problem is part of the purpose of the request threshold. If extra items are sent, they would normally have nowhere to go, and so would clog up the network until someone requests them. However, extra items can be sent to *buffer terminals*. Buffer terminals additionally request all types of resources that aren't requested elsewhere, by using the default signal. Just set the default on a terminal to some positive value (say, 100) and any extra items will be routed to that terminal.
I/O terminals automatically connect to adjacent chests, unless this is disabled in the map settings.
Balancing
Smart routers are not very balanced, because they make some types of logistics prolems significantly easier. However, they are fairly expensive and use a lot of power.
How it works
Each router contains several invisible very fast filter inserters, much like with the https://mods.factorio.com/mod/miniloader mod. However, if you place many items on the port's allow-list, then simply setting the inserters' filters wouldn't be enough: inserters can only have up to 5 filters, and any other items in the allow-list would be ignored. So each router also contains a circuit made of invisible combinators to intersect the filters with the items present on the input belts.
Smart routers use extensive circuitry. Each green wire carries the following signals:
- For each item, the number of those items being put on the belt in that tick. This must remain less than 64.
- For each item, 64 times a demand factor for that item.
- The connected signal is set to -64 by each smart router. So if it's -64 then one smart router is connected, and if it's -32 then two smart routers are connected.
- The leaf signal is set to 64 by each leaf (requester and/or provider) port. This is currently only used to turn the port indicator light blue.
The item types participate in a "leaky heat equation": each smart router with N connected ports propagates slightly less than 1/Nth of its demands to each neighboring router. You can imagine that a leaf node demanding e.g. copper is a "heat source" on the copper channel, and then heat propagates throughout the smart router network. The heat leaks out slightly from everywhere in the network, but especially from the edges, which sets up a heat gradient. When a router receives an item, it will be routed in a direction that has above-average heat (= demand) for that item type.
The routers count how many items they are expecting to receive, so that they don't send too many.
Because each router knows how much of each signal it's broadcasting in each direction, it can cancel out the contribution from its own outputs when processing its inputs. This enables all the signals to fit on one
Ratings & reviews
Sign in to leave a rating or comment.