**4. Results**

As discussed in Section 2, the evaluation of the forecast performance of the two building prediction models was realized according to two points of view: (i) the ability of the models to match the behavior of a known reference building and (ii) their dynamic operation when applied within the controller of the same building. Since short-term dynamics are involved in an MPC, a representative summer week was selected for the analysis (from July 30 to August 6). Figure 5 shows the uncontrollable inputs in the selected period (i.e., ambient temperature and total gains).

**Figure 5.** MPC uncontrollable inputs (disturbances) for the selected summer week: (**a**) ambient temperature, *T*amb; (**b**) total gains, *G*.

As concerns the performance analysis, the ANN training data were selected as comparison terms to test the two building models. As mentioned in Section 3, the ANN training data were obtained with daily random set-points, which could range in the allowed comfort band. Figures 6 and 7 show the results in the entire 168-point dataset for the ANN-based model and the RC network, respectively. Since the output of the models was different in the two approaches, for the ANN the hourly cooling power forecasting was evaluated (Figure 6a), while for the RC network the internal air node temperature was considered (Figure 7a). As can be seen, both the prediction models were able to reply to the dynamic variations of the training data. In the first case, the *RMSE* was 0.26 kW, while the value found for the RC network was 0.34 ◦C. As highlighted by the *RSE* profile in Figure 6b, for the ANN the deviation was mainly due to the inability of the network to simulate the cases with reduced or zero cooling demand. For the physical-based model, instead (Figure 7b), there seemed to be a regular prediction error rather than specific peaks. It is worth noting that the *RSE* assumes a maximum value of 0.9 ◦C in the RC model and a value of 0.8 kW in the ANN model.

**Figure 6.** ANN model prediction results compared to training data: (**a**) cooling power demand; (**b**) root square error (*RSE*).

**Figure 7.** Resistance–capacitance (RC) model prediction results compared to training data: (**a**) indoor air temperature; (**b**) *RSE*.

When the building was allowed to be controlled by the MPC, at each time step the cooling power demand that was selected was the one that minimized the total energy cost. The original energy cost profile and its corresponding penalty signal in the representative summer week are shown in Figure 8a,b, respectively. The use of the penalty signal, instead of the actual energy cost, allowed us to amplify the cost variation and, thus, to incentivize the unlocking of the building's energy flexibility.

Figures 9 and 10 show the MPC results for both the prediction models. The results are presented with a prediction horizon, *ph*, of 6 hours. Specifically, Figures 9a and 10a show the comparison between the building's actual internal air temperature (Type 56) and the MPC's predicted value for the same time step (*t*). Instead, in Figures 9b and 10b, the control actions (*Q*(*t*) in Figure 3) selected by the controller at each time step are represented. Looking at the black curves in Figures 9a and 10a, it is possible to note that both the prediction models were able to activate the building's energy flexibility, exploiting the whole comfort temperature range. Low temperature values are preferred when the energy cost is

low and subsequent increases are expected. Conversely, the temperature is maintained close to the higher comfort range when high energy costs are detected.

The application of the MPC with both the prediction models produced a total cost reduction of about 16% if compared to the reference building with a fixed set-point of 26 ◦C. The *RMSE* between the actual air temperature and that predicted by the MPC at each time step also shows similar error values for the two models: 1.1 ◦C for the controller with the ANN and 0.99 ◦C for the RC model. However, comparing these values with the *RMSE*s found in the first part of the analysis, a degradation in the prediction performance can be noted for both the approaches. This is due to the fact that the building operated in variable dynamic conditions when the energy flexibility was activated. Thus, the predictions depend on constantly updated factors (such as the starting temperature conditions, the charge and discharge level of thermal inertia, etc.) which clearly amplify the prediction error.

**Figure 8.** Electricity cost signal for the selected summer week: (**a**) hourly energy cost, *c***;** (**b**): penalty signal, *p*.

**Figure 9.** MPC with ANN as building prediction model: (**a**) internal air temperature, comparison between the actual Type 56 air zone temperature and ANN prediction at each timestep; (**b**) cooling power profile (control action sequences).

**Figure 10.** MPC with RC as building prediction model: (**a**) internal air temperature, comparison between the actual Type 56 air zone temperature, and RC prediction at each timestep; (**b**) cooling power profile (control action sequences).

Although the models seem to have similar performances, different on-time trends for the two models can be expected if the actual building air temperature is observed (the red curves in Figures 9a and 10a). In particular, the MPC with the RC network seemed to follow the system dynamics more accurately than the controller with the ANN. When the ANN was operatively used in the controller, it appeared to perform less effectively than the RC network. In both cases, in the second half of the tested period, the prediction error started to grow but, in the case of the ANN, the actual air zone temperature exceeded the upper comfort limit by more than one degree (28.8 ◦C was the maximum value reached with the ANN in the controller, against 27.5 ◦C in the case of the RC model). This behavior is also confirmed by the duration curves reported in Figure 11. In the building regulated by the ANN-based MPC, the indoor temperature was found to be above the upper control limit for 36% of the simulation time. This percentage dropped to 24% when the RC network was used. This behavior was due to the difficulty of the control to maintain the comfort level when the temperature was too close to the upper comfort boundary; a small error in prediction can also cause temperature violations.

**Figure 11.** Indoor air temperature duration curves.

In summary, a reversal of performance between the two models can be found when the evaluation is carried out for the application in a realistic controller. The main reason for this behavior is related to the difficulty in selecting the proper dataset for the ANN training. In fact, the model must not only be

able to replicate the response of the building in the same input conditions (and this is done well in the present study), but it must also be able to predict the system's responses in di fferent scenarios, taking into account the contribution of energy flexibility. When the latter is introduced, it becomes di fficult to identify a dataset that can train the black box model adequately, since the problem becomes dynamically a ffected by the operation of the system. Although the flexibility contribution seems to be better represented by the white box model based on the RC network, even in this case, a degradation in the prediction performance is detected when the controller is applied to the building. When using a white box model, however, a relevant amount of detailed data relating to the design and construction characteristics of the building should be known in order to implement an accurate model. Moreover, it is not always obvious which is the best network structure to use in the physical-based approach. For very complex buildings, it may be exceedingly di fficult to identify an appropriate model and the corresponding parameters, even if detailed knowledge of the building is available. Another aspect that should be taken into account when using a purely physical-based model is that some dynamics (e.g., occupancy) cannot be considered in any way unless dedicated models are added. When, instead, measured data are used for the model training, such information may be intrinsically provided to the model. For these reasons, it could be convenient to monitor data and use hybrid models.

To conclude, Table 2 reports a comparison summary between the two building model approaches, subdivided into the main steps of configuration and implementation in an MPC.


**Table 2.** Comparison summary between a physical-based and a data-driven approach in an operative MPC.
