Dual estimation Constructing building energy models from data sampled at low rate

(cid:1) Estimation of equation-based energy models from data. (cid:1) Unmeasured states and parameters of building energy models are jointly estimated. (cid:1) Implicit discretization method to cope with the low sampling rate of data. (cid:1) Observability analysis of the equation-based building energy model. (cid:1) Validation using historical data from a real-life building.


Introduction
There is a growing interest in research and industry to extract in real-time additional insights from data collected by building automation systems (BAS).Examples of the additional value include real-time fault detection and diagnostics [1], energy saving supervisory control [2][3][4][5], real-time performance validation and energy usage analysis [6], real-time estimation of energy consumption in connection with user behavior [7][8][9], real-time estimation of the user behavior for improved control decisions [10][11][12][13], realtime estimation of thermal comfort models [14].These real-time applications share the common goal of checking correct evolution of energy dynamics and/or thermal comfort, and detecting anomalies and their causes [15].To this purpose it is necessary to develop appropriate estimation tools that can detect, online from real-time collected data, whether the system is running according to a nominal model, or it is deviating from it.
In building applications the practical aspect and constraints are particularly important, since the majority of customers (building owners, landlords and tenants, as well as facility managers and energy service companies) are not willing to substantially invest in the solutions, at least until a short payback period is guaranteed.As a result, there is an opportunity for analytic engines capable of operation on legacy BAS systems which log only limited number of data points with limited sampling rate and resolution.While in industry there exists a variety of rule-based solutions for the individual BAS application listed above (e.g.Attune by Honeywell [16], SmartStruxure Lite solution by Schneider Electric [17], envisage ⁄ Energy Management System by General Electrics [18] and many others), researches have shown that a model-based approach is expected to provide a common basis to be shared by most of the advanced features and outperform rule-based methods [19][20][21][22].The model-based approach requires the development of an appropriate model for the system dynamics, and the use of data to interpret in real-time the model parameters and their possible variations.
A model is a product that represents a system of interest, and quoting George Box ''all models are wrong, but some are useful": in the following we will elaborate on which models are useful to our real-time purposes.Several building energy models and related software are available, which can be categorized as steady-state building energy simulation models and dynamic building energy simulation models.Models like the ISO 13790 [23] fall in the first category, because of the steady-state assumption that the building is heated or cooled for the thermal comfort of people.Models like EnergyPlus, TRNSYS, Modelica and RC models [24,25] fall in the second category, because they take into account (to different extent depending on the specific software) the dynamic behavior of heat and mass transfer.Steady-state building energy simulation models are used for long-term simulations and predictions, especially given the fact that in many buildings energy use is collected on monthly or weekly basis.However, they cannot be adopted for real-time energy monitoring and control.For real-time purposes we need to use dynamic building energy simulation models, well suited for buildings equipped with automated meter reading, where data are collected at a rate typically in the range from units of minutes to one hour.Taking into account hourly or per minute thermal dynamics allows using these models not only for long-term simulations and predictions, but also for real-time management and control purposes.Collection of data on a weekly or monthly basis makes not only real-time monitoring and control impossible, but it has been also identified as one of the main reasons for having huge gaps between the estimated and the actual building energy consumption [26].
Summarizing, we are interested in dynamic building energy simulation models.Using the classification of Lawrence Berkeley National Laboratory [27], when can further distinguish dynamic building energy simulation models into: Procedural energy modeling (like EnergyPlus and TRNSYS).Equation-based energy modeling (like Modelica and RC models).
Procedural modeling is usually more complex, because it is based on partial differential equations.For this reason modeling the physics is mixed with the implementation of numerical solution algorithms, and these building simulation programs typically do not allow specifying initial conditions for all state variables, which makes it impossible to use these models for model predictive control purposes or anti windup of control action or other optimization and monitoring tasks.Equation-based modeling is usually simpler, because based on ordinary differential equations with lumped parameters: this simplifying assumption allows defining state variables, specifying their initial conditions and controlling their evolution.Within the scopes of this paper, estimation of energy models from equation-based modeling is to be preferred over procedural modeling, because they allow easier real-time interpretation of the (lumped) model parameters [28].
Estimation of equation-based energy models is equivalent to estimating the parameters of the heat transfer equations (thermal resistance, conductance etc.) and/or some variables that cannot be measured (e.g.envelope temperatures).Estimation of equationbased energy models from data becomes challenging when combined with the following two issues: (1) In most practical cases, many measurements are missing, due to the expensive sensors that would be required to acquire these measurements.For example, in building thermal dynamics, it is easy to get zone temperatures, but more difficult to get envelope temperatures.Envelope temperatures can be as important as zone temperatures in understanding the state of the building, so it is relevant to estimate them.(2) The measurements are logged at low sampling rate to save memory.In most practical cases, and in particular for buildings running legacy BAS systems, the logging rate is low compared to the thermal response of the respective subsystem of the building.The thermal dynamics of the walls of many conventional buildings is of the order of one hour [29].Recall the Nyquist-Shannon sampling theorem and classical recommendation to set the logging rate approx.10-times faster than the fastest dynamics of interest [30].Thus, we consider -for real-time purposes -15 min to be a low sampling rate.Since the sampling rate usually cannot be significantly increased, the low rate makes it difficult to construct reliable discrete-time models out of continuous-time equation-based dynamics.By reliability we intend that the dynamics of the discretized energy model (with estimated states and parameters) should match the actual continuous-time dynamics of the building.Unfortunately, large discretization steps put this reliability at stake.

