Photovoltaic Plant Optimization to Leverage Electric Self Consumption by Harnessing Building Thermal Mass

: The self-consumption without surplus to the grid is one of the aspects of the new Spanish law for prosumers. Increasing the share of renewable energy sources into the grid inherently leads to several constraints. The mismatch between the energy demand and the renewable energy production, which is intermittent in nature, is one of those challenges. Storage offers the possibility to decouple demand and supply, and therefore, it adds ﬂexibility to the electric system. This research evaluates expanding electricity self-consumption without surplus to the grid by harnessing thermal mass storage in the residential sector. The methodology is investigated by using a variable refrigerant ﬂow air conditioner system. Because there is no option to export the excess capacity to the grid, this research proposes an approach to proﬁting from this surplus energy by activating structural thermal mass, which is quantiﬁed from the information acquired using a building energy model. For this purpose, an EnergyPlus model of a ﬂat in Pamplona (Spain) was used. The optimization analysis was based on a set-point modulation control strategy. Results show that under adequate climatological circumstances, the proposed methodology can reduce the total electric energy from the grid between by 60–80%.


Introduction and Motivation of the Work
Renewable energy plays a critical role in the new decarbonization era. People all over the world are pressing governments to continue the promotion of investments in clean generation technologies. Among the most promising of these technologies are photovoltaic panels (PV), but the massive Feed-In-Tariff (FIT) of the past are gone. Their modification is related to the massive price reduction by thorough technological achievements in the PV market [1] and the substantial burden that these supporting schemes caused on the tariffs of electricity. New tools and ideas should be developed to make renewable energy more affordable by reducing the amount of consumed resources involved in their implementation. The management of renewable energy sources is receiving more attention and should be maximized. Furthermore, other concepts that are related to the main role of prosumers, such as demand response, are becoming more popular and following this direction. There is an increasing need for new technological solutions to realize new ideas regarding a grid with more potential to consume renewable energy sources (RES) [2].
There is a clear trend of solar PV making major contributions to the electricity supply. In many countries, the decline in the feed-in tariff has promoted self-consumption, and it will play an important role in the calculation of return on investment (ROI) of solar PV installation. Therefore, estimating and predicting self-consumption can help potential adopters make informed judgments about their potential ROI by reducing the amount of electricity that they import from the grid. Better evidence-based research on self-consumption will support changes in the behavior of consumers so that they make use of PV generation, and this change will have a positive effect on grid demand. This knowledge is also critical for policymakers to calculate the appropriate feed-in tariff rate to achieve PV deployment targets [25].
The revised renewable energy directive [26] and the new Spanish law on self-consumption [27] focused on the concept of renewable energy communities. The modulation of the heating power through optimized set-points make this methodology very appropriate for collective self-consumption. The highest potential of the methodology is deployed when the optimization is performed with day-ahead weather forecast. This way, each member of the self-consumption cluster will be able to adapt their consumption pattern to the available energy. This research is within the SABINA H2020 project [28], where a Power-to-Heat solution based on the storage capacity of thermal mass to assess the potential of buildings to modulate electric heating power provided by a HP, when surplus energy is available from a renewable source. Optimized set-points define control strategies to exploit the building's flexibility considering both energy and thermal comfort. For this purpose, renewable energy produced on-site is maximized to reduce the energy that is needed from the grid.
The control strategy for optimization is based on model predictive control (MPC) [29]. This type of control uses a building energy model (BEM) to estimate its control signals following an objective function in order to (i) improve its behavior, with a focus on many aspects, from storage to a demand response event [30]; (ii) reduce a building's energy peak power, which contributes to the reduced use of the energy grid in the peak hours; (iii) prepare the building for a peak load event; or (iv) simply optimize the building's energy consumption by adapting it to the system's tariffs (using the building's thermal inertia) [31].
In this paper, an approach is proposed that combines HPs with solar electricity production. For this application to take full advantage of the energy produced by PV panels, the thermal demand of the building should be concentrated in the hours of maximum solar radiation. The aim is to obtain the maximum coincidence between the building's energy demand curve and the photovoltaic production curve. To this end, the model prediction control process works against a model and can, therefore, offer the building's thermal inertia as an asset for storing energy. The results show that a certain level of thermal inertia plays a key role in the optimization capacity, reducing the energy consumption from the grid and increasing the penetration of renewable energy from the microgrid. Because thermal inertia, in contrast to batteries, is an infinite source, this solution is a step forward in making low-scale microgrids more sustainable. Microgrids provide flexibility to the grid, and thermal inertia provides flexibility to the microgrid. Therefore, the main innovation of the paper is the automatic control of the surplus renewable energy produced on site, by programming the optimal set-points based on weather forecast. This process could be implemented in the next generation of home energy management systems (HEMS). This paper is organized as follows. Section 2 explains the methodology, which includes the simulation and the optimization environment and the sources of data used for implementation in the BEM, such as weather, PV panels, heating system and construction components. Section 3 is dedicated to the analysis of the results. Section 4 presents the conclusion and discusses future works.

