**2. Literature review about MPC control**

to optimise the operation of the mechanical air supply systems of the Passeig De Gracia metro station in Barcelona. To the purpose of this application, predictive models were developed to support the optimal control of environmental conditions in the station, which was necessary

Building Energy Management Systems (BEMSs) are control systems installed in buildings for managing the building's mechanical and electrical equipment, such as ventilation, lighting, fire and security systems [2]. BEMSs consist of hardware and software components. The hardware set-up of a BEMS is typically made up of sensor-actuator networks that accurately monitor the indoor-outdoor environment and the building plants state. The software side of a BEMS consists of a number of functional layers that implement standard management functionalities like plant status monitoring, alarm management, demand driven plant management, reporting, etc. The hardware side of the commercial BEMS technology is at present a rather mature field. A number of initiatives and associations both at industrial and public level (e.g. European Building Automation and Controls Association-EU.BAC) are cooperating to develop open communication and seamless integration standards such as BACnet, KNX, LonWorks [3], and DALI [4]. The software side of commercial BEMSs is being standardised as well. Standard EN15232 provides a structured list of controls, building automation and technical building management functions that make an impact on the energy performances of buildings. Firstly, it provides a method to define the minimum requirements concerning the building automation and the building management policies, differentiated according to the level of complexity of buildings; secondly, it provides detailed methods to assess the impact of these policies on the energy performance of any given building. Never‐ theless, EN15232 methods are limited to relatively simplified applications, ranging from simple homeostatic control to demand-driven and time-scheduled policies. The implementa‐ tion of optimised control policies that encompass the complex weather and end-user dynamics in the energy management of buildings is still missing. The analysis of standard BEMS applications suggests that only a fraction of the available BEMS energy saving potential of each specific building is utilized by the implemented management policies, thus missing significant opportunities for reducing operating costs through better supervisory controls. Frequently, plant and building set-points follow prescribed schedules and are not optimized in response to changing dynamic conditions, including weather, internal loads, occupancy patterns, etc. Nonetheless, there are significant opportunities for optimizing control set points and modes of operation in response to dynamic forcing functions and utility rate incentives. A number of studies [5-8] have shown potential savings for optimized controls in the range of 10% to 40%

Model Predictive Control (MPC) [9-11] may be used to enhance BEMSs so that they can improve their control performances getting close to optimal behaviour. MPC is an advanced control technique [12] that uses the predictions of future building status, obtained by means of a model of the building's dynamics, in order to solve the problem of determining the optimal control policies. The purpose of building management is to guarantee comfort at minimum operational cost. The MPC integrated approach to building management guarantees perform‐ ance over the full range of conditions which are likely to be encountered. Since the predictions

due to the many interacting variables of the domain.

4 Dynamic Programming and Bayesian Inference, Concepts and Applications

of the overall cooling cost.

As mentioned in the Introduction, the Bayesian networks developed in this chapter were used to provide forecasts about the future state of the PdG-L3 in Barcelona, given the knowledge about their current state, in order to support the application of a Model based Predictive Control (MPC) approach. In fact, MPC is an enhancement of adaptive control.

It is known that any control in buildings is targeted to minimize power consumption while keeping required comfort level and guaranteeing robustness of the solution. In order to fit these specifications, the control system must comply with several features. It must be optimal, i.e. it finds out the values of a vector of design parameters that yield optimal system perform‐ ance evaluated by a so-called cost function. In addition, the control system must be adaptive, which is "a special type of nonlinear control system which can alter its parameters to adapt to a changing environment. The changes in environment can represent variations in process dynamics or changes in the characteristics of the disturbances. […]" [15]. Robustness is also required, thus implying that the models used for designing the controller should consider all process dynamics and must be able to adapt to unknown conditions. Finally, the predictive feature is another opportunity for achieving high energy efficiencies: prediction gives the capability of taking soft control actions in advance instead of suddenly reacting to unexpected deviations from the required state, thus saving energy.