Nomenclature
These two issues reveal the need for developing methods that can estimate missing measurements, estimate relevant parameters, and cope with low sampling rate.In this work we focus on estimation of building heat transfer dynamics, and we tackle the aforementioned challenges via a dual estimation scheme where states and parameters of the thermal system are estimated simultaneously.The estimated variables can be consequently used to extract aforementioned insights from the logged data.For example, faults can be detected and diagnosed from the fact that changes in the building thermal parameters and/or anomalous behavior of estimated variables can be related to degradation of materials, changes in building usage, or faults.
We develop two dual estimation schemes, based on Extended Kalman Filtering (EKF) and Unscented Kalman Filtering (UKF), respectively: in order to cope with the low sampling rate of data (15 min sampling time), an implicit discretization (Euler backward method) is adopted to discretize the continuous-time thermal dynamics.Typically, estimated building thermal models are constructed based on explicit discretization methods like the Euler forward method.In this work it is shown that explicit discretization methods, combined with 15 min sampling time, are ineffective for reliable building heat transfer models: the discrete-time dynamics do not match the continuous-time ones, and even explicit methods of high order (Runge Kutta and Multistep) fail to provide a good approximation of the continuous dynamics with such long time step.Either smaller time steps or alternative discretization methods are required.We verify that the implicit Euler backward discretization method provides good approximation of the continuous-time dynamics and can be also easily implemented for our dual estimation purposes.Furthermore, we provide a rigorous observability analysis to check a priori when the dual estimation problem is well posed, or when the model to be estimated must be redesigned because it leads to an unobservable model.The applicability of the proposed method in terms of estimation of both states and parameters is demonstrated via simulations and using historical data from a real-life building.

