[Rseding91] [1.1.21] defines.flow_precision_index.one_second actually represents 5 seconds

This subforum contains all the issues which we already resolved.
Post Reply
Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

[Rseding91] [1.1.21] defines.flow_precision_index.one_second actually represents 5 seconds

Post by Xorimuth »

As used in https://lua-api.factorio.com/latest/Lua ... flow_count, it actually returns the average value over 5 seconds, not 1. I've only tested this with electrical networks.

For my mod, I want this time period to be as low as possible. Having an actual '1 second' option would be good, although 1 tick would be much better! (Or you could expose the total value over 1 tick, which would be perfect! viewtopic.php?f=28&t=94959)

If need be, I can provide a mod and save that demonstrates this.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: [1.1.21] defines.flow_precision_index.one_second actually represents 5 seconds

Post by Xorimuth »

In case you're concerned about any backwards incompatible changes you fancy making, the string 'defines.flow_precision_index.one_second' only occurs in the following mods:

capacity-combinator_1.0.3 capacity-combinator_1.0.3/control.lua
power-combinator_4.3.3 power-combinator_4.3.3/control.lua (same author as capacity-combinator)
spawner-alert_0.1.7 spawner-alert_0.1.7/control.lua
PowerOverload_1.0.0 PowerOverload_1.0.0/control.lua (my mod)
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.21] defines.flow_precision_index.one_second actually represents 5 seconds

Post by Rseding91 »

Thanks for the report. It's now fixed for the next release.

The defines are correct but the logic in get_flow_count was wrong.
If you want to get ahold of me I'm almost always on Discord.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.21] defines.flow_precision_index.one_second actually represents 5 seconds

Post by Rseding91 »

I did notice that the one-second window will give numbers back scaled to 1 minute. Is that what you meant?

It matches how the GUI functions; it takes the 1 second window and says "if you did this for a minute; here's what you would make".
If you want to get ahold of me I'm almost always on Discord.

Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: [1.1.21] defines.flow_precision_index.one_second actually represents 5 seconds

Post by Xorimuth »

Rseding91 wrote:
Thu Feb 11, 2021 7:39 pm
I did notice that the one-second window will give numbers back scaled to 1 minute. Is that what you meant?

It matches how the GUI functions; it takes the 1 second window and says "if you did this for a minute; here's what you would make".
That bit is fine, I just multiply the result by 60 to get it in watts. Its nice in that you can pick any of the defines and your maths would be the same, the only difference being how far back in time it effects the result.

Screenshot 2021-02-11 at 20.07.20.png
Screenshot 2021-02-11 at 20.07.20.png (5.48 KiB) Viewed 2700 times
What I'm really wanting (but is outside the scope of this bug report) is a way to get the network consumption (506MW in this screenshot), which compared to my current solution:
1. would require no calculations on the lua side (this code is ran many times every tick)
2. would update instantly (not be averaged over the last second)

2. could also be achieved by adding a defines.flow_precision_index.one_tick

Anyway, this has spilled over from viewtopic.php?f=28&t=94959, where it should belong.
My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Xorimuth
Filter Inserter
Filter Inserter
Posts: 625
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: [Rseding91] [1.1.21] defines.flow_precision_index.one_second actually represents 5 seconds

Post by Xorimuth »

Hmm, I'm pretty sure that this has still not been fixed as of 1.1.24. With the mods Power Overload and Editor Extensions, the following blueprint creates a situation where the pole should blow up every second, but it only blows up exactly every 5 seconds. I'm using `defines.flow_precision_index.one_second`.

Please can this be moved back to "Bug reports", and let me know if I'm misunderstanding something!

Edit: Fixed in 1.1.25: https://wiki.factorio.com/Version_history/1.1.0#1.1.25

My mods
Content: Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Remote Configuration | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings

Post Reply

Return to “Resolved Problems and Bugs”