Hey all, first time posting a blueprint here, hope you find it useful.
The problem I wanted to solve: classic mid-game oil headache. Petroleum gas overflows, heavy oil backs up, light oil drains to zero, and the whole refinery stalls because one tank is full. I got tired of manually flipping recipes on solid fuel chemical plants, so I built this.
What it does: 9 chemical plants making solid fuel that dynamically split across all three fluids based on tank fill levels. The split is fully flexible, not a fixed ratio:
- 5 / 3 / 1 when all three fluids are present in different amounts
- 9 / 0 / 0 only one fluid overflowing, others empty
- 7 / 1 / 1 slight skew toward one fluid
- 7 / 2 / 0 two fluids available, third one drained
- 7 / 0 / 2 middle fluid skipped
- ...and any other combination the situation calls for
Circuit logic recalculates tank levels every tick and reassigns machines on the fly. No idle plants waiting for "their" fluid, no manual recipe swaps.
Scalable: need more throughput? Just duplicate the 9-plant block and connect it to the existing one, the circuit logic handles extra lines automatically. Stack as many copies as your fluid supply can feed.
Usage: pipe in all three fluids (petroleum gas, heavy oil, light oil). Solid fuel comes out. That's it.
Under the hood: how it actually works
The idea is simple: chemical plants pick their own fluid based on whichever one has piled up the most. Step by step.
Step 1. Read tank levels, convert to fill percentages.
Step 2. Sum all three percentages. Use that sum to calculate each fluid's share of the total. If gas is at 90%, heavy oil at 30%, light oil at 0%, the sum is 120, so gas gets 75%, heavy oil 25%.
Step 3. 3 fluids, 9 chemical plants, the numbers divide cleanly. Multiply each fluid's share by 9 to get the plant count for that fluid. From the example above: 6.75 / 2.25 / 0.
Step 4. Floor it: 6 / 2 / 0. Sum is 8, but we have 9 plants. One got lost in rounding.
Step 5. Hand the leftover to the fluid with the largest share. Result: 7 / 2 / 0. Edge case 9 / 0 / 0 falls out of the same logic with no special-casing.
Step 6. Fluids in Factorio don't mix, so supply is handled through pump-valves. On a recipe change, the residual fluid drains into an internal loop, then the correct pump opens.
That's the whole trick.
Heads up: to connect a duplicate block, remove the filters from the pumps, place the pipe, then put the filters back.
Blueprint string in the comments (Reddit eats long strings in posts sometimes).
If you want a deeper dive into the combinator setup, ask away in the comments, I'll happily walk through any part of it.
Blueprint: https://factorioprints.com/view/-Os0_C5EQJd6-nuxZ1fk (Hosted on Factorio Prints since the string is too long for a Reddit comment.)
___
P.S. Real talk: a big part of why this exists is that I just wanted to build something cool. Not a perfect optimization, more an exercise in approach. The percentage-based dynamic allocation logic itself can be lifted and reused for other distributed production problems where you want machines to self-balance across multiple inputs based on relative supply.
And let's be honest, the factory must grow. Sometimes that means another row of furnaces. Sometimes it means an over-engineered self-balancing block that you'll lovingly stare at for ten minutes after it's done.
___
P.P.S. I built all of this while taking a "short break" from my actual project: a mega mall that builds everything for itself, you just tell it what and how much you want at the input.
I've been building this mega mall for over six months now. Time keeps slipping, and the project is slowly burying me alive.
...the break has been going on for a while.