Related work
Estimation problems are ubiquitous in smart energy applications, and in building thermal dynamics in particular.Auto regressive models with exogenous inputs are widely used for parameters estimation: in [31] statistical models for solar radiation and outdoor air temperature are used to calculate room temperatures and heating load in office buildings; the authors of [32] obtain the physical meaning of wall parameters by estimation and deduction from a thermal network model; convective and radiative heat interchanges for photovoltaic integrated facades and roofs are estimated in [33].The work in [34] develops methods for estimating thermal conductivity and resistance, related to heat exchanger design.Most of the methods based on auto regressive models, including the aforementioned ones, are not dual estimation methods: in fact, they use a prediction error setting, where parameters are estimated, but no state estimation is performed.Other estimation methods from literature worth mentioning are the temperature-based approach to detect persisting small increase or decrease in the normal building energy consumption in [35]: this method identifies an abnormal energy consumption fault according to the deviation between the measured and simulated consumption.In [36], a simplified thermal network model is combined with parameter estimation techniques, for determining the most representative parameter set for thermal load estimation.Worth mentioning are also machine learning techniques for building energy management: their adoption had been increasing during the years, with applications in fault detection and diagnosis of HVAC systems [37], building load prediction [38,39], forecasting of energy consumption [40,41].Machine learning approaches are complementary to the proposed physic-based approach, since they build models from example inputs (rather than from first principles), and they are completely data-driven.
Despite the good results of the aforementioned approaches, most of them rely on ad-hoc methods, that cannot be easily generalized to other settings, like the dual estimation setting.Estimation methods based on Kalman filtering [42], which would allow for this generalization, are to a large extent not adopted in smart energy applications.Some exceptions are the following: in [43] recursive estimation (i.e.parameter estimation) is proposed in conjunction with adaptive control.In [44] several lumpedparameter building thermal models are compared to evaluate the model complexity needed to capture the basic thermal behavior of the entire building: an extended Kalman filter is used to estimate the missing states, but no parameter estimation is performed.In [45] a combination of Kalman filter and real-time least squares is used to estimate the unknown heat flux on the inner wall of a tube from measured temperature on the outer wall.In [46] a Kalman Filtering approach is used to estimate the indoor thermal sensation: again, these are state estimation problems, where no parametric estimation is performed.On the other hand Kalman filtering methods are becoming largely adopted in specific fields complementary to energy efficient buildings, namely wind speed prediction [47,48], battery state of charge estimation [49][50][51], parameter estimation of solar cells [52,53].Notice, however, that none of these fields deals with dual estimation problems for joint estimation of states and parameters.A notable exception is represented by Maasoumy et al. [54], where a dual estimation scheme is introduced, but the problem of low sampling rate is not addressed, as well an observability analysis is not performed.To the best of the authors' knowledge, this is the first smart energy study that deals with dual estimation with low sampling rate.
The rest of the paper is organized as follows: Section 2 presents the (continuous-time) building thermal model under consideration.Section 3 introduces the dual estimation problem and the EKF and UKF to solve it.Section 4 discusses issues related to discretization with low sampling rate.Section 5 performs an observability analysis to verify that the dual estimation problem is well-posed.Section 6 shows the performance of the resulting dual estimation scheme in simulation, while Section 7 using data from a real-life building.Section VIII concludes the paper.

A building heat transfer model
The building heat transfer model under consideration comprises a thermal zone exchanging heat with the outside ambient and a neighborhood zone.The model has been derived using the lumped parameter approach leading to the RC model, as described e.g. in [55][56][57].The diagram of Fig. 1 represents the heat exchange situation.It is the result of the tradeoff between model descriptiveness and its observability from the available measurements, as elaborated in Section 5.The heat transfer equations are as follows: where C a is the thermal capacitance of the zone air and C m is the thermal capacitance of the building mass (envelope).The other coefficients in (1) are the conductances between zone air and mass (a am ) and between outside air and mass (a om ).The variables T z ; T n ; T o and T m are the temperature of the zone under consideration, of the neighborhood zone, of the outside air, and of the building mass.In (1) no external solar radiation or internal heating gains are assumed, in order to keep the presentation as simple as possible.These terms can be easily included without jeopardizing the correctness of the proposed approach.
It is now convenient to introduce the following concepts for the dynamic model of a system: State: is a collection of variables that include what is needed to give a complete description of the system.In (1) the state is given by T z and T m which describe the (thermal) state of zone and envelope.Input: is a collection of exogenous variables that are fed to the system and influence its evolution.In (1) the input is given by T n and T o which come from outside the system and influence the evolution of the (thermal) state of zone and envelope.Parameters: is a collection of constants whose values characterize the model.In (1) the parameters are given by the thermal capacitance C a and C m and by the conductances a am and a om .
Notice that in our case the parameters can slowly vary during the evolution of the system.
After grouping some terms together, (1) can be equivalently written as where the coefficients represent the thermal exchange coefficients air-to-mass (b a2m ), mass-to-air (b m2a ), outside-to-mass (b o2m ).The representation ( 2) is typically more convenient than (1) because all coefficients appear linearly.Notice that the temperature of the zone under consideration, of the neighborhood zone, of the outside air can be easily measured, while the temperature of the building mass requires expensive intrawall sensors, whose measurements are not always reliable.In most practical application it is thus impossible to measure T m and such variable must be estimated.Furthermore, the coefficients b a2m ; b m2a ; b o2m depend on the envelop materials and they can even change with building usage: it is thus of interest to estimate them.Given these considerations, we formulate the problem as follows: Problem formulation: Develop an algorithm that can, from measurements of the temperature of the zone under consideration, of the neighborhood zone and of the outside air, derive estimates of the temperature of the building mass T m and of the heat transfer coefficients b a2m ; b m2a ; b o2m in (2).Furthermore, in case the heat transfer coefficients change with time, the algorithm should be able to detect such changes.
The stated problem can be solved within the framework of dual estimation, which consider the problem of jointly estimating the state and the parameters of a dynamical system.

