**6.1. The SEAM4US simulator**

The Simulink (Mathworks©) architecture of the SEAM4US simulator is shown in Fig. 11. The simulator is made of four main components. The PdG Environmental model, the passenger flow simulator, the lighting control simulator and the environmental MPC.

power to get reasonable and effective simulation times. This is in contrast with the model embedding requirements, which foresees models included in relatively light computational environment due to deployment constraints and cost reasons. Furthermore, the alignment of the initial state of such a large model with the actual state of the station is very problematic in terms of computational time and of the stability of the solution. Therefore, the model that support the controller by means of predictions on the future status of the station has been derived from the PdG environmental model through a model reduction process into Bayesian

Bayesian Networks for Supporting Model Based Predictive Control of Smart Buildings

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

29

The PdG has been used to produce a large set of control cases that have been analysed to find out the minimum set of parameters for an effective control of the target performances. The reduced case set has been then fed into the Bayesian Network, through EM learning algo‐ rithms, in order to get the Bayesian predictor for the MPC control shown in sub-section 5.1. The size of this predictor is small enough and its computational time short enough to suit the model embedding requirements. The statistical nature of the predictor avoids any problems

The prediction accuracy achieved by the reduced model is good enough to get a reliable control

The passenger model simulates the passenger flows and the consequent occupancy distribu‐ tion of the spaces inside the station. It is regulated by the train schedule, by the hour of the day – either a normal or a rush hour-and by the week day-either a weekend or a working day. The simulator has been developed in the Modelica language and is based on the bond graph theory. The passenger flow is simulated as a mass flow occurring among the station spaces. The mass sources are modulated by train arrivals and hourly scheduled flow rates observed from the outside. The model calibration has been carried out through observations (i.e. sampling performed by means of security cameras installed in the metro station) of the flow rates of passenger entering and exiting the trains and the station entrances at different hours of the days. The internal flow is then regulated through mass flow delays calculated on the basis of

Finally, the lighting control subsystems regulates the lighting level adaptively in relation to the occupancy level of each station ambient. It implements a reactive form of control that is driven by the visual task of each specific situation that may occur in the station ambient, either rush hour, waiting train arrival, and so on. The outcome of the lighting simulator are the dimming level of each appliance of the station. This of course influences the station environ‐ ment as a thermal gain and is therefore provided to the PdG environmental model input.

A noteworthy aspect of the SEAM4US simulator is its computational arrangement. In fact, it implements a co-simulation architecture. The overall container is the Simulink system, which provides the control clock and a fixed simulation step to all the other subsystems. The passenger model and the lighting simulator are included in the Simulink framework as Functional Mock-up Units (FMU) that internally include the solver, through Functional Mockup Interfaces (FMI). Interestingly, the FMI protocol provides the necessary interface between the different solvers, adapting the time varying simulation steps of the FMUs with the Simulink

Networks, as described in Section 6 of this Chapter.

concerning the estimation of the initial state.

of the station.

typical transit speeds.

**Figure 11.** The Simulink SEAM4US Simulator architecture: occupancy (green), fan frequencies (blue), dimming level of lights (orange), measures (violet).

The PdG Model is the one developed in the Modelica language. To this aim, the Buildings Library 1.3 [28] has been extended in order to represent physical entities and parameters of the underground environments. At compile time the PdG environmental model results in a matrix with tenths of thousands of unknowns. The PdG Model is interfaced with a weather file of Barcelona that provides the hourly external weather parameters, including wind speed and directions. The PdG Environmental Model receives as inputs the passenger occupancy levels of each space of the station, the lighting level of the appliances in each space, and the fan control frequencies. It then outputs all the environmental parameters, like air temperature and humidity, the pollutants levels, and the energy consumption of the fans. These parameters are then fed back to the control logics as the basis for the next control step. In the SEAM4US simulator the large PdG Environmental model acts as the real station. In principle, this model could be used in the deployed MPC system to provide the necessary and accurate predictions of the next future in the model predictive controller. This option has revealed unpractical. The big size of the model produces a large memory footprint and requires significant computation power to get reasonable and effective simulation times. This is in contrast with the model embedding requirements, which foresees models included in relatively light computational environment due to deployment constraints and cost reasons. Furthermore, the alignment of the initial state of such a large model with the actual state of the station is very problematic in terms of computational time and of the stability of the solution. Therefore, the model that support the controller by means of predictions on the future status of the station has been derived from the PdG environmental model through a model reduction process into Bayesian Networks, as described in Section 6 of this Chapter.

