Multi-liquid loading station; self-cleaning single pipe system
Posted: Sat Jan 11, 2025 7:58 pm
Been playing for a month now and this is my first proper design. Hope it is of some use to somebody.
The problem: For distant oil fields I wanted to process the oil on-site and have a single export station for all three fluids; using a single pipe to convey the fluids to the train wagon pumps.
The issue: If a fluid wagon is filled to capacity then the pumps connected to it will retain 400 fluid, which can only then flow forwards and will contaminate the next train if a different fluid type is pumped.
The solution: Two easy solutions to the pump issue would be to either use a dedicated purge wagon in-between loading sessions, or to ensure that wagons are never filled to capacity so that the excess pump fluid can be pumped in. I didn't like either of those; the former is lame, the latter would require testing to get the threshold correct if the system were scaled up (more pipe holding fluid between the wagons and storage tanks). So, I set about coming up with a self-cleaning system.
The design: Requirement: Loading wagons can be generic, but must be empty.
The system is comprised of 5 groups of combinators. Functionality, in visual order from top-to-bottom:
One potential issue I could see is that if you are somehow able to fill the main storage tank of a fluid type before the flush system can recycle any flushed fluids, then it might back up until it stalls. Not sure if that's even possible, but as you can tell by the scale I was only designing for a small oil field with a handful of refineries.
I let it run for awhile, refilling with infinity pipes, to see if it broke and it seemed fine. One potential improvement you could make is to increase the flush capacity so you could drain any incoming wagons that are not empty. For my purposes I was using a generic wagon system with train interrupts.

Mods: Not sure whether this is best placed here or in the station sub-forum; feel free to move and/or duplicate it if you wish.
The problem: For distant oil fields I wanted to process the oil on-site and have a single export station for all three fluids; using a single pipe to convey the fluids to the train wagon pumps.
The issue: If a fluid wagon is filled to capacity then the pumps connected to it will retain 400 fluid, which can only then flow forwards and will contaminate the next train if a different fluid type is pumped.
The solution: Two easy solutions to the pump issue would be to either use a dedicated purge wagon in-between loading sessions, or to ensure that wagons are never filled to capacity so that the excess pump fluid can be pumped in. I didn't like either of those; the former is lame, the latter would require testing to get the threshold correct if the system were scaled up (more pipe holding fluid between the wagons and storage tanks). So, I set about coming up with a self-cleaning system.
The design: Requirement: Loading wagons can be generic, but must be empty.
The system is comprised of 5 groups of combinators. Functionality, in visual order from top-to-bottom:
- Takes fluid level of all three types, sorts for the highest, and when a train docks to the station that fluid type is put into a memory cell for the duration of the loading. This signal is used to control which fluid type pumps should activate; if you just used the sorted signal it would change during the loading when the highest is no longer the highest
- Controls the train limit; for each fluid type over a threshold, add/subtract limit.
- Main storage tank pump controls; when the wagon pump flush is complete, activate the pumps on the main storage tanks for the fluid type (includes lower threshold stop control if wanted)
- (single combinator to the right of flush tank pump); when there is no train docked or the flush process is complete activate the OUT pump on the two flush tanks; fluids are recycled into the main tanks through filtered pumps. It is necessary to separate the flush tank in/out process, so that you don't get a false positive if the in/out flow rates somehow match for more than 90 ticks
- The meat and potatoes, the flush system; when a train docks to the station the wagon IN pumps connect and activate by default (no control or filter), pushing any previous fluid from the pipes and pumps into the train wagons. This is immediately pumped back out of the wagons by a single pump and pushed into the two flush tanks.
The flush tank level is measured twice, once by an arithmetic combinator adding zero, and by a decider combinator that also takes in the arithmetic value (now delayed 1 tick); if the values are the same then the fluid level has not changed in 1 tick and a signal is emitted - 'everything' wildcard ensures that if flush system is completely empty (i.e. before the first ever train) then the signal is still emitted (can't compare two zero signals).
That signal then passes into another decider combinator, which counts up to 90; it takes about 62 ticks just for the wagon pumps to engage when a train docks; fluid levels might appear steady between ticks when the fluid level integers are being rounded, so the extra 30 ticks adds a buffer to prevent a false positive of flush complete. Anytime the flush tank level changes the counter resets. When the counter reaches 90 a memory-cell emits a 'flush complete' signal.
This signal then deactivates the wagon OUT pumps and also feeds into the main storage tank pump controls to begin the loading process. Due to the combinator system itself the main tanks don't click on until 1 tick after the wagon OUT pumps - not sure if it would matter if they activated/deactivated in the same tick, but a useful outcome anyway. - Station chain signal blocks next incoming train until the flush tank has been emptied, though this happens before the loading is complete at this scale anyway.
One potential issue I could see is that if you are somehow able to fill the main storage tank of a fluid type before the flush system can recycle any flushed fluids, then it might back up until it stalls. Not sure if that's even possible, but as you can tell by the scale I was only designing for a small oil field with a handful of refineries.
I let it run for awhile, refilling with infinity pipes, to see if it broke and it seemed fine. One potential improvement you could make is to increase the flush capacity so you could drain any incoming wagons that are not empty. For my purposes I was using a generic wagon system with train interrupts.

Mods: Not sure whether this is best placed here or in the station sub-forum; feel free to move and/or duplicate it if you wish.