**5.2. The cost function**

With reference to Fig. 1, the controller unit passes a candidate control policy to the BNs and uses resulting predictions in order to compute a cost function, which must select the best output to be used as an input in the next time step. The degrees of freedom (outputs) of the controller for PdG-L3 station are the frequencies of the station fans (*FreSF*1, *FreSF* 2). The predictions that the controller queries to the Bayesian Networks are the absorbed powers of tunnel fans and station fans (*PElTF* 1, *PElTF* 2, *PElSF* 1, *PElSF* 2) and the air temperature in the platform (*TemPl*3). The future outdoor temperature (*TOuWS*) is retrieved from a weather forecast service and the air change in the platform (*ACOPl*3=amount of clean air entering the platform) is computed as a proper combination of the air flows predicted by the BNs (derived by the specific station topology):

$$\begin{aligned} \text{ACOPI3} & \triangleq \text{AFISFa1}^{+} + \text{AFISFa2}^{+} + \text{AFICNI}^{+} + \\ &+ \left[ \text{(AFICNop - AFISLb + AFICNq)^{+} - } \right] \text{AFISL } b^{-} \right] \text{I}^{+} \end{aligned} \tag{22}$$

The objective of MPC is to minimize the following cost function with respect to station fan frequencies:

Bayesian Networks for Supporting Model Based Predictive Control of Smart Buildings http://dx.doi.org/10.5772/58470 25

$$\begin{aligned} \mathbf{J} &= \sum\_{k=1}^{H} \alpha\_{PT} \bigg( \frac{\lfloor \text{PEIFF } 1(k) \circ P \text{EIFF } 2(k) \rfloor}{\sim} \right) + \alpha\_{PS} \bigg( \frac{\lfloor \text{PEIFF } 1(k) \circ P \text{EIFF } 2(k) \rfloor}{\sim} \Big) + \\ &+ \alpha\_{DT} \bigg( \frac{\binom{\text{TOM} \\$\\$\\$\\$\\$\\$\text{(k)} \cdot T \text{emP} \\$\\$(k)}{\sim} \Big)^{2} + \alpha\_{T} \bigg( \frac{\binom{\text{Te} \\$\\$\\$\\$\\$\\$ \cdot T \text{emP} \\$\\$\\$(k)}{\sim} \Big)^{2} \\ &+ \alpha\_{AC} \bigg( \frac{\binom{\text{-}}{\text{ACOP1} \\$\\$\text{-} \text{ACOP1} \\$(k)}{\sim} \Big)^{2} + \alpha\_{DF} \bigg( \frac{\binom{\text{FeSF1} \\$\\$\\$\\$\\$ \cdot T \text{ReS} \\$\\$ \text{1(k)} \sim 1}{\sim} \Big)^{2} \end{aligned} \tag{23}$$

Subject to constraints:

*ACOPl*3(*k*) > *ACOPl*3*Min*

*TemPl*3(*k*) <*TemPl*3*Max*

**Figure 9.** Qualitative comparison between the real temperature plot computed by DymolaTM and forecasts by the

Finally, and as fourth step, the performances of the two networks were verified also through simulations. Fig. 9 shows the good agreement between the real temperature simulated by DymolaTM in PL3 and the forecasted plot of PL3 as predicted by TP-DBN. The simulations performed by the Bayesian Networks in this case were carried out according to what already described. The input values at the first time step were instantiated as evidences taken by the Dymola model. Then, the outputs from the networks were used as inputs for the next time step in the networks and the simulations were iterated in the same way all over the period shown in the diagram. It's clear that the predictive and dynamic Bayesian network are able to accurately model the temperature plot in PL3 and to give the right inputs to the controller, in

With reference to Fig. 1, the controller unit passes a candidate control policy to the BNs and uses resulting predictions in order to compute a cost function, which must select the best output to be used as an input in the next time step. The degrees of freedom (outputs) of the controller for PdG-L3 station are the frequencies of the station fans (*FreSF*1, *FreSF* 2). The predictions that the controller queries to the Bayesian Networks are the absorbed powers of tunnel fans and station fans (*PElTF* 1, *PElTF* 2, *PElSF* 1, *PElSF* 2) and the air temperature in the platform (*TemPl*3). The future outdoor temperature (*TOuWS*) is retrieved from a weather forecast service and the air change in the platform (*ACOPl*3=amount of clean air entering the platform) is computed as a proper combination of the air flows predicted by the BNs (derived

> *ACOPl*3≜ *AFlSFa*1<sup>+</sup> + *AFlSFa*2<sup>+</sup> + *AFlCN l* <sup>+</sup> + + (*AFlCNop* - *AFlSLb* + *AFlCNq*)<sup>+</sup> - | *AFlSL b* -

The objective of MPC is to minimize the following cost function with respect to station fan

<sup>|</sup> <sup>+</sup> (22)

Bayesian Network TP-DBN.

**5.2. The cost function**

order to evaluate the best control policy.

24 Dynamic Programming and Bayesian Inference, Concepts and Applications

by the specific station topology):

frequencies:

*FreSFMin* < *FreSF* 1(*k*)= *FreSF* 2(*k*) < *FreSFMax*

The variables marked with "tilde" (~) are the normalisation coefficients that corresponds to the typical values of the corresponding variable. At sampling time *t* ∈N, *PElTF* 1(*k*) represents the estimation of the value of variable *PElTF* 1 at time *t* + *k* (*k* ∈N) evaluated at time *t* (i.e. *PElTF* 1(*t* + *k* |*t*)). The design parameters of the MPC controller are the prediction horizon *H* ,

the desired values denoted with bar notation *TemPl*3 \_ , *ACOPl*3 \_ , the weights of each single objective in the cost function *α*…, and the bounds of the given constraints: *ACOPl*3*Min*, *TemPl*3*Max*, *FreSFMin*, *FreSFMax*.
