Theikkru wrote: ↑Sun Jul 07, 2024 4:16 am
Now it makes even less sense to me; I don't know why you're trying so hard to use the individual capacities of pipes or tanks to calculate things when it causes so many strange problems, and the steps I showed already handle the "special case" you're talking about just fine.
In the equations I wrote, 3 pumps tried to pull a combined 600×50%=300 fluid that tick, but since there was only 100 in the segment, it got split up as 33, 33, and 34.
Well i can understand why it wouldn't make sense, it's kind of far from the topic of the power plant, more abstract, and i'm not qualified to explain those things, which i made up and may contain mistakes. But i think i can try again to explain with another different initial setting and compare the 2 to try and illustrate better how i can see the pump working.
Supposedly If i use the same value as those you started with,my things would yield the exact same thing. Your equation describe for me one case where there couldn't be any other answer given starting condition.
It would only use the "????" answer only if the initial conditions are different enough to allow for all the pumps to potentially pull at their "max pulling rate" from the whole segment.
Theikkru wrote: ↑Sun Jul 07, 2024 4:16 am
If I try to follow your instructions:
mmmPI wrote: ↑Sun Jul 07, 2024 3:13 am
[...]
(1) read segment volume = amount of fluid in it
[volume]=100
[volume]=1000
mmmPI wrote: ↑Sun Jul 07, 2024 3:13 am
(2) get segment capacity ( number of pipe * pipe capacity ) +( number of tank * tank capacity ) ....
[seg-cap]=200
[seg-cap]=1000
mmmPI wrote: ↑Sun Jul 07, 2024 3:13 am
(3) get segment fill % ( (1) / (2) )*100 ( yes i had this backward )
[seg-fill]=(100/200)x100= 50%
[seg-fill]=(1000/1000)×100=100%
mmmPI wrote: ↑Sun Jul 07, 2024 3:13 am
(4) get entity from which pumps are attempting to pull volume (3) * capacity of that particular entity
[entity]=[seg-fill]×100=50
[entity]=[seg-fill]×100=100
mmmPI wrote: ↑Sun Jul 07, 2024 3:13 am
(5) get pump max optimistic pulling rate from that entity ( number of pump attached to that single pipe * (4))
[optimistic]=3×[entity]=150
[optimistic]=3×[entity]=300
mmmPI wrote: ↑Sun Jul 07, 2024 3:13 am
(6) check if all pump can pull at max rate : => compare (5) and (1)
[optimistic]=150>100=[volume]
[optimistic]=300<1000=[volume]
mmmPI wrote: ↑Sun Jul 07, 2024 3:13 am
if (5)> (1), all pumps gets to pull [(1)/number of pumps]*(3) quantity of fluid
if (5) < (1) , all pumps gets to pull (4) quantity of fluid,
(150>100) thus each pump is allowed to pull (100/3) * (50%) = 100/6 = 16.66667 fluid that tick (1000/second if sustain, which doesn't happen, because the tick after the fluid in the segment will be different, which means the fill level will be different, which means the pump will be allowed to pull less liquid and so on)
same as => [pull]=[volume]÷3×[seg-fill]=100÷3×50%=16.6667
(300<1000) thus each pump is allowed to pull : 100 fluid that tick. ( 6000/second if sustain which doesn't happen but goes to show the "max rate" as being inherited from the pipe capacity )
I don't see how it would be much slower or too different than your equations, in that i have attempted to use the same values, it shouldn't apply for all machines only for pumps. The capacity of the segment doesn't need to be queried every tick, it only need to be updated when a pipe or a tank or any entity is built on the map, it then gets assigned to a "fluid segment" and "increased its capacity" for (2).
(1) has to be updated every tick anyway as that's the amount of fluid in the segment.
(3) is just a simple division at the "beginning of the tick", after the amount of fluid is pushed onto a segment or removed, it means the (1) has changed since previous tick, since there is a different quantity of fluid, the % of fill need to be updated to, and it takes into account wether or not player build pipes during that tick in previous step because fillness depend on both fluid quantity and capacity of segment.
(4) is occuring each tick, but only for every entity that is "pipe-or-tank-attached-to-pumps". I thought only for "pump" not all machine and not all "pipes or tanks". One only need to math how much fluid in 1 pipe, 1 tank , 1 modded-tank, PER [fluid-segment] since inside a fluid segment, all "pipes" or "tanks" or "modded-tank" would contain the same "absolute value" ( the green bar of fluid shown in the FFF making me think this math is already present).
(5) is occuring each tick, but only for every group of pump attached to the same point, so that if 1 or 2 or 3 pump are attached to the same "pipe" or "tank" their optimistic pulling off rate would be accounted for as 1 value to be compared against the quantity of fluid in the whole segment. If a pipe is attached to no pump, it is not inducing any additionnal calculation.
(6) each group of pump attached to the same point pull the same amount of fluid, most of the time only 1 pump will be in the group, unless one squeeze 2 pump pulling from the same pipe/tank, or even 3 pumps, in this case, given previous steps, pumps would be able to empty the segment at a very high rate that could be tweaked without risking creating additionnal fluid.
Theikkru wrote: ↑Sun Jul 07, 2024 4:16 am
(Why would a chem plant or turbine get as much as 100 or 25000 fluid per tick!?)
I only considered the case of pumps, not all machines, to establish the "maximum", attempting to find an explanation that would make it 6000 fluid/second, considering pipe has 100 capacity.
25000 fluid per tick is way too much x) but this would correspond to the "special case" when a pump is pulling from a tank. The number can be "capped" with a hardcoded-to-tweak-value, so that it would correspond to 12000 fluid per second to maintain the same values as in the old system for pump-max-rate-when-pulling-from-tank, or 25000 per second , doubling the max rate of vanilla game, making the "special case of pulling from tank" even better compared to the 6000/s that would be "inherited limit" when pumps pull from pipes or whatever value that devs seem fit when they playtest the expansion.
I also considered that the % of fill, is somewhat of a player indicator of the real value which would be "quantity of fluid", and that in game the "quantity of fluid" is updated first, and then the % of fill is calculated. which maybe was not well explained and caused unecessary confusion.
I also didn't consider the part where one make sure there is no attempt to push more fluid in the next segment than it can contain, which would be necessary for describing the whole pump functionning. ( but not machines like chem plant of turbines ).
Again at this point i'm not saying it's "simpler" or "better" or "more obvious" than your explanation, or any other explanation, it's just what popped in my head after i realized the problems in the previous explanations. It may still contain mistakes or me not realizing the extra computationnal cost.
This would make sense for me in the context of "is 1 pump or 3 pump or 0 pump" the best for the nuclear power plant ? => it depend on how wildly you speculate on the pumps rate calculation
Then even if my math are not making sense or incorrect , i can't rule out devs come up with a much clever solultion so that my speculation about flow rate are validated , despite me not possibly finding any nice algo to justify it , so i feel like i couldn't rule out cases where either 0 or 1 or 2 or 3 pumps would be optimal for the power plant.