Building Energy Model (BEM)
This methodology uses detailed building energy models developed in OpenStudio [32] and EnergyPlus [33]. In particular, EnergyPlus is a whole building energy simulation program that enables obtaining the energy consumption (heating, cooling) taking into account many aspects, including the thermal mass. It is an appropriate simulation software since the purpose of this MPC application is to benefit from the thermal storage building's capacity and use it as a thermal battery, therefore the BEM must represent complex phenomena as building's thermal inertia [34], and for this reason detailed energy models are used. As is highlighted by Corbin et al. [35] "While many examples of model predictive control (MPC) use simplified building models exist in the literature, the use of a complex simulation model allows phenomena not easily captured in simplified models to be studied". The detailed energy models provide a reliable basis for this kind of application, as they take into account the building's physical aspects, its operational schemes and the weather conditions in a dynamic way.
For the application of this procedure, the BEM used in the optimization must be a calibrated energy model that accurately represents the building's energy performance. Several authors of previous research described the calibration process for detailed energy models [36][37][38][39][40]. In this case, the model is synthetic, which means that it is assumed to fit perfectly to the real building. The use of synthetic models for exploring a new methodology is recommended by ASHRAE [41]. In addition, real weather data are used instead of forecast weather data because the purpose of this study is to show the maximum potential of using the thermal mass of a building as thermal storage. Analysis of the impact of introducing real weather forecast errors should be carried out as a complementary study.
The optimization was applied for an individual dwelling of 98.1 m 2 that is part of a block of apartments in Pamplona, Spain. The building has three facades facing southeast, southwest, and northwest. The northeast wall is a party wall with the adjacent dwelling (see Figure 1). Table 1 shows the construction features of the model, and Figure 2 where each construction component is used in the BEM. The technical data (ventilation, occupation and operational schedules, values of the construction components) are taken from the Spanish Regulation Technical Building Code [42]. For the evaluation of the thermal mass as an overall value, a script in EnergyPlus runtime Language (Erl) was made to sum up the thermal storage of all the construction components.  Table 1.

Heating System
The HVAC system of the dwelling was simulated as a variable refrigerant flow (VRF) system. It is an off-the-shelf EnergyPlus component. A VRF system varies the refrigerant flow using variable speed compressor and electronic expansion valves. Among the two alternative models available in EnergyPlus, in this paper the System Curve Based Model was chosen. EnergyPlus provides several performance curves to describe system operation, and detail information can be checked at the EnergyPlus Engineering Reference book [43]. The terminal units operate to satisfy the heating load (only the winter case is implemented) in the conditioned thermal zones on the basis of the zone thermostat temperature set-point. In this case study, a unique thermostat is considered for all thermal zones. A schema of the main components for one single zone is shown in Figure 3. Table 2 shows the main characteristics of the VRF system.

