0.15.10 Fluid wagon leaving even though condition is not met

Bugs that are actually features.
Post Reply
CaptainHook
Inserter
Inserter
Posts: 22
Joined: Sat Mar 04, 2017 11:10 am
Contact:

0.15.10 Fluid wagon leaving even though condition is not met

Post by CaptainHook » Mon May 15, 2017 2:53 pm

This is not a big bug, but still.
How to reproduce:
1, build a train with fluid wagon and fill it with crude oil (I tried crude oil, probably doesnt matter what you fill it with)
2,Build a station, set the leaving condition of the train to fluid count: empty
3, Pump out the crude oil.
4, watch train leave even though it has 0,8 crude oil in it

Only one part of the wagon was empty, other two had 0,4 crude oil in them.(screenshot)
Is this a bug or is the fluid count rounded down so 0.8 was considered 0 and train left? Not sure so posted it.
Attachments
20170515164622_1.jpg
20170515164622_1.jpg (816.29 KiB) Viewed 2474 times

Loewchen
Global Moderator
Global Moderator
Posts: 5131
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by Loewchen » Mon May 15, 2017 2:55 pm

Signals only work in integers, therefore anything < 1 is considered empty.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2180
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by steinio » Mon May 15, 2017 2:58 pm

Loewchen wrote:Signals only work in integers, therefore anything < 1 is considered empty.
Oh this damned fluids.
What happens if i fill water in the wagon after that?

Greetings, steinio.
Image
Transport Belt Repair Man
My little mods: Link | My favourite mods: Bob's Mods | Angel's Mods | Yuoki Railway Core | EvoGUI | Logistic Train Network
Factorio Cheat Sheet by Denis Zholob

View unread Posts

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2180
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by steinio » Sat May 20, 2017 2:39 pm

PUSH

Why is this on not a bug?

This damned fluid behavior is so annoying.
What should we do with an unempty rail tanker with 0.1 liquid?

Get this sorted out!
Image
Transport Belt Repair Man
My little mods: Link | My favourite mods: Bob's Mods | Angel's Mods | Yuoki Railway Core | EvoGUI | Logistic Train Network
Factorio Cheat Sheet by Denis Zholob

View unread Posts

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 3621
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by Klonan » Sat May 20, 2017 2:40 pm

steinio wrote:PUSH

Why is this on not a bug?

This damned fluid behavior is so annoying.
What should we do with an unempty rail tanker with 0.1 liquid?

Get this sorted out!
Use the 'inventory empty' condition if you want the train to leave when its empty

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

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by Optera » Wed May 31, 2017 7:49 am

Klonan wrote: Use the 'inventory empty' condition if you want the train to leave when its empty
This workaround is not usable if you have a train set to unload only part of it's contents.
e.g. have a train picking up lubricant and sulfuric acid to distribute it to 2 different stations.

Schedule checks for fluid contents should always round up.

BenSeidel
Filter Inserter
Filter Inserter
Posts: 543
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by BenSeidel » Wed May 31, 2017 10:06 am

what happens if you multiply the signal by 100,000?
Would that work?

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

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by Optera » Wed May 31, 2017 11:01 am

BenSeidel wrote:what happens if you multiply the signal by 100,000?
Would that work?
0.1 is rounded to 0, 0*100k = 0.
I have no idea if circuit signals would actually round 0.6 up. Pumps are now so powerful it's hard to get them to leave anything between 0.5 and 0.9 in a tank.

BenSeidel
Filter Inserter
Filter Inserter
Posts: 543
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by BenSeidel » Thu Jun 01, 2017 1:27 am

Optera wrote:
BenSeidel wrote:what happens if you multiply the signal by 100,000?
Would that work?
0.1 is rounded to 0, 0*100k = 0.
I have no idea if circuit signals would actually round 0.6 up. Pumps are now so powerful it's hard to get them to leave anything between 0.5 and 0.9 in a tank.
Yeah, for some reason I thought that the rounding happened as the signal entered the combinator, not as it left the storage tank. But now I think about it I realise how stupid that sounds.
The only solution is to simply not use floating point numbers in computer software.

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

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by Optera » Thu Jun 01, 2017 5:40 am

BenSeidel wrote:The only solution is to simply not use floating point numbers in computer software.
The only solution is to round to int according to application.
This application is especially simple since there is no case where rounding down is required. No one cares if a train set to leave at fluid >= 75k leaves at 74999.1, but if a train set to fluid = 0 leaves a 0.9 that's a problem.

Tekky
Filter Inserter
Filter Inserter
Posts: 998
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by Tekky » Mon Jun 05, 2017 8:47 pm

Related suggestion thread:

viewtopic.php?f=6&t=49274 round up fluids reading train inventory

BenSeidel
Filter Inserter
Filter Inserter
Posts: 543
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by BenSeidel » Thu Jun 08, 2017 1:00 pm