complex analytical approaches and occupancy figures result someway difficult to predict. Hence, the dynamics of the station cannot be solved –and predicted– though a simplified thermal model (e.g. of statistical type); so, the reported work focuses on the key problem regarding the development of predictive models relative to complex domains, which was faced through the adoption of Bayesian Networks. In fact, they gave back a lumped representation

Bayesian Networks for Supporting Model Based Predictive Control of Smart Buildings

The overall MPC control framework applied to the station is represented in Fig. 1. Inputs *u* to the system are the variables that can be driven by the controller (e.g. frequency that drives injector fans in the case of mechanical air supply). The outputs *y* are the power consumption and indicators for comfort and health that must be controlled in order to reach certain desired reference level *r*. The relation between inputs and outputs is also significantly affected by a set of disturbances *d*, such as weather, train arrival, passenger flows and fans external to the station: they cannot be manipulated but only "accounted for" by using direct measures, whenever possible, together with a disturbance model. At each control step, the prediction

which minimizes a given cost function while complying with given constraints. Once the optimization problem has been solved, the first step *u* of the optimal sequence is applied as the best control action. The overall procedure is repeated at each step, thus closing the control loop. The implementation of those systems asks for the development of devices and services:

**1.** monitoring systems and intelligent algorithms to interpret occupant's behaviour [20];

**3.** accurate and fast dynamic models of buildings' behaviour and their systems, necessary to feed the high-level control systems (i.e. to generate the predicted output sequence *y*

The predictive models mentioned by bullet no. 3 above were developed in the form of Bayesian Networks, because they were able to simulate the complexity of the system under analysis while keeping the computational effort manageable for real-time applications. To this aim Section 4 presents the basics on probability inference and Bayesian learning, despite the fact that this chapter cannot cover all the algorithms related to these topics. In Section 5 the indices useful to evaluate the quality of the developed networks were shown. In the same section the problem of network instantiation which includes even uncertainty is unfolded. Section 6 will report the procedure used to develop the Bayesian Networks object of this chapter, the validation of their inference capabilities and the cost function implemented by the controller to search the optimum solutions. Finally, in Section 7 the networks were wrapped within the whole predictive modelling framework and their capabilities shown through one example.

**2.** high-level control systems capable of solving optimization problems in real-time;

**4.** accurate modelling of disturbances (e.g. occupancy, weather conditions etc..).

^

^ picked out by the controller; disturbance predic‐

is that one

http://dx.doi.org/10.5772/58470

7

^);

, measured outputs *m* from PdG-L3 and the prediction

^. The optimal control sequence *<sup>u</sup> \**

of a number of sub-systems, involving thousands of variables.

model receives candidate input sequences *u*

model estimates the future output sequence *y*

tions come from disturbances models *d*

Conclusions are given in Section 8.

MPC works based on a model of the building dynamics and the solution of an optimization problem to determine the optimal control inputs. It takes into account the (measured) current state of the system, future weather conditions and other disturbances (e.g. internal gains), in order to control actuators (e.g. HVAC, lighting and blind systems), so that energy and money usage are minimized. At the current point in time, a heating/cooling plan is formulated for the next several hours to days, based on predictions of the upcoming weather conditions. The control action is designed by running the model of the process over a given prediction horizon and evaluating the control sequence that gives the minimum value of the cost function [16]. Based on the results from this computation, the first step of the control policy is applied to the building, setting all the HVAC components, before moving one step forward and repeating the process at the next sampling time. This receding horizon approach is what introduces feedback into the system, since the new optimal control problem solved at the next time will be a function of the new state at that point in time, and hence of any disturbances that have meanwhile acted on the building. The final result will be a trajectory of inputs and states into the future that satisfy the dynamics and constraints of the system while optimizing some given criteria.