Electric Building System
The building electric power service was simulated. These objects are required when on site generators produce electricity within the facility, for example solar photovoltaics panels. The PV panels are configured only to provide electric energy to the HVAC system. Therefore, the HVAC system is connected with both the PV panels and the grid working in parallel and they are summed in order to supply the total electrical energy demanded by the HVAC system (see Figure 4). For this case study, the PV panels are simulated directly in the EnergyPlus model as an object (Generator:Photovoltaic). The simple PV model object used (PhotovoltaicPerformance:Simple) since the purpose of these research is not the detailed simulation of the photovoltaic installation. This model is intended to be useful for design purposes to quickly get an idea of the levels PV production and peak power. The Figure  1 shows the building energy model where can be seen the surface of the PV installation on the roof (purple square). In this case study, the southeast roof was selected, which has an inclination of 20°, and is covered with 28 m 2 of PV panels facing 27°south with a cell efficiency of 15%. The system consists of sixteenth photovoltaic solar panels connected in parallel, each with a 240 W peak power output and a total output of 4000 W. In Table 3 main production results from the PV plant are shown. In the same way Figure 5 shows the hourly PV production for the days of study.    7 8 9 10 11 12 13 14 15 16 17 18 19 7 8 9 10 11 12 13 14 15 16 17 18 19 7 8 9 10 11 12 13 14 15 16 17 18 19 7 8 9 10 11 12 13 14 15 16 17 18 19 7 8 9 10 11 12 13 14 15 16 17 18 19 7 8 9 10 11 12 13 14 15 16 17 18

Weather Data
The external weather file used in this investigation contained real data for the year 2017 gathered by two nearby weather stations: one is located in the School of Architecture of the Universidad de Navarra, which is 2 km away, and provides outdoor temperature (°C), wind direction (°), wind speed (m/s), and relative humidity (%); the other parameters are provided by a weather station belonging to the Navarra Government that is located 3 km away from the study test site, and it provides global solar radiation (W/m 2 ), diffuse solar radiation (W/m 2 ), rainfall (L/m 2 ), and atmospheric pressure (mbar). Figure 6 shows the main weather parameters related to the days of study and to the PV production shown in Figure 5. With that information a specific *.epw file was created to perform the simulations for the different scenarios. The direct global radiation is calculated by the program as it is explained in the EnergyPlus documentation [44].   In this case, MPC will be used to obtain an optimal set of HVAC temperature set-points for the following hours with the objective of optimizing a PV system installation. The MPC methodology used in this study is described in a previous paper from the authors [45] and it is focused mainly on two aspects: the use of detailed Building Energy Models (BEM) as the best method to obtain building information (energy consumption, thermal zone temperatures, etc.), which will be used later as an objective function; and the reduction of the search space that allows the use of genetic algorithms to optimize these objectives so that the results can be obtained in a reasonable time. The following paragraphs explain the application of this MPC methodology for the purpose of this study.

Model Predictive Control (MPC) Strategy
The software used to perform the optimization is JEplus+EA [46], which couples a genetic algorithm with EnergyPlus software. This software has a user-friendly interface that makes the optimization process very easy for non-experts. The algorithm is the non-dominated sorting genetic algorithm II (NSGA-II) [47], which is commonly used to perform optimizations [48]. When using this type of algorithm, it is necessary to have control of the search space because if it is too large, finding good solutions is closely related to the simulation time. For MPC optimization problems, in which time is a decisive factor, it is necessary to control this search space. In this optimization methodology, the search space of the problem is adjusted by using HVAC temperature set-points as discrete decision variables (in steps of 0.5°C) subject to lower and upper boundaries, optimizing the set-points only when the photovoltaic panels are producing electric energy and splitting this period into 1-hour blocks (see Figure 8). The search space is 11 7 , which allows good results to be obtained with a genetic algorithm configuration of 125 generations of 16 individuals.
The other key factor for any optimization problem is the definition of a suitable objective function to guide the algorithm in the optimization process. The objective function used is the reduction in electric energy from the grid. It is composed of HVAC electric consumption minus PV production. When PV production is greater than HVAC electric consumption, the goal is achieved. This is a direct output of the program, and therefore, it is very simple to implement because there is no need for any external computation. The algebraic relation of all the components can be seen in Figure 4. Only the hours with PV production were part of the optimization, so only the HVAC temperature set-points related to this PV production period were used as the control variables. This period was divided into blocks of 1 h because for HVAC systems' slow-moving processes (such as air temperature), hourly data is enough [49]. For a day of the study, the optimization time was formed by 7 samples (from 09:00 to 17:00). The evaluation of the objective functions accounted for 15 h (from 09:00 to 23:00). The search space was also defined by the degree-granularity of the temperature set-points. Half a degree was selected for each value within the optimization time. The search space was 11 7 (1.94 × 10 7 ) simulations, so it was not feasible to perform them by computing all the possibilities.

