Page 1 of 1

Full tank not full for logistics

Posted: Wed Apr 27, 2016 7:42 pm
by steinio
Hello,

i've a setup which shows the fill level of my tanks.
If i set the 'full' lamp to light if level > 2499 the lamp gets never on although the tank shows full.
The connected pump with the same settings also never switch on.
2498 works indeed. Could be a rounding error.

The number is apprev. with 2.5k, better would be 4 digits for clearance.

Greetings steinio

Re: Full tank not full for logistics

Posted: Wed Apr 27, 2016 8:23 pm
by daniel34
I think it has to do with the fluid handling of Factorio.
Storage tanks (or pipes for that matter) will fill very slowly if they are almost full.

I have a small lubricant production only for electric engines which uses 0.1 lubricant/sec but I produce 1 lubricant/sec in the chemical plant.
In between is a storage tank. It will stay between 2496 and 2498 amount. As soon as I disconnect the electric engine production it will slowly fill to the max, after ~3-5 seconds it goes > 2499 and ~15 seconds later it will stop at 2499.97.

I don't think this is a bug, as the fluid handling was probably done this way by design.
What stops you from using 2490 or 2475 as value? One could reasonably say the storage tank is as good as full at that value (2475 = 99% full).

You can check the amount of fluid in the storage tank with the following command while the entity is selected with the mouse:

Code: Select all

/c game.local_player.print(game.local_player.selected.fluidbox[1].amount)

Re: Full tank not full for logistics

Posted: Wed Apr 27, 2016 8:28 pm
by Rseding91
I was about to say it wasn't a bug but now I don't know.

The fluid is stored as a floating point number. 2499.9024 fluid for instance.

The circuit network and conditions deal with integers.

The question is: should fluid when sent to the network as a number be rounded up or down.

If the first, then there's a bug, if the 2nd then there's no bug to fix.

Re: Full tank not full for logistics

Posted: Wed Apr 27, 2016 10:02 pm
by steinio
daniel34 wrote:I think it has to do with the fluid handling of Factorio.
Storage tanks (or pipes for that matter) will fill very slowly if they are almost full.

I have a small lubricant production only for electric engines which uses 0.1 lubricant/sec but I produce 1 lubricant/sec in the chemical plant.
In between is a storage tank. It will stay between 2496 and 2498 amount. As soon as I disconnect the electric engine production it will slowly fill to the max, after ~3-5 seconds it goes > 2499 and ~15 seconds later it will stop at 2499.97.

I don't think this is a bug, as the fluid handling was probably done this way by design.
What stops you from using 2490 or 2475 as value? One could reasonably say the storage tank is as good as full at that value (2475 = 99% full).

You can check the amount of fluid in the storage tank with the following command while the entity is selected with the mouse:

Code: Select all

/c game.local_player.print(game.local_player.selected.fluidbox[1].amount)
Hello daniel34,

well nothing stops me... :)
I use it as discribed by you as workaround. The question is, is 2500 > 2499 in the eyes of the game.

Greetings steinio

Re: Full tank not full for logistics

Posted: Thu Apr 28, 2016 1:58 am
by DaveMcW
Rseding91 wrote:The question is: should fluid when sent to the network as a number be rounded up or down.
I vote for natural rounding. floor(n + 0.5).

Re: Full tank not full for logistics

Posted: Thu Apr 28, 2016 1:39 pm
by Klonan
Thanks for the report
DaveMcW wrote:
Rseding91 wrote:The question is: should fluid when sent to the network as a number be rounded up or down.
I vote for natural rounding. floor(n + 0.5).
I believe this should be the case, round it to the nearest integer,
Since the only way to read super accurate fluid levels is with script,
And that combinators work with integers etc.

Re: Full tank not full for logistics

Posted: Sat Apr 30, 2016 8:12 am
by kovarex
Klonan wrote:Thanks for the report
DaveMcW wrote:
Rseding91 wrote:The question is: should fluid when sent to the network as a number be rounded up or down.
I vote for natural rounding. floor(n + 0.5).
I believe this should be the case, round it to the nearest integer,
Since the only way to read super accurate fluid levels is with script,
And that combinators work with integers etc.
Yes, sounds reasonable, changed it for 0.12.32

Re: Full tank not full for logistics

Posted: Tue Oct 25, 2016 7:58 pm
by steinio
Gooooood morning vietnam..