**6.1. The SEAM4US simulator**

28 Dynamic Programming and Bayesian Inference, Concepts and Applications

lights (orange), measures (violet).

The Simulink (Mathworks©) architecture of the SEAM4US simulator is shown in Fig. 11. The simulator is made of four main components. The PdG Environmental model, the passenger

**Figure 11.** The Simulink SEAM4US Simulator architecture: occupancy (green), fan frequencies (blue), dimming level of

The PdG Model is the one developed in the Modelica language. To this aim, the Buildings Library 1.3 [28] has been extended in order to represent physical entities and parameters of the underground environments. At compile time the PdG environmental model results in a matrix with tenths of thousands of unknowns. The PdG Model is interfaced with a weather file of Barcelona that provides the hourly external weather parameters, including wind speed and directions. The PdG Environmental Model receives as inputs the passenger occupancy levels of each space of the station, the lighting level of the appliances in each space, and the fan control frequencies. It then outputs all the environmental parameters, like air temperature and humidity, the pollutants levels, and the energy consumption of the fans. These parameters are then fed back to the control logics as the basis for the next control step. In the SEAM4US simulator the large PdG Environmental model acts as the real station. In principle, this model could be used in the deployed MPC system to provide the necessary and accurate predictions of the next future in the model predictive controller. This option has revealed unpractical. The big size of the model produces a large memory footprint and requires significant computation

flow simulator, the lighting control simulator and the environmental MPC.

The PdG has been used to produce a large set of control cases that have been analysed to find out the minimum set of parameters for an effective control of the target performances. The reduced case set has been then fed into the Bayesian Network, through EM learning algo‐ rithms, in order to get the Bayesian predictor for the MPC control shown in sub-section 5.1. The size of this predictor is small enough and its computational time short enough to suit the model embedding requirements. The statistical nature of the predictor avoids any problems concerning the estimation of the initial state.

The prediction accuracy achieved by the reduced model is good enough to get a reliable control of the station.

The passenger model simulates the passenger flows and the consequent occupancy distribu‐ tion of the spaces inside the station. It is regulated by the train schedule, by the hour of the day – either a normal or a rush hour-and by the week day-either a weekend or a working day. The simulator has been developed in the Modelica language and is based on the bond graph theory. The passenger flow is simulated as a mass flow occurring among the station spaces. The mass sources are modulated by train arrivals and hourly scheduled flow rates observed from the outside. The model calibration has been carried out through observations (i.e. sampling performed by means of security cameras installed in the metro station) of the flow rates of passenger entering and exiting the trains and the station entrances at different hours of the days. The internal flow is then regulated through mass flow delays calculated on the basis of typical transit speeds.

Finally, the lighting control subsystems regulates the lighting level adaptively in relation to the occupancy level of each station ambient. It implements a reactive form of control that is driven by the visual task of each specific situation that may occur in the station ambient, either rush hour, waiting train arrival, and so on. The outcome of the lighting simulator are the dimming level of each appliance of the station. This of course influences the station environ‐ ment as a thermal gain and is therefore provided to the PdG environmental model input.

A noteworthy aspect of the SEAM4US simulator is its computational arrangement. In fact, it implements a co-simulation architecture. The overall container is the Simulink system, which provides the control clock and a fixed simulation step to all the other subsystems. The passenger model and the lighting simulator are included in the Simulink framework as Functional Mock-up Units (FMU) that internally include the solver, through Functional Mockup Interfaces (FMI). Interestingly, the FMI protocol provides the necessary interface between the different solvers, adapting the time varying simulation steps of the FMUs with the Simulink fixed one. The inclusion of the large PdG environmental model was not that easy. The Dymola model did not allow exporting the solver that is uniquely able to simulate the model within an FMU. Therefore, we have opted for a loosely coupled simulating environment, which runs the Dymola and the Simulink in parallel and synchronize them through a DDE channel. A wrapper of the Dymola model, which essentially implements an FMI, provides the necessary sync and message transfer functionalities.

(a)

(b)

meaningful control strategies (bottom).


K°

1

10

19

28

37

46

55

64

73

82

91

100

109

118

127

136

145

154

163

