# Measuring my apartment’s thermal conductivity

I live in a typical Montréal apartment : poorly  insulated and heated with electric baseboards. Since electricity is the only source of heat in my apartment and Hydro-Québec, Québec’s electricity provider, provides an hourly measurement of our electricity consumption, I thought I could try to estimate the absolute thermal conductivity of my apartment.

# Thermal conductivity

Heat flow rate ($$q$$) between two systems is proportional to the temperature difference ($$\Delta T$$) between them. The proportionality constant is named thermal conductivity. In this article, we will denote $$\alpha$$ as the thermal conductivity constant of the apartment with the exterior. Given these variables, the heat transfer rate between the apartment and the exterior is

$$q = \alpha \Delta T .$$

Our goal is to find $$\alpha$$. To do so, we will need measurements of the power used to keep the apartment’s temperature constant for different temperature differences between the apartment and the exterior.

# Experimental setup

My apartment is on the top floor of a two-floor building. I have three neighboring apartments : one below and two on the sides. The figure below illustrates the major heat flows of my apartment, where $$\mathbf{A}$$ is my apartment, $$\mathbf{N_{i}}$$ are my neighbors’ apartments and $$\mathbf{E}$$ is the exterior.

Since we are only studying the heat flows during winter, the main heat flow $$\mathbf{q_{A E}}$$will be from my apartment $$\mathbf{A}$$ to the exterior $$\mathbf{E}$$. In general, the temperature outside will vary from 5°C to -20°C in Montréal during winter. This means a temperature difference from 15°C to 40°C when the indoor temperature is 20°C.

Whenever there is a temperature difference between my apartment $$\mathbf{A}$$ and a neighbor apartment $$\mathbf{N_{i}}$$, there is a heat flow $$\mathbf{q_{A N_i}}$$ between the two. In general, the temperature between two neighboring apartments will be below 10°C, so these heat flows should be less important than the heat flow to the exterior.

The total heat flow rate $$\mathbf{q}$$ of the apartment is summarized by the following equation :

$$q = q_{A E} + \sum_{i=1}^3{q_{A N_i}}$$

If the temperature inside my apartment has reached steady state and we assume that all the consumed electric power $$\mathbf{P}$$ is used to heat my apartment, then all the consumed electric power $$\mathbf{P}$$ is used to compensate for the total heat flow $$\mathbf{q}$$ out of my apartment. Under these assumptions, the consumed electric power is equal to the apartment heat flow

$$P=q .$$

The closest moment we can get to these assumptions is at the end of the night since two important sources of variability are eliminated : human activity and solar radiation.

The figure below presents the average hourly electric power used during a typical winter day. Outside, it was around -10°C (14F) most of the day, dropping to -16°C (3F) at the end of the day.

We see that there is much lower power usage variability during the night than during the day. The set-point of the thermostats is lowered before going to sleep, so it takes a few hours for the temperature inside to reach steady state. If we take the temperature just before waking up, we can assume that heat flow has reached steady state.

## Model

To find the apartment thermal conductivity constant with the exterior we need to record the exterior temperature, the interior temperature and the total electric power usage over multiple days at the end of the night.

The thermal conductivity $$\alpha$$ is found by fitting the following linear model to the recorded data :

$$P = \alpha \Delta T + \beta$$

where $$P$$ is the total electric power consumed, $$\alpha$$ is the conductivity constant, $$\Delta T$$ is the temperature difference between the apartment and the exterior and $$\beta$$ is constant heat flow rate, independent of the exterior temperature.

This model is equivalent to the total heat flow $$q$$ equation presented earlier with

$$\Delta T \alpha = q_{A E}$$

$$\beta = \sum_{i=1}^3{q_{A N_i}} .$$

The heat flow rate with the neighbors is a constant, because it is independent of the temperature difference between the apartment and the exterior. Of course this constant will be noisy because the temperature between each apartment will vary.

# Results

The exterior temperature, the interior temperature and the total electric power usage were recorded from mid October 2018 to mid January 2019. The electric power used as a function of the temperature difference between the apartment and the exterior during this period is presented in the figure below. Figure 3 : Consumed electric power as a function of the temperature difference between the apartment and the exterior.

As expected, the power increases linearly as the temperature difference increases. We also observe that the spread of the power measurements increases as the temperature difference increases. This is indicative of variability in the thermal conductivity $$\alpha$$. Even though we recorded the data at night when there is no solar radiation, other environmental factors can lead to variability in the thermal conductivity. Two important factors are probably snow cover on the roof and wind. Snow on the roof will increase the effective roof insulation, reducing the thermal conductivity. Wind doesn’t affect the insulation, but prevents a boundary layer of warmer air from forming over the roof surface, increasing the temperature difference.