Dual estimation
We consider the problem of estimating both the (unmeasurable) states xðkÞ 2 R n and parameters w 2 R s of a discrete-time (nonlinear) dynamic system xðk þ 1Þ ¼ FðxðkÞ; uðkÞ; vðkÞ; wÞ yðkÞ ¼ HðxðkÞ; uðkÞ; nðkÞ; wÞ ð 3Þ where the first equation is the state transition function and the second equation is the measurement function.In (3) uðkÞ 2 R m is an exogenous input to the system, yðkÞ 2 R p is the output of the system, while vðkÞ and nðkÞ are the process and observation noise, respectively.The functions FðÁÞ and HðÁÞ are the state transition and output maps of appropriate dimension.Notice that the building heat transfer model ( 2) is linear in the states and in the parameters, but since the dual estimation formulation is general enough, we will explain the nonlinear case (which can be handled both by the EKF and the UKF).Furthermore, we will concentrate on the discretetime case because of the way the data are saved and consequently the way Kalman filters are implemented.Let T s be the sampling time.Section 4 explains more in details how to obtain a discretetime model out of the continuous-time dynamics.In order to simplify the presentation, we introduce the notation x k ¼ xðkÞ and rewrite In the joint Kalman filtering dual estimation, the state and model parameters are concatenated within a combined state vector, and a single EKF or UKF is used to estimate both quantities simultaneously.Let us call v k ¼ ½x 0 k w 0 k 0 2 R nþs and rewrite (4) as In (5) the state is augmented in such a way that the uncertain parameters w are represented as additional state variables.The original state vector is augmented with these new state variables which we may denote the augmentative states.As a consequence, the functions f ðÁÞ and hðÁÞ are the state transition and output maps of the augmented system of appropriate dimension.A Kalman filter must then be used to estimate the augmented state vector.
To set up an augmentative model an assumption must be made about the behavior of the augmentative state.The most common assumption is that the augmentative state is (almost) constant or slowly varying.The corresponding differential equation is which is often referred to as random walk.In (6) m is a white process noise that models slow variations.The (almost) constant assumption is not the only one: an (almost) constant rate can be used to model parameter drifts (e.g. to estimate degradations).Once the augmented model has been defined, a Kalman filter can be designed and implemented in the usual way, to estimate both the original states and the augmentative states.In the following, define L ¼ n þ s, and Q k and R k the covariance matrices of the extended process and observation noise, possibly depending on time.We briefly recall how to implement an Extended Kalman Filter and an Unscented Kalman Filter for the augmented model.

Extended Kalman Filter
The classical Kalman filter calculates the optimal prediction and optimal gain term exactly in the linear case.For nonlinear models, however, the classical Kalman filter is not optimal anymore: the Extended KF approximates the optimal prediction and optimal gain term as: where vÀ k is the predicted (augmented) state estimate, P À k the predicted covariance estimate, ỹk the innovation residual, S k the innovation covariance, K k the near-optimal Kalman gain, P k the updated covariance estimate, and vk updated (augmented) state estimate.The covariances are determined by linearizing the dynamic equations . As such, the EKF can be viewed as providing ''firstorder" approximations to the optimal terms (in the sense that expressions are approximated using a first-order Taylor series expansion of the nonlinear terms around the mean values).

