Page 1 of 1

Fluid System - multiples

Posted: Sat Mar 06, 2021 12:52 pm
by 150d
Hi,

even after 250+ hours in the game I still don't understand the fluid system.


This works as I would expect:

tank -> pump -> pipes -> pump -> tank


But what about this:

tank -> pump -> pipes -> pump -> two-tanks

Here, the two tanks never fill completly. The line will just stop pumping as soon as the double-tank is about 75% full. This gets even worse if there are more than two tanks at the receiving end.


Or this:

tank -> pump -> pipes -> pump -> tank
......\> pump -> pipes -> pump -/

(ignore the dots, just formatting)

The intention is to fill the target tank twice as quickly. But again, this doesn't work - one pipeline will just stop pumping and the tank won't fill any quicker than it would with one line.


Something about the fluid principle still eludes me. Can anybody give me a tip?


Regards

Re: Fluid System - multiples

Posted: Sat Mar 06, 2021 2:48 pm
by Impatient
Sure.

What elludes you, is that the fluid system is the result of at least 3 attempts of getting it right and behave nicely. But the implementation of a simulation of real world fluid mechanics was and is a beast.

I resided to use only sequential fluid setups, never parallel ones. With parallel ones I never was able to ensure even load of parallel lines or tanks or whatever parallel. Only when using circuitry.

Re: Fluid System - multiples

Posted: Sat Mar 06, 2021 3:11 pm
by 150d
So how do you build a "tank farm" to store large amounts of liquids? If I connect e.g. 9 tanks together, they never "even out" between them, regardless how long I wait: The tank furthest from the feed line may be empty, even though the "first" tank in line may be half full.

I've tried to help even out the tanks by building a pipe line directly around them, connecting to every tank opening in the process. Sometimes this seems to help, in other cases it doesn't.

Next: How do you even connect to a tank? I've seen cases where the tank is half full, but the pipe directly connected to it is almost empty. Why?

There are peoply building enormous setups. How do they manage the fluid system - if it just simply doesn't work?

Re: Fluid System - multiples

Posted: Sat Mar 06, 2021 3:42 pm
by coppercoil
150d wrote:
Sat Mar 06, 2021 3:11 pm
I've seen cases where the tank is half full, but the pipe directly connected to it is almost empty. Why?
Could you provide a screenshot or blueprint? Very likely there are some important issues you didn't notice. Two tanks should work as well.
Fluids may be tricky, but once you understood that strange physics, you can build anything you want.

Re: Fluid System - multiples

Posted: Sat Mar 06, 2021 4:09 pm
by Impatient
150d wrote:
Sat Mar 06, 2021 3:11 pm
So how do you build a "tank farm" to store large amounts of liquids? ...
I build them in a sequential setup as well.

pump-tank-pump-tank-pump-...

I know that this works as expected.

Re: Fluid System - multiples

Posted: Sat Mar 06, 2021 4:43 pm
by 150d
Example:

Look at the two pumps at the top. They are supposed to fill the tank array beneath them. (Please ignore the rest.)

The tank contents (top row) are from left to right:
21k - 20k - 20k - 21k - 20k

The pipeline (coming down from above) leading to the left pump is "95 of 100" full (looking at the pipe-from-ground above each pump), the line leading to the right pump "98 of 100".

Both pumps themselves are full more than "380 of 400".

The left pump is working 1000/s.

-> But the right pump is working only 164/s.


Why? The lines are full, the tanks are not full -> why is the right pump not working?

factorio_tanks_1.jpg
factorio_tanks_1.jpg (59.31 KiB) Viewed 5196 times

Re: Fluid System - multiples

Posted: Sat Mar 06, 2021 5:59 pm
by ickputzdirwech
I would suggest that you remove the pipes between the pumps and the storage tanks and then test it again.

Re: Fluid System - multiples

Posted: Sat Mar 06, 2021 8:58 pm
by astroshak
You should not need a large number of tanks for fluid buffering like that. Process the crude as swiftly as you can upon receiving it, and make sure that you have another load coming as soon as possible so that you don’t run dry. You can get by with 1 storage tank per fluid wagon on your train if you wanted to. As well as 1 storage tank for heavy, light, and petroleum, and a storage tank or so for sulfuric acid and lube.

