## 8 Validation in a Testing Environment
Once the validations in the laboratory prototype were completed, including communication between the hardware device and the cloud, the compliance of actuators with issued commands, and the viability of the installation procedure, the system was ready for deployment in a real-world environment. Then, the next phase involved testing the solution in a home equipped with a PV system, an electric battery, and an aerothermal system, to confirm its performance in a practical setting. This progression from prototype to field testing ensured that the final solution would be robust, reliable, and user-friendly. The installation where the real-world test will be carried out is located in Madrid and consists of a 6.3 kWp PV system, a 10 kWh electric storage, and an 8 kW aerothermal machine. As can be seen in Figure 29, the hardware device was placed next to the photovoltaic inverter. Figure 29: Installation in a real environment. The chosen temperature sensor is an NTC (negative temperature coefficient) thermistor with an uncertainty of \(\pm\)0.3 \({}^{\circ}\)C. This choice is based on the sensor's high precision and reliability in measuring temperature in outdoor and indoor environments. NTC thermistors offer a narrow range of uncertainty, making them ideal for applications where accuracy is crucial, such as in climate control systems within a home. The relatively low uncertainty of \(\pm\)0.3 \({}^{\circ}\)C ensures that temperature readings are highly consistent, providing accurate data for managing heating, ventilation, and air conditioning (HVAC) systems. Additionally, NTC thermistors are cost-effective, durable, and widely available, making them a practical choice for this purpose. In this test, several important aspects were verified, further demonstrating the advantages of the proposed solution for the customer. Once this analysis was completed, both the MPC models and the planner were implemented, and a validation test was performed in the real environment for which data were collected during one month of spring. In order to discuss the validation of the thermal model, the results of the real test can be seen in Figure 30, which, for simplicity, illustrates the behavior of the energy consumption of the air conditioning system during one week of the month in which the test was performed. This analysis was carried out to evaluate the consistency between the theoretical consumption model and the actual measured values obtained from the real installation. Figure 30 shows a characteristic consumption pattern with daily peaks, reflecting the system's effort to reach the target temperatures during periods of higher thermal demand, such as mornings and evenings. Overall, there is an acceptable correlation between the theoretical and validation curves, suggesting that the theoretical model adequately captures the expected behavior of the HVAC system. The pink bars highlight certain discrepancies, which correspond to the difference between the predictions made by the proposed system and the measurements obtained in real operating conditions, where slight climatic fluctuations or changes in space occupation occur. Figure 31 shows the results obtained in the test during the whole month. Figure 31: Electrical consumption in the real environment. Figure 30: Correlation between theoretical and experimental data for a particular week. The blue curve represents the original consumption without considering the self-consumption system and batteries; the orange curve represents the consumption with the PV system and battery, but without optimization or implementation of the thermal battery; while the gray curve represents the final consumption after optimization and implementation of the thermal battery.