One remarkable survey about the effectiveness of MPC was carried out by means of simula‐ tions and applied to office buildings [17]. First, the authors considered and compared a list of potential adaptive approaches, among which we cite reduction of the thermal comfort when the building is not used, widening of the room temperature comfort range, use of Indoor Air Quality controlled ventilation. Results coming from these approaches were then compared with the benefits of a model based predictive control. The building was simulated by means of a single zone, twelfth order, time discrete bilinear building model of coupled thermal, air quality and light dynamics [18, 19]. Those preliminary simulations showed that the highest energy savings were determined by predictive control, which was also the best one at reducing the number of comfort violations encountered during the process.

What makes the application of predictive control to the "Passeig de Gracia" (PdG-L3) metro station in Barcelona very meaningful is that this is the case of a large underground building where the interaction with the outdoors is very critical and it can be modelled using very complex analytical approaches and occupancy figures result someway difficult to predict. Hence, the dynamics of the station cannot be solved –and predicted– though a simplified thermal model (e.g. of statistical type); so, the reported work focuses on the key problem regarding the development of predictive models relative to complex domains, which was faced through the adoption of Bayesian Networks. In fact, they gave back a lumped representation of a number of sub-systems, involving thousands of variables.

It is known that any control in buildings is targeted to minimize power consumption while keeping required comfort level and guaranteeing robustness of the solution. In order to fit these specifications, the control system must comply with several features. It must be optimal, i.e. it finds out the values of a vector of design parameters that yield optimal system perform‐ ance evaluated by a so-called cost function. In addition, the control system must be adaptive, which is "a special type of nonlinear control system which can alter its parameters to adapt to a changing environment. The changes in environment can represent variations in process dynamics or changes in the characteristics of the disturbances. […]" [15]. Robustness is also required, thus implying that the models used for designing the controller should consider all process dynamics and must be able to adapt to unknown conditions. Finally, the predictive feature is another opportunity for achieving high energy efficiencies: prediction gives the capability of taking soft control actions in advance instead of suddenly reacting to unexpected

MPC works based on a model of the building dynamics and the solution of an optimization problem to determine the optimal control inputs. It takes into account the (measured) current state of the system, future weather conditions and other disturbances (e.g. internal gains), in order to control actuators (e.g. HVAC, lighting and blind systems), so that energy and money usage are minimized. At the current point in time, a heating/cooling plan is formulated for the next several hours to days, based on predictions of the upcoming weather conditions. The control action is designed by running the model of the process over a given prediction horizon and evaluating the control sequence that gives the minimum value of the cost function [16]. Based on the results from this computation, the first step of the control policy is applied to the building, setting all the HVAC components, before moving one step forward and repeating the process at the next sampling time. This receding horizon approach is what introduces feedback into the system, since the new optimal control problem solved at the next time will be a function of the new state at that point in time, and hence of any disturbances that have meanwhile acted on the building. The final result will be a trajectory of inputs and states into the future that satisfy the dynamics and constraints of the system while optimizing some given

One remarkable survey about the effectiveness of MPC was carried out by means of simula‐ tions and applied to office buildings [17]. First, the authors considered and compared a list of potential adaptive approaches, among which we cite reduction of the thermal comfort when the building is not used, widening of the room temperature comfort range, use of Indoor Air Quality controlled ventilation. Results coming from these approaches were then compared with the benefits of a model based predictive control. The building was simulated by means of a single zone, twelfth order, time discrete bilinear building model of coupled thermal, air quality and light dynamics [18, 19]. Those preliminary simulations showed that the highest energy savings were determined by predictive control, which was also the best one at reducing

What makes the application of predictive control to the "Passeig de Gracia" (PdG-L3) metro station in Barcelona very meaningful is that this is the case of a large underground building where the interaction with the outdoors is very critical and it can be modelled using very

the number of comfort violations encountered during the process.

deviations from the required state, thus saving energy.

6 Dynamic Programming and Bayesian Inference, Concepts and Applications

criteria.

