NIST Technical Note 1891 

A Self-Learning Algorithm for 

Temperature Prediction in a Single 

Family Residence 

Farhad Omar 

Steven T. Bushby 

http://dx.doi.org/10.6028/NIST.TN.1891

This publication is available free of charge from:
NIST Technical Note 1891 

A Self-Learning Algorithm for 

Temperature Prediction in a Single 

Family Residence 

Farhad Omar 

Steven T. Bushby 

Energy and Environment Division 

Engineering Laboratory 

September 2015 

http://dx.doi.org/10.6028/NIST.TN.1891 

U.S. Department of Commerce 

Penny Pritzker, Secretary 

National Institute of Standards and Technology 

Willie E. May, Under Secretary of Commerce for Standards and Technology and Director 

This publication is available free of charge from:
ii

Disclaimer 

Certain commercial entities, equipment, or materials may be identified in this document 

in order to describe an experimental procedure or concept adequately. Such identification 

is not intended to imply recommendation or endorsement by the National Institute of 

Standards and Technology, nor is it intended to imply that the entities, materials, or 

equipment are necessarily the best available for the purpose. 

National Institute of Standards and Technology Technical Note 1891

Natl. Inst. Stand. Technol. Tech. Note 1891, 35 pages (September 2015) 

http://dx.doi.org/10.6028/NIST.TN.1891

CODEN: NTNOEF 
iii

Abstract 

In order to develop effective control optimization strategies to manage residential 

electricity consumption in a smart grid environment, predictive algorithms are needed 

that are simple to implement, minimize custom configuration, and provide sufficient 

accuracy to enable meaningful control decisions. Two of the largest electrical loads in a 

typical residence are heating and air-conditioning. A self-learning algorithm for 

predicting indoor temperature changes is derived using a first-order lumped capacitance 

technique. The algorithm is formulated in such a way that key design details such as 

window size and configuration, thermal insulation, and airtightness that effect heat loss 

and solar heat gain are combined into effective parameters that can be learned from 

observation. This eliminates the need for custom configuration for each residence. 

Using experimental data from the National Institute of Standards and Technology (NIST) 

Net-Zero Energy Residential Test Facility (NZERTF), it was demonstrated that an 

effective overall heat transfer coefficient and thermal time constant for the house can be 

learned from a single nighttime temperature decay test. It was also demonstrated that an 

effective solar heat gain coefficient can be learned without knowledge of the window 

area and orientation by application of a self-learning, sliding-window algorithm that 

accounts for seasonal variations and daily weather fluctuations. The resulting algorithm is 

shown to be able to predict indoor temperatures for a one-day time horizon using a solar 

irradiance and outdoor temperature forecast, and control decisions for operating a heat 

pump. 

Keywords 

Net zero energy house; net zero energy residential test facility; thermal model; lumped 

capacitance model; thermal time constant; overall heat transfer coefficient; moving 

window optimization; sliding window optimization; parameter learning; parameter 

fitting, parameter optimization
iv

Acknowledgments 

The authors wish to thank everyone involved in the Net Zero Residential Test Facility 

project. Special thanks are extended to Dan Veronica, Amanda Pertzborn, Vance Payne, 

Harrison Skye, and Mark Kedzierski.

Authors Information 

Farhad Omar 

Electrical Engineer, Mechanical Systems & Controls Group 

Engineering Laboratory 

National Institute of Standards and Technology 

100 Bureau Drive, Mailstop 8631 

Gaithersburg, MD, 20899 

Tel: 301-975-4008 

Email: farhad.omar@nist.gov

Steven T. Bushby 

Leader of Mechanical Systems & Controls Group 

Engineering Laboratory 

National Institute of Standards and Technology 

100 Bureau Drive, Mailstop 8631 

Gaithersburg, MD, 20899 

Tel: 301-975-5873 

Email: steven.bushby@nist.gov
v

Contents 

Abstract ........................................................................................................................................... iii

Acknowledgments .......................................................................................................................... iv

Authors Information ....................................................................................................................... iv

List of Figures .................................................................................................................................vi

List of Tables ..................................................................................................................................vii 

1. Introduction ................................................................................................................................. 1

2. Lumped Capacitance Model ........................................................................................................ 2

2.1 Learning the Overall Heat Transfer Coefficient and Thermal Time Constant ...................... 5

2.3 Estimating Solar Gain............................................................................................................ 8

2.4 Moving Window Prediction Algorithm ............................................................................... 12

4. Conclusion and Future Work..................................................................................................... 25

References ..................................................................................................................................... 27
vi

List of Figures 

Figure 1. The NZERTF house exterior............................................................................................ 1

Figure 2. A house thermal energy balance ...................................................................................... 2

Figure 3. Results from a night temperature decay test .................................................................... 6

Figure 4. Comparison of predicted and measured first floor temperatures during a night test ....... 7

Figure 5. Heat pump load vs. temperature difference, courtesy of William V. Payne.................... 8

Figure 6. The concept of the moving window prediction algorithm............................................. 12

Figure 7. Available solar irradiance – training and prediction days.............................................. 14

Figure 8. Learning parameters on a cloudy day ............................................................................ 15

Figure 9. Available solar irradiance – training and prediction days.............................................. 16

Figure 10. Learning parameters on a sunny day............................................................................ 17

Figure 11. Average % RMSE for various training window sizes.................................................. 19

Figure 12. Learning parameters over a 7-day training window and applying to a sunny day....... 20

Figure 13. Learning parameters over a 7-day training window and applying it to a sunny day ... 21

Figure 14. The % RMSE, MAPE and the average error ............................................................... 22

Figure 15. The worst case prediction scenario (7-day training window) ...................................... 23

Figure 16. A typical case prediction scenario (7-day training window)........................................ 24

Figure 17. The best case prediction scenario (7-day training window)......................................... 25
vii

List of Tables 

Table 1. List of inputs and their associated values to calculate the angle of incidence................. 11

Table 2. Coefficients of a glass window used to calculate transmittance and absorptance........... 11

Table 3. Prediction horizon % RMSE and MAPE (1-day training window) ................................. 18
1 

1. Introduction

Developing effective control strategies to manage residential electricity consumption in a smart 

grid environment requires predictive algorithms for all significant electrical loads that are simple 

to implement, minimize custom configuration, and provide enough accuracy to enable 

meaningful control decisions. In a smart grid environment, time-varying prices, demand response 

agreements, or possibly market-based transactions to buy or sell electricity, may significantly 

influence the cost of electricity consumption. Other key inputs to control decisions include 

weather and occupant choices. 

Heating, ventilating, and air-conditioning (HVAC) is one of the largest electrical loads in a 

typical house. In order to evaluate control strategies that might involve preheating or precooling, 

temperature setbacks, or letting the temperature drift during peak price periods, it is important to 

be able to predict the resulting indoor air temperature changes. Many tools to simulate building 

energy use and comfort conditions have been developed that have this capability [1]. Although 

details vary, these tools require information about the location, orientation, windows, and other 

construction details of the house. They also require expertise in crafting a simulation. A simpler 

approach is needed to develop control strategies that might be used in a typical home. 

In this work, a self-learning algorithm for temperature prediction in a single family residence 

was developed. The approach taken was to define a simple lumped capacitance model where key 

parameters for the model can be learned through observation instead of derived from in depth 

knowledge of the construction details. The algorithm was validated using performance 

measurements from the Net-Zero Energy Residential Test Facility (NZERTF), at the National 

Institute of Standards and Technology (NIST) in Gaithersburg, Maryland [2, 3]. The NZERTF is 

a 251 m2

(2700 ft2), four bedroom house with a detached garage built entirely with commercially

available products. The exterior of the NZERTF is shown in Figure 1. 

Figure 1. The NZERTF house exterior
2 

2. Lumped Capacitance Model 

In order to predict the interior air temperature of a house, a first order lumped capacitance model 

described in [4] is utilized. The house is assumed to be a single control volume with a uniform 

interior temperature. Figure 2 shows a schematic of the overall energy balance on a house. 

Figure 2. A house thermal energy balance 

The energy balance equation as a rate of change of energy is given by: 

Q Q Q Q st solar G out

   

  

(1.1) 

where: 

st

st p

dQ dT Q Vc

dt dt





 

is the rate of the thermal energy stored in the house; 



is the density; 

p

c

is the specific heat; 

V

is the volume; 

Q q Solar   sol





is the total solar heat gain added to the house; 

Q q q G   hp l



 

is the internal heat generated inside the house by the heat pump (qhp), and 

plug-loads (ql) including sensible heat generated by the occupants; and 
3 

Q UA T T Out  



 



 is the heat loss to the environment due to the temperature difference 

between the inside and the outside. UA is the overall heat transfer coefficient, T is the 

indoor dry-bulb and T∞ is the outside ambient dry-bulb temperatures, respectively. Note 

that radiation heat losses are neglected. 

Applying these definitions, Equation (1.1) can be rewritten as follows: 

p sol hp l   dT Vc q q q UA T T

dt

      

(1.2)

If we let 

     T T

, then 

dT d

dt dt





and Equation (1.2) becomes: 

p sol hp l

d

Vc q q q UA

dt



     

(1.3)

Dividing both side of Equation (1.3) by

Vcp

 we obtain the following first-order differential 

equation: 

sol hp l

p p

d q q q UA

dt Vc Vc

 

 

 

 

(1.4)

Re-writing Equation (1.4): 

d

b a

dt



  

(1.5)

where: 

,and sol hp l

p p

UA q q q

a b

  Vc Vc

 

 

Multiplying both sides of Equation (1.5) by an integrating factor e

at and rearranging gives: 

    at at at d t

e e a t e b

dt



  

(1.6)

Using the product rule, the left hand side of Equation (1.6) can be written as: 
4     d at at e t e b

dt

 

(1.7)

Integrating both sides of Equation (1.7) with respect to t gives: 

   

  1

at at

at at

d e t e bdt

e t b e C

a







 

 

(1.8)

Dividing both sides of Equation (1.8) by e

at gives: 

  b at t Ce

a





 

(1.9)

when 

t  0,   0

b

C

a

  

then Equation (1.9) becomes: 

    0

b b at t e

a a

 

  

      

(1.10)

Substituting the values for a, b, ψ back into the Equation (1.10) results in the first order lumped 

capacitance model. If we let 

(0)    T T i 

 where Ti is the initial temperature of the house and 

T∞ is the ambient temperature then Equation (1.10) becomes 

exp

sol hp l sol hp l

i

p

q q q q q q UA T T T T t

UA UA Vc  

       

         

     

(1.11)

Defining the thermal time constant τ such that: 

  1

Vcp UA 

 

    

where: 

1

UA

     

is the overall-lumped thermal resistance; and 

  Vcp

is the lumped thermal capacitance. 

Re-writing and re-arranging Equation (1.11) gives the first order model to predict the interior 

temperature: 
5 

exp

sol hp l sol hp l

i

q q q q q q t

T T T T

UA UA 

 

       

         

   

(1.12)

The value of (qsol) can be estimated from measurements of solar irradiance using methods 

discussed later in this document. The value of (ql) is also known through a fixed occupancy 

schedule described in [3]. However, the values of UA and τ are not known a priori. A learning 

algorithm is used to estimate these values from measured data. In this paper they are denoted as 

effective quantities (UAe, τe) to acknowledge the fact that the values are not the true UA and τ of 

the NZERTF but an approximation that will enable us to predict the indoor temperature. 

A discrete form of Equation (1.12) is developed by defining t as Δt = tk+1- tk where k = 1,2,...,n

are the discrete time steps and n is the number of data points. Let (Qh = qsol + qhp + ql) represent 

the total heat gain inside the NZERTF in every time step. Let Ti represent the indoor 

temperature. Applying these concepts to Equation (1.12) gives the one-step learning/prediction 

model: 

, ,

, 1 , , ,

exp

h k h k

i k k i k k

e e e

Q Q t

T T T T

UA UA 

  

    

             

(1.13)

2.1 Learning the Overall Heat Transfer Coefficient and Thermal Time Constant 

Estimates for the UAe and τe are needed to use Equation (1.13) to predict the indoor temperature. 

Since both UAe and τe are mainly driven by the temperature difference between the inside and 

outside, a single test was conducted in the NZERTF on a cold winter night. Testing at night 

