A demand side management approach to increase self-consumption in buildings

There is a growing interest in increasing the presence of renewable energy in the electric network. Photovoltaic production from grid-connected systems is leading this growth in terms of households. Alongside this development, concern about network security has emerged, because excesses of intermittent renewable energy on the grid could exceed voltage limits. Self-consumption, understood as the capacity of the producer to consume his or her own production, can partially solve these problems. Thermostatic controllable loads, such as heating and cooling, represent 50% of the total amount of energy consumed by buildings; the proper allocation of these loads could be a driving force for self-consumption. In this study, a demand side management strategy is proposed based on a building energy model equipped with an inverter heat pump coupled with a photovoltaic plant. The goal is to maximize the use of local energy from the photovoltaic plant (self-consumption), reducing the export and import of energy to and from the grid. This goal is achieved by optimizing the set-points in each room. An array of optimal set-points over six years is presented. The results show the capacity of the methodology to match similar values of self-consumption (70% in winter and 50% in summer) obtained by strategies based on chemical batteries. The findings are shown in an energy matching chart at different levels of detail (yearly and monthly). Color bubbles are added to the matching chart to help visualize the unmatched energy of the system graphically. In comparison with actual model predictive control technologies, this study’s strategy offers great simplicity and a large saving in computational time.


Introduction
The European Union (EU) is moving away from fossil fuels, with a strong commitment to reduce greenhouse gas emissions. In May 2019, the EU Council and EU Parliament signed the Clean Energy for all Europeans package (European Commission and Directorate-General for Energy 2019). This document is a step forward in implementing the EU energy strategy. The package includes eight new laws aiming to support the EU's long-term energy strategy and the EU's leadership in achieving carbon neutrality by 2050. Among the main elements of the document, we highlight the energy performance of buildings and renewable energy. This paper focuses on these two concepts to craft a specific proposal for both together.

Background and motivation
Buildings play a double role in the electric energy market: they can be energy consumers and, simultaneously, energy producers by hosting renewable energy facilities. Furthermore, the grid faces the major challenge of integrating renewable energy because of its intermittent character. Matching local renewable energy production with building energy demand is an urgent task to reach the EU target of 32% for renewable energy sources in the EU energy mix by 2030.
The EU's on the Energy Performance of Buildings Directive (EPBD) states that, in 2020, all new buildings should be nearly zero energy buildings (nZEB) (European Parliament, Council of the European Union 2010). The net zero energy building (NZEB) concept can be defined as a BUILD SIMUL (2023) (Pless and Torcellini 2010). This scenario increases the market interest in electric heating and cooling technologies such as heat pumps (HPs). Under the assumption that increasing building electrification will make the grid greener, heat pump technologies can be considered a strategic option (Battaglia et al. 2017). Heat pumps have a great potential for shifting electrical loads, and they can offer different control strategies for load matching. The electricity consumed by an HP can be considered through the "thermostatic control loads" (TCL), which can offer opportunities to stabilize the intermittent nature of renewable energy in grid applications, such as demand response (DR) (Gasca et al. 2022). Simultaneously, photovoltaic (PV) technology is growing, and prices are lowering, as has been recently published (Kost et al. 2021). Therefore, a combination of an HP and PV can be considered a viable solution in NZEB applications (Fischer and Madani 2017). Many countries have decided to link their energy future to the sun. That means that the consumption of energy from the sun has to be properly allocated at the lowest possible cost in buildings. One way of achieving this is by increasing self-consumption of local energy production (Luthander et al. 2015). The NZEB concept uses the grid as storage, but the grid has limitations, and many countries such as Germany, Italy, and Spain have started to promote self-consumption as the primary solution to avoid an excess of energy overloading the grid, therefore, new strategies and solutions should be provided in the near future (Widén et al. 2009;Widén 2014).

