round up fluids reading train inventory
Moderator: ickputzdirwech
round up fluids reading train inventory
Problem:
Controlling pumps for unloading is cumbersome with stops showing 0 while there's 0.x fluid left in wagons.
Using the empty condition does not work if you want to have that train drop off oil and pick up sulfuric acid.
Solution:
Stops reading train inventories should always round up fluids to next integer.
Controlling pumps for unloading is cumbersome with stops showing 0 while there's 0.x fluid left in wagons.
Using the empty condition does not work if you want to have that train drop off oil and pick up sulfuric acid.
Solution:
Stops reading train inventories should always round up fluids to next integer.
My Mods: mods.factorio.com
Re: round up fluids reading train inventory
+1000
This issue is currently driving me batty.
This issue is currently driving me batty.
Re: round up fluids reading train inventory
you can set it to if fluid is <1 solves the issue mostly for trains you don't intend to carry different fluids at different times.
My Mod ideas - https://forums.factorio.com/forum/vie ... 49#p107558
Re: round up fluids reading train inventory
You don't seem to get the point.JohnyDL wrote:you can set it to if fluid is <1 solves the issue mostly for trains you don't intend to carry different fluids at different times.
Fluids are double values.
Stops show fluid values by truncating them to integer, making it impossible to discern if something is truly 0 or <1 if you prefer that.
My Mods: mods.factorio.com
Re: round up fluids reading train inventory
actually I do get the point of the difference between <1 and =0 what I don't get the point about 100% is why it matters <1 is actually <0.5 thanks to current rounding and a loss of that little only matters once and happens as rounding errors eventually anyway. You need 200+ deliveries for it to prevent 2 oil processes happening that could otherwise have worked 75000 oil per wagon*4/100 gives 3000 processes per train an equivalent loss of 1 in 600,000. it's a negligible loss like asking for a nuclear reactor to deliver 1 extra kilowatt
My Mod ideas - https://forums.factorio.com/forum/vie ... 49#p107558
Re: round up fluids reading train inventory
With the way fluids work in factorio a tank gets locked to a fluid with even trace amounts of a fluid inside.JohnyDL wrote:actually I do get the point of the difference between <1 and =0 what I don't get the point about 100% is why it matters <1 is actually <0.5 thanks to current rounding and a loss of that little only matters once and happens as rounding errors eventually anyway. You need 200+ deliveries for it to prevent 2 oil processes happening that could otherwise have worked 75000 oil per wagon*4/100 gives 3000 processes per train an equivalent loss of 1 in 600,000. it's a negligible loss like asking for a nuclear reactor to deliver 1 extra kilowatt
The problem is we don't see these trace amounts in circuit network. It should output 0 only when a tank is truly empty and ready to take in any fluid.
My Mods: mods.factorio.com
Re: round up fluids reading train inventory
Seems to me the real solution to the problem should be "Use integers instead of floats for fluid values". Though that would probably be a headache to change.
Re: round up fluids reading train inventory
Yes I thought the same a while ago.Roxor128 wrote:Seems to me the real solution to the problem should be "Use integers instead of floats for fluid values". Though that would probably be a headache to change.
Maybe the developers can provide some insights why they decided for floats.
Re: round up fluids reading train inventory
Yes I agree if you need to 100% empty to change fluids then that's an issue but if you need to do that then you probably don't need the circuit network interfering at all. if you're using it as a detection to stop mixing fluids the train is probably going back and forth between the same stations if you need to change fluid it's probably a one off procedure and you can turn off the circuit controls to do it. I can't think of any good reason why I'd want to have 2 different fluids using the same wagon even an edge case where you're delivering petroleum gas and taking away sulphuric acid from the same set up I'd want 2 trains so that the train doesn't act as a bottle neck.
Another alternative is adding in a small delay on your detection line, if there's a delay of say 10 ticks that's more than enough time to empty the last tiny bit of fluid.
Another alternative is adding in a small delay on your detection line, if there's a delay of say 10 ticks that's more than enough time to empty the last tiny bit of fluid.
My Mod ideas - https://forums.factorio.com/forum/vie ... 49#p107558
Re: round up fluids reading train inventory
LOL you should try the Logistic Train Network mod.JohnyDL wrote:Yes I agree if you need to 100% empty to change fluids then that's an issue but if you need to do that then you probably don't need the circuit network interfering at all. if you're using it as a detection to stop mixing fluids the train is probably going back and forth between the same stations if you need to change fluid it's probably a one off procedure and you can turn off the circuit controls to do it. I can't think of any good reason why I'd want to have 2 different fluids using the same wagon even an edge case where you're delivering petroleum gas and taking away sulphuric acid from the same set up I'd want 2 trains so that the train doesn't act as a bottle neck.
Another alternative is adding in a small delay on your detection line, if there's a delay of say 10 ticks that's more than enough time to empty the last tiny bit of fluid.
Re: round up fluids reading train inventory
Love that mod never use it for fluids though there's no point. so few endpoints in that network it's simpler to do it manually
My Mod ideas - https://forums.factorio.com/forum/vie ... 49#p107558
Re: round up fluids reading train inventory
As a programmer, I can say there are certainly a few reasons to use floats when writing something. The main ones I can think of off the top of my head being these three:steinio wrote:Yes I thought the same a while ago.Roxor128 wrote:Seems to me the real solution to the problem should be "Use integers instead of floats for fluid values". Though that would probably be a headache to change.
Maybe the developers can provide some insights why they decided for floats.
1. Being the computer equivalent of scientific notation, they have a very large range (10^308 down to 10^-308 for 64-bit floats).
2. Algorithms are often easier to implement with floats rather than just integers.
3. Some APIs require their use for certain functions (eg. OpenGL uses them for things like coordinates and colours, and both HLSL and GLSL use them for all colour values).
Hope that helps give a little insight.
Re: round up fluids reading train inventory
I'm curious for the reasoning behind the usage of float for fluids myself. No recipe needs fractions for crafting.steinio wrote:Yes I thought the same a while ago.Roxor128 wrote:Seems to me the real solution to the problem should be "Use integers instead of floats for fluid values". Though that would probably be a headache to change.
Maybe the developers can provide some insights why they decided for floats.
My Mods: mods.factorio.com
Re: round up fluids reading train inventory
most likely it's there to produce the desired flow behaviour on pipes, if there's a drop off of 0.1% per pipe and its calculated pipe by pipe and rounded each time once you drop below 500 fluid in a pipe with integers the drop off effect would stop.
My Mod ideas - https://forums.factorio.com/forum/vie ... 49#p107558
Re: round up fluids reading train inventory
Oh no, not this again.
I remember the rounding method was changed about 2 times due to problems like this.
Won't rounding up(in all cases including storage tanks, since it has to be consistent) cause other problems in other setups?
I'll add this to my TODO and hopefully we can fix it.
We might implement a mechanic where large high pressure fluids would destroy static small amounts of leftover fluid. This would also solve the "delete and replace all pipes because I accidentally put the wrong fluid in it for 1 second" problem.
We are also considering remove all the pipe fluid physics and replacing it with a much simpler model, similar to how electric networks work.
I remember the rounding method was changed about 2 times due to problems like this.
Won't rounding up(in all cases including storage tanks, since it has to be consistent) cause other problems in other setups?
I'll add this to my TODO and hopefully we can fix it.
We might implement a mechanic where large high pressure fluids would destroy static small amounts of leftover fluid. This would also solve the "delete and replace all pipes because I accidentally put the wrong fluid in it for 1 second" problem.
We are also considering remove all the pipe fluid physics and replacing it with a much simpler model, similar to how electric networks work.
Re: round up fluids reading train inventory
Twinsen I think it sounds like a better case for a check on disconnect of pump if it's a bug fix (though I'm still not bothered by it)
on event pump disconnect: if fluid in tank <1 then delete fluid from tank force add fluid to pump even if over full
on event pump disconnect: if fluid in tank <1 then delete fluid from tank force add fluid to pump even if over full
My Mod ideas - https://forums.factorio.com/forum/vie ... 49#p107558
Re: round up fluids reading train inventory
Related bug report thread (which was moved to "Not a bug"):
viewtopic.php?f=23&t=47626 0.15.10 Fluid wagon leaving even though condition is not met
viewtopic.php?f=23&t=47626 0.15.10 Fluid wagon leaving even though condition is not met
Re: round up fluids reading train inventory
Playing with the Logistic Train Network mod myself, and this fluid rounding problem is destroying my life ;_;
So, first, here's the solution I created for my fluid train depot: My current theory is any configuration other than a single unbroken line results in fractions of fluid getting stuck in a pipe. This configuration allows a continuous pressure differential to entirely drain the pipe.
Second, here's my current problem: The train is set to leave when its contents are empty, or, after a long timeout. Now, I can change both of these settings in the LTN Mod, and I'm going to. But as it stands I have no way to fully empty the train using the circuit network. I can fully empty a cargo wagon using the circuit network, but I can't fully unload a fluid wagon using the circuit network.
Rounding up, from my player's perspective, or maybe decimalizing the circuit network, seem simplest? But then that also introduces fuck-knows-what behind the scenes, which makes sense to me too.
Maybe the simplest solution is to have fluids destroy with the higher pressure winning.
The pressure destruction method would probably open up some really cool options and designs for plumbing too. Maybe single-pipe refinery setups...
So, first, here's the solution I created for my fluid train depot: My current theory is any configuration other than a single unbroken line results in fractions of fluid getting stuck in a pipe. This configuration allows a continuous pressure differential to entirely drain the pipe.
Second, here's my current problem: The train is set to leave when its contents are empty, or, after a long timeout. Now, I can change both of these settings in the LTN Mod, and I'm going to. But as it stands I have no way to fully empty the train using the circuit network. I can fully empty a cargo wagon using the circuit network, but I can't fully unload a fluid wagon using the circuit network.
Rounding up, from my player's perspective, or maybe decimalizing the circuit network, seem simplest? But then that also introduces fuck-knows-what behind the scenes, which makes sense to me too.
Maybe the simplest solution is to have fluids destroy with the higher pressure winning.
The pressure destruction method would probably open up some really cool options and designs for plumbing too. Maybe single-pipe refinery setups...
Re: round up fluids reading train inventory
It's not as simple as rounding up.
If I round up soon there will be a flood of complaints from a different group of people saying that their storage tank logic no longer works, because there is 0.00001 fluid in their storage tank that they can't pump out. Or similar problems to this.
If I round up soon there will be a flood of complaints from a different group of people saying that their storage tank logic no longer works, because there is 0.00001 fluid in their storage tank that they can't pump out. Or similar problems to this.