# Optimal HVAC control 3

If you’ve seen my previous posts you’ll know that what we need next is a thermodynamic model of how heat flows in a house with an A/C system. Now people at the DOE national laboratories try to build super fancy models of insolation, insulation, heat conduction, heat generation, and soforth but I don’t have a couple of million dollars in grant money for blogging (damn!). So instead I’m going to propose a dead simple compartment model for a house. Namely there are three compartments as follows:

- outdoors whose temperature is a given function of time (from forecasts or from a given heatwave record or something).
- the walls (whose temperature is a function of how much heat energy is in the walls)
- the indoor air (whose temperature is a function of how much heat energy is in the air).

Heat flux through the walls will be a function of the temperature differences between indoors, the walls, and outdoors. Heat flux out of the air into the A/C system will be a function of the duty cycle of the A/C unit. We will wind up with an ODE system which controls the temperature evolution.

We can start with relatively simple ODEs as follows:

$$T_{out}(t) $$ known via a given timeseries or forecast.

$$\frac{T_{sens}}{t_{decay}} \frac{dT_{w}}{dt}(t) = \frac{T_{sens}}{m_w} [(T_{out}-T_{w})/R_{out} + (T_{in}-T_{w})/R_{in}]$$

In this model $$m_w$$ is the thermal mass of the wall, AKA heat capacity (in energy/temperature) larger values mean temperature changes require a lot of energy. R values are the “resistance to flow” across the outside-wall boundary or the wall-inside boundary. Since T and t are nondimensional numbers, we multiply by the characteristic scale for each one to get a differential equation in dimensional form, in this case $$T_{sens}= 2^\circ F$$ and $$t_{decay} = 6 \rm hrs$$ as defined in the previous article though we will see that it might make more sense to choose different scales.

$$\frac{T_{sens}}{t_{decay}}\frac{dT_{in}}{dt}(t) = \frac{1}{m_{in}}[T_{sens} (T_{w} – T_{in})/R_{in}+d(t) P_{AC}]$$

Here d(t) is the duty cycle, a number between 0 and 1 which is a function of time and which we can control, and $$P_{AC}$$ is the thermal extraction power of the A/C system. If we divide through by our characteristic rate $$\frac{T_{sens}}{t_{decay}}$$ we will get a nondimensional equation throughout. These equations will have several nondimensional groups (that is complexes of constants each of which has its own dimensions, but the combination of which is dimensionless). In particular for the last equation we have:

$$\frac{t_{\rm decay}}{m_{\rm in} R_{\rm in}}$$ and $$\frac{t_{\rm decay} P_{AC}}{T_{\rm sens} m_{\rm in}}$$.

The first group is the ratio of the time for the exterior temperature to decay to our set point divided by the time it takes the heat necessary to raise the interior one unit of temperature to flow into the interior when the walls are kept 1 unit of temperature hotter. The factor $$m R$$ has units of energy/temperature * temperature / (energy/time) which works out to units of time. When this ratio goes to zero then the walls have very little ability to conduct heat so the interior is insulated from the exterior relatively well, whereas when it is intermediate the interior is coupled to the exterior through a significant dynamical system, and when this goes to infinity the interior temperature is always equal to the wall temperature since the slightest difference in temperature would cause infinite heat flow.

The second group is the ratio of the energy removed by the AC unit running full blast for 6 hours divided by the energy needed to raise the interior by one sensitivity unit of temperature. This group is a good candidate for defining as 1, which we would do by choosing a different characteristic time scale than previously so other things would have to change. But if we keep our current nondimensionalization, then when this is large the AC unit is able to rapidly change the interior temperature and when this is small, the AC unit takes a lot of time to change the temperature.

Although we do not know the thermal mass of the interior air, or the thermal mass of the walls, or either of the thermal resistances involved there are not 4 total unknowns. In total there are 3 nondimensional groups involved, one of them appears in both ODEs and is a coupling constant, and there is one unique one to each ODE.

We can estimate these nondimensional groups by considering certain situations. For example, what interior – exterior temperature difference can our AC unit sustain when running full blast continuously. Suppose that the exterior temperature is 105F and the steady state interior temp will be 85F with the A/C on full. Then we know dT_w/dt = 0 and dT_in/dt = 0 and d=1 giving us one equation. We can also measure the rate of interior temperature decrease when the AC is first turned on after equilibriating the walls and the interior to the exterior temperature. Finally we could measure the rate of change of the interior temperature if the AC is off, starting with everything at equilibrium at the minimum overnight temperature. These three conditions should be enough to solve for the three unknown nondimensional groups.

To be moving on with, let’s pick some values that sound of the right magnitude. We’ll name the nondimensional groups $$\mu_{out}$$, $$\mu_{in}$$, and $$\mu_{AC}$$. We expect that the AC power is many times larger than the power that it takes to change the interior air by 2F over 6 hours. Let’s say the AC can create a 2F change in 2 mins which implies $$\mu_{AC}=180$$. Also, let’s say we live somewhere where the exterior temperature changes slowly compared to the speed with which the interior can heat up through the walls. With one unit of temperature difference perhaps the heat necessary to raise the interior one temperature unit flows in 10 minutes compared to the 6 hours for the overall event time scale so $$\mu_{in} = \mu_{out} = 6(60)/10 = 36$$.

Now we can think about setting up solutions to the dynamical system and seeing how knowledge of the weather forecast (or hindsight) as well as the occupant preferences would affect how the A/C system should run and what the temperature would be through time. For a given temperature record, we can seek out a function $$d(t)$$ such that the $$T_in$$ and $$d(t)$$ functions minimize the badness functional. If we approximate the badness functional integral with a sum we can use numerical methods to find our best $$d(t)$$.