Unscented Kalman Filter
The Unscented Kalman Filter is based on the unscented transformation [58].The unscented transformation is a method for calculating the statistics of a random variable which undergoes a nonlinear transformation.Consider propagating the random variable vk (of dimension L) through a nonlinear function given by the system dynamics.To calculate the statistics of the propagated variable, we form a matrix Xðkjk À 1Þ of 2L þ 1 sigma vectors The unscented filter (UF) propagates the estimates as follows Remark 1.Notice that even if ( 2) is linear in the states and in the parameters, the augmentation in ( 6) makes the augmented model bilinear.For this reason nonlinear estimation techniques are required for dual estimation.

Discretization issues in building heat transfer models
Consider the model in (2).If the model were linear, one could use exact discretization methods based on zero-order hold, namely However, there are two reasons why this method cannot be used in the dual estimation case at hand.The first is the fact that the coefficients in (2) appear in a bilinear fashion in the augmented model and can be even slowly time-varying.Another reason for not considering the exact discretization (7) where T s is the sampling time.The Euler forward method is said to be explicit, since the solution x kþ1 is an explicit function of x i ; i 6 k.
The method increments the solution through an interval T s while using derivative information from only the beginning of the interval.As suggested by intuition, the Euler forward method is more accurate if the step size T s is smaller.The Euler forward method can also be considered as the Taylor expansion of the function f truncated to the first order.This consideration allows us to state that since the quadratic and higher-order terms are ignored, the local truncation error is of order OðT 2 s Þ.It is well known that the Euler forward method can be numerically unstable, especially for stiff equations: however, we will show numerically that the Euler forward method can be numeri-cally unstable also for non-stiff building heat transfer model (2).Let us assume that the model parameters in (2) are perfectly known, so that no parameter estimation is necessary.Fig. 2 shows the evolution of the zone temperature coming from the continuous-time model (2) versus the evolution of the zone temperature coming from the model discretized with the Euler forward method.It is evident that after already few steps the Euler forward method has an oscillatory unstable behavior.Furthermore, we will show that higher-order discretization techniques can be similarly inaccurate.

Higher order explicit methods
In order to increase the accuracy of the discretization method, more complex methods can be adopted e.g. by using more function evaluations.The most common is the midpoint method (also called second order Runge-Kutta method) which uses two function evaluations in the following way: The name of the method comes from the fact that the function f giving the slope of the solution is evaluated at t ¼ kT s þ 1 2 T s , which is the midpoint between kT s at which the value of xðtÞ is known and ðk þ 1ÞT s at which the value of xðtÞ needs to be found.The midpoint method can be demonstrated to have local truncation error of the order of OðT 3 s Þ (more precise than the Euler forward method).The other possibility for increasing accuracy of discretization is to use more past values, for example as in the two-step Adams-Bashforth method: which has also local truncation error of the order of OðT 3 s Þ (more precise than the Euler forward method).Fig. 3 shows the evolution of the zone temperature coming from the continuous-model ( 2) versus the evolution of the zone temperature coming from the model discretized with the midpoint method and the two-step Adams-Bashforth.It is evident that also these higher-order discretization methods fail to catch the continuous-time behavior after already few steps.Notice that the two methods would work perfectly if a smaller sampling time were adopted, as revealed by Fig. 4, which is obtained for T s ¼ 2 min.We conclude that explicit discretization methods are not suitable for low sampling rate.Either smaller time steps or alternative discretization methods are required.Implicit methods are investigated, and we will consider the simplest implicit discretization method, namely the Euler backward method.