Sorry factorio guys but i have the feeling that i'm getting angry.

According to the 2nd latest changelog someone of your team had the need to fiddle with the topic of this thread again:

Code: Select all

Storage tanks connected to the circuit network will output floored fluid values instead of rounding them.
Does this change now with every new major version?
tank.png
tank.png (299.94 KiB) Viewed 12731 times
You can see in the picture, that the tank never reach it's capacity of 2500.
The lamp should lit if water > 2499.

Please repair it again - forever.

Greetings steinio

Re: Full tank not full for logistics

Posted: Tue Oct 25, 2016 8:01 pm
by Klonan
steinio wrote:Gooooood morning vietnam..

Sorry factorio guys but i have the feeling that i'm getting angry.

According to the 2nd latest changelog someone of your team had the need to fiddle with the topic of this thread again:

Code: Select all

Storage tanks connected to the circuit network will output floored fluid values instead of rounding them.
Does this change now with every new major version?
tank.png
You can see in the picture, that the tank never reach it's capacity of 2500.
The lamp should lit if water > 2499.

Please repair it again - forever.

Greetings steinio
This is desired behaviour, set your combinator to 2490.

There is a solution in 0.15,
So you will have to trust us until then, that it is the right move

Re: Full tank not full for logistics

Posted: Tue Oct 25, 2016 8:09 pm
by steinio
Oh man so much leap of faith - hopefully it pays off :)

Re: Full tank not full for logistics

Posted: Fri Oct 28, 2016 5:57 pm
by Smoovious
Not that my vote matters, but if I had one, I would want to have the 5/4 rounding back. (even with multiplying fluid volumes by 10x).

Testing my 4 tanks together, for volume of 10,000 to see if they're full, and 0, to see if they're empty, just makes more sense to me than testing for 9,996.

Unless the circuit network will be switched to floating point... well, even then, I'd still want to 5/4 round to the last decimal place it would use.

My 0.02 monies worth.

-- Smoov

Re: Full tank not full for logistics

Posted: Sun Oct 30, 2016 12:58 am
by GlassDeviant
Not sure why this is showing up on my "unread posts" list, but...

I know this game is an OCD dream; however, there comes a point when rigid definitions of "full" and "empty" get in the way of a functional system. The fractional difference between 4990 units of heated water in a pair of tanks and 5000 units is real, but it's not going to make one bit of difference between survival and destruction when pumping it into an array of steam engines powering a wall of defensive lasers against an alien attack.

When you set your thermostat in your house, there is a limit to the precision of the setting.

Ask anyone with an engineering degree, precision has limits.

So while you can demand that tanks in a simulation game fill absolutely, totally full and notify you via the circuit network what it happens, does it really matter so much that you are able to avoid having to say "X > 2490" or did you just miss a dose of Paxil?

(sorry, a little melodramatic/exaggerated, but really...is it going to kill you to use 99.6% full instead of 100%? no offense intended, just injecting a little philosophy)

Re: Full tank not full for logistics

Posted: Sun Oct 30, 2016 10:32 am
by steinio
No... the real problem is, that the fundamental behavior has changed 3 times in the last year.

Re: Full tank not full for logistics

Posted: Sun Oct 30, 2016 10:51 am
by impetus maximus
steinio wrote: Image
i just adjust my numbers to get around the problem in question. [offtopic] how are you displaying those numbers?

Re: Full tank not full for logistics

Posted: Sun Oct 30, 2016 1:37 pm
by Rseding91
steinio wrote:No... the real problem is, that the fundamental behavior has changed 3 times in the last year.
The game didn't exist a few years ago :P

Re: Full tank not full for logistics

Posted: Wed Nov 02, 2016 6:55 pm
by steinio
impetus maximus wrote:
i just adjust my numbers to get around the problem in question. [offtopic] how are you displaying those numbers?
Sorry - it's SmartDisplay by binbinhfr: https://mods.factorio.com/mods/binbinhfr/SmartDisplay

Re: Full tank not full for logistics

Posted: Thu Nov 03, 2016 1:10 am
by impetus maximus
steinio wrote: Sorry - it's SmartDisplay by binbinhfr: https://mods.factorio.com/mods/binbinhfr/SmartDisplay
ok thanks. looked vanillaish. :lol: