Heat exchanger uses specific energy of wrong fluid to calculate result.

Things that has been reported already before.
Post Reply
Dragony
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Sun Jul 09, 2017 8:13 pm
Contact:

Heat exchanger uses specific energy of wrong fluid to calculate result.

Post by Dragony »

I am not sure if I am correct, because the topic is complicated.

If you use a heat exchanger, it takes an heat input, transfers the heat to the fluid and outputs it as a different fluid. The amount of energy transferred per second is given via energy_consumption. The temperature of the output fluid is given by target_temperature. The amount of fluid output per second is then calculated based on the specific energy J/°C of the fluid. The problem is, that it takes the specific energy of the input fluid, but it should take it of the output fluid.

In vanilla this problem has no effect, as steam and water have the same specific energy. As soon as they are not the same, the problem becomes obvious, because you usually use the steam to do something with it, like putting it into turbines, which themselves look at the specific energy of the steam. The result is that if steam has only half the specific value of water, 50% of energy is just lost.

Practically it will become obvious in-game when you wonder why your heat exchanger needs double the amount of energy for providing steam than the steam turbine generates power by using the steam.

Bilka
Factorio Staff
Factorio Staff
Posts: 3155
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Heat exchanger uses specific energy of wrong fluid to calculate result.

Post by Bilka »

Duplicate: 103016
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Dragony
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Sun Jul 09, 2017 8:13 pm
Contact:

Re: Heat exchanger uses specific energy of wrong fluid to calculate result.

Post by Dragony »

I have read the duplicate but ignored all the follow-up Powergeschwurbel.

I am actually very surprised that vanished energy is not a bug in your eyes. But ok. :roll:

Bilka
Factorio Staff
Factorio Staff
Posts: 3155
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Heat exchanger uses specific energy of wrong fluid to calculate result.

Post by Bilka »

The energy is used to heat the input fluid. The process is: Heat input, then convert 1:1 to output. It is not: Convert input 1:1 to output, then heat output.

The energy of the output fluid does not matter here, it could also be 100 times more or be a fluid that is just used for its fuel_value.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Dragony
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Sun Jul 09, 2017 8:13 pm
Contact:

Re: Heat exchanger uses specific energy of wrong fluid to calculate result.

Post by Dragony »

Hmmm ok. Don't you see the fundamental problem here or do you see it and you just don't care? I personally have a huge problem with just deleting energy, but maybe you say it's working as intended and idgaf about thermodynamics.

It is not about being pedantic like the commenters in the other thread. It is absolutely not neccessary to be physically correct, but even with the most simple calculations you can still stay plausible.

I don't know why the heater works the way it does and you probably won't change it either because it would probably break things, but if you want to take the energy of the input fluid into account (which is absolutely correct), then the correct formula would have probably been (per tick):

fluid_amount = desired_fluid_amount_per_second / 60
input_energy = fluid_amount * input_fluid_temperature * input_fluid_specific_energy
output_energy = fluid_amount * desired_output_fluid_temperature * output_fluid_specific_energy
transfer_energy = output_energy - input_energy
input_heat -= transfer_energy

This means the energy is dynamic and depends on transferred energy based on both fluids. For example, if the water already is 100° and the output is 100° steam, then the heat energy used is 0 per tick, which is "correct" (I ignore the phase changing details because they are irrelevant in a game.)

I don't understand why energy_consumption is static. That way the flow would have to be dynamic, which clearly would cause many other problems, but it's a simple fact, that energy is conserved and if you put 100 MW into your boiler, then they have to go somewhere. A dynamic transfer energy would have made things much more plausible. And it doesn't delete energy.

Bilka
Factorio Staff
Factorio Staff
Posts: 3155
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Heat exchanger uses specific energy of wrong fluid to calculate result.

Post by Bilka »

I'm explaining how the code works. It's essentially the same logic as before steam was a separate fluid, so it does all its math on the input fluid.

The boiler doesn't define a desired fluid amount to be transferred, it defines how much energy to put into the input fluid to heat it. You can easily try this by putting higher temperature water into the boiler with an infinity pipe, it will produce more steam per second. So your second post is a feature request, not a bug report. You are welcome to put it into the appropriate subforum, maybe someone wants to rework boilers for the next major version.

Fun fact, before steam was a separate fluid, some people used this behaviour to pre-heat the water that was then fed into heat exchangers to reduce the amount of heat exchangers needed per steam turbine.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

Post Reply

Return to “Duplicates”