Euler backward method
A modification of the Euler forward method which eliminates the stability problems noted in the previous section is the backward Euler method: This differs from the forward Euler method in that the function f is evaluated at the end point of the step, instead of the starting point (see Fig. 5).The backward Euler method is an implicit method, meaning that the formula for the backward Euler method has x kþ1 on both sides, so when applying the backward Euler method we have to solve an equation.This makes the implementation more costly.However, unlike the Euler forward method, the backward method is unconditionally stable and so allows large time steps to be taken.Unconditional stability can be shown with this toy example: assume we want to discretize the (stable) differential equation _ x ¼ ax, with a < 0. The Euler forward method would lead to which becomes unstable for 1 þ T s a j j> 1, i.e.T s > À2=a.The Euler backward method would lead to which is always stable no matter what a is.The rationale behind the backward Euler method is similar to the forward Euler method, with the difference that in the forward Euler method the derivative at the end of the interval is used (cf.Fig. 5).
For the model ( 2) the backward Euler method becomes: which can be written as The inverse of the 2 Â 2 matrix can be easily calculated to be . Fig. 6 reveals that the Euler backward discretization is perfectly able to catch the continuous-time profile, even for low sampling rate.
Remark 2. Notice that the matrix N is always invertible, because the determinant is positive This comes from the fact that sample time and heat transfer coefficients are always positive.We conclude the section by defining the following measure of discrepancy which represents, over the simulation horizon ½0; T, the deviation of the zone temperature of the discretized model with respect to the zone temperature of the continuous-time model.The discrepancy is calculated for all discretization methods (and different time steps) and shown in Table 1.The result is that the backward Euler method with sampling rate T s ¼ 15 min can represent the continuous time dynamics to a good accuracy (1.04%).

Observability analysis
What is often missing in dual estimation problems is an appropriate observability analysis: in other words before proceeding with the augmented state estimation, it is important to check whether the joint estimation of states and parameters is wellposed, i.e. states and parameters are observable.
It is well-known that the intuitive notion of observability is: from observing the sensor(s) for a finite period of time, can I find the state at previous times?
Since observability is a structural property of the real (continuous-time) system and not of its discretized model, the observability analysis is carried out in continuous time.In order to explain observability we will use a toy example.

Toy example
In the following we will consider the simple system _ x ¼ ax where we assume to estimate both x and a as in the dual estimation formulation.Notice that (12) is at the same time representative of some building dynamics (increase/decrease temperature) and simple enough to allow a simple analysis.
We augment the dynamics as follows: Since the augmented system is nonlinear, the observability analysis must be carried out via a local approach relying on the Lie derivative [59].It is crucial to underline that observability for nonlinear systems is more complex than looking at the observability of the linearized model (the linearized augmented model would result unobservable, but this does not mean that the augmented model is unobservable).In fact, nonlinear observability is intimately tied to the Lie derivative.The Lie derivative is the derivative of a scalar function along a vector field.The augmented model in (12) can be written as , and f and h are defined accordingly.Notice that the x can be measured, but a not.The Lie derivative of h with respect to f is: We can also define higher-order Lie derivatives: We have that in order to have observability, the rank of the gradient operator ð15Þ must be full.Summarizing, the observability of a nonlinear system is given by the following theorem.
Theorem [59].Let G denote the set of all finite linear combinations of the Lie derivatives of h 1 ; . . .; h p with respect to f for various values of u = constant.Let dG denote the set of all their gradients.If we can find n linearly independent vectors within dG, then the system is locally observable.
Please notice that the gradient operator becomes the observability matrix in the linear case.In our case we have that i.e. we take the Lie derivative up to order 1.The gradient of ( 16) is which has rank 2 if a is different than 0. So the system is locally observable. 1

Observability of the heat transfer model
Let us then verify the observability of the building heat transfer model (2) using the aforementioned nonlinear observability analysis.We find that the corresponding dG has rank 5, which means that the two temperatures and three heat transfer coefficients are (locally) observable.The observability analysis has been carried out via the Matlab symbolic toolbox, and it is not shown in details due to the length of the resulting Lie derivatives.
Furthermore, notice that alternative building heat transfer models lead to unobservable systems.The following RC model, also arising from the lumped parameter approach [55][56][57] but with different constants assumes that the mass interacts differently with the neighborhood zones, due to b n2m .However, ( 17) has a dG of rank 5, which means that not all 4 coefficients are observable.The following alternative RC model where an extra term is adopted to model the direct exchange between zone and outside air, has also a has a dG of rank 5, thus resulting unobservable.However, if a ''window" term is added, in the following way where w w 2 ½0; 1 is a known input representing the window opening, then the system would become observable (at least for some non degenerate inputs).
Remark 3. Notice that, differently than linear systems, the system input affects the observability of nonlinear systems.For example, (19) with window always closed (w w ¼ 0) or always open (w w ¼ 1), would make b 02a unobservable.This coefficient would become observable only with some window opening strategy that 'excites' the system.To the best of the authors' knowledge, there are no general results explaining which kind of input makes the coefficient observable, and which do not: in these complex cases, observability can only be demonstrated a posteriori with extensive simulations.The analysis of this section has the merit to show a priori when a dual estimation problem is not well posed (e.g. ( 17) or ( 18)), so that different models must be adopted.

