Boiler energy is bounded ?!

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Boiler energy is bounded ?!

Post by Fatmice »

So, I was messing around with boiler type. Since energy member variable is [RW] for boiler, I thought I could just put any positive number in. Much to my surprise, that is not the case. For a vanilla boiler (energy_consumption=390kW) , the most one can add is (520000/75) J ~ 6933.333333 J at a time through the console or per tick or per whatever-time-interval if in control.lua. If you add more than this number, the temperature rise is not higher. Why??? What is so special about the ratio 52/75?

Furthermore, for any general boiler with base_area and liquid with liquid-heat-capacity, it seems the maximum of energy is (52/75) * (base_area*10) * (liquid-heat-capacity) J
Last edited by Fatmice on Wed Feb 04, 2015 4:13 am, edited 1 time in total.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

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

Re: Boiler energy is quantized ?!

Post by Koub »

Quantum mechanics applied to Factorio boilers :)
/mind blown
Koub - Please consider English is not my native language.

Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Re: Boiler energy is bounded ?!

Post by Fatmice »

I investigated further but still do not know how to derive the funky ratio of 52/75.

In a vanilla boiler with no steam-engine connected and using water, the quanta of 6933.333333 J can be applied to 10 units of fluid to give a temperature rise of exactly 0.6933333333 C. If an energy larger than 6933.333333 is applied, the temperature rise is still 0.6933333333 C with the extra energy above the maximum simply vanished. Energy less than 6933.333333 J can be used giving the corresponding temperature rise. If the vanilla boiler is working, .energy returns 433.3333333333. This number does not change regardless of fuel type. So why that number? 6933.33333333 - 433.33333333 = 6500 J Where did 6500 J come from? energy_consumption of vanilla boiler is 390kW => 390000J/s / (60 ticks/s) = 6500 J / tick.

This leads me to think that .energy in a boiler type is a buffer that holds the excess amount of energy waiting be applied to the fluid, but that .energy is not a boundless buffer. The size of the buffer is proportional to the base_area and heat capacity of the fluid modified by the fudge factor 52/75. But where did 52/75 came from?
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Re: Boiler energy is bounded ?!

Post by Fatmice »

Well well...seems I figured this out after all.

.energy buffer size is related to energy_consumption of a boiler type. It is not related to the heat-capacity of a fluid or the base_area. Although a bigger base_area will inversely affect rate of temperature rise, but only if you start with a full boiler, which is rarely the case.

The formula is pretty straight forward. .energy buffer size (J) = energy_consumption (J) * 16/15. I don't know why the devs love the number 16/15 which is 6.6%. This same ratio is also used for the maximum energy that can be extracted by generator types which is 544/6 KJ / tick, which came from 85 KJ * 16/15.

So what does this mean? It simply means via script, one can "overclock" any boiler by 6.6%

It so happens that 1/15 is a repeating decimal and in percent form it is 6.666666 => 666. The devs are satanist! :twisted:
Last edited by Fatmice on Wed Feb 04, 2015 12:18 pm, edited 1 time in total.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

Nemoricus
Fast Inserter
Fast Inserter
Posts: 181
Joined: Mon Jan 19, 2015 7:48 am
Contact:

Re: Boiler energy is bounded ?!

Post by Nemoricus »

15 does happen to be a divisor of the target frame rate for Factorio (60 FPS).

User avatar
rk84
Filter Inserter
Filter Inserter
Posts: 556
Joined: Wed Feb 13, 2013 9:15 am
Contact:

Re: Boiler energy is bounded ?!

Post by rk84 »

For some reason they add resting consumption also to buffer size. Normally used with electric energy sources.
resting_consumption = 1 / 30.0
buffer size = energy_consumption * (1 + 2 * resting_consumption)

Side note:
I think that energy consumption should be change to output power or something. Because boiler has effectivity 0.5, it actually consumes 780kW and half of that is used to heat water.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela

Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Re: Boiler energy is bounded ?!

Post by Fatmice »

rk84 wrote:For some reason they add resting consumption also to buffer size. Normally used with electric energy sources.
resting_consumption = 1 / 30.0
buffer size = energy_consumption * (1 + 2 * resting_consumption)

Side note:
I think that energy consumption should be change to output power or something. Because boiler has effectivity 0.5, it actually consumes 780kW and half of that is used to heat water.
Where did you find resting_consumption? I never saw it in any prototypes... :roll:

I'm pretty sure Vanilla boiler does consume 780 KW. It's pretty easy to test, just give it a fuel with exactly 780 KJ of energy. It is expected only 390 KJ will be applied to the fluid. It seems clear though that .energy is a buffer to store energy after some fuels have been converted to energy while factoring in the boiler's effectivity. I don't have access to the source code but this algorithm makes logical sense given how boilers behave.
  1. Destroy a fuel and apply fuel_value to staging_buffer
  2. if fluid_temperature < max_temperature and staging_buffer > 0
    staging_buffer = staging_buffer - [(energy_consumption/tick (in J) - .energy) * effectivity]
    .energy = (energy_consumption/tick (in J) - .energy) + .energy
    apply .energy to the fluidbox
  3. if staging_buffer < 0
    go back to 1
staging_buffer is only evident by the consumption bar in the boiler. It's not necessary to access it anyway since .energy is enough. It is likely staging_buffer can be negative during a tick but will be refilled in the next tick.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

Rahjital
Filter Inserter
Filter Inserter
Posts: 435
Joined: Thu May 29, 2014 10:44 am
Contact:

Re: Boiler energy is bounded ?!

Post by Rahjital »

Fatmice wrote:Where did you find resting_consumption? I never saw it in any prototypes... :roll:
It doesn't exist. Idle consumption is controlled by the energy_source.drain property, and it defaults to energy_consumption / 30.

Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Re: Boiler energy is bounded ?!

Post by Fatmice »

Rahjital wrote: It doesn't exist. Idle consumption is controlled by the energy_source.drain property, and it defaults to energy_consumption / 30.
Hm, I see. This is known from reading source code I gathered? I see no mention of how the drain property is defined on either the wiki or searching this forum.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

Post Reply

Return to “Modding discussion”