Page 1 of 1

Occasionally not detecting full fluid wagon

Posted: Sun Nov 27, 2022 4:16 am
by mauhler31
Factorio version: 1.1.70-1

I have tried to setup a fluid provider station for 1 fluid wagon worth of heavy oil. However, the train is stuck at the station even though the fluid wagon is full. When I click into the train, it shows that the train condition for fluid contents >= 25k is not satisfied even though when I look at the fluid wagon, it shows 25k. This seem to have happened after the request timed out. I'm not sure if that could have caused this.

Are there any workarounds I can try? Thanks.
Screenshot (1).png
Screenshot (1).png (98.58 KiB) Viewed 1633 times
Screenshot (2).png
Screenshot (2).png (3.03 MiB) Viewed 1633 times

Re: [1.18.0] Occasionally not detecting full fluid wagon

Posted: Mon Nov 28, 2022 9:47 am
by Optera
1) This should be in general gameplay help.
LTN uses base game schedule-train interactions.

2) Going by the schedule the train is not filled to 25k.
Remember the GUI and circuit network round up.

Re: [1.18.0] Occasionally not detecting full fluid wagon

Posted: Tue Nov 29, 2022 5:01 am
by mauhler31
Sorry I'm not sure I understand your suggestion. The train schedule says I haven't met the 25k condition but when I check the fluid wagon contents I do have 25k.

Re: Occasionally not detecting full fluid wagon

Posted: Tue Nov 29, 2022 6:50 am
by Nidan
Try changing the condition to "> 24999".
Optera wrote:
Mon Nov 28, 2022 9:47 am
Remember the and circuit network round up.
Missing a word there?

Circuit network rounds down, unless it's a fluid in (0, 1], which is rounded up (to 1). Most, if not all, other displays round normally.

So, even if the wagon is at 24999.999 and everything displays "25k", the circuit network will see 24999 which is less than 25000 so the condition is not fulfilled.
With fluids I recommend only using the full/empty cargo conditions or, if they can't be used, account for potential floating point imprecision in the conditions.

Re: Occasionally not detecting full fluid wagon

Posted: Wed Nov 30, 2022 4:49 am
by mauhler31
When I hit this scenario, I waited about 10 minutes for it to try to resolve itself but it never did. Even if at one point in time the fluid wagon was 24999 instead of 25000, shouldn't the pump have been able to pump the remaining fluid into the wagon? Is it possible there is a rounding error in the fluid wagon contents calculation?

In terms of workarounds, the train conditions are set by LTN. Optera, is it possible to have LTN round down the train condition when handling fluids, or is there a way to tell LTN to request an amount smaller than a full wagon? (ie 24k)

Re: Occasionally not detecting full fluid wagon

Posted: Wed Nov 30, 2022 5:52 am
by Optera
Nidan wrote:
Tue Nov 29, 2022 6:50 am
Circuit network rounds down, unless it's a fluid in (0, 1], which is rounded up (to 1). Most, if not all, other displays round normally.

So, even if the wagon is at 24999.999 and everything displays "25k", the circuit network will see 24999 which is less than 25000 so the condition is not fulfilled.
With fluids I recommend only using the full/empty cargo conditions or, if they can't be used, account for potential floating point imprecision in the conditions.
Last I checked Factorio uses mathematical rounding everywhere. (>= 0,5 is rounded UP)

Re: Occasionally not detecting full fluid wagon

Posted: Wed Nov 30, 2022 5:56 am
by Optera
mauhler31 wrote:
Wed Nov 30, 2022 4:49 am
When I hit this scenario, I waited about 10 minutes for it to try to resolve itself but it never did. Even if at one point in time the fluid wagon was 24999 instead of 25000, shouldn't the pump have been able to pump the remaining fluid into the wagon? Is it possible there is a rounding error in the fluid wagon contents calculation?

In terms of workarounds, the train conditions are set by LTN. Optera, is it possible to have LTN round down the train condition when handling fluids, or is there a way to tell LTN to request an amount smaller than a full wagon? (ie 24k)
Don't ask for workarounds you disabled.
LTN adds a default stop timeout of 120s, after which trains are forced to leave stations.

Anyway since this is now a base game interaction I consider it resolved for LTN.

Re: Occasionally not detecting full fluid wagon

Posted: Wed Nov 30, 2022 3:01 pm
by sparr
If there's any fluid at all in the storage tank, which the alt mode icon suggests there is, then the pump should be able to put the last unit(s) of fluid into the fluid wagon. If you have a save showing this situation, I recommend posting it as a bug report.

Re: Occasionally not detecting full fluid wagon

Posted: Wed Nov 30, 2022 3:15 pm
by FuryoftheStars
Optera wrote:
Wed Nov 30, 2022 5:52 am
Nidan wrote:
Tue Nov 29, 2022 6:50 am
Circuit network rounds down, unless it's a fluid in (0, 1], which is rounded up (to 1). Most, if not all, other displays round normally.

So, even if the wagon is at 24999.999 and everything displays "25k", the circuit network will see 24999 which is less than 25000 so the condition is not fulfilled.
With fluids I recommend only using the full/empty cargo conditions or, if they can't be used, account for potential floating point imprecision in the conditions.
Last I checked Factorio uses mathematical rounding everywhere. (>= 0,5 is rounded UP)
Unless something changed recently, last I remember, the circuit network truncates/drops the decimal portion. I've had situations before where the value in the circuit network was 1 lower than what the gui showed.

Re: Occasionally not detecting full fluid wagon

Posted: Wed Nov 30, 2022 4:07 pm
by Loewchen
The condition is not set to >= 25000 based on the progress bar in the first screenshot, look like 25900.

Re: Occasionally not detecting full fluid wagon

Posted: Thu Dec 01, 2022 2:40 am
by mauhler31
It seems like I got confused since the condition displayed was truncated. I believe the problem was that I hadn't set a LTN max train length so it was trying to request more than a single wagon load. I haven't encountered this since I added it.

Really appreciate all the help!