Handling precise fluid amounts... how?
Handling precise fluid amounts... how?
My question:
How do I handle fluids in EXACT amounts reliably?
I'm looking for ways to do precise fluid handling. Hooking up a pump to enable/disable at a certain amount of fluid in a tank doesn't work, it overshoots the mark:
Worse, it seems that the overshoot is wholly unpredictable, so this will not be good enough.
I thought I'd be able to work in units of 50 fluid on a reliable basis by just using barrels, but testing them quickly told me otherwise:
This single unit of offset does not seem like much, but it breaks my builds rather spectacularly.
Me and a friend are on a server building the One Step Per Stop Rocket Train (OSPSRT). Basically, a Pretty big) train takes all the raw materials required, and stays with it all the way to rocket launch, performing one operation at each station.
So, I'll need to be able to pump exact amounts around at the fluid stations, to be able to do exactly ONE rocket, and no more. I've got the problems solved for item handling, but fluids
Does anyone have any methods, tips or mods that might help us?
How do I handle fluids in EXACT amounts reliably?
I'm looking for ways to do precise fluid handling. Hooking up a pump to enable/disable at a certain amount of fluid in a tank doesn't work, it overshoots the mark:
Worse, it seems that the overshoot is wholly unpredictable, so this will not be good enough.
I thought I'd be able to work in units of 50 fluid on a reliable basis by just using barrels, but testing them quickly told me otherwise:
This single unit of offset does not seem like much, but it breaks my builds rather spectacularly.
Me and a friend are on a server building the One Step Per Stop Rocket Train (OSPSRT). Basically, a Pretty big) train takes all the raw materials required, and stays with it all the way to rocket launch, performing one operation at each station.
So, I'll need to be able to pump exact amounts around at the fluid stations, to be able to do exactly ONE rocket, and no more. I've got the problems solved for item handling, but fluids
Does anyone have any methods, tips or mods that might help us?
Re: Handling precise fluid amounts... how?
Use barrels.
Re: Handling precise fluid amounts... how?
Thanks, but I tried that and explain in the OP why that doesn't work.
Re: Handling precise fluid amounts... how?
None of this is what you want to hear, but I'm not aware of any way to get count-perfect fluid processing. You might try single-tick pump pulses (maybe 1 tick on and then 9 off?) but I expect that will have similar issues to using barrels.
Optera's Inventory Sensor will give you different measurement results, since it rounds up instead of down, but I'm not sure that will be any better. If you're having troubles because your fluid wagons aren't emptying completely, that's what you need.
It sounds like a really neat base, and I'd love to see it when you're done, but, fluid wagons or barrels, I think you're going to have to sully your perfect plan and overload the trains. You can let the extra hang out at the destination stations, and do some cross-station circuit magic, so the oil field station (for example) knows to underload the crude wagon(s) by whatever leftover is hanging out at the refinery station, or you can let the extra hang out on the train, and use that as the signal to load less next time around.
EDIT, because my brain helpfully supplied extra information 5 minutes after I posted: OnmiFluid might be the mod you're looking for. I've never used it, though.
Optera's Inventory Sensor will give you different measurement results, since it rounds up instead of down, but I'm not sure that will be any better. If you're having troubles because your fluid wagons aren't emptying completely, that's what you need.
It sounds like a really neat base, and I'd love to see it when you're done, but, fluid wagons or barrels, I think you're going to have to sully your perfect plan and overload the trains. You can let the extra hang out at the destination stations, and do some cross-station circuit magic, so the oil field station (for example) knows to underload the crude wagon(s) by whatever leftover is hanging out at the refinery station, or you can let the extra hang out on the train, and use that as the signal to load less next time around.
EDIT, because my brain helpfully supplied extra information 5 minutes after I posted: OnmiFluid might be the mod you're looking for. I've never used it, though.
Re: Handling precise fluid amounts... how?
I see where you showed your attempt not working, but I don't see any attempt to explain (or understand) why. Getting every drop of liquid out of a container is a specialized task IRL too, in Factorio you use assemblers for that. There's going to be a few drops hiding in nooks in pumps and pipes and storage tanks so run a cycle or two to prime them, knowing you won't get a perfect result, and from then on you'll get full value out of the exact BOM quantities you deliver. In barrels.Xtrafresh wrote:Thanks, but I tried that and explain in the OP why that doesn't work.
Re: Handling precise fluid amounts... how?
Or Barrels Processing, where is possible do refinery fluids-in-barrels.DaleStan wrote:because my brain helpfully supplied extra information 5 minutes after I posted: OnmiFluid might be the mod you're looking for. I've never used it, though.
Re: Handling precise fluid amounts... how?
Oh right! It derps once or twice initially, but then never again? I'll test, if that's the case I'm saved. I'll still have a look at omnifluid thoughquyxkh wrote:I see where you showed your attempt not working, but I don't see any attempt to explain (or understand) why. Getting every drop of liquid out of a container is a specialized task IRL too, in Factorio you use assemblers for that. There's going to be a few drops hiding in nooks in pumps and pipes and storage tanks so run a cycle or two to prime them, knowing you won't get a perfect result, and from then on you'll get full value out of the exact BOM quantities you deliver. In barrels.Xtrafresh wrote:Thanks, but I tried that and explain in the OP why that doesn't work.
Re: Handling precise fluid amounts... how?
Thanks for the tips! I was going down the same rabbithole - cross station overflow tracking and loaders adjusting on subsequent runs... Even in concept in my head there were 50 things going wrong, let alone an actual game run.DaleStan wrote:None of this is what you want to hear, but I'm not aware of any way to get count-perfect fluid processing. You might try single-tick pump pulses (maybe 1 tick on and then 9 off?) but I expect that will have similar issues to using barrels.
Optera's Inventory Sensor will give you different measurement results, since it rounds up instead of down, but I'm not sure that will be any better. If you're having troubles because your fluid wagons aren't emptying completely, that's what you need.
It sounds like a really neat base, and I'd love to see it when you're done, but, fluid wagons or barrels, I think you're going to have to sully your perfect plan and overload the trains. You can let the extra hang out at the destination stations, and do some cross-station circuit magic, so the oil field station (for example) knows to underload the crude wagon(s) by whatever leftover is hanging out at the refinery station, or you can let the extra hang out on the train, and use that as the signal to load less next time around.
EDIT, because my brain helpfully supplied extra information 5 minutes after I posted: OnmiFluid might be the mod you're looking for. I've never used it, though.
Also thanks for the interest
I have the last 5 stations set up, here's a map view of them:
Because of how the numbers work, every 5th train receives 2 extra RCUs and LDS's. Aside from that, it now produces a rocket and satellite with no byproducts in those last few steps. 5 Stations done, only 24 to go!
Re: Handling precise fluid amounts... how?
Use barrels. Just don't build a pipe between the unbarreling assembler and the pump. Attach the pump directly to the assembler, otherwise some micro-amounts of liquid will remain in the pipes, perfectly breaking your perfect count.
Re: Handling precise fluid amounts... how?
Personally I would expect that even in that case, floating point errors will mean that you still either gain or lose a tiny fraction of fluid, so I wouldn't expect exact amounts. Just settle for having a small surplus somewhere.Lav wrote:Use barrels. Just don't build a pipe between the unbarreling assembler and the pump. Attach the pump directly to the assembler, otherwise some micro-amounts of liquid will remain in the pipes, perfectly breaking your perfect count.
Re: Handling precise fluid amounts... how?
This is true, sadly:Zavian wrote:Personally I would expect that even in that case, floating point errors will mean that you still either gain or lose a tiny fraction of fluid, so I wouldn't expect exact amounts. Just settle for having a small surplus somewhere.Lav wrote:Use barrels. Just don't build a pipe between the unbarreling assembler and the pump. Attach the pump directly to the assembler, otherwise some micro-amounts of liquid will remain in the pipes, perfectly breaking your perfect count.
Those 2-ish units got stuck inside the pump due to some calculation or other on the 6th cycle of 10 barrels. How many units will get stuck, and when, is entirely unpredictable, though how that should be possible is beyond me, as Factorio is supposed to be completely deterministic.
As I'm typing this, some are popping into mind:
If I use barrels, I can't control the exact amount of fluid sloshing around between barreling and unbarreling, but I CAN control the exact amount in and out of the train. The 'leakage' described above has an upper bound: once 200 fluid units have gotten stuck in it, the pump is full (god let's hope so!)
That means if I have a pre-filled buffer tank with more buffer than the combined pumps in the setup can hold, I can always insert and extract exact amounts from the setup, and the trains can keep going
Re: Handling precise fluid amounts... how?
Basically - I doubt that much would be lost even if there were floating-point errors, and I doubt that anywhere near 200 units will get stuck in the pump.Xtrafresh wrote:If I use barrels, I can't control the exact amount of fluid sloshing around between barreling and unbarreling, but I CAN control the exact amount in and out of the train. The 'leakage' described above has an upper bound: once 200 fluid units have gotten stuck in it, the pump is full (god let's hope so!)
That means if I have a pre-filled buffer tank with more buffer than the combined pumps in the setup can hold, I can always insert and extract exact amounts from the setup, and the trains can keep going
There are 10 types of people: those who get this joke and those who don't.
Re: Handling precise fluid amounts... how?
Well, I stopped and started the setup above a bunch of times, and it kept going up. I was at 68 units stuck in there when I stopped, after 5 minutes of clicking... I didn't feel like spending the next 10 minutes to push it all the way up to 200, but it kept going up, and the average didn't show any chance of slowing.Jap2.0 wrote:Basically - I doubt that much would be lost even if there were floating-point errors, and I doubt that anywhere near 200 units will get stuck in the pump.
Re: Handling precise fluid amounts... how?
Hm, that's odd. I might look into that sometime.Xtrafresh wrote:Well, I stopped and started the setup above a bunch of times, and it kept going up. I was at 68 units stuck in there when I stopped, after 5 minutes of clicking... I didn't feel like spending the next 10 minutes to push it all the way up to 200, but it kept going up, and the average didn't show any chance of slowing.Jap2.0 wrote:Basically - I doubt that much would be lost even if there were floating-point errors, and I doubt that anywhere near 200 units will get stuck in the pump.
There are 10 types of people: those who get this joke and those who don't.
-
- Inserter
- Posts: 46
- Joined: Mon Oct 23, 2017 10:46 pm
- Contact:
Re: Handling precise fluid amounts... how?
Did some experimenting last night and found a couple of weird behaviors re: pump outputs. Some of it looks useful:
- A pump will never hold on to more than 100 units of fluid if given a choice.
- A pump is limited by the fill level at the output. If it's connected to a storage tank (and nothing else) with 10K fluid (40% full), it will keep a maximum of 40 fluid. If the tank has 15K fluid (60% full), it'll keep a maximum of 60 fluid, and so on.
- Fluid momentum and variations in input tend to keep the number lower than the theoretical maximum, with how much lower depending heavily on the rate of flow.
TL;DR: If something is consuming the output from a pump, the amount of 'trapped' fluid goes to almost zero.
- A pump will never hold on to more than 100 units of fluid if given a choice.
- A pump is limited by the fill level at the output. If it's connected to a storage tank (and nothing else) with 10K fluid (40% full), it will keep a maximum of 40 fluid. If the tank has 15K fluid (60% full), it'll keep a maximum of 60 fluid, and so on.
- Fluid momentum and variations in input tend to keep the number lower than the theoretical maximum, with how much lower depending heavily on the rate of flow.
TL;DR: If something is consuming the output from a pump, the amount of 'trapped' fluid goes to almost zero.
Re: Handling precise fluid amounts... how?
IIRC not all of the fluid math is visible in the GUI, I think there are fractions not represented on screen. If so, I don't know how you will achieve such precision, but your end goal may still be achievable.
What are you wanting to end up with? A completely empty supply train for every rocket? Given that fluids may not be absolutely predictable, you might settle for simply topping off a certain number of tanks on each train visit.
What are you wanting to end up with? A completely empty supply train for every rocket? Given that fluids may not be absolutely predictable, you might settle for simply topping off a certain number of tanks on each train visit.
Re: Handling precise fluid amounts... how?
(sigh)Xtrafresh wrote: ↑Mon Sep 10, 2018 8:38 pmThis is true, sadly:Zavian wrote:Personally I would expect that even in that case, floating point errors will mean that you still either gain or lose a tiny fraction of fluid, so I wouldn't expect exact amounts. Just settle for having a small surplus somewhere.Lav wrote:Use barrels. Just don't build a pipe between the unbarreling assembler and the pump. Attach the pump directly to the assembler, otherwise some micro-amounts of liquid will remain in the pipes, perfectly breaking your perfect count.
This is so not true. I've even went and tested this, and everything works perfectly.
You see, when I write "attach the pump directly to the assembler", I usually mean you need to attach the pump directly to the assembler. And not, you know, to several pipe sections. Because it's not the pump that's leaving trace amounts of liquid, it's the pipes and liquid physics.
P. S. Hmm, unless the devs changes the way pump works between 0.15 and 0.16. That's a possibility.
Re: Handling precise fluid amounts... how?
Thedarkbunny's testing seems to disagree with you. Also, factorio seems to disagree, as it's displaying the trapped liquid to be in the pump, not in the pipes.Lav wrote: ↑Wed Sep 12, 2018 8:19 am(sigh)Xtrafresh wrote: ↑Mon Sep 10, 2018 8:38 pmThis is true, sadly:Zavian wrote:Personally I would expect that even in that case, floating point errors will mean that you still either gain or lose a tiny fraction of fluid, so I wouldn't expect exact amounts. Just settle for having a small surplus somewhere.Lav wrote:Use barrels. Just don't build a pipe between the unbarreling assembler and the pump. Attach the pump directly to the assembler, otherwise some micro-amounts of liquid will remain in the pipes, perfectly breaking your perfect count.
This is so not true. I've even went and tested this, and everything works perfectly.
You see, when I write "attach the pump directly to the assembler", I usually mean you need to attach the pump directly to the assembler. And not, you know, to several pipe sections. Because it's not the pump that's leaving trace amounts of liquid, it's the pipes and liquid physics.
P. S. Hmm, unless the devs changes the way pump works between 0.15 and 0.16. That's a possibility.
Still, if i'm wrong I'd love to hear it.
Can you show me your test setup? Can it work "perfectly" when several pumps are placed in sequence?
I suppose I could design a factory to use only pumps for pipes and tanks for corners...
Edit:
Never mind. I followed your instructions, tested for ONE cycle, et voila!
Last edited by Xtrafresh on Wed Sep 12, 2018 10:15 pm, edited 1 time in total.
Re: Handling precise fluid amounts... how?
That is indeed the goal here, though it's starting to look like a utopia. For example, every 5th train produces two extra RCU's and two extra LDSs because of the production module math. I'm not quite ready to calculate backwards to see how much less of each resource every 35th train should take along as a resultadam_bise wrote: ↑Tue Sep 11, 2018 9:37 pmIIRC not all of the fluid math is visible in the GUI, I think there are fractions not represented on screen. If so, I don't know how you will achieve such precision, but your end goal may still be achievable.
What are you wanting to end up with? A completely empty supply train for every rocket? Given that fluids may not be absolutely predictable, you might settle for simply topping off a certain number of tanks on each train visit.
Re: Handling precise fluid amounts... how?
Impressive work, thanks for this!thedarkbunny wrote: ↑Tue Sep 11, 2018 4:55 pmDid some experimenting last night and found a couple of weird behaviors re: pump outputs. Some of it looks useful:
- A pump will never hold on to more than 100 units of fluid if given a choice.
- A pump is limited by the fill level at the output. If it's connected to a storage tank (and nothing else) with 10K fluid (40% full), it will keep a maximum of 40 fluid. If the tank has 15K fluid (60% full), it'll keep a maximum of 60 fluid, and so on.
- Fluid momentum and variations in input tend to keep the number lower than the theoretical maximum, with how much lower depending heavily on the rate of flow.
TL;DR: If something is consuming the output from a pump, the amount of 'trapped' fluid goes to almost zero.