Optera wrote:
BenSeidel wrote:The only solution is to simply not use floating point numbers in computer software.
The only solution is to round to int according to application.
This application is especially simple since there is no case where rounding down is required. No one cares if a train set to leave at fluid >= 75k leaves at 74999.1, but if a train set to fluid = 0 leaves a 0.9 that's a problem.
Can't find the original thread, but it rounds that way because of the UI rounds. People were setting conditions that tested for full tanks, such as "crude oil = 2500" and it was never true, due to the rounding issues, so the rounding was changed to what it is now. It hasn't been an issue because checking if something is empty is fine, because the tanks didn't get disconnected. It would still play havoc with pumps in some extreme cases though.

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

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by Optera » Thu Jun 08, 2017 3:40 pm

BenSeidel wrote:
Optera wrote:
BenSeidel wrote:The only solution is to simply not use floating point numbers in computer software.
The only solution is to round to int according to application.
This application is especially simple since there is no case where rounding down is required. No one cares if a train set to leave at fluid >= 75k leaves at 74999.1, but if a train set to fluid = 0 leaves a 0.9 that's a problem.
Can't find the original thread, but it rounds that way because of the UI rounds. People were setting conditions that tested for full tanks, such as "crude oil = 2500" and it was never true, due to the rounding issues, so the rounding was changed to what it is now. It hasn't been an issue because checking if something is empty is fine, because the tanks didn't get disconnected. It would still play havoc with pumps in some extreme cases though.
The last change to rounding of fluids in circuit network I recall was when I reported Combinator displays inconsistent values on mouse over.

However with fluid wagons and stops reporting train contents requirements for circuit network have changed. I'd gladly take a minor discrepancy between mouse over and circuit network if it means I can discern if that wagon is truly empty or still has a 0.01 residue locking it to that fluid.

Rounding to next full integer wouldn't break existing setups either. A condition = 2500 would just trigger a bit earlier on 2499.1 instead of 2499.5

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2180
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by steinio » Thu Jun 08, 2017 5:42 pm

BenSeidel wrote:
Optera wrote:
BenSeidel wrote:The only solution is to simply not use floating point numbers in computer software.
The only solution is to round to int according to application.
This application is especially simple since there is no case where rounding down is required. No one cares if a train set to leave at fluid >= 75k leaves at 74999.1, but if a train set to fluid = 0 leaves a 0.9 that's a problem.
Can't find the original thread, but it rounds that way because of the UI rounds. People were setting conditions that tested for full tanks, such as "crude oil = 2500" and it was never true, due to the rounding issues, so the rounding was changed to what it is now. It hasn't been an issue because checking if something is empty is fine, because the tanks didn't get disconnected. It would still play havoc with pumps in some extreme cases though.
Hi,

the thread was this: viewtopic.php?f=11&t=24558 but the point was not the displayed value but the wrong rounding - the same groundhog as every day.

But why should the developers listen to the users, they just decided to multiply fluids by 10 - what a wonderful idea...
Image
Transport Belt Repair Man
My little mods: Link | My favourite mods: Bob's Mods | Angel's Mods | Yuoki Railway Core | EvoGUI | Logistic Train Network
Factorio Cheat Sheet by Denis Zholob

View unread Posts

User avatar
pezzawinkle
Long Handed Inserter
Long Handed Inserter
Posts: 62
Joined: Thu Jan 12, 2017 1:28 am
Contact:

Re: 0.15.10 Fluid wagon leaving even though condition is not met

Post by pezzawinkle » Fri Jun 30, 2017 1:54 am

Optera wrote:
BenSeidel wrote:
Optera wrote:
BenSeidel wrote:The only solution is to simply not use floating point numbers in computer software.
The only solution is to round to int according to application.
This application is especially simple since there is no case where rounding down is required. No one cares if a train set to leave at fluid >= 75k leaves at 74999.1, but if a train set to fluid = 0 leaves a 0.9 that's a problem.
Can't find the original thread, but it rounds that way because of the UI rounds. People were setting conditions that tested for full tanks, such as "crude oil = 2500" and it was never true, due to the rounding issues, so the rounding was changed to what it is now. It hasn't been an issue because checking if something is empty is fine, because the tanks didn't get disconnected. It would still play havoc with pumps in some extreme cases though.
The last change to rounding of fluids in circuit network I recall was when I reported Combinator displays inconsistent values on mouse over.

However with fluid wagons and stops reporting train contents requirements for circuit network have changed. I'd gladly take a minor discrepancy between mouse over and circuit network if it means I can discern if that wagon is truly empty or still has a 0.01 residue locking it to that fluid.

Rounding to next full integer wouldn't break existing setups either. A condition = 2500 would just trigger a bit earlier on 2499.1 instead of 2499.5
In that case, you should be able to "round to even", or embed the "greater or less than" with each appropriate rounding method. Either would solve the edge cases. I know its not a simple conversion, but it should be do-able. The other quick fix (this may still bugger with a few things), is to have the fluid count be made an integer by passing 100* (or 10*) fluid to the circuit network so it is still detected below a threshold?

Post Reply

Return to “Not a bug”

Who is online

Users browsing this forum: No registered users