Basic Thermodynamics

Started by Frembo, January 04, 2015, 10:42:08 PM

Previous topic - Next topic

Frembo

I hope I can help you overhaul the temperature system.

There are calculations in the game already based on the area a furnace or A/C unit is controlling, so this is likely rectified by some coding/mathematical calculations.

Rundown of laws of thermo:
0th law- If two systems are in thermal equilibrium respectively with a third system, they must be in thermal equilibrium with each other. This law helps define the notion of temperature.

1st law- When energy passes, as work, as heat, or with matter, into or out from a system, its internal energy changes in accord with the law of conservation of energy.

2nd law- In a natural thermodynamic process, the sum of the entropies of the participating thermodynamic systems increases. Equivalently, perpetual motion machines of the second kind are impossible.

3rd law- Absolute zero cannot be achieved

Heat and energy (work is also energy) are all interchangeable when I type here, so if I stray from one standard, sorry.

Let's get started, the A/C units have a cold and hot output making them compliant with thermo which is good.  However, the energy draw from it is not in accordance with the laws.  A/C units work as "heat pumps" wherein they take heat from one reservoir (i.e. the room or building) and move it to another (i.e. outside).  However, to do this without violating the 2nd law, we need to use work (power-on the A/C).  This work needs to be "added" to the "hot" reservoir.  This is why heat pumps are so cool.

If you are not familiar with heat pumps, I suggest a quick read on wikipedia: http://en.wikipedia.org/wiki/Heat_pump, but the A/C units in this game act exactly like heat pumps.  This also means that if your A/C has 200 watts powering it, and it is backwards, i.e. pointing with the exhaust into the room, then it will provide more heat than an electric furnace would at 200 watts (because it is taking heat from outside, and moving it in and providing work at 200 watts).

The definition of a watt is a joule per second, which will heat up 1 gram of water 1 degree C.  It will also heat up 1.01 grams of air by 1 degree C.  These can be defined by specific heat and can be converted to volume as well, and would be easy calculations to set up.  This also means that a furnace working at 200 watts must output a minimum of 200 joules a second into the surrounding air (electric furnaces have effectively 100% efficiency) due to conservation of energy.

Currently, furnaces bug me as they are quite inaccurate at this.  Additionally, when not switched off, they are consuming a minimum of 20W which means they are actively heating the room by 20W.  So, when calculating energy input to a system, everything with a power source must be considered.  Humans are assumed to be 100W light bulbs when civil engineers design heating and cooling systems for large rooms such as theaters.  So, depending on the amount people in the room, the machines being used (like smelter, tailor's bench, cooking station, etc), and passive energy sources use such as lights and auto-doors we can easily calculate a total source of energy in a room.  Then use this, and latent heat of the system, and energy "bleed" or transfer to "outside" using insulation coefficients, we can accurately calculate proper temperature.

The game already accounts for a bit of insulation, but neglects underground, specifically inside mountains.  The interior of a mountain is extremely stable when it comes to temperature.  It is quite incorrect for the game to calculate "outside" temperature inside the mountain when you build rooms that are currently not temperature controlled.

It would be very taxing of the system to calculate air flow and thereby convection of the systems, so I suggest making the temperature the same in a room as a function of distance to sources (as it already is… I think).  I.E. calculating temperature flow across tiles is not necessary, but doable.

To wrap up, I suggest:
Making A/C units more expensive as they are far superior to electric heaters when it comes to maintaining temperatures. 
Overhauling the temperature calculation system
Allow A/C’s and heaters to dynamically consume energy -or- have them run for a specific amount of time to heat or cool then they would turn off (this would be more like modern HVAC systems).
Have the insulation system based on a logarithmic scale for attempting to attain equilibrium, which would make players desire or design better insulators (goes with 2).
Make mountains and “underground” sections have much higher insulation -or- always attempt to attain underground standard temperatures (~55 for temperate zones, ~70 for hotter zones, ~32 for tundra regions) (goes with 4).

I hope this may bring some insight to help improve the physics of the game.

Thanks for reading!