## 6 Implementation  
To evaluate the results of the proposed system, a mock-up consisting of a residential house, specifically a single-family home for two people, is proposed. Its location was established in downtown Madrid, since this is a location where it is interesting to achieve energy savings and reduce CO\({}_{2}\) emissions. The house has a single floor and a sloping cable roof. Appendix A includes a plan of the house, and Appendix B includes the parameters considered for the thermal model of the house. The parameters used in the thermal model have been obtained with CYPECAD MEP 2025.c [59]. CYPECAD MEP is a program for the design and sizing of the building envelope, layout, and facilities on a 3D model integrated with the different elements of the building. The program allows us to obtain the necessary parameters for the thermal model, based on the edges detected, depending on the construction solutions adopted and the description of the building from the point of view of thermal analysis (zoning, description of spaces, etc. ), according to the standards ANSI/ASHRAE/ACCA Standard 183-2007 [60], CEN/TR 12831 [61], or ISO 6946 [62]. The data for each enclosure include interior conditions, occupancy, illumination, ventilation established according to current regulations, and equipment or other loads. The program also includes libraries of enclosures, partition walls, floors, and roofs, as well as various types of windows. For the calculations in this paper, the design conditions considered are an operating temperature range inside the enclosures of 22 \({}^{\circ}\)C to 26 \({}^{\circ}\)C in summer and 18 \({}^{\circ}\)C to 23 \({}^{\circ}\)C  
Figure 2: Peak saving constraint. in winter, with a relative humidity of 50% maintained throughout both seasons for all air-conditioned rooms in the house. For sizing the photovoltaic system, the following factors were taken into account: the available roof surface area for installing solar panels, the absence of shading that could hinder proper radiation reception, the geographical location of the house, and the increased energy demand during winter for heating. Consequently, a photovoltaic setup with 14 solar panels of 450 W each was selected, providing a total peak power of 6.3 kW. Additionally, a 10 kWh electrical battery was included in the design. The developed system is designed for continuous operation. As previously mentioned, predictions are made with a seven-day horizon, as this represents the optimal balance: it provides the planner with enough foresight to improve accuracy and maximize energy savings, while avoiding unnecessary increases in computation time. This process uses data from prediction models for costs, house usage, atmospheric conditions, and other factors to generate hourly predictions for the entire week ahead. For the planner, the HVAC MPC provides power requirements as well. With these data, the optimizer provides the demand prediction and the battery usage planning with the abovementioned time frequency. The execution process has several steps and is schematically represented in Figure 3.  
First, the price prediction models, electrical consumption prediction (excluding HVAC consumption), and solar radiation are executed, providing results with an hourly frequency, and are considered constant during that hour. Parameters and values considered for the planner module are included in Appendix D.  
Second, the MPC model is run to obtain an accurate prediction of the HVAC consumption. This model is run by updating the inputs to the model (outdoor temperature, atmospheric conditions, etc.) and target temperature to be reached in each room once every hour and allows us to obtain the temperature of each room at each instant of time.