To find the thermal conductivity, we could use standard linear regression to find $$\alpha$$ and $$\beta$$ in our linear model

$$P = \alpha \Delta T + \beta .$$

Unfortunately, linear regression assumes that the measurement errors are only on $$\beta$$, not on $$\alpha$$, and we just observed that there is variability on $$\alpha$$. To get a better fit with the data, we will assume that both $$\alpha$$ and $$\beta$$ are Gaussian variables

$$\alpha \sim \mathcal{N}(\mu_\alpha, \sigma^2_\alpha)$$

$$\beta \sim \mathcal{N}(\mu_\beta, \sigma^2_\beta).$$

With these assumptions, we get a new probabilistic model for our data :

$$P \sim \mathcal{N}(\Delta T \mu_\alpha + \mu_\beta, {\Delta T}^2 \sigma^2_\alpha + \sigma^2_\beta) .$$

Then, we use gradient descent to find the maximum likelihood of parameters $$\mu_\alpha$$, $$\mu_\beta$$, $$\sigma_\alpha$$ and $$\sigma_\beta$$. In the figure 4 below, the black line represents the mean of the parameters and the red area the 95% confidence interval. The table 1 below presents the value of the fitted parameters.

Table 1 : Model parameters
Parameter Mean Standard deviation Unit
$$\alpha$$ (thermal conductivity) 111 19.6 W/°C
$$\beta$$ (power offset) -389 0 W

From the figure, we see that the model fit is generally quite good. In particular, the uncertainty (total variance of the distribution) increases as the temperature difference increases. Unfortunately, with the data, the gradient descent always converges to 0 for $$\sigma_\beta$$, the standard deviation of $$\beta$$. This doesn’t represent the reality, as there has to be some noise independent from the temperature difference. For example, the temperature difference between my apartment and the neighbors will vary, leading to noisy $$\beta$$.

I think the problem is the temperature dependent variance increases to the square of the temperature difference. This means that the temperature dependent variance ($${\Delta T}^2 \sigma^2_\alpha$$) quickly dominates the temperature independent variance ($$\sigma^2_\beta$$). We don’t have a lot of data below a temperature difference of 10°C, so the gradient descent doesn’t have enough data to properly fit $$\sigma^2_\beta$$.

If we add two data points at a temperature difference of 7.5°C, each at 300W away on each side of the mean, and fit the model, we get the results in the figure 5 and table 2 below. The added data points are displayed in green.

Table 2 : Model parameters with synthetic data
Parameter Mean Standard deviation Unit
$$\alpha$$ (thermal conductivity) 112 18.8 W/°C
$$\beta$$ (power offset) -407 118.7 W

This time, the gradient descent converges to a standard deviation $$\sigma_\beta$$ of 118.7W, which makes more sense. Also, the 95% confidence interval in figure 5 looks more realistic than the one in figure 4.  Unfortunately, I probably won’t get any data points at a $$\Delta T$$ below 10°C before spring. Fortunately, even with imperfect variance measurements, the means seem to be valid and the 95% confidence interval presented in figure 5 still reflects quite well the data.

The measured negative power offset $$\beta$$ of -389 W means that I need a system to “absorb” 389W of power to keep my apartment at a constant temperature if the temperature difference between my apartment and the exterior is 0°C. What this really means is that on average, my neighbors are providing my apartment a net heat transfer rate of 389W. This also means that on average, I don’t have to pay to heat my apartment until the temperature difference with the exterior is above 3.5°C. The real power offset is probably even a bit higher than 389W, because a small fraction of the electric power consumed isn’t used to heat the apartment. For example, my electric water heater is located in the basement of the building, so the energy used to keep to water at 60°C all night long probably isn’t dissipated into my apartment. This “lost” power is probably in the range of 100W-200W.

# Conclusion

On average, the thermal conductivity of my apartment is around 111 W/°C. This means that for each degree Celsius of temperature difference increase between my apartment and the exterior, I need an additional 111W of electric power to keep the indoor temperature constant. Also, on average, there is a constant heat flow rate of 389W coming into my apartment, even if I don’t heat it. This heat flow is probably coming from the neighbors keeping their apartment warmer than mine. Thanks neighbors!

A thermal conductivity constant of 111W/°C is quite high for a two-bedroom apartment. I am not surprised since I know the apartment is very badly insulated. In fact, I have a feeling there is absolutely no insulation within the walls and ceiling. Unfortunately, this is typical in Montréal. Even if we live in a cold climate, electrical energy, the most popular domestic heating energy source, is very cheap in Québec (5.9¢/kWh). This means that there is little incentive to improve old buildings’ energy efficiency since the energy bill is still relatively low.

The Python code used to fit the model to the data and to generate the figures is available.