My attempt at generic stations
Posted: Tue Nov 26, 2024 8:18 pm
The problem: I want to use trains to replace large swaths of my spaghetti belts. If possible, I want there to be no belts, only trains outside of space platforms.
I'd like to do this in a "generic" way, where I don't have trains dedicated to specific products; they just move whatever needs to be moved at the time.
My solution: using the circuit network to enable/disable stations, and interrupts to keep the trains going in the right direction. Wires are free now, so it's not even that expensive to scale.
To accomplish this, I have a "global" green and red wire network. Red has unallocated stations with demand--so long as they need a product and there's no train already dedicated to picking up that product, the demand will be on the red wire.
Green wire is unallocated supply trains. If a train has stuff in it, and isn't on it's way to a station, the station it is resting at will push it's inventory onto the green network.
There are five types of stations: Pickup and Dropoff for liquids and items, plus a fuelling station. Pickup stations check the red wire, and enable if thye have enough stock to fill a demand that they see on the red wire. They also take their train count, multiplied by -1, and add it to the red wire to reflect a demand in process of being met. Additionally, pickup stations have a limit for how much they will load into a train, disabling their pumps/insterters once the limit is reached.
Dropoffs track their stockpiles and put a signal on the red line when stocks get too low, so long as they don't already have a train unloading. They stay disabled unless there is a signal on the green line that matches a good they demand.
Both station types took 4 combinators to implement this logic. At the same time, I'm betting I'm going to need depots to handle race conditions. Any particular station will only enable for a single tick, but it's still feasible that they're going to collide at some point and cause havoc. I'll have to put some combinators in depots to handle that when it happens.
The trains have an interrupt to go to pickup when it's not full; stay until idle. An interrupt to go to dropoff; stay until empty or idle. An interrupt to go to a refuel station for low fuel stock. Their schedule only has a single stop--the depot, where they wait for 1s.
Has anyone else designed around this with the new interrupt system? I'm new at circuit network logic, so I figure there's probably someone somewhere who's done this better than I have.
I'd like to do this in a "generic" way, where I don't have trains dedicated to specific products; they just move whatever needs to be moved at the time.
My solution: using the circuit network to enable/disable stations, and interrupts to keep the trains going in the right direction. Wires are free now, so it's not even that expensive to scale.
To accomplish this, I have a "global" green and red wire network. Red has unallocated stations with demand--so long as they need a product and there's no train already dedicated to picking up that product, the demand will be on the red wire.
Green wire is unallocated supply trains. If a train has stuff in it, and isn't on it's way to a station, the station it is resting at will push it's inventory onto the green network.
There are five types of stations: Pickup and Dropoff for liquids and items, plus a fuelling station. Pickup stations check the red wire, and enable if thye have enough stock to fill a demand that they see on the red wire. They also take their train count, multiplied by -1, and add it to the red wire to reflect a demand in process of being met. Additionally, pickup stations have a limit for how much they will load into a train, disabling their pumps/insterters once the limit is reached.
Dropoffs track their stockpiles and put a signal on the red line when stocks get too low, so long as they don't already have a train unloading. They stay disabled unless there is a signal on the green line that matches a good they demand.
Both station types took 4 combinators to implement this logic. At the same time, I'm betting I'm going to need depots to handle race conditions. Any particular station will only enable for a single tick, but it's still feasible that they're going to collide at some point and cause havoc. I'll have to put some combinators in depots to handle that when it happens.
The trains have an interrupt to go to pickup when it's not full; stay until idle. An interrupt to go to dropoff; stay until empty or idle. An interrupt to go to a refuel station for low fuel stock. Their schedule only has a single stop--the depot, where they wait for 1s.
Has anyone else designed around this with the new interrupt system? I'm new at circuit network logic, so I figure there's probably someone somewhere who's done this better than I have.