## 2 Materials and Methods
### Calibration
#### 2.2.2 Automatic Calibration  
In the automatic procedure, the model was again calibrated using the hourly indoor T measured in the different monitoring campaigns but involving simulation-based optimization method. This automated method was based on the coupling of a simulation program and an optimization engine, which consists of several optimization algorithms. Optimization settings (variables, constraints, selected algorithm, etc.) and an objective function are needed for the optimization engine. Subsequently, the engine sends a call signal to the simulation program, to run a simulation and obtain a resulting scenario. If the output of the simulation satisfies the stop criteria for the algorithm, the optimal solution has been found and the process is concluded. Otherwise, the optimization engine elaborates and sends a new set of input data to the simulation program, calls for a new simulation run and repeats the process until at least a stop criterion is met (Figure 2). In this calibration process, the objective function was the Cumulative Squared Error (\(CSE\)) of simulated (\(s\)) and measured (\(m\)) data:  
\[CSE=\sum_{i=1}^{n}(s_{i}-m_{i})^{2} \tag{9}\]  
The function was built in IDA-ICE including:1. _Source-File_, containing all the T data measured in a specific room for the monitoring campaign period;
2. _Zone-Sensor_, referring to the thermal zone which the room corresponds, in order to extract the simulated T data to be compared with the measured ones;
3. List of _mathematical operators_, to build the function. Using GenOpt [43; 44] via the parametric-runs macro embedded in the IDA ICE environment as the optimization engine, a hybrid algorithm--a combination of the Particle Swarm Optimization (PSO) algorithm for a first global search and the Hooke-Jeeves (HJ) algorithm for a second local search--minimized the objective function. The PSO algorithm is a metaheuristic population-based algorithm that makes use of the group behaviour of an ensemble of particles, intended as a social organism. This \"swarm\" of particles searches in the solution space using simple rule-based decisions combined with randomized decisions, sharing information about the best solution found so far. The PSO algorithm does not require any previous knowledge of the objective function or its derivative, which allows it to deal with discontinuities. It can also search in very large search-spaces, does not \"get stuck\" in local optima and has the possibility to evaluate a large number of cost functions. However, although excellent solutions are always found by the algorithm, global optimum cannot be guaranteed [45; 46]. The HJ algorithm is a direct search algorithm that, starting from a (user) selected base point, performs local search using a defined step in the variability range of the input parameters. If the process does not decrease the cost, the step is reduced and the search continues from the best solution found so far. If, conversely, the objective function decreases, a temporary best value is found and assumed as new base point for the following search. The process keeps on going until the cost function decreases. The HJ algorithm is not gradient-based--it can easily face discontinuities but may be attracted by local optima if the first base point has not been wisely selected [47]. The hybrid algorithm involved in the calibration process takes advantage of the positive face of both algorithms, reducing the disadvantages. Indeed, PSO rapidly converges to a set of very good solutions (potential optima), the best of which is taken as base point for HJ. Subsequently, the direct search algorithm more deeply investigates the neighbourhood of this base point, searching for the global optimum. The calibration was performed as a single-objective optimization problem, considering only the candidate parameters derived from the sensitivity analysis. Once the process was over, the goodness of the result could be evaluated again in terms of RMSE, CVRMSE and NRMSE, also to facilitate the further comparison.