Simulation results
In this part we aim at showing the performance of EKF-and UKF-based dual estimators via simulations.The continuous time     The model is discretized with backward Euler method with T s ¼ 15 min, and all the continuous-time covariances are translated into their discrete-time counterpart.The EKF-and UKFbased dual estimators are derived via the procedures that have been described.Figs.7 and 8 show, for two particular realization of the noises, the performance of the EKF-and UKF-based dual estimators.It is possible to notice that both temperatures are tracked with great accuracy: in addition the filters are able to track changes in the parameters.
The performance of EKF-and UKF-based dual estimators is further investigated with extensive simulations.In particular, 100 Montecarlo simulations are performed and the estimation performance is measured in terms of the average root mean square (RMS) error between the true temperatures and the estimated temperatures, and between the true parameters and the estimated parameters.The RMS is averaged over the 100 simulations.The results are shown in Table 2.There is possible to notice that the UKF performs slightly better than the EKF.

Real-life test case and results
Here we show a real-life application of the UKF-based dual estimator.The pilot building selected is a school located in the province of Treviso, Italy, with humid subtropical climate.The building is equipped with hydronic heating system supplied by a gas-fired boiler.The heating system is supervised by an IQ1 Trend building energy management system [60].The legacy system logs selected building data at a 15-min rate.The objective of the exercise is to develop a dynamic model of the zone thermal response, which would be used in model-based analytics as explained in Section 1. Fig. 9 depicts the complete heat exchange in one room of the school.It has to be underlined that the complete heat exchange dynamics are not observable according to the observability analysis of Section 5.For example, the temperature of the water in the radiator is not available, and this makes it impossible to observe some thermal dynamics arising from internal gains.We have thus to come up with a simplified heat exchange situation whose dynamics are observable given the available logged datapoints.
The only logged datapoints relevant to the zone response are zone temperatures (T z and T n in model ( 2)) and outside air temperature (T o in model ( 2)).Fig. 10 depicts the heat exchange under consideration, whose dynamics are observable via the logged datapoints.Notice that Fig. 10 is compatible with the model (2).Consequently, the test is based on historical data collected during night in such a way that the model (2) is valid.Since this is a real-life experiment, the real parameters and the real mass temperature are not available.Figs.11 and 12 show, for 2 particular nights the good fit of measured and estimated zone temperature, and the evolution of mass temperature and heat transfer coefficients.Furthermore, in order to check the correctness of the results, a Kalman smoothing technique is used to estimate the initial state at the beginning of the night: the initial state is used to run the backward Euler discretized model and compare it with real data.Figs. 13 and 14 show that the model matches the data with good accuracy.Notice that the real measurements are subject to a quite big quantization error due to sensor precision.

Conclusions
This work presented two dual estimation schemes based on Extended Kalman Filtering (EKF) and Unscented Kalman Filtering (UKF) for building heat transfer models used in real-time applications.The dual estimation schemes are used to simultaneously estimate both missing data (mass temperature) and uncertain heat transfer coefficients.In order to cope with low sampling rate of data (with sampling time 15 min), an implicit discretization (Euler backward method) was used to discretize the continuous-time heat transfer dynamics.It was shown that explicit discretization methods (even of high order) are ineffective for building reliable heat transfer models with low sampling rate.Either smaller time steps or alternative discretization methods are required.We verified that the implicit Euler backward method provides good results and could be also easily implemented for our dual estimation purposes.The applicability of the proposed method in terms of estimation of both states and parameters was demonstrated via simulations and using historical data from a real-life building.

Fig. 9 .
Fig. 9. Real-life test case: complete heat exchange, whose dynamics are not observable via the logged datapoints.

Fig. 10 .
Fig. 10.Real-life test case: heat exchange under consideration, whose dynamics are observable via the logged datapoints.

Table 1
Discrepancy continuous/discrete time model.