eliminated the impact of direct solar heat gain into the interior space. During the test, the house’s

main thermostat setpoint was lowered to approximately 15.6 °C (60 °F), and the heat recovery 

ventilation unit was turned off. The first floor and outdoor dry-bulb temperatures were measured 

throughout the night. The first floor temperature is an average of measurements made in all the 

rooms on the first floor. Figure 3 shows the results of the test. The uncertainty in measuring the 

indoor and outdoor dry-bulb temperature described in [5], with a confidence level of 95 %, is 

± 0.2 °C (0.4 °F) and ± 0.6 °C (1.0 °F), respectively. 
6 

Figure 3. Results from a night temperature decay test

Because the heat pump energy and solar heat gain to the house are equal to zero in this test, 

Equation (1.13) is reduced to the following: 

l, l,

, 1 , , ,

exp

k k

i k k i k k

e e e

q q t

T T T T

UA UA 

  

    

             

(1.14)

In order to estimate UAe and τe using an optimization technique, an objective function is defined 

as the sum of squared error (SSE) between the measured average first floor temperature (Tm) and 

the predicted temperature (Tp) obtained from Equation (1.14). The objective function is 

  2

2

,

e e m p

f UA T T   

(1.15)
7 

and, the optimization problem is: 

 

,

min ,

 1

 60

e e

e e UA

e

e

f UA

UA







  

  

(1.16)

where, the units for upper and lower bounds of the UAe are in W/K and τe are in minutes. For 

numerical stability, the lower bound of UAe was set to 1; however, the upper bound was allowed 

to float because it was not known a priori. Similarly, the lower bound of τe was set to 1 hour and 

the upper bound was allowed float as well. A Matlab non-linear optimization function (fmincon) 

with its default interior-point algorithm was used to minimize Equation (1.16) subject to the 

upper and lower bound constraints. The result of the optimization is shown in Figure 4. 

Figure 4. Comparison of predicted and measured first floor temperatures during a night 

test 
8 

Figure 4 shows the predicted and measured first floor temperature, for the test period, and 

statistics describing the goodness of fit. The resulting learned parameters are, UAe = 172 W/K 

and τe = 104 h. 

To verify the value of UAe an alternative method was used to provide a comparison estimate. 

Daily heat pump thermal energy output for the period of October 2014 – May 2015 were plotted 

with respect to the indoor/outdoor temperature difference as shown in Figure 5. The uncertainty 

in measuring Toutdoor and Thermal Energy described in [5], with a confidence level of 95 %, is 

± 0.2 °C (0.4 °F) and ± 9.4 %, respectively. Assuming that internal loads and solar gain are 

small compared to the conductive and convective heat losses, 

Q UA T T hp  outdoor setpoint



 

Thus the slope of linear fit to the data provides an estimate for UA. From these data it was found 

that UA = 180 ± 8 W/K with a confidence of 95 %. This result confirms that learned value of 

UAe = 172 W/K is a reasonable estimate. 

Figure 5. Heat pump load vs. temperature difference, courtesy of William V. Payne

2.3 Estimating Solar Gain 

An estimate of solar heat gain is needed to apply Equation (1.13). Detailed procedures for 

estimating solar heat gain are provided in [6]. Modeling solar heat gain is a complex process that 

involves many details about window size, orientation, shading, and materials along with 
9 

estimates of direct and indirect solar radiation. For the application intended in this work, these 

details are not likely to be available and the custom configuration needed to use them is not 

practical to obtain. The solution proposed is to develop a mathematical representation for solar 

heat gain with a small number of parameters that capture the unknown details, and then learn 

those parameter values by observation. One representation for solar heat gain is adapted 

from [7]. 

sol DN cos   A

q E T NA W   

(1.17)

where: 

qsol is the total solar heat gain; 

EDN is the direct normal irradiance per unit area; 

θ is the incidence angle; 

T is the transmittance; 

A is the absorptance; 

N is the inward-flowing fraction; and 

WA is the window area. 

The quantity (T – NA) is the solar heat gain coefficient (SHGC). Because the optical properties 

of T and A varies as a function of incidence angle (θ) and wavelength (λ) the SHGC is [7] 

SHGC T NA             , , , 

(1.18)

