round up fluids reading train inventory

Post your ideas and suggestions how to improve the game.
Ralfinator
Inserter
Inserter
Posts: 31
Joined: Sun Jun 26, 2016 9:37 pm
Contact:

Re: round up fluids reading train inventory

Post by Ralfinator »

We are also having a lot of trouble with this in our base. :( We have a single train stop where trains where 3 different liquids arrive (controlled by LTN but that's actually not terribly relevant), and we need to enable only the right pumps. Sadly, the pumps shut off before the tank is empty, due to the rounding.

Given that the devs see problems with always rounding up, I am not sure what the best solution here would be. Some ideas:
- Somehow make it so that containers can never contain fractional amounts of liquids.
- Have a setting at the train stop / fluid tank that controls rounding up vs down.

Koub
Global Moderator
Global Moderator
Posts: 5697
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: round up fluids reading train inventory

Post by Koub »

Or add a way to control fluid flushing by circuit network. This has been requested when fluid flushing was added, and would probably address your issue (with a systematic flush whenever a train leaves the station for example).

[Edit] : viewtopic.php?f=6&t=86216
Koub - Please consider English is not my native language.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2681
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: round up fluids reading train inventory

Post by darkfrei »

Why fluids cannot be integer as items?

mrvn
Smart Inserter
Smart Inserter
Posts: 4156
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: round up fluids reading train inventory

Post by mrvn »

Ralfinator wrote:
Fri Jul 31, 2020 7:51 am
We are also having a lot of trouble with this in our base. :( We have a single train stop where trains where 3 different liquids arrive (controlled by LTN but that's actually not terribly relevant), and we need to enable only the right pumps. Sadly, the pumps shut off before the tank is empty, due to the rounding.

Given that the devs see problems with always rounding up, I am not sure what the best solution here would be. Some ideas:
- Somehow make it so that containers can never contain fractional amounts of liquids.
- Have a setting at the train stop / fluid tank that controls rounding up vs down.
Actually that you are using LTN helps avoid this problem. Some while ago I wrote a patch for LTN so the yellow constant combinator on the LTN Stop outputs a -1 signal for any fluid to unload. If you connect your pumps to the yellow constant combinator (not the train stop) and set them to '<liquid> != 0' then they will do the right thing for unloading.

Note: works for loading too if you always request full fluid wagons. Partial loads still need an arithmetic combinator.

mrvn
Smart Inserter
Smart Inserter
Posts: 4156
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: round up fluids reading train inventory

Post by mrvn »

darkfrei wrote:
Fri Jul 31, 2020 10:24 am
Why fluids cannot be integer as items?
Because the math for moving liquids through pipes would become verry rough if it had to limit itself to integers. An output of 50 liquid for example would not even travel 10 pipe length because it takes 55 units to maintain a one unit gradient for that length. Fluids wouldn't get far enough and be stop-and-go like a traffic jam on a highway.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2646
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: round up fluids reading train inventory

Post by Optera »

mrvn wrote:
Fri Jul 31, 2020 1:38 pm
darkfrei wrote:
Fri Jul 31, 2020 10:24 am
Why fluids cannot be integer as items?
Because the math for moving liquids through pipes would become verry rough if it had to limit itself to integers. An output of 50 liquid for example would not even travel 10 pipe length because it takes 55 units to maintain a one unit gradient for that length. Fluids wouldn't get far enough and be stop-and-go like a traffic jam on a highway.
With the current unfinished/broken fluid mechanics.

Oxygen not Included for example has more robust and easier to understand fluid mechanics that would work perfectly fine with integer numbers.

ptx0
Filter Inserter
Filter Inserter
Posts: 345
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: round up fluids reading train inventory

Post by ptx0 »

Optera wrote:
Sat Aug 01, 2020 9:15 am
mrvn wrote:
Fri Jul 31, 2020 1:38 pm
darkfrei wrote:
Fri Jul 31, 2020 10:24 am
Why fluids cannot be integer as items?
Because the math for moving liquids through pipes would become verry rough if it had to limit itself to integers. An output of 50 liquid for example would not even travel 10 pipe length because it takes 55 units to maintain a one unit gradient for that length. Fluids wouldn't get far enough and be stop-and-go like a traffic jam on a highway.
With the current unfinished/broken fluid mechanics.

Oxygen not Included for example has more robust and easier to understand fluid mechanics that would work perfectly fine with integer numbers.
Same with Satisfactory's pipe mechanics.

Ralfinator
Inserter
Inserter
Posts: 31
Joined: Sun Jun 26, 2016 9:37 pm
Contact:

Re: round up fluids reading train inventory

Post by Ralfinator »

Actually that you are using LTN helps avoid this problem. Some while ago I wrote a patch for LTN so the yellow constant combinator on the LTN Stop outputs a -1 signal for any fluid to unload. If you connect your pumps to the yellow constant combinator (not the train stop) and set them to '<liquid> != 0' then they will do the right thing for unloading.
I had in the past checked that combinator to see if it would output the requested amount on an LTN requester (similar to how it does the same on an LTN provider, so I thought that would make a lot of sense -- not just for fluids), and it did not -- I saw no output at all from the yellow combinator. I just tried again, still no luck. Are you sure that patch is working? This is with LTN 1.13.10.

mrvn
Smart Inserter
Smart Inserter
Posts: 4156
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: round up fluids reading train inventory

Post by mrvn »

Ralfinator wrote:
Sun Aug 09, 2020 8:36 pm
Actually that you are using LTN helps avoid this problem. Some while ago I wrote a patch for LTN so the yellow constant combinator on the LTN Stop outputs a -1 signal for any fluid to unload. If you connect your pumps to the yellow constant combinator (not the train stop) and set them to '<liquid> != 0' then they will do the right thing for unloading.
I had in the past checked that combinator to see if it would output the requested amount on an LTN requester (similar to how it does the same on an LTN provider, so I thought that would make a lot of sense -- not just for fluids), and it did not -- I saw no output at all from the yellow combinator. I just tried again, still no luck. Are you sure that patch is working? This is with LTN 1.13.10.
https://github.com/Yousei9/Logistic-Tra ... e.lua#L466

Code: Select all

            elseif c.type == "fluid_count" then
              if (c.condition.comparator == "=" and c.condition.constant == 0) then
                --train expects to be unloaded of each of this fluid
                fluidInventory[c.condition.first_signal.name] = -1
              elseif c.condition.comparator == "≥" then
                --train expects to be loaded to x of this fluid
                fluidInventory[c.condition.first_signal.name] = c.condition.constant
              end
            end
The code is still there and it worked for me before. Maybe some of the mod settings are relevant? Check the schedule for the train that it contains a "fluid_count = 0" condition and play with the options a bit.

Post Reply

Return to “Ideas and Suggestions”

Who is online

Users browsing this forum: Illiander42