[1.1.63] modding related - boilers take energy and consumption from input fluid, not output

This subforum contains all the issues which we already resolved.
Honktown
Smart Inserter
Smart Inserter
Posts: 1044
Joined: Thu Oct 03, 2019 7:10 am
Contact:

[1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by Honktown »

boiler_input_not_output_0.0.1.zip
(944 Bytes) Downloaded 77 times

Code: Select all

--2e6 / (1e3 * 500) = (2/5)e1 = 4 units/s
data.raw.boiler.boiler.target_temperature = 500
data.raw.boiler.boiler.energy_consumption = "2MW"
data.raw.fluid["steam"].heat_capacity = "1KJ"
data.raw.fluid["steam"].default_temperature = 0

--2e6 / (300e3 * 500) = (2/15)e-1 = 0.0133 units/s
data.raw.fluid["water"].heat_capacity = "300KJ"
Expectation: Boiler consumes and outputs 2MW, in 4 units of 500 degree steam, consuming 4 water.
Reality: Boiler consumes 2MW of fuel, 0.01333 units of 500 degree steam, 0.013333 units of water. Output is... something.
boiler.png
boiler.png (96.4 KiB) Viewed 3511 times
I have mods! I guess!
Link
User avatar
KiwiHawk
Filter Inserter
Filter Inserter
Posts: 274
Joined: Thu Jul 05, 2018 9:48 am
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by KiwiHawk »

To put it a different way:

Changing the heat_capacity and default_temperature of Steam DOES NOT effect boilers.
Changing the heat_capacity and default_temperature of Water DOES effect boilers.

Is this working as intended? It seems backwards.
Dev for Bob's mods, Angel's mods, Helmod, Sea Block, Circuit Processing, Science Cost Tweaker.

Buy me a coffee
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by FuryoftheStars »

Well, as you are inputing water and not steam, first off it makes complete sense that it’s not going to use the Steam’s heat capacity for the whole calculation (as it’s not steam to start).

That said, technically speaking, using water’s heat capacity for the entire calculation can be seen as wrong, too, because at some point in the process it should turn to steam (unless it’s kept under pressure). However, as they have not supplied values to say “x heated to y turns into z”, I can completely see the math happening the way it does.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3191
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by boskid »

Not a bug.

Since the output temperature is fixed it makes sense to use input fluid heat capacity to adjust the energy required for conversion since the temperature of incoming source fluid affects the total energy required to produce a unit of output fluid.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3234
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by BlueTemplar »

First off, there's another bug (or maybe naming issue) :
heat capacity is energy per temperature, so it should be

Code: Select all

heat_capacity = "1KJ/°C"
or at least

Code: Select all

heat_capacity_per_°C = "1KJ"
Second, it was more consistent when steam was just 100+°C water (before 0.15ish).

The way it should work is to still have a phase change temperature (even maybe if you still cannot mix water and steam any more) :
before that temperature it's the heat capacity of water that would be used, after that - the one of steam (the two rightmost diagonals below) :
Image
(Of course IRL the energy required for the phase change itself from liquid water to steam - the horizontal part - is quite massive !)

And finally, expanding on what FuryoftheStars already mentioned, it depends whether you're expecting the unit of fluids to be in L or in kg :
1 L of water can turn into more (or less, using somewhat weird game logic) than 1 L of steam
but 1 kg of water can NOT turn into more or less than 1 kg of steam !

So in this 2nd case, if you have a fixed starting temperature of water and a fixed target temperature of steam, then the only way it makes sense if there is still a mismatch between boiler's power «usage» (?) -
(btw, potentially different from power consumption, does it work properly with efficiency different from 100% ?)
-and the power required to heat water & steam is for the boiler to produce less steam !

(Also boiler.energy_consumption should be called boiler.power_consumption since it's in "W" = "J/s" and not "J".)
BobDiggity (mod-scenario-pack)
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3234
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by BlueTemplar »

BlueTemplar wrote: Tue Aug 23, 2022 1:58 pm The way it should work is to still have a phase change temperature (even maybe if you still cannot mix water and steam any more) :
before that temperature it's the heat capacity of water that would be used, after that - the one of steam
But perhaps this is too problematic to implement now ?
The next most correct way would be I guess to take the average of both fluids' heat capacities.

Also, it would be nice if electric boilers could work in reverse : take hotter fluid, give back colder fluid, while generating electricity (while still respecting their efficiency value of course) !
BobDiggity (mod-scenario-pack)
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by FuryoftheStars »

BlueTemplar wrote: Tue Aug 23, 2022 3:36 pm
BlueTemplar wrote: Tue Aug 23, 2022 1:58 pm The way it should work is to still have a phase change temperature (even maybe if you still cannot mix water and steam any more) :
before that temperature it's the heat capacity of water that would be used, after that - the one of steam
But perhaps this is too problematic to implement now ?
The next most correct way would be I guess to take the average of both fluids' heat capacities.
Technically this could be problematic, too, if the amount over the transition threshold you are heating it isn't that much compared to the base substance.

IE, if you're only heating the water to 100 degree steam, taking the average would make it so it uses less energy than it should.

For simplicity sake, I think what they've done is fine.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3234
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by BlueTemplar »

Yes, this would be less about the physics than making something that is in-game-logic-consistent.

Since having only one of the fluids have exclusive «control» over what the actual heat capacity of the conversion from one to the other would leave the other fluid «wanting», and there is no in-game defined «transition» temperature, cut down the middle !

(I'm thinking here of other potential modded conversions like this, not just water <=> steam...)

P.S.: Now that I think of it, it also has the additional benefit of making easier even weirder conversions involving more than 2 fluids at the same time !
(Hmm, though in that case, taking the barycenter might be better ?)
BobDiggity (mod-scenario-pack)
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by FuryoftheStars »

I believe it already is “in-game-logic-consistant”? Offhand, I don’t know of anything in the game that uses properties of the input items and resultant items for determining anything.

If a change would be made, I’d advocate for adding an additional (table) property for what it transitions to and at what temperature. The idea of “averaging” it, unless it is essentially the same as calculating out that transition point, I’d probably be against.

However, I do wonder if the idea of superheating water under pressure could be used to “explain” the current behavior? I haven’t researched it in depth enough to know.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Honktown
Smart Inserter
Smart Inserter
Posts: 1044
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by Honktown »

BlueTemplar wrote: Tue Aug 23, 2022 1:58 pm (Also boiler.energy_consumption should be called boiler.power_consumption since it's in "W" = "J/s" and not "J".)
Pedantically, it's accurate. Power is an abstract concept that can't be measured or represented as being a property in a single instant, but energy is. The priority would be to default to energy, and as energy_consumption is the description, it may help to point out consumption is the noun form of the rate at which something is used. That which is being used: energy. Another way to describe it, "power consumption" would be describing "watts per unit time" in the physical sense which is not a thing.

"power consumption" is used loosely in electric descriptions, as a measure of "absolute amount of capacity to be used (future) or used (past)". A value against total value, not value per time. "Consumption" being used in a second, convenient-but-not-accurate concrete amount which requires extra information: out of what, 'cause it sure isn't time. Ad nauseum: a comparable not-thing would be trying to describe a car's "mpg/kpl consumption" versus fuel consumption. Weirdly, one could say a car produces so much "mpg/kpl" and driving, headlights, stereo, defrosters, AC, windows etc want a proportion of it (their "consumption")... but we don't.
I have mods! I guess!
Link
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5300
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by Klonan »

In this household we respect the laws of thermodynamics.

In this case, the law of conservation of energy.
I wasn't going to make the logic too complicated, but the basic principle that applying 10MJ to 100 water should result in Steam with 10MJ of potential energy.

So if Steam has 1/10 the heat capacity, the boiler will produce 10x more Steam.
This is also reflected and shown properly in the tooltips:
factorio-run_vStlpg6yMJ.png
factorio-run_vStlpg6yMJ.png (503.96 KiB) Viewed 1625 times
jotakami
Manual Inserter
Manual Inserter
Posts: 1
Joined: Thu Jun 13, 2024 5:24 am
Contact:

Re: [1.1.63] modding related - boilers take energy and consumption from input fluid, not output

Post by jotakami »

Does your solution also respect the laws of thermodynamics when the minimum temperatures of the fluids differ? Just want to make sure since you only mentioned heat capacity in your reply but you can run afoul if you don't account for the energy gained or lost by shifting to a lower or higher minimum temperature.
Post Reply

Return to “Resolved Problems and Bugs”