and Equation (1.17) can be written as 

cos    ,

sol DN A

q E SHGC W    

(1.19)

In a residential buildings we can assume that the windows are of the clear glass type and 

therefore not strongly spectrally selective so that the wavelength dependence of SHGC can be 

neglected. Thus, Equation (1.19) can be re-written as 

sol DN cos    A

q E SHGC W   

(1.20)

Equation (1.20) is the total solar heat gain, at every time step, added to a house and the SHGC 

(as function of the incidence angle) is given in [7] 

     

1

L

k k

k

SHGC T N A   



 

(1.21)

where, L is the number of glazing layers, Nk and Ak are the inward-flowing fraction and 

absorptance of layer k, respectively. Assuming a single layer window, a modified version of 

Equation (1.21) is
10 SHGC T NA           

(1.22)

Since the type of the windows installed in a house is not known a priori; therefore, Equation 

(1.22) becomes 

SHGC T N A e e           

(1.23)

where, Ne (effective N) is an approximation of N and SHGCe (effective SHGC) is an 

approximation of the SHGC. Normally, in order to convert beam radiation measured on one 

surface to another (i.e., on a tilted surface to that on a horizontal surface) a dimensionless 

geometric factor; that is, a ratio between the two surfaces is computed and the beam radiation is 

multiplied by that ratio. For further description of calculating this ratio see [8]. It is further 

assumed that the orientation and size of the windows is unknown. The objective is to modify 

Equation (1.20) such that the details of window size and orientation, shading effects, and the 

fraction of direct or diffuse solar radiation are represented by parameters that can be learned by 

observation. This eliminates the need for detailed custom configuration by the user. The 

modified solar heat gain equation is 

sol e   e

q I SHGC AR    

(1.24)

where: 

I is the solar irradiance in W/m2; and 

ARe is an approximation (effective) window area and the ratio of solar irradiance to the 

vertical surfaces of the windows in units of m

2

. 

We utilize a moving window optimization technique, described later, to learn the Ne and ARe

parameters. 

In order to calculate SHGCe given in Equation (1.23) the transmittance and absorptance must be 

calculated based on the angle of incidence. The angle of incidence is calculated using Equation 

(1.25) described in [8]. 

               

                 

       

cos sin sin cos sin cos sin cos

 cos cos cos cos cos sin sin cos cos

 cos sin sin sin

       

        

   

 

 



(1.25)

where: 

δ is the declination, the angular position of the sun at solar noon; 

φ is the latitude, the angular location north or south of the equator; 

β is the slope, the angle between the plane of the surface in question and the horizontal 

(windows or solar radiation measuring angle); 

γ is the surface azimuth angle, the deviation of the projection on a horizontal plane of the 

normal to the surface from the local meridian; 
11

ω is the hour angle, the angular displacement of the sun east or west of the local meridian 

due to rotation of the earth on its axis at 

15

per hour; and

θ is the angle of incidence, the angle between the beam radiation on a surface and the 

normal to that surface. 

For a detailed explanation of computation of the values δ, ω, and θ see [8]. While the latitude, 

slope, longitude, local meridian, local time zone, surface azimuth angle are inputs and based on 

the geographical location of the NZERTF in Gaithersburg Maryland. The list of inputs and their 

associated values are given in Table 1.

Table 1. List of inputs and their associated values to calculate the angle of incidence 

Inputs Values based on location of NZERTF 

 39.14 

(windows tilt



) 

90

Longitude

77.2

Local Meridian

75

Local Time Zone Eastern



0

In this application, the incidence angle is computed based on the timestamp associated with the 

measured data. According to [9], the transmittance and absorptance of a variety of window types can 

be computed using Equations (1.26) and (1.27).

   

3

0

cosi

i

i

T c  





(1.26)

   

3

0

cosj

j

j

A c  





(1.27)

The coefficients ci and cj for a single layer glass,

3.2 mm (1 8 ) inch

, double strength float are 

adopted from Table I of [9] and reported in Table 2. 

Table 2. Coefficients of a glass window used to calculate transmittance and absorptance

Windows 

Structure

Solar 

Properties

0

c 1c 2c 3c

Glass

T( )  -0.0372 3.0392 -3.6360 1.4784