Evaluation Criteria
The optimization was carried out during the months of November and December. Four optimizable days (19 and 20 November and 4 and 5 December) were chosen using the criteria of a medium or high heating energy demand (between 4 and 7 kWh per day) and good PV production (between 10 and 15 kWh per day), and two not optimizable days (16 and 17 December) with high heating energy demand (more than 10 kWh) and low PV production (around 5 kWh) were selected. These choices were made to show the depth of the relationship between this optimization process and PV production. The optimization period in each day is 09:00-17:00. Figures 9 and 10 show 18 days in November and 13 days in December that could have been used in this research since they had similar weather conditions.

Analysis of Results
A general overview of the results produced by SC2 and SC3 is shown in Figure 11. When surplus energy from PV is available, the optimization process transform it into extra building energy demand and after sunset this extra energy consumption return to the building to reduce building energy needs. In Figure 12 the set of variable set-points between 20 and 25°C to generate the modulation of the energy available, are shown.
In the following figures a day to day analysis is going to be performed in order to quantify the results of the optimization conducted in this study.  6 8 10 12 14 16 18 20 22 0 2 4 6 8 10 12 14 16 18 20 22 0 2 4 6 8 10 12 14 16 18 20 22 0 2 4 6 8 10 12 14 16 18 20 22 0 2 4 6 8 10 12 14 16 18 20 22 0 2 4 6 8 10 12 14 16 18  In Figure 13, the optimization process carried out for 5 December is shown in detail to understand its function. The gray and yellow graph shows the thermal mass storage after and before (base case) optimization. The negative sign means that the structure is being charged with energy from the HVAC system, and the positive sign indicates that energy is delivered to the indoor environment. To have a surplus charge, SC3 (blue graph) consumes more energy than SC2 (orange graph) from the available PV production. As a result of this extra energy consumption (5.17 kWh), after 16:00, the thermal structure of the optimized case (gray graph) returns energy to the indoor environment (4.15 kWh, positive sign), causing a reduction in grid energy consumption of 1.85 kWh. On the other hand, the base case (SC2) continues to consume energy from the environment, and no savings are realized. Figure 14, which shows the performance for 17 December, demonstrates the result of having no extra PV production (0.2 kWh) to be optimized. SC2 almost achieves the maximum storage capacity, and the optimization process can only slightly increase the PV energy used, but it is not enough to realize an energy profit, and there is no release of energy after sunset. In this example, the optimization process does not work. The same happens on 16 December. Appendix A summarizes the results of all the data from the simulations and the graphs for the other days analyzed.    After the detailed analysis of a complete day in a good and bad case to represent similar occurrences on the other days, a more generalized result can be shown. In Figure 15, the effects of the different scenarios are compared for each selected day. Gray indicates the events in SC1, orange represents SC2, and blue represents SC3. As explained previously, two days (16 and 17 December) that lack adequate PV production were selected to demonstrate the consistency of the process. If PV production is low, then energy savings are not possible, so optimization does not need to be implemented on those days. When the weather conditions are appropriate, the energy savings from the main grid range from 82% to 75% for the selected days in SC3, which is an average increase of 30% compared with SC2. Figure 16 shows a similar analysis, but in this case, the evaluation period for savings is from 17:00 to 23:00. The goal of this analysis is to check the performance of the optimization after sunset. The power of the process is clearer in this example because SC2 is not able to produce any extra profit. The reason is that the thermal mass activation is not sufficient, and the results are similar to those of SC1. These results are very important because they show the potential of the system to shift power from peak hours when energy from the grid is more expensive. The results range from 86% to 54%, which is quite remarkable.  Figure 16. Electric energy consumption from the grid from 16:00 to 23:00 (peak hours). In gray consumption without solar contribution (SC1). In orange consumption with solar contribution (SC2). In blue consumption with solar contribution and optimization (SC3). The percentage is the reduction compared to the gray bar. Figure 17 shows the evaluation of each day to compare the relation between energy storage in the thermal mass and the amount of extra energy needed to produce it. The difference in the energy used comes from using more energy from PV in the case of SC3. The thermal storage in the figure is the difference between the thermal storage of SC2 and the thermal storage of SC3, and it represents the increase in thermal storage due to the optimization. The maximum amount of thermal energy storage is about 13 kWh, which is achieved by expending around 4.5 kWh of electric energy. Therefore, the average ratio between energy storage and the extra PV used is around 2.8 kWh. In the days with low solar radiation, there is no difference between the two scenarios (SC2 and SC3) because no extra energy is available. It is noteworthy that similar values of extra PV consumption (around 4.5 kWh) produce a similar amount of thermal storage in the building (around 13 kWh) and savings, which range from 1.5 to 1.83 kWh. No more energy can be used despite having extra PV energy production, which is related to the maximum set-point allowed, 25°C.   Figure 17. In gray: PV used by SC3 and in yellow PV used by SC2. In orange: PV production for each day. In blue: storage difference between base and optimize case. The percentage is reffered to orange (PV production for each day).
In addition to the better energy results, the optimized scenario (SC3) improves the comfort levels inside the dwelling [50]. Figure 18 shows the predicted mean vote (PMV) [51] for the period of optimization that corresponds to the period involving PV production considering 1 clo of clothing insulation (a winter business suit [41]). "The PMV index predicts the mean response of a large group of people according to the ASHRAE thermal sensation scale" [41]. This is a numeric scale in which each value represents the thermal sensation, and it ranges from −3 (cold) to +3 (hot). The comfort zone usually varies from −1 (slightly cool) to +1 (slightly warm), and 0 (neutral) is the perfect condition. In general, the usual values for winter and summer for energy savings are −1 and +1, respectively. As can be seen in Figure 18, for 19 and 20 November and 4 and 5 December, the optimized model (SC3) reverses the number of hours in which the building temperature is slightly cool, increasing the number of hours of neutral temperature (perfect comfort zone). This is because of the increasing set-point temperature after the optimization. In contrast, for the 13 and 14 December, since there is little possibility of optimization, the values are basically the same.

