Background
I am designing a simulator for building designs, and need to track the interior temperature of the constructed building. For simplicity, this building will be one room; meaning the only walls are the 4 exterior facing walls.
Variables
I am starting with the outdoor temperature, the area of the wall that is being hit by sunlight (ray casting), and the material the wall is made out of. I can also get time since simulation started for delta time, or calculate the "in world" 24 day equivalent of time passed.
Attempts
I know that using the material I can get the thermal conductivity, and I believe I can calculate resistance from wall thickness / (conductivity * area).
My issue is that all formulas I can find use the unknown temperature to solve for the heat transfer Q.
My experimentation with providing a random default interior temperature results in the interior immediately jumping to whatever the exterior is with no gradual change (and no interior heat creation Qi). When I add something to mock an internal heater the internal temperature rises perpetually with seemingly no rhyme or reason.
The formula I have been mainly using is
// T[in](Time) = T[in](initial) * e ^((-k/c) * t) + [T[out] + Q[i]/K] [1-e ^((-k/c) * t)]
$$T_{in}(t) = T_{in}(t=0) * e ^{(-k/c) * t} + \left(T_{out} + \frac{Q(i)}{K}\right)\cdot \left(1-e ^{(-k/c) * t}\right)$$
I have also been trying to make use of the following info:
$$Q_x = -\frac{K}{L}\cdot A \cdot dT$$
where:
- K = thermal conductivity of wall [W/M c or W/M k]
- A = area of wall [m^2]
- dT = temp difference [C or K]
- L = wall thickness in m