Page 1 of 1

[2.0.24] incorrect BoilerPrototype temperature/energy calculations

Posted: Mon Dec 09, 2024 3:22 am
by radical_larry
The simplest way to recreate this bug is by increasing the default_temperature of steam. For default_temperature < target_temperature of the vanilla boiler, it will start producing more steam, as it seems to calculate the production rate by the difference between its target_temperature and the default_temperature of the output fluid. If default_temperature == target_temperature of the output fluid, no output fluid is produced at all, despite the boiler showing a green light and saying it is working in the UI.
In the case of default_temperature > target_temperature, attempting to save the game will reliably hard-crash if such a boiler is already placed.
The crash log, no mods except DLC, only the default temperature of steam has been changed in the vanilla base files to 166:

Code: Select all

Factorio crashed. Generating symbolized stacktrace, please wait ...
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Map\MapSerialiser.hpp(54): MapSerialiser::operator<<<EnergyStorage>
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Energy\Burner.cpp(95): Burner::save
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Entity\Boiler.cpp(158): Boiler::save
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Surface\Chunk.cpp(181): Chunk::saveNonRecursive
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Surface\Chunk.cpp(79): Chunk::save
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Surface\Surface.cpp(1270): Surface::save
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Map\Map.cpp(1116): Map::save
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Scenario\Scenario.cpp(1039): Scenario::saveMap
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Scenario\Scenario.cpp(933): Scenario::saveAs
C:\Users\build\AppData\Local\Temp\factorio-build-mzgSZi\src\Scenario\ParallelScenarioSaver.cpp(134): ParallelScenarioSaver::doSave
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include\thread(56): std::thread::_Invoke<std::tuple<void (__cdecl SoundLibrary::AsyncLoader::*)(void),SoundLibrary::AsyncLoader *>,0,1>
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp(97): thread_start<unsigned int (__cdecl*)(void *),1>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF823A27374)
00007FF823A27374 (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF82449CC91)
00007FF82449CC91 (ntdll): (filename not available): RtlUserThreadStart
Stack trace logging done
 269.733 Error EnergyStorage.cpp:24: EnergyStorage saving in that state will cause desyncs: energy(3080000.000000000000000) > capacity(32000.000000000000000)
 269.733 Error CrashHandler.cpp:643: Received 22
Logger::writeStacktrace skipped.
 269.733 Error CrashHandler.cpp:190: Map tick at moment of crash: 13709
 269.780 Info CrashHandler.cpp:318: Executable CRC: 2516237861
 269.780 Error Util.cpp:95: Unexpected error occurred. If you're running the latest version of the game you can help us solve the problem by posting the contents of the log file on the Factorio forums.
Please also include the save file(s), any mods you may be using, and any steps you know of to reproduce the crash.
 274.356 Uploading log file
 274.419 Error CrashHandler.cpp:270: Heap validation: success.
 274.420 Creating crash dump.
 274.544 CrashDump success
As described in the API docs, the intended function of the boiler in output-to-separate-pipe mode is to calculate "when enough energy is available to heat the input fluid to the target_temperature".
In my understanding, the boiler should produce the output fluid at target_temperature, or failing that, clamp it between its default and maximum_temperature, whenever there is enough energy to heat the input fluid from its current temperature to its target_temperature.

Re: [2.0.24] incorrect BoilerPrototype temperature/energy calculations

Posted: Sat Dec 28, 2024 2:21 pm
by GotLag
I think this may be related to a problem I am having with my Superheating mod. The superheater takes input steam at 165 degrees and outputs at 465 at 60 units/sec, for 3.6 MW of heating

This worked in Factorio 1.1 but in 2.0 the superheater consumes 60 units of steam per second and only outputs 40, meaning the turbine only outputs 3.6 MW instead of the 5.4 MW it should be (1.8 MW from the boiler heating the steam to 165 degrees, then another 3.6 MW from the superheater raising the temperature to 465)
Image

Note that the superheater's power output is 3.6 MW, it just says 1.8 MW in the info panel because of the 200% efficiency