[2.0.21] Fluids within a pipe segment are distributed to consumers quite unevenly

Bugs that are actually features.
User avatar
Shados
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sat Mar 05, 2016 11:08 am
Contact:

[2.0.21] Fluids within a pipe segment are distributed to consumers quite unevenly

Post by Shados »

Within a given pipe segment, fluids are not split evenly among consuming machines, and the degree of unevenness is sufficient to cause observable issues in some cases.

It's most obvious in circumstances where your fluid supply is close to the maximum combined consumption of your machines. For example, we can see it quite clearly using the `show-fluid-box-fluid-info` debug setting in this setup of 55 steam turbines fed by 32 heat exchangers running at full output (i.e. ~3299 steam/s into turbines that can consume 3300 steam/s):
20241125015537_1.jpg
20241125015537_1.jpg (1.38 MiB) Viewed 159 times
Because of this uneven distribution of steam, the turbines end up outputting somewhat less than the 320MW they should be doing from this input rate. Over time, the turbines getting more steam fill their internal buffers and the starved turbines start getting more fluid, causing the power generation rate to eventually match expectations, but in this kind of circumstance it takes several minutes to get close to that point (the -7m mark and after in this graph shows it slowly ramping up):
20241125150233_1.jpg
20241125150233_1.jpg (803.55 KiB) Viewed 159 times
20241125150214_1.jpg
20241125150214_1.jpg (1.1 MiB) Viewed 159 times

This also exacerbates the 'wobbliness' of the fluid output of systems using circuit-controlled duty cycles to limit pump/fluid throughput (for e.g. trying to hit a particular thruster efficiency level, or restricting the consumption of buffered steam in a reactor for power smoothing).

The uneven distribution is largely minimised or hidden in situations where consumption/demand is a decent bit higher than supply, and also in situations where the total volume of the pipe segment is quite large, but these are just work-arounds and aren't really applicable to all builds.

Going by the below quote from FFF-416, I'm not entirely sure if this should be considered a bug in the 2.0 fluid mechanics or not, but I did find it very unexpected and quite unpredictable in practice.
In the new system, junctions are entirely unimportant; a segment only cares about the machines connected to it. When a machine is updated, its max pulling rate is limited based on the filled ratio of the connected segment. This results in much more even splitting, which while still not perfect, is pretty damn close.
I wonder: if pipe segments are already treated internally as a single cohesive unit, would it not be possible to have the fluid code update the buffers of all their attached machines in the pipe segment's update instead of being handled in each machine's update, and thus achieve an even (or buffer/demand-weighted) distribution of fluids...?
Rseding91
Factorio Staff
Factorio Staff
Posts: 14363
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.21] Fluids within a pipe segment are distributed to consumers quite unevenly

Post by Rseding91 »

Thanks for the report however I’m not seeing any bug here. Fluids were never said to consume perfectly even, just “more even than before” which is exactly what you see.
If you want to get ahold of me I'm almost always on Discord.
Muche
Fast Inserter
Fast Inserter
Posts: 231
Joined: Fri Jun 02, 2017 6:20 pm
Contact:

Re: [2.0.21] Fluids within a pipe segment are distributed to consumers quite unevenly

Post by Muche »

It looks to me that the wobbliness experienced is due to
FFF-416 wrote:Fri Jun 21, 2024 11:00 am Machines [...] can pull from a segment at a rate proportional to how full the segment is. In other words, if a segment is half full, then the pulling rate is half of the maximum.
In OP's example, the amount of steam in the pipeline is almost zero, this translates to steam turbines' almost zero pull.
So maybe one tick they pull zero steam and the next one some nonzero steam, which results in this wobbliness?

When I disconnected the electricity consumer and let the turbines fill completely (and pipeline to about 25%), then reconnected the consumer, the production jumped immediately to 320MW, no wobbliness of 318MW.
Also adding extra two turbines seemed to overcome those rounding issues - after two minutes of ramp up, turbines produced designed 320MW.
Post Reply

Return to “Not a bug”