**Figure 13.** Some plots from the simulations in search of optimal control strategies: frequency of the fans in charge of mechanical air supply according to the control policy (top) and related air temperature plots determined by the most

Fig. 13 shows an example of a simulation result of three days of operation, which is relative to the environmental control. The simulation time is represented along the x axis, while the y axis represents the fan frequencies in Fig. 13-a. Negative frequencies means that the fan direction is inverted (extracting air instead of supplying). Three curves are reported. The dashed curve (Baseline) depicts the current policy used for fan control, as it is actually implemented in the station, which we assumed as the baseline. The fan is driven at maximum speed for all the station opening time and it is turned off during the closure time. The second dash-dot curve represents MPC constrained to only two driving frequencies, while the third (continuous) curve is related to a continuous frequency driving. In addition to the fact that MPC control provides an energy saving rate that can rise up to 35%, it is noteworthy to realize why this happens. Comparing the baseline curve with the MPC controlled, it appears that in many cases the driving frequencies and the baseline have opposite signs. This means that in the standard baseline driving the station fans very often are opposed to the air flow induced by the external sources, and therefore contribute negatively to the air exchange and to the comfort parameters. This is reflected by the temperature curves that are slightly lower – i.e. more comfortable-for the MPC controlled environment despite the huge energy saving (Fig. 13-b). Summarizing,

172

181

190

199

208

217

226

235

244

253

262

271

280

289

298

307

316

325

334

343

352

361

370

379

388

397

406

415

424

433

secs



1

9

17

25

33

41

49

57

65

73

81

89

97

105

113

121

129

137

145

153

161

169

177

185

193

201

209

217

225

Bsl\_FreSF1 CP0\_OM1\_FreSF1 CP0\_OM2\_FreSF1

Baseline Discrete Frequencies Continuous Frequencies

233

Bsl\_TemPL3 CP0\_OM1\_TemPL3 CP0\_OM2\_TemPL3

Baseline Discrete Frequencies Continuous Frequencies

241

249

257

265

273

Bayesian Networks for Supporting Model Based Predictive Control of Smart Buildings

281

289

297

305

313

321

329

337

345

353

361

369

377

385

393

401

409

417

425

433

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

31

secs

10

30

50

70

Hz

8. Conclusions

reasonable computational effort is required.

Fig. 13 - Some plots from the simulations in search of optimal control strategies: frequency of the fans in charge of mechanical air supply according to the control policy (top) and related air temperature plots determined by the most meaningful control strategies (bottom). Fig. 13 shows an example of a simulation result of three days of operation, which is relative to the environmental control. The simulation time is represented along the x axis, while the y axis represents the fan frequencies in Fig. 13-a. Negative frequencies means that the fan direction is inverted (extracting air instead of supplying). Three curves are reported. The dashed curve (Baseline) depicts the current policy used for fan control, as it is actually implemented in the station, which we assumed as the baseline. The fan is driven at maximum speed for all the station opening time and it is turned off during the closure time. The second dash-dot curve represents MPC constrained to only two driving frequencies, while the third (continuous) curve is related to a continuous frequency driving. In addition to the fact that MPC control provides an energy saving rate that can rise up to 35%, it is noteworthy to realize why this happens. Comparing the baseline curve with the MPC controlled, it appears that in many cases the driving frequencies and the baseline have opposite signs. This means that in the standard baseline driving the station fans very often are opposed to the air flow induced by the external sources, and therefore contribute negatively to the air exchange and to the comfort parameters. This is reflected by the temperature curves that are slightly lower – i.e. more comfortable - for the MPC controlled environment despite the huge energy saving (Fig. 13-b). Summarizing, these results show how the effectiveness of the MPC control of complex environment relies on the power

and on the flexibility of the Bayesian predictor and of the Bayesian Inference paradigm.

In this Chapter we have shown that the role of Bayesian predictors may be critical in order to implement predictive control of buildings. This kind of control is one of the most effective ones currently being developed by researchers, because it is able to smooth control actions and to trigger them in advance. However, it cannot be applied without a reliable predictor of the expected state of the controlled domain. Such a predictor must be queried in real-time, which is feasible just in case a

In other words, computationally demanding software programs cannot be used to produce predictions at run time, but they can be run to generate datasets and these datasets may be used to transfer knowledge into Bayesian Networks. At this juncture, Bayesian inference may be performed: in fact,
