Working pump doesn't fill fluid tank to its limit.

Bugs that are actually features.
Hagaret
Inserter
Inserter
Posts: 28
Joined: Wed Aug 31, 2016 8:32 pm
Contact:

Working pump doesn't fill fluid tank to its limit.

Post by Hagaret »

We got 2 tanks with light oil on top and 1 wired fluid tank on the bottom and there's a working pump between them. So the wired tank supposed to be filled up to 25k and circuit networks should've show me 25k on a wire, but that's not happening. Instead of that I got 24999 on a wire and 25k in the menu of fluid tank. I reused such system more than 20 times in different places and everything works fine, but any of these cases might be bugged at the exact same way eventually.

Version of the game 2.0.28 (build 81088 expansion, win64)
Attachments
20241222132540_1.jpg
20241222132540_1.jpg (1.25 MiB) Viewed 1002 times
20241222120453_1.jpg
20241222120453_1.jpg (1.23 MiB) Viewed 1002 times
20241222120448_1.jpg
20241222120448_1.jpg (1.24 MiB) Viewed 1002 times
20241222120441_1.jpg
20241222120441_1.jpg (1.15 MiB) Viewed 1002 times
Shogal
Inserter
Inserter
Posts: 36
Joined: Tue Mar 05, 2019 1:46 am
Contact:

Re: Working pump doesn't fill fluid tank to its limit.

Post by Shogal »

Sorry for possible offtopic, but regardless it being bug or not, it's unreliable to assume full tank to contain exactly 25000 when it's constantly consumed from the other side. The exact value will only work if adding to the tank is computed exactly after all subtractions from it, or if subtractions don't happen every single tick and the combinator can catch the exact moment when the new amount was added to tank, clapped to capacity limit and not subtracted yet. Allowing some margin like [fuel] < 24980 will fix the schematic (assuming pump throughput is not more than 20 per tick if I don't miss anything).
Hagaret
Inserter
Inserter
Posts: 28
Joined: Wed Aug 31, 2016 8:32 pm
Contact:

Re: Working pump doesn't fill fluid tank to its limit.

Post by Hagaret »

Shogal wrote: Mon Dec 23, 2024 12:56 pm Sorry for possible offtopic, but regardless it being bug or not, it's unreliable to assume full tank to contain exactly 25000 when it's constantly consumed from the other side. The exact value will only work if adding to the tank is computed exactly after all subtractions from it, or if subtractions don't happen every single tick and the combinator can catch the exact moment when the new amount was added to tank, clapped to capacity limit and not subtracted yet. Allowing some margin like [fuel] < 24980 will fix the schematic (assuming pump throughput is not more than 20 per tick if I don't miss anything).
Even so, I still don't get what's the problem for pump to decrease output speed to that minimum amount of liquid that needed to get to that liquid level of 25k. Pump got everything to fill that tank, but it just refuses to do so.
Muche
Smart Inserter
Smart Inserter
Posts: 1006
Joined: Fri Jun 02, 2017 6:20 pm
Contact:

Re: Working pump doesn't fill fluid tank to its limit.

Post by Muche »

I've tried to reproduce it. It happened when the pipeline exceeded total volume of 45300. Below that the tank filled to 25000, above that only to 24999.
I would say it's due to how fluid system works plus rounding.
FFF-430 wrote: Fri Sep 27, 2024 11:00 am The output rate limit is particularly interesting because it makes the fluids feel much more like fluids again. Before, a pump could just push fluid in at the max 6000/s rate until the pipeline was 100% full, but now it slows down as the pipeline fills. For each pipeline, there is a certain fullness ratio where the output and input rates equalize, and the level of fluid in the pipe oscillates around this point as the machines do their work.
Above that 45300 limit, the fullness ratio seems to cause the pump to slow down pumping to below 1 fluid per tick, so it stops, and never fills that remaining 1 fluid.
Hagaret
Inserter
Inserter
Posts: 28
Joined: Wed Aug 31, 2016 8:32 pm
Contact:

Re: Working pump doesn't fill fluid tank to its limit.

Post by Hagaret »

Muche wrote: Mon Dec 23, 2024 2:02 pm I've tried to reproduce it. It happened when the pipeline exceeded total volume of 45300. Below that the tank filled to 25000, above that only to 24999.
I would say it's due to how fluid system works plus rounding.
FFF-430 wrote: Fri Sep 27, 2024 11:00 am The output rate limit is particularly interesting because it makes the fluids feel much more like fluids again. Before, a pump could just push fluid in at the max 6000/s rate until the pipeline was 100% full, but now it slows down as the pipeline fills. For each pipeline, there is a certain fullness ratio where the output and input rates equalize, and the level of fluid in the pipe oscillates around this point as the machines do their work.
Above that 45300 limit, the fullness ratio seems to cause the pump to slow down pumping to below 1 fluid per tick, so it stops, and never fills that remaining 1 fluid.
So the possible solution for that could be decreasing amount of source tanks to only one?
Shogal
Inserter
Inserter
Posts: 36
Joined: Tue Mar 05, 2019 1:46 am
Contact:

Re: Working pump doesn't fill fluid tank to its limit.

Post by Shogal »

Hagaret wrote: Mon Dec 23, 2024 3:03 pm So the possible solution for that could be decreasing amount of source tanks to only one?
This could solve exactly this single case. But generally it's better to do comparisons in proper way when dealing with floating point numbers (and fluids in factorio definitely are). Directly comparing them for being strictly equal is generally a bad idea because at some point they won't be equal due to rounding errors (google "0.1 + 0.2 problem" for more info). So it's much safer to compare for, say, >= 24.99k, sacrificing 0.01k to avoid rounding errors just in case.
Muche
Smart Inserter
Smart Inserter
Posts: 1006
Joined: Fri Jun 02, 2017 6:20 pm
Contact:

Re: Working pump doesn't fill fluid tank to its limit.

Post by Muche »

Further testing showed that the issue shows up at 39700 at some specific total volumes - 39700, 40200, 41200, 41900, 43400, ... , 45400, ... , 49900, ... , 182800, ... .

To me, it looks like rounding issues in floating point number representation (see e.g. 124368) in some subsequent fluid pumping maths.

The solution is to either not rely on storage tank having exactly 25000 fluid, to split pipeline into smaller ones (i.e. add a pump before the first flamethrower turret), or add a pipe/two/ten until the rounding is just right and the issue disappears.
Post Reply

Return to “Not a bug”