Re: Fluid System - multiples

Posted: Sat Mar 06, 2021 9:54 pm
by MEOWMI
Connect pumps directly to tanks and the difference in pump speed will be tremendous (provided the pump has enough fluid flowing to it to even pump).

The two main rules with flow rates and tanks are: place a pump directly before the tank and directly after the tank. Otherwise the pipe connection between the tank and pump slows down the flow rate a lot and even wastes some capacity. This is true for direct tank-to-tank connections too, though the difference is less pronounced than between tank-to-pipe connections.

Consequently, if you want double the flow rate into a tank, put pumps directly at two of it inputs. You must then use pumps as the remaining two connections in order to maintain the enormous flow rate. (If it's too fast of a flow rate for your needs, then just connect one pump in and one pump out, no need to even have two.)

From what I've come to understand the flow rate works mostly as follows:

Fluid entities (specifically only pipes and tanks) only transfer part of their relative proportional excess to adjacent entities. What this means, is that if a pipe is 90% full and connected to a tank that is 80% full, only part of the pipes 10% will flow into the tank over some time. If I understand things correctly, it is also true that a 90% full tank would have a higher rate of flow into an 80% full pipe than a 90% full pipe into an 80% full tank. However, maybe the most important takeaway from this, is that as the proportional difference decreases, flow rates will decrease too. If a pipe is 100% full and a tank next to it is 95% full, only some part of that 5% of the volume in the pipe will flow into the tank, and this amount will decrease as the percentage capacities become closer to each other. You could easily have thousands of empty space in a tank and only have abysmal flow rates into the tank because of this reason. For completeness, I'll also mention that, as the length of a pipe system increases, the flow rate will naturally decrease, because only some fraction of the difference actually flows through, meaning that in long chains of many many entities, the flow will slow down between every consecutive entity: a small part of the (percentage) difference becomes an even smaller part of the difference, over and over. The reason you don't often notice this is that when the flow rate is high enough to begin with, it doesn't matter that it slows down a little.

Now, here's how that changes with a pump: Pumps transfer a constant quantity (whatever they can pump, up to their max rate) into their target entity, meaning that their throughput is independent of how much fluid there already is in the target. A 10% full tank will fill as fast as a 90% full tank when the pump is pumping directly into it. If you pump into a pipe first, the pipe has a tiny capacity which gets filled almost instantly, and only a part of its capacity immediately flows into the tank, specifically, the percentage difference as I explained above.

It's not that realistic of a fluid simulation, but afaik this is how it functions.

Re: Fluid System - multiples

Posted: Sun Mar 07, 2021 6:03 pm
by Laie
150d wrote:
Sat Mar 06, 2021 12:52 pm
But what about this:

tank -> pump -> pipes -> pump -> two-tanks

Here, the two tanks never fill completly. The line will just stop pumping as soon as the double-tank is about 75% full. This gets even worse if there are more than two tanks at the receiving end.
Errrm.... cannot confirm?

I have setups like these, e.g. the railway stations next to my oil fields. Flow slows down noticeably once the tanks are almost full, asymptotically, I'm not sure if they ever quite reach 100%. But *hold on while I check* I don't see a slowdown until I have 99% fill, and the pump will keep struggling until it's deactivaed by circuit network at 99.9% -- when a train comes, the remaining fraction-of-a-percent will be dumped into the (then) emptying tank and there is no adverse effect to turn-around times.

This fits my mental model of how fluids work, which is essentially the same as MEOWMI's, above.
150d wrote:
Sat Mar 06, 2021 4:43 pm
Why? The lines are full, the tanks are not full -> why is the right pump not working?
The only explanation I can think of: because the pipe it's trying to pump into is mostly full?

Re: Fluid System - multiples

Posted: Sun Apr 11, 2021 1:18 pm
by 150d
I just can't figure this out.

I need four pipelines supplying 1237/s each.
An offshore pump supplies 1200/s, so I need five pumps for the four lines.

This is what I tried:
factorio_pipe_5to4.jpg
factorio_pipe_5to4.jpg (46.33 KiB) Viewed 4753 times

1, 2, 3, 4, 5 are pipes from the offshore pumps.
A, B, C, D lead off to consumers.

The five offshore pumps should produce 1200*5=6000/s, while the four consumers should only use 1237*4=4948/s. Therefore, the three tanks should fill up in no-time.

But they don't:

The tank top/left contains 12k, top/right contains 9,2k, bottom/right contains 16k.

The pumps are working:

1 pumping 639/s
2 pumping 1200/s
3 pumping 293/s
4 pumping 1200/s
5 pumping 1200/s

In sum, they are filling the tanks with 4532/s, while they are drained with 4948/s.

Why don't the pumps work full speed and fill the tanks??


It seems to me that it only works as intended when there es exactly one fill or drain pump at one port of the tank. But then I'll never get my five-to-four ratio because the tanks just don't have enough ports.


Regards

Re: Fluid System - multiples

Posted: Sun Apr 11, 2021 1:28 pm
by 150d
edit:

Yeehaa, I think I've got it. I read your earlier comments again really carefully, then came up with this:

factorio_pipe_5to4_morepumps.jpg
factorio_pipe_5to4_morepumps.jpg (36.54 KiB) Viewed 4749 times

... an additional pump after joining two feed lines. And this seems to work as intended!


Thanks for the tips!


Regards

Re: Fluid System - multiples

Posted: Mon Apr 12, 2021 11:47 am
by Impatient
hey there,

first take a look at the table about fluid throughput
and rework the pipe network accordingly

https://wiki.factorio.com/Fluid_system#Pipelines

second, offshore pumps produce water at a rate of 12000/s, not 1200/s.

third, with the knowledge of (1), don't overlook little traps like merging two pipelines to one pipe to connect them to a tank inlet.

4th, a sequence of connected tanks is a big no go regarding high throughput. always have a pump between tanks, to ensure optimal throughput. the reasons are a bit more complex and i can't go into their details, as i am not proficient with them myself.

5th, i am not sure, but i think parallel pipelines with forks and merges do not work as in real world as to the implementation of the fluid system in the game engine. but that is also something i have limited knowledge about. i just never use parallels. i build dedicated pipelines to areas with one or several consumers, where i know, that the pipeline throughput suffices for the consumers.

Re: Fluid System - multiples

Posted: Mon Apr 12, 2021 11:52 am
by disentius
Another way: start at the waterfront. As you can see here, A pipe length of 12 segments can support 1285 f/s, just above what you need.

So start with 2 pumps attached to 1 tank, and output from a tank to a pump. als long as you keep no more than 12 pipe segments (underground pipes = 2 segments) between pumps, you can transport that volume over any distance you want.
2021-04-12 13_49_21-Window.png
2021-04-12 13_49_21-Window.png (1.15 MiB) Viewed 4662 times
[EDIT]
I see that Impatient beat me to it :)
ad1.
Fluids do not merge/split equally. As MEOWMI stated, each pipe segment gains or transports fluid based on the level difference between them and the adjacent pipe/tank segments.
A tank with a level of 50% contains 12500 fluid, a pipe with a level of 50% has 50 fluid. A level difference of 1% from tank -> pipe ->250 fluid in the formula, pipe -> tank means 1 fluid input.
It gets more complicated with steam engines, boilers, and buildings which accept fluid as input. (the base "level"of fluids is 0, pipes and puumps hav a range from 0 to 100, steam engines and boilers have a range from -100 to 100)
2021-04-12 14_20_21-Window.png
2021-04-12 14_20_21-Window.png (28.71 KiB) Viewed 4652 times
ad2.
Segments are processed sequentially. this explains why you see the differences in pumping speed in your example with numbered pumps.

ad3.
Since the last Fluid optimization, pipes and tanks are processed in parallel, pumps still normal entities. this leads to the following general rule-of-thumbs:
- prefer more lines of pipes instead of fewer with pumps
- for predictable results, use A-> B connections whitout merges or splits whenever possible