A( ) 

0.0738 0.2370 -0.4364 0.2168

With the transmittance and absorptance calculated, the two unknown parameters are the 

inward-flowing fraction Ne (from Equation (1.23)) and ARe (from Equation (1.24)). The total 

heat gain (Qh = qsol + qhp + ql) inside the NZERTF with qsol given by Equation (1.24) is

Q I SHGC AR q q h       e    e hp l 

(1.28)
12

In order to calculate Ne and ARe a moving window optimization algorithm was developed and 

implemented. 

2.4 Moving Window Prediction Algorithm

The moving window algorithm utilizes Equations (1.13) and (1.28) to learn the Ne and ARe

parameters from measured data over a training window, the size of which is discussed later. 

These parameters are then used to predict the next day’s indoor temperature. Training is repeated 

daily using a fixed-size sliding window of data. This approach allows any shading effects and the 

seasonal variation in sun position to be accounted for. The moving window prediction approach 

is illustrated in Figure 6. The red rectangles depict the sliding training data window. The green 

rectangles depict the corresponding prediction horizon. 

Figure 6. The concept of the moving window prediction algorithm, note that the sizes of 

the windows are not to scale 

The objective function for the moving window algorithm is defined as the SSE between the 

measured average first floor temperature (Tm) and the predicted temperature (Tp) obtained from 

Equation (1.13). This can be expressed as 

  2

2

,

e e m p

f N AR T T  

(1.29)

The optimization problem is defined as
13

,

min ( , )

 0 1

 1

e e

e e N AR

e

e

f N AR

N

AR

 

  

(1.30)

where, the Ne is a unitless quantity, and the ARe is in units of m2. The upper and lower bounds of 

the Ne is between [0, 1] because it only represents the fraction of the solar irradiance absorbed 

into the interior spaces. The lower bound of the ARe is set to

1

 for numerical stability. The upper 

bound is allowed to float because it is not known a priori. 

In order to find Ne and ARe a Matlab non-linear optimization function (fmincon) with its default 

interior-point algorithm was used to minimize Equation (1.30). Initially the algorithm was 

trained on one day of data and predicted the next day’s temperature. But since the Ne and 

especially ARe parameters greatly affect the total solar heat gain of the model, the prediction 

accuracy was highly influenced by the variability of the solar irradiance from one day to the next 

due to cloud cover. For example, if the parameters were learned on a cloudy day and applied to a 

day that was sunny the model over predicted the temperature. The model under predicted when 

the opposite was true. Figure 7 shows the measured solar irradiance for a cloudy training day 

followed by measured solar irradiance on the prediction day. Figure 8 shows the impact of this 

situation on predicting the next day’s temperature. 
14

Figure 7. Available solar irradiance – training and prediction days 
15

Figure 8. Learning parameters on a cloudy day and applying it to a sunny day (1-day 

training window) 

There is a good agreement between the predicted and measured temperatures, shown in the top 

plot of Figure 8, because, by adjusting the Ne and ARe parameters, the learning algorithm 

minimizes the SSE between the model and the measured data. The second plot shows the 

model’s predicted indoor temperature at the beginning of the day and the third plot shows the 

comparison between the predicted and the actual measured temperatures for the same day. 

It was found that if the parameters were learned on a cloudy or a sunny day and applied to a day 

with a similar solar condition, the predicted and measured temperatures were close. Figure 9

shows the solar irradiance for the training and prediction days while Figure 10 shows the 

influence of learning a parameter on such a day and applying it to a day with a similar solar 

condition. 
16

Figure 9. Available solar irradiance – training and prediction days 
17

Figure 10. Learning parameters on a sunny day and applying it to a sunny day (1-day 

training window) 

These results clearly indicate that a larger training window is required. In order to evaluate the 