The overall MPC control framework applied to the station is represented in Fig. 1. Inputs *u* to the system are the variables that can be driven by the controller (e.g. frequency that drives injector fans in the case of mechanical air supply). The outputs *y* are the power consumption and indicators for comfort and health that must be controlled in order to reach certain desired reference level *r*. The relation between inputs and outputs is also significantly affected by a set of disturbances *d*, such as weather, train arrival, passenger flows and fans external to the station: they cannot be manipulated but only "accounted for" by using direct measures, whenever possible, together with a disturbance model. At each control step, the prediction model receives candidate input sequences *u* ^ picked out by the controller; disturbance predic‐ tions come from disturbances models *d* ^ , measured outputs *m* from PdG-L3 and the prediction model estimates the future output sequence *y* ^. The optimal control sequence *<sup>u</sup> \** is that one which minimizes a given cost function while complying with given constraints. Once the optimization problem has been solved, the first step *u* of the optimal sequence is applied as the best control action. The overall procedure is repeated at each step, thus closing the control loop. The implementation of those systems asks for the development of devices and services:


The predictive models mentioned by bullet no. 3 above were developed in the form of Bayesian Networks, because they were able to simulate the complexity of the system under analysis while keeping the computational effort manageable for real-time applications. To this aim Section 4 presents the basics on probability inference and Bayesian learning, despite the fact that this chapter cannot cover all the algorithms related to these topics. In Section 5 the indices useful to evaluate the quality of the developed networks were shown. In the same section the problem of network instantiation which includes even uncertainty is unfolded. Section 6 will report the procedure used to develop the Bayesian Networks object of this chapter, the validation of their inference capabilities and the cost function implemented by the controller to search the optimum solutions. Finally, in Section 7 the networks were wrapped within the whole predictive modelling framework and their capabilities shown through one example. Conclusions are given in Section 8.

*P(X*2*|X*1*)*, where *X*1 is a parent of *X*2 (which is its child node instead) and *X*2 is conditionally independent of any variable in the domain which is not its parent [21]. The "chain rule" descends from this concept, in that the joint probability of a group of variables in a domain can be determined by the knowledge of the state of just its parents, thus limiting the database

More remarkably, Bayesian Networks allow to perform inferences, in other words any node can be conditioned upon new evidences, even when they are relative to multiple variables. This feature is particularly important in case a control system must work in real-time, because in that case evidences acquired about a state variable (i.e. from sensor measurements) must be propagated to update the state of the rest of the domain. This process requires conditioning, and it might be called also probability propagation or belief updating. It is performed via a flow of information throughout the network, without limitation in the number of nodes [1]. When it is run in the MPC framework, the controller will make queries to a set of nodes belonging to the networks, whose probability distributions are computed from the state of other nodes, upon which observations (or evidences) are already available (e.g. the future state of disturbance variables and the current state of the physical domain). To this purpose the Bayes theorem is exploited when there is a need to reverse the inference. In particular, if inference is run from causes to consequences it is called predictive reasoning; otherwise, if inference is directed from consequences to causes, it is called diagnostic reasoning. Inference in Bayesian Networks is solved by complex combinations of algorithms [1]. In order to show how this works in the case of BEMs, a short example will be discussed. The first step towards the development of any Bayesian Network is defining its graphic structure, which requires all the variables of the domain to be ordered and causal relationships among them to be defined. The three elementary structures used to order variables in Bayesian Networks are: causal chains, causal tress and poly-trees (Fig. 2). Then, other more complex structures may be formed as a combination or enhancement of these elementary fragments. The computational burden

**Figure 2.** Graphic representation of a causal chain made up of three nodes (a), a causal tree (b) and a causal poly-tree

*P*(*Xi* | *X*1, …, *Xi*-1) (1)

http://dx.doi.org/10.5772/58470

9

Bayesian Networks for Supporting Model Based Predictive Control of Smart Buildings

*P*(*X*1, …, *Xn*) =∏

*i*=1 *n*

required for its inference [22]:

would change as a consequence.

(c).

**Figure 1.** Predictive model based control framework defined for the metro station PdG-L3.
