## 4 Methodology
### Model Parameters: Verification and Validation of the Proposed Model  
It is necessary to perform several tests in the laboratory and some simulations in Matlab to obtain the parameters for the model. Load measurements have been collected for more than 4 months. Different cycles of water outlets with different heat sources (HP or resistor) have been programmed to observe the behaviour of the load and its response to different water consumption profiles (charge-discharge cycles). Moreover, different control strategies (DR) on supply have been tested (a single heat source or two sources) to verify the response of the model in transient and steady-state scenarios. Later, the model parameters were fitted by performing several simulations in Matlab, obtaining the accuracy and precision of the model with respect to the real database. An additional advantage of PBLM is that some initial values of parameters can be easily estimated based on the thermal processes that occur in the load and their environment. This makes the evaluation of final  
Figure 7: Latency in 80 L HPWH: (**a**) Evolution of power in a test example; (**b**) Histogram for OFF/ON latency trials. parameters easier. A trivial example for this initial estimation is the total capacity Ct of the water tank can be obtained through physical-chemical characteristics of water and the geometry of the tank as  
\[C_{t}=\rho Vc_{e}=0.99\ \mathrm{kg}/\mathrm{L}*80\ \mathrm{L}*4.18\ \mathrm{ kJ}/\mathrm{kg}\mathrm{K}=331\ \mathrm{ kJ}/\mathrm{K} \tag{3}\]  
where \(\rho\) is the density of the water, V is the total volume of the tank, and \(\mathrm{c_{e}}\) is the specific heat of water (4.18 kJ/kgK). With these initial values, a genetic algorithm has been used to refine the value of parameters. The performance of the model has been verified using three common metrics: the Mean Percent Error (MPE), the Mean Absolute Percent Error (MAPE), and the Root Mean Square Error (RMSE). MPE has been selected to measure accuracy because it can describe the magnitude and direction of the bias. MAPE and MPE indicate the percentage of error between the temperature predicted and the real temperature inside the tank, while MPE can determine whether the temperature is over- or underestimated. The closer to zero both are, the more accurate the model is. To evaluate the precision, MAPE and RMSE have been selected. The lower the RMSE is, the more precise the model is. The model designed and explained in Section 4.1 has been implemented in Matlab and tested with real data from the laboratory load demonstrator (Figure 5) with different duty cycles, a mix of internal heating sources, and water draw profiles. The parameters obtained for the model are depicted in Table 3.  
Table 4 reports the results obtained through simulation for the evaluation and verification of the model, with the parameters presented in Table 3 for one week of tests as an example. As shown, Day 6 presents the maximum indices of temperature error in the mixed-water zone (WH2). In the case of the RMSE, the maximum error is 2.05 \({}^{\circ}\)C. In the case of MPE and MAPE, the error is \(-\)2.32% and 2.65%, respectively. Negative values in MPE mean that the temperature is overestimated, while positive values show an underestimation of the temperature. In the hot water zone, maximum errors are shown on Day 7, with values of 1.556 \({}^{\circ}\)C for RMSE, \(-\)2.02% for MPE, and 2.35% for MAPE. Finally, in the cold-water zone, RMSE and MAPE are the greatest for Day 2, with errors of 1.08 \({}^{\circ}\)C and 1.93%, respectively, while MPE is greatest on Day 1, with a value of 1.36%. In all water zones, the errors are less than 3% and 3 \({}^{\circ}\)C (for RMSE), so it can be assumed that the proposed model performs properly. As Day 6 is the day with the greatest errors, Figure 8 depictsmeasurements obtained from the load and the temperature values for the water zones obtained with the model (corresponding to Table 4) for this day.