merit of various training window sizes two statistical measures (relative root mean square error 

(% RMSE) [10] and mean absolute percentage error (MAPE) given in [11] are defined as follows 

 2

1

% 100

n

i i

m p

i

m

T T

n

RMSE

T





 



(1.31)

and

1

1

100

i i n

m p

i

i m

T T

MAPE

n T 



  

(1.32)
18

where: 

n

is the number of samples; 

i T

m

is the ith measured temperature; 

T

m

is the mean of the measured temperature; and 

i

T

p

is the ith predicted temperature. 

Both % RMSE and MAPE are dimensionless quantities, and a measure of closeness of the 

predicted and measured temperatures. The output of Equation (1.31) and (1.32), reported in 

Table 3, confirms the observation that the prediction accuracy of the model is significantly 

improved when the training and prediction days had identical solar conditions. 

Table 3. Prediction horizon % RMSE and MAPE (1-day training window) 

Figure #

% RMSE MAPE

Figure 8 29 23

Figure 10 0.4 0.4

Using these metrics an optimal window size can be determined. The prediction algorithm was 

tested for various training window sizes over the 85-days data set. The average % RMSE, for 

each training window size, was calculated and reported in Figure 11. Figure 11 also shows the 

average elapsed time (in minutes) that the optimization algorithm took while learning the Ne and 

ARe parameters. It is noted that the elapsed time is specific to our implementation of the 

algorithm. Faster times may be possible but in general the larger the training window the slower 

the optimization. 

Figure 11 shows that there is large reduction in % RMSE when the size of the training window is 

increased from 1 to 3 days. The error is further reduced, gradually, until the size of the training 

window is 7 days long. There is a slight increase in the error for the 14 and 21 days of training, 

however the increase is minimal. Even though the 42 days training window has the lowest 

% RMSE, the time that the optimization requires to learn Ne and ARe is significantly larger 

compared to the rest of the training windows. Considering the elapsed times, number of training 

data required, and smaller prediction error, it was decided that the 7-day training window was an 

appropriate size. 
19

Figure 11. Average % RMSE for various training window sizes (UAe = 172 W/K and τe = 104 h) 

The impact of using the seven-day vs. one-day of training is shown for the same days, previously 

depicted in Figure 8 and Figure 10, are given in Figure 12 and Figure 13, respectively. 

The % RMSE and MAPE shown in Figure 12 have significantly improved over the values 

reported, for the same days, in Figure 8. However, the % RMSE and MAPE shown in Figure 13

have slightly increased over the same days reported in Figure 10. The slight increase in % RMSE

and MAPE were expected because the Ne and ARe parameters were effectively average values vs. 

a day where the solar conditions were similar to the conditions of the day being predicted. 
20

Figure 12. Learning parameters over a 7-day training window and applying to a sunny 

day 
21

Figure 13. Learning parameters over a 7-day training window and applying it to a sunny 

day

The maximum % RMSE and MAPE errors, for a one-day training window, over 85-day data set 

are 33 % and 26 %, respectively. The corresponding maximum % RMSE and MAPE errors, for 

the seven-day training window, are 7 % and 5 %, respectively. The % RMSE and MAPE, for 

seven-day training window, and their average errors are shown in Figure 14. 
22

Figure 14. The % RMSE, MAPE and the average error for both metrics (7-day training 

window) 

In order to visually depict the behavior of the learning algorithm and its prediction capabilities, 

three different prediction scenarios were identified to represent the worst (Figure 15), a typical 

(Figure 16), and the best case (Figure 17). 
23

Figure 15. The worst case prediction scenario (7-day training window)
24

Figure 16. A typical case prediction scenario (7-day training window) 
25

Figure 17. The best case prediction scenario (7-day training window) 

4. Conclusion and Future Work

In order to develop effective control optimization strategies to manage residential electricity 

consumption in a smart grid environment, predictive algorithms are needed that are simple to 

implement, minimize custom configuration, and provide enough accuracy to enable meaningful 

control decisions. A self-learning algorithm for predicting indoor temperature changes is derived 

using a first-order lumped capacitance technique. The algorithm is formulated in such a way that 

key design details such as window size and configuration, thermal insulation, and airtightness 

that effect heat loss and solar heat gain are combined into effective parameters that can be 

learned from observation. This eliminates the need for custom configuration for each residence. 

Using experimental data from the NZERTF, it was demonstrated that an effective overall head 

transfer coefficient UAe and thermal time constant τe for the house can be learned from a single 
26

nighttime temperature decay test. On a winter night the temperature setpoint was lowered to 

permit a larger than normal drop in indoor temperature and the temperature decay over time was 

measured. A least squared error fit to the data was used to determine UAe and τe. The resulting 

value of UAe was verified by using an alternate technique. 

The effect of solar irradiance on indoor temperature was accounted for by defining an effective 

solar heat gain coefficient SHGCe and a parameter ARe that combines the unknown window area 

with the unknown ratio of solar irradiance measured on a horizontal surface to the solar 

irradiance normal to the windows. A sliding-window learning algorithm was developed that can 

learn these parameters from a combination of solar irradiance data, internal temperature data, and 

the previously estimated UAe and τe. The sliding window of learning data accounts for both 

seasonal variations in the sun position and daily cloud cover fluctuations. By trial and error, 

using data from the NZERTF, it was determined that a training window size of seven days 

produced good results. 

The resulting algorithm was verified using 85 days of performance data from the NZERTF. After 

a seven day learning period, the algorithm was used each day to predict a one-day temperature 

profile using known solar irradiance measurements as a forecast and known heat pump thermal 

energy output. The predicted temperature profile agreed with measured values with an average 

root mean square error of 2 % and a maximum root mean square error of 7 % over the 85-day 

period. A maximum absolute percentage error analysis was done on the same data resulting in an 

average error of 1 % and a maximum error of 5 %.

Application of the algorithm requires a forecast of solar irradiance and outdoor temperature. It 

also requires past measurements of indoor temperature, outdoor temperature, and thermal energy 

output from heating and cooling equipment. The learning process eliminates the need for 

additional construction detail information for the residence. It is expected that the temperature 

prediction algorithm is sufficiently accurate to enable a control optimization algorithm to predict 

the effect of alternate control strategies for operating HVAC equipment on occupant comfort in a 

smart grid environment where electricity price changes with time of year and grid conditions. 

Additional work is planned to verify that the algorithm and training window size are broadly 

applicable to single family residences and to determine the potential impact of combining it with 

user-defined comfort constraints to reduce electricity costs in a smart grid environment.
27

References 

[1] IBPSA-USA, “Best Directory | Building Energy Software Tools.” [Online]. Available: 

http://www.buildingenergysoftwaretools.com/. [Accessed: 15-Aug-2015]. 

[2] H. Fanney, V. Payne, T. Ullah, N. Lisa, M. Boyd, F. Omar, M. Davis, H. Skye, B. 

Dougherty, B. Polidoro, W. Healy, J. Kneifel, and B. Pettit, “Net-zero and Beyond! 

Design and Performance of NIST’s Net-zero Energy Residential Test Facility,” Energy 

Build. 101, pp. 95–109, 2015. 

[3] F. Omar and S. Bushby, “Simulating Occupancy in the NIST Net-Zero Energy Residential 

Test Facility,” NIST, Technical Note 1817, 2013.

[4] F. Incropera and D. DeWitt, “Introduction to Heat Transfer,” 4th ed., Wiley, 2002, pp. 

240–249.

[5] M. Davis, W. Heally, M. Boyd, L. Ng, V. Payne, H. Skye, and T. Ullah, “Monitoring 

Techniques for the Net-Zero Energy Residential Test Facility,” NIST, Technical Note 

1854, 2014.

[6] “Chapter 15. Fenestration,” in ASHRAE Handbook: Fundamentals, ASHRAE, 2013, p. 

13.

[7] “Chapter 15. Fenestration,” in ASHRAE Handbook: Fundamentals, ASHRAE, 2013, p. 

17.

[8] J. A. Duffie and W. A. Beckman, “Solar Radiation,” in Solar Enginieering of Thermal 

Processes, 3rd ed., Wiley, 2006, pp. 3–17.

[9] M. Rubin, “Solar optical properties of windows,” Energy Res., vol. 6, pp. 123–133, 1982.

[10] P. Lei, “A Linear Programming Method for Synthesizing Origin-Destination (O-D) Trip 

Tables from Traffic Counts for Inconsistent Systems,” Virginia Polytechnic Institute and 

State University, 1998. 

[11] J. S. Armstrong, Ed., “Appendix,” in Principle of Forecasting: A Handbook for 

Researchers and Practitioners, Kluwer Academic Publishers, 2001, p. 470.