Self-consumption in Spain
In Spain, new legislation, based on a Royal Decree (RD, 2019) (Ministerio para la transición ecológica 2019), introduced a simplified net-metering mechanism for consumer billing. This procedure is consistent with the guidelines of the European Commission in reference to PV self-consumption. The self-consumption options considered in the Spanish legislation can be summarized as follows:  Self-consumption with energy surplus (this option is for a PV generation plant up to 100 kW). Production can cover energy for self-consumption and deliver the excess to the grid. This excess energy will be compensated for at the end of the billing period (one month), but the energy section of the invoice can not be negative; this excess will be sold at the average hourly price, which is lower than the buying cost. For small consumers (precio voluntario del pequeño consumidor, PVPC), the excess is valued at the average hourly price.  Self-consumption without energy surplus. This option is when production is only consumed in the dwelling, and the excess is not sent to the grid. In this case, an anti-spill system has to be installed. Under this schema there are two options for self-consumption. One achieves similar savings for self-consumption to those achieved by selling the energy to the grid. This strategy normally is a winter strategy, where PV production is quite low, and the energy demand from the grid is quite high. With the actual prices, selling and buying have a similar price and, therefore, increasing revenues from self-consumption beyond normal operation is not an easy task. The second strategy is for summer, where PV production is higher than energy demand; therefore, as the net metering cannot be negative, selling excess on the basis of a certain quantity does not produce any revenue. Both strategies are going to be tested in this paper.

The concept: demand side management
There are two main strategies for increasing self-consumption in residential buildings, namely, demand side management (DSM) and energy storage based on batteries. The latter is attracting growing academic interest because of the impact of charging electric vehicles on the residential electric networks (Raghavan and Khaligh 2012); however, for specific battery applications in households, the prices are high, and the market is still waiting for a new generation of affordable batteries (Saviuc et al. 2019). The first approach is more feasible, and it has been subjected to specific algorithms and techniques (Strbac 2008).
DSM aims to modify the consumption profile; it refers to actions directed to optimize a site's energy consumption and to reduce expenses. It is an instrument to limit the impacts of a high surge of renewable sources onto the grid. The measures can, consequently, balance energy consumption and the amount of energy fed into the grid. In return for payment, DSM can offer "grid services" and, therefore, reduce the operational cost of the electrical system (Jensen et al. 2017). DSM can be classified into two main groups: rule-based control (RB) and model predictive control (MPC). RB works by using algorithms that operate depending on certain system parameters (Coffey 2012). MPC requires more advanced algorithms based on forecast models for weather . The latter can be computationally costly, and the parameters have to be carefully selected in order to avoid intractable problems (May-Ostendorp et al. 2011).
The use of demand side management strategies in order to increase self-consumption has been the subject of previous studies: Munkhammar and Widén (2012) concluded that a scenario involving end-user flexibility only increase the solar fraction by a few percent. Also, Widén (2014) analyzed the impact that scheduling some programmable appliances has in the PV self-consumption, but the strategy had an overall low potential. Zong et al. (2012) improved the PV self-consumption through a MPC strategy based on the power price and the weather forecast. In Vanhoudt et al. (2014), the authors analyzed the potential of an active heat pump for demand response purposes, in order to reduce the peak power demands and to increase the self-consumption of the PV panel or the residential wind turbine. Similarly, in Thygesen and Karlsson (2016) a weather forecast controller was used in a ground source heat pump, but the increase in SC was limited.
The combination of DSM and battery storage has been also studied. In Castillo-Cagigal (2010, 2011) a test was performed on a prototype of a self-sufficient solar house with PV panels, battery storage, controllable appliances and smart metering. The results shown that the relation between the electricity flows and storage capacity is not linear. In Widén and Munkhammar (2013), the behaviour of this combination in Swedish detached single-family houses was analyzed; and Vrettos et al. (2013) the increase of PV self-consumption through the use of small-scale batteries and flexible thermal loads. In Masa-Bote et al. (2014) the authors concluded that DSM strategies and local storage can drastically reduce the uncertainty associated to the forecast of photovoltaic generation.
The demand side management methodology exploits alternative storage to batteries; the main options can be grouped into building thermal mass activation and hot water tanks. Many studies have considered hot water tank storage as a viable solution (Dar et al. 2014;Bee et al. 2018), but it requires an extra investment and space for the tank; in addition, it is not applicable to all the heating and cooling heat pump options. In the Mediterranean area, an inverter heat pump or a variable refrigerant flow inverter (VRF) is frequently used as a cost-effective solution (Nizetic et al. 2014;Aguilar et al. 2017;Nižetić et al. 2017), but these are not compatible with a storage tank. In addition, thermal mass activation is a cost-effective solution but relies on effective algorithms for MPC. The impact of this technique has been broadly studied (Reynders et al. 2013;Le Dréau and Heiselberg 2016); however, MPC can be computationally unfeasible.
This study is based on a building energy model (BEM), under the assumption of perfect knowledge of energy consumption, PV production, and the weather forecast. In a real test case, the energy consumption should be corrected by the use of calibrated energy models. Previous works by some of the authors have been developed to establish the error of the BEM, through uncertainty studies (Ramos Ruiz et al. 2017aRuiz et al. , 2017bGutiérrez González et al. 2019). Specific calibration techniques for building envelope calibration can be consulted in references (Ramos Ruiz et al. 2016;Fernández Bandera and Ramos Ruiz 2017;Gutiérrez González et al. 2020) and for heating ventilation and air conditioning systems (HVAC systems) in references (Pachano and Fernández Bandera 2021;Pachano et al. 2022). The error for the weather has been evaluated in the following studies (Lucas Segarra et al. 2020b;Gutiérrez González et al. 2021) and for the weather forecast in references , 2020a.
The use of models to find the optimal thermal curve for each zone is a similar approach to MPC, but in this case the model is more detailed; therefore, more parameters can be controlled. In the case of MPC, simplified models (Neural Network) are normally used. These models find solutions quickly, but sometimes they lack accuracy, because they fail to represent the building's thermal behavior.