Conclusions and Future Work
This paper presents a case study to demonstrate the optimization of a building's energy storage capacity (SC3) for a group of selected days in winter. The results show that dependence on energy from the grid can be reduced in SC3 by 45%-65% compared with SC2 and 70%-80% compared with SC1. The methodology consists of applying an optimization process to obtain a set of HVAC temperature set-points (between 20 and 25°C) for the hours of HVAC operation when renewable energy produced by PV in situ is available. The objective is to increase the in situ renewable energy penetration, which increases in the range of 29%-43% when comparing SC3 with SC2. Similarly, there is an energy reduction of 55%-85% in the peak hours from 16:00 to 23:00. This last result shows that this is an excellent methodology for demand response programs. Despite an increase in indoor air temperature depending on the availability of PV production, the building's indoor comfort is not affected. This research quantified the amount of energy that is transferred from PV to the building thermal mass, and the result is 1-2.8 kWh. A special script for the quantification of the thermal mass was developed in order to sum the building's thermal heat storage of all the massive components. Good weather conditions are necessary (solar peak radiation of around 900 W/m 2 and mean outdoor temperature of 5°C) to achieve this goal. The methodology cannot be applied every day, as observed on 16 and 17 December when the optimization (SC3) is not producing significant results compared with the base case (SC1).
One of the main problems of this methodology is the computation time (2.5 h for each day), and alternative means of optimization should be considered in the future: different algorithms, different types of models, or different computation strategies. A comprehensive analysis of more days or even several years is desirable to gain a broader view of the potential of the methodology.
Real test case scenarios should be checked with calibrated energy models. The SABINA H2020 EU project with three real test sites (a school in Denmark and two office buildings in Greece) and a laboratory site in Spain are perfect environments for understanding the potential of the technology.
In the optimization processes, forecast data are necessary for the evaluation. This study used perfect weather data and renewable energy production. Future works may investigate the impact of errors in the weather forecast on the optimization results in order to maximize the profit of the methodology. Additionally, the same study should be considered for a summer case to determine which scenario realizes savings.

Abbreviations
The following abbreviations are used in this manuscript: The model without any renewable energy SC2

BMS
The model with the renewable energy consumption but with a fixed set-point of 20 SC3 The optimized model with variable set-points

Appendix A. Summary of Results
A summary of the main results of the optimization are in Tables A1 and A2.  Figure A1. Daily performance of 19th November.    Figure A4. Daily performance of 16th December.