Contribution and originality of the research
In this paper, we describe an RB technique based on a building energy model developed in EnergyPlus, which was used to produce a set of optimal set-points curves for each thermal zone at each ten-minute time-step. The solutions were tested in different years and different seasons in order to evaluate the quality of the results.
The main problem of the EnergyPlus model is related to slowness in execution and the difficulties to embed the software into a smart controller, which deterred these results to be implemented in a home management system (HMS) to override fixed set-points. The use of a surrogate model is an alternative to solve these difficulties. These models can be trained by using the information provided in this study to generate faster control strategies. As an example May-Ostendorp (2012)  Previous research has shown that PV systems with battery storage had a higher improvement in self-consumption and self-sufficiency than DSM. With a DSM strategy, the increase in the rate of self-consumption is between 2% and 15%. However, with a battery storage capacity of 0.5-1 kWh per installed kW of PV power, it is possible to increase the relative self-consumption by 13%-24% (Luthander et al. 2015(Luthander et al. , 2019. This work is innovative, since the findings of the proposed technique increase the capacity for self-consumption 20% over the base case scenario. In other words, the results are in a similar range to previous works based on chemical batteries, which can be considered remarkable (Femia et al. 2013;Luthander et al. 2015Luthander et al. , 2019Psimopoulos et al. 2016). In addition, the grid consumption is reduced by 8% for winter and 30% for summer.
The result offers two approaches, one for the winter case, where the model optimizes the solution without over-consumption, because PV production is scarce, and a summer case where over-consumption is viable because of the excess of PV production, which under Spanish law can be dispatched but not sold to the grid. In both cases, the proposed solution is profitable despite the high prices of actual electric energy. The results are presented in an original manner based on an energy matching chart developed by Luthander et al. (2019), where matching bubbles have been added to increase the information related to unmatched energy.

Methodology
In this paper, the surplus of PV production is used for the activation of thermal mass. The set-points vary between 20 °C and 23 °C, and the reference case is 21 °C according to the Spanish thermal code. This study considers the application of an RB strategy based on a BEM with the goal of maximizing the self-consumption of PV energy in a flat located in Pamplona. The EnergyPlus model is composed of a rooftop PV system of 4 kWp coupled with a variable refrigerant flow (VRF) inverter with 2.7 kW of nominal power, which provide heating and cooling to the flat (see Figure 1). The goal is to match the instantaneous PV production (P) with the flat's energy demand (L). The thermal mass of the building is used to store the PV power surplus by modulating the set-point of each thermal zone of the flat. The study was carried out separately in winter and summer, because in mild seasons with low energy demand, the base case scenario worked properly. The

Weather data
According to the Köppen classification, Pamplona is Cfb and can be considered an oceanic climate. Precipitation does not vary significantly over the year. The sunshine hours are similar to oceanic coastal climates such as the nearby Basque locations, rather than the typical Mediterranean areas. On the other hand, the rainfall is significantly lower than the coastal Basque locations. Because of its altitude of 450 meters and its inland location, the climate is harsher than in coastal areas with colder winters and warmer summers. Table 1 summarizes the main weather data obtained from a TMY file of Pamplona, based on the last five years.

Variable refrigerant flow and photovoltaic model description
The photovoltaic model is the object of the EnergyPlus PhotovoltaicPerformance:Simple; it is described in the software documentation. It is the more simplified model. In this model, the user has direct access to the efficiency with which surfaces convert incident solar radiation to electricity and need not specify arrays of specific modules; in this study, cell efficiency was fixed to 0.15. The surface area of the PV panels installed was 12 m 2 with the orientation of 154° facing south. The panels were roof integrated with an inclination of 34° and were also connected to a generator object that estimated the rated electric power output, which means that the actual power output for each time-step was determined by the generator component. The generator had a rated electric power output of 3900 W and the inverter efficiency was 0.9. The VRF HP computer model provided by EnergyPlus was used; the object is called AirConditioner:VariableRefrigerantFlow. The first VRF HP model was implemented in EnergyPlus V7.0 in December 2011 and was fully explained in Raustad (2013). Next, it was verified by using the manufacturer's performance data in Nigusse and Raustad (2013). This model type cannot be used simultaneously for cooling and heating and is controlled by each zone's thermostats. The model allows multiple indoor fancoil units (FCU) to be connected to a single outdoor unit through refrigerant lines. The refrigerant flow is controlled using a variable speed compressor and an electronic expansion valve installed for each indoor unit. The whole connection of the system is represented in Figure 1.
The model relies on empirical equations to define performance. It uses biquadratic performance curves to illustrate the capacity and the energy input ratio (EIR) as a function of the indoor and outdoor air temperatures and the part-load ratio (PLR) for part-load performance. The following equations are used to represent the performance curves: where: CAPFT = the biquadratic or cubic capacity modifying curve as a function of temperature (-); EIRFT = the biquadratic EIR modifying curves as a function of temperature (-); PFPLR = the electric power modifying curve as a function of PLR (-); PLR = the heating or cooling part-load ratio (-); ID T = the average of indoor coils entering air dry bulb (heating) or wet bulb (cooling) temperature (°C); OD T = the average of outdoor coils entering air dry bulb (cooling) or wet bulb (heating) temperature (°C); a 1 , ..., a 6 = the numerical coefficients; BoundaryTFT = the boundary equation to divide high and low temperature regions. The variation in performance with outdoor entering air temperature would be difficult to calculate using a single curve, because there are two distinct temperature regions (high and low). Therefore, the VRF computer model has two curves and automatically determines which curve should be used based on the boundary curve equation.
The EnergyPlus Output is the capacity and electric power variable of the EnergyPlus model at full load, normalized by using the equations for the combinations of indoor and outdoor air temperatures.
In Tables C.5, C.6 and D.7, which can be found in Appendix C and Appendix D, the coefficients for Eqs. (1), (2), and (3) are provided for the outdoor unit and the FCU. These data have been taken from the VRF model of EnergyPlus V9.0.1, when compared with previous versions, slightly different values of coefficients were observed. These coefficients were exported for use in a spreadsheet to depict the performance curves of each equation in Figures 2 and Fig. 2 Heating and cooling energy input modifiers as functions of low temperature (above) and high temperature (center), respectively; the boundary between indoor and outdoor temperatures for heating and cooling (below) at low and high temperature, at full heating and cooling load, the PLR (Figure 4), and the heating and cooling capacity modifiers of FCU models ( Figure 5). A summary of the system performance data of the VRF HP model is shown in Table 2.

Control strategy
The process for obtaining the optimal set-points curves is described in Figure 6. In order to distribute the excess of energy in the different zones, an annual simulation is performed with the base case at fixed thermostat of 21 °C. This simulation provides the demand distribution of energy room by room. This configuration is adjusted to winter and Fig. 4 The electric power modifying curve as a function of the part-load ratio at high and low temperatures for heating and cooling, which presents approximately the same values  Heating and cooling capacity modifiers as functions of low temperature (above) and high temperature (center), respectively; the boundary between indoor and outdoor temperatures for heating and cooling (below) summer seasons. The information is used for the distribution of energy in the algorithm. In addition, the COP for each time-step was collected from the BEM operation.
In the second step, the files with the previous data were used to compute the set-points. The subroutine for the optimal temperature was executed in EnergyPlus Runtime Language (Erl) when the energy available was higher than the energy required by the model in the base case scenario; when the energy available was lower, the standard set-points were applied. The algorithm introduced the excess of energy into the different thermal zones according to the criteria of distribution calculated in the previous step. It was distributed into each thermal zone using an object of EnergyPlus called OtherEquipment, which allows distribution of sensible heating or cooling in a thermal zone without the need for an HVAC system. In this stage, the VRF system was OFF. Finally, if the energy introduced produced overheating or overcooling, the algorithm overrode those values with the minimum (20 °C)/maximum (23 °C) set-points.
In the third step, the VRF was ON. The objective was to verify that the set-point curves produced in the previous step had the intended effect. To verify if the methodology is working the five following criteria should be fulfilled:  The energy consumed from the PV should be higher in the optimized case. The DSM strategy aims to use the excess of energy produced by the PV through set-point modulation (between 20 °C and 23 °C), and, therefore, reduce the energy dispatched to the grid.  The energy from the grid should be lower, due to the increase in energy consumed from the PV production.  Self-sufficiency should be higher, as the strategy aims to maximize the ratio between the instantaneous energy use and the total energy consumed by the building.  Self-consumption should be higher, because the methodology maximize the instantaneous PV energy use from the instantaneous PV production. The results were checked for five different years with similar findings. The main goal was to obtain more points in the middle of the band (20-23 °C), trying to avoid the maximum and minimum. That would be a clear sign that the methodology was working.

Grid indicators
Grid indicators are defined in the literature; they quantify the impact of production and consumption on the grid (Salom et al. 2011). Similarly, load matching indicators (Lund et al. 2011) and cover factors are defined in Verbruggen and Driesen (2014). These indicators measure the mismatch between local electricity demand and supply. In this paper, two main indicators are used: first, self-consumption, which can be defined as the ratio between the PV used locally and the total PV production, and second, self-sufficiency, which is the ratio between the PV used locally and the total energy consumed by the building. These factors are represented by the following equations.
where: P(t) = instantaneous on site PV generation; L(t) = instantaneous building power consumption; M(t) = instantaneous overlapping of generation and load profile; M(t) = min{L(t), P(t)}; g sc = self-consumption; and g ss = self-sufficiency.

Self-consumption evaluation: the matching chart
The matching chart was developed by Luthander et al.
(2019) as a graphical visualization of self-consumption and self-sufficiency in buildings. Figure 7 shows the concept of this chart. In this paper, extra information was added to the chart in the form of color bubbles, which can improve understanding of the meaning of each position within the chart. The parameters shown in the chart are related to each other according to the following equation: The main elements of the diagram are as follows:  Red dotted lines. According to Eq. (8), they represent the relation P/L. The intercept with the extremes shows the maximum self-consumption when P/L > 1 (33% in Eq. (8)), or the maximum self-sufficiency when P/L < 1 (33% in Eq. (8)). Another important feature introduced by Luthander et al. (2019) is that a system does not move from the line without substantially changing the size of P or L.  Green dotted line. This line divides the space between net consumers (below) and net producers (above). It represents the space for the NZEB buildings, where P/L = 1. The points of the extremes are important, because in the upper corner there is a perfect match, while in the lower corner there is not a match between consumption and production.  Color bubbles. In the first place, the size of the bubble is related to L; in Figure 7, different sizes are shown as examples. In reference to the concentric circles of the bubbles, the ratio between the radius is 2 , which means that the two areas inside the circle (the inside circle and the ring) are equal. The blue refers to the PV production; it is located in the inside circle when P/L > 1 (net producers) and in the ring when P/L < 1 (net consumers). The yellow refers to the building energy load and its behavior is opposite to the blue. Green represents matching and is always in the inside circle.

Why color bubbles?
In Luthander et al.'s (2019) study the bubbles were presented with different sizes depending on L; however, in order to explain the main numbers of the matching chart, extra information was originally provided with triangles. However, triangles could not be introduced on the chart; therefore, color bubbles are the evolution of triangles to be represented on the matching chart. The main limitation is the size, which means that it is not possible for many bubbles be represented in the same area of the chart, and an auxiliary table has to be provided.

What is the extra information from the color bubbles?
Let us review the different bubbles in Figure 7. A net producer bubble is represented on the upper side of the chart, over the red dotted NZEB line. In this bubble, the blue (representing P) is in the inside circle. The green area is a percentage of the circle and is on the self-consumption axis (in our case 25%). The intercept with the 100% self-sufficiency line gives us the P/L relation. This information can be provided by a regular matching chart. For further information, calculus must be performed with Eq. (8). The color bubble offers us the amount of energy load that does not match with P, which is represented by yellow on the ring. In this case, it is the difference (8%) between 33%, which is the maximum self-consumption at the end of the red dotted line, and 25%, which is the actual self-consumption of this net producer bubble. The net consumer bubble is represented on the lower side of the chart. In this bubble, the yellow (representing L) is in the inside circle. The green area is a percentage of the circle, and it is on the self-sufficiency axis (in our case 25%). The intercept with the 100% self-consumption line gives us the P/L relation (33%). The bubble offers the amount of P that cannot be matched with L (8%).

Analysis of the results
The BEM was simulated for six different years from 2013 to 2018 with actual weather data collected from a nearby meteorological station for four months of winter (January, February, November, and December) and four months of summer (June, July, August, and September). The reason for this is that the methodology needs a reasonable energy demand of heating and cooling; this way the algorithm can activate the thermal mass. If the energy demand of the building was low, the thermal mass activation could be counterproductive, and the results would not offer a significant improvement over the base case scenario. Table 3 shows a general view of all the results. The PV use increased in a range from 35% to 49% in winter and from 72% to 110% in summer. In relation to the cover factor, self-consumption increased in a range from 21% to 24% in summer and from 19% to 22% in winter; in addition, the self-sufficiency increase was approximately 16% in summer and 8% in winter. The first conclusion of this general view is that the results were quite consistent for the different years. In addition, when comparing these results with the studies present in Luthander et al. (2019), the values obtained for self-consumption and self-sufficiency were similar to cases where batteries were used and clearly beyond the results of DSM. The comparison between different studies is difficult to achieve since there are several influencing factors, such as the climate considered, the building characteristics, the annual demand and the PV production, or the occupation, that should not be ignored. However, it seems that the results of this study with DSM can be considered similar to other studies with a 4 kWh battery, where the increase of the self-consumption reached values of 22%, 27%, and 29% (Bruch and Müller 2014;Weniger et al. 2014;Bertsch et al. 2017, respectively). These can be considered remarkable results considering the cost and the maintenance of batteries.
In Figure 8, the same results are shown in the form of the energy matching chart; as mentioned previously, it was not possible to use the bubbles due to the lack of space in the chart. Another important remark that can be drawn from the matching chart is the different behavior in winter and summer. In winter, when the points of the base case scenario and the optimized models were connected, they crossed through the origin of the chart. As previously mentioned, this means that the P/L relation was the same before and after the optimization. In winter, the P was lower, and selling to the grid could be a profitable option; hence, over-consumption was not always a viable solution. Thus, the winter strategy varied between charging and discharging the thermal mass. This was achieved by reducing In contrast, in summer, the connected line did not cross the origin, which means that a modification of the relation P/L was made. In summer, the strategy was over-consumption, because the excess of P could not be sold to the grid; therefore, L was increased, and, consequently, the P/L was modified.

Detailed analysis of the results of 2018
All the years analyzed showed similar behaviour; we chose 2018, the most recent year, for a more detailed analysis at the level of monthly and daily hourly averages of energy and temperature. The first observation from the monthly matching chart of 2018, in Figure 9, is that the performance was very similar to that in Figure 8, which means that there was a similar pattern at the yearly and monthly level.
In Figure 10, the matching bubbles were added to increase understanding. The size of the bubbles in winter were larger than the summer ones, which is expected from the weather characteristics of Pamplona as a Pyrenees region, with a strong winter season and mild summers. As mentioned before, for winter, the bubbles of the base case scenario were of equal size to the optimized, which means that the relation P/L was constant; therefore, in Figure 9, when connecting these two points, the line crossed the origin. On the contrary, in summer, the size of the bubbles were different, and the connection of the lines did not cross the origin; here, the over-consumption strategy based on the extra energy available from the PV production was reflected. Additionally, the bubbles allow us to check graphically the matching capacity of each month (green area of each bubble) and the unmatched energy for the base scenario and the optimized case. Notice that, in the winter months, the self-sufficiency values corresponded to the green area; in summer, that correspondence of the green area was with self-consumption. However, the unmatched energy (blue and yellow of the ring) cannot be detected graphically without the bubble information.

Winter period
The purpose of the DSM strategy is the use of otherwise wasted energy (when available) or the reduction in the amount of energy dispatched to the grid. Due to the weather characteristics, in winter, buildings in Pamplona are net consumers as can be seen in the matching chart in Figure 9. The winter strategy was to increase self-consumption without increasing demand. This was achieved for all the winters in the years from 2013 to 2018 and for all the winter months in 2018.
In Figure 11, a summary of the daily ten-minute time-step average temperature can be seen. The main goal was to achieve an array of optimal set-points to increase the consumption of local energy production and, hence, reduce the amount dispatched to the grid. As this available energy varied due to changing weather conditions, a rule of fixed set-points would be counterproductive and would raise grid energy consumption. On the other hand, a high excess of PV production would fix the set-point at the maximum allowable set-point of 23 °C. As can be seen in Figure 11, this was not the case, because in all the months there was a modulation of the temperature. Notice that despite showing only the average temperature, the ten-minute optimal temperatures were achieved for each room (thermal zone) of the flat; this high number of points is quite remarkable.
In relation to the energy analysis, the daily hourly energy was shown for the different months of: January, February, November, and December. For a deeper understanding, February is presented in Figure 12, while the rest of the were very similar, during the optimization time (from 10:00 to 17:00), self-consumption was clearly enhanced. Overall, the grid consumption was reduced, but in some hours it was increased. However, the general balance of the winter season was around 10% lower. In all cases, it can be observed that the morning storage has a slight effect on the evening consumption. As an example, the color bubbles of February presented in Figure 10 are shown in a matching chart in Figure 13. The size of the bubbles is equal and the connection line crosses the origin, which means that there is no variation in P/L relation.

Summer period
The summer strategy was different due to the excess PV production. According to Spanish legislation, explained in the introduction, the excess can be dispatched to the grid but for free. Under this circumstance, the aim is to obtain maximum profitability from this energy, since dispatching it for free should be the last resort. On the basis of the above, over-consumption is a viable solution. When we analyze Figure 14, we can take note of how the set-points were modulated in June and September but not in July or August; the reason for this was the large amount of PV production available in the latter months. It is clear that when PV production is high, the methodology does not offer an original solution, and it is during scarce PV production that it obtains the maximum profit. To test this, we chose a day in August where the modulating optimal set-point can be regarded (see Figure 15).
In relation to the energy consumption, the difference with winter is quite clear. In this case, the optimization period was from 10:00 to 19:00. In this case, over-consumption ( Figure 16) was a justifiable option, because this energy had to be dispatched to the grid for free, and any other profitable solution would be valuable. The savings from the grid were around 25% as stated in Table 3, and they came from the evening performance where, clearly, less energy was consumed as can be seen in Figure 16.
In Figure 17, the color bubbles and the matching charts are shown. It shows explicitly a net producer strategy. The size of the bubbles show the increase in L; therefore, there is a double line of connection with the origin instead of a single line. The green area shows the increase in self-consumption, and the yellow area shows the unmatched energy.

Comfort analysis
An analysis was performed in order to verify whether the set-points modification affected the comfort level inside the dwelling. The index used was the predicted mean vote (PMV) developed by Fanger, which shows the thermal sensation produced when combined environmental variables (air temperature, radiant temperature, relative humidity and air velocity) with individual variables (activity and clothing). Fanger defends that other factors are not relevant on the state of thermal comfort. The PMV index is useful only for predicting steady-state comfort responses (ASHRAE 2017) and provides a score that identifies a thermal sensation, varying from +3 (intolerably warm) to −3 (intolerably cold), where the neutral value, 0, is the perfect condition (Fanger 1970). The ISO 7730 standard includes the PMV index and recommends that an environment should have values between +0.5 and −0.5 to be classified as thermally acceptable (Chowdhury et al. 2008).
The analysis was carried out for the hours when the set-points were modified, that is: from 10 a.m. to 5 p.m. during winter, and from 10 a.m. to 7 p.m. during summer. Figures 18 and 19 demonstrate that the comfort level was not compromised in the optimized model compared to the base model. Also, the variation of the comfort level during winter was almost imperceptible. In contrast, in the summer situation, where there are more days with excess energy production, the PMV is almost equal to −0.5 in most of the hours studied, due to the overcooling generated. However, most values do not exceed the −0.5 range and remain within the comfort zone.
These figures are a general overview, but in terms of comfort, it is important to make a more detailed analysis. Therefore, the most critical days of the optimized models were chosen. The criteria for selecting the days was excess energy production, which could lead to overcooling or overheating, in order to analyse the thermal comfort in these situations. Figure 20 shows that the Fanger score for the winter day 24 January is between the recommended: from −0.5 to +0.5. Although from 12 p.m. to 15 p.m. the temperatures of the optimized model is above 23 °C, the strategy of overheating does not exceed the limits of an environment thermally acceptable.
The most critical optimized model in summer is also between the acceptable values of thermal comfort, even if the temperature is lowered to around 20 °C. We chose the most critical day in August because it is the one that best demonstrates the set-point modulation strategy. In Figures 21(a) and (b), there is a synchrony between the temperature and PMV values. Furthermore, July is also a relevant month for detail optimisation, as its PMV values are slightly below −0.5 (the comfort limit set by ISO 7730). However, its most critical day does not represent the strategy well. Figure E.29 in Appendix E reveals that on this day the energy production was sufficient to set the thermostat to 20 °C, making the strategy unnecessary, since our study is based on the modulation of the set-points. Therefore, those days when the PV production is so high than when the set-point is always 20 °C, are out of our scope. On days like these, indoor temperatures can be easily adjusted by changing the thermostat set-point.

Conclusion
This research explored a DSM methodology based on a BEM aiming to maximize the self-consumption of local PV production and minimize the interaction with the grid. This methodology provided an array of near-optimal set-points for six years at a ten-minute time-step for five different thermal zones. The simulation was performed for two seasons and four months per season in winter (January, February, November, and December) and in summer (June, July, August, and September). Two different strategies were carried out, one for winter and another for summer. In winter, the excess energy was dissipated inside the building, and the final energy demand of the optimized strategy was similar to the base case. A reduction from the grid of 8% was consistently achieved, with a boost of 22% in relation to self-consumption. In summer, with a higher PV production, excess demand was produced, but the final energy reduction from the grid was about 25% due to the demand reduction in the evening after optimization occurred; the self-consumption was enhanced by 24%. The results were presented by using the energy matching chart, which clearly shows the improvement obtained in the outcomes compared with other similar DSM strategies. The different strategies used in summer and winter were demonstrated graphically in the chart. The values of the findings at the level of self-consumption matched similar works using batteries with around 4 kWh of capacity, which is noteworthy. As a novelty, in the energy matching chart, color bubbles were added, which helped us to graphically explain the unmatched energy of the process.
This study can be easily extended to any building energy model based on whole-building simulation software such as EnergyPlus. The BEM should represent the thermal behavior of a real building by a calibration process. If the BEM is equipped with a VRF HP system, the methodology proposed in this paper can be directly replicated by following the steps proposed in Section 2. Moreover, this methodology could be implemented in a real building management system or could be part of a training system in an offline optimization process to develop faster system controllers. In future work, a surrogate model could be implemented to test whether similar levels of increased self-sufficiency or decreased grid interaction could be achieved.