Energetic, Cost, and Comfort Performance of a Nearly-Zero Energy Building Including Rule-Based Control of Four Sources of Energy Flexibility

: A focal point of ongoing research is matching the energy demand in the built environment to the energy supply from onsite generation, to maximize the self-consumption, and from the energy grids, to lower energy costs and reduce peak loads on the system. Energy ﬂexibility addresses this task by modulating the energy demand in a building according to dynamic criteria such as electricity prices or onsite generation. This study addresses the potential of building performance simulation with real time rule-based control that provides energy ﬂexibility based on onsite generation and hourly electricity prices, prioritizing energy matching, and reducing costs. The novelty relies on investigating four sources of energy ﬂexibility simultaneously: shiftable machine loads, charging/discharging of batteries, hot-water storage tanks, and the building’s mass. The energy matching and ﬂexibility actions provided a decrease of up to 4% in annual energy costs, yet risk increasing the cost by 9% when the savings are offset by the increase in the energy demand. As well, the method for price categorization strongly inﬂuences the cost performance of the ﬂexibility actions. The outcomes of this study provide insight to energy ﬂexibility sources in nearly-zero energy buildings and how their outcomes are affected by price thresholds.


Introduction
The necessity to attenuate climate change has motivated the research community to develop strategies to use energy in the most efficient ways. Moreover, the European Union has established in the Energy Performance of Buildings Directive (EPBD) that all new buildings must be nearly-zero energy in a cost-optimal way by 2020 [1]. This, in combination with the rise of decentralized and end-user-owned generation components, promoted deeper investigation into the potential of adjusting the energy demand in the built environment to match the energy supply from its onsite generation components, to maximize the self-consumption, and from the energy grids, to lower energy costs and reduce peak loads on the system. Energy flexibility addresses this challenge by modulating the energy demand in a building or a group of buildings according to dynamic criteria such as electricity prices or onsite generation. For instance, the energy demand of a building can be increased when energy prices are low and/or reduced in periods when energy prices are high. An example would be to raise the indoor temperature before a period with high prices, so as to reduce the heating demand (thus the energy imported) at high prices without maiming the comfort levels. Similar actions can be performed based on the availability of onsite generation from photovoltaic panels, solar collectors, or other generation components. The modulation actions can be implemented through demand response (DR) by shifting the energy use in the building based on onsite generation and dynamic energy prices. A comprehensive review on DR in the residential sector has been presented by Haider et al. [2].
The advantages of DR strategies have received much attention in recent years. As stated by Nolan and O'Malley [3] in their review of DR deployment and challenges, "there is a pressing need to quantify the value of DR". Indeed, it is apparent in the literature that the advantages of DR vary. Alimohammadisagvand et al. [4] compared rule-based DR control algorithms based on electricity prices. Their results indicate that a DR controlled ground-source heat pump (GSHP) heating system can save up to 15% in energy costs. Hoon Yoon et al. [5] proposed a DR controller for heating, ventilation, and air-conditioning (HVAC) systems in residential buildings; the controller provided up to almost 11% energy cost savings and reduced the peak load by almost 25%. Similarly, Christantoni et al. [6] reduced the energy demand by 14% in a commercial building by implementing DR to control the heating, cooling and ventilation equipment. The authors remark that a centralized chiller load provided the most significant reduction potential. Fotouhi Ghazvini et al. [7] created an optimization-based controller to schedule demand in a smart household including a photovoltaic (PV) system, an electric vehicle, and an electric water heater. The controller made use of the storage capability provided by the electric vehicle and the electric water heater to reduce the daily energy cost by up to 31% compared to a simple rule-based algorithm. Baldi et al. [8] also implemented an optimization-based controller, in this case based on Parameterized Cognitive Adaptive Optimization (PCAO), in a set of buildings with distributed generation and demand response. They emphasize that energy sharing between buildings can reduce costs and show that their optimized method outperforms rule-based DR strategies by up to 25%. Similarly, Michailidis et al. [9] also implemented PCAO with current and future information about weather conditions and building state to manage a low energy, high-inertia building, resulting iñ 50% energy savings. In contrast, Neves et al. [10] found existing modeling tools that offered savings below 0.5% in a case study of the island of Corvo, Portugal, partly due to the input data limitations. The wide range of results in the mentioned studies indicates that deeper insight into the performance of different DR strategies is needed. Moreover, attention must be paid, to the full extent of the results from DR strategies. As remarked by Knudsen and Petersen [11], who developed a model predictive controller (MPC) for space heating, aiming to minimize energy costs can increase CO 2 emissions and aiming to minimize CO 2 emissions might only marginally reduce costs. Only by using a weighted sum of these goals could the benefits be balanced.
Another key aspect to consider while evaluating DR strategies is their impact on the thermal comfort inside the building. Since set-point temperatures are often used as DR control variables, there is a risk to create uncomfortable conditions in the living space. Péan et al., for example, evaluated the effect of demand-side management on thermal comfort and energy costs [12]. Their strategies reach up to 20% monetary savings in heat pump operation, yet the authors warn that thermal comfort may deteriorate significantly if no distinction is made between daytime and nighttime comfort limits. Le Dréau and Heiselberg studied the modulation potential of the thermal mass of the buildings, and its effect on the comfort levels [13]. They reached the conclusion that changing the indoor set-point temperature can lead to overheating, particularly in highly-insulated buildings such as passive houses, or if simple control systems are implemented. Oldewurtel et al. use MPC based on occupancy [14] and/or weather predictions [15] to manage the energy demand in office buildings, to ensure that comfort levels are satisfied. While they do not pursue DR, they also modulate set-point temperatures to save energy-up to 34%-without diminishing comfort. Thus, for DR to be willfully adopted by residential end-users, the DR strategy must consider not to compromise the standard thermal comfort level, at least to a certain degree.
This study addresses the potential of building performance simulation with real time rule-based control (RBC) that provides energy flexibility by prioritizing energy matching and reducing energy costs in a single-family nearly-zero energy building, while maintaining thermal comfort. The RBC is based on onsite generation and hourly electricity prices (HEP), aiming to: (i) maximize self-consumption and (ii) reduce costs. The novelty of this study relies on investigating simultaneous shifting options of four sources of energy flexibility: shiftable machine loads; charging/discharging of electric batteries; hot-water storage tanks (HWST); and the building's mass. Moreover, several price-classification strategies are considered, including past and/or future prices with different time-windows as well as two different calculation methods for the benchmark price. Such a wide array of energy flexibility actions, price-classification strategies, indicators (matching, costs, comfort, and flexibility), and the priority of energy matching in the proposed RBC is, to our best knowledge, yet to be explored, and could provide deeper knowledge on the potential of energy flexibility actions in single-family buildings.
In Section 2 the building and its energy system are presented along with the price-classification strategies and the energy flexibility actions. Section 2 also presents the indicators used to evaluate the system performance. The performance of the system simulations with the RBC, based on cost, total load and the matching and flexibility indicators, are presented in Section 3 and discussed in Section 4. The article concludes in Section 5 where the main outcomes are presented.

Research Method
The study is based on the simulation of a residential building and its energy system, in which a RBC modifies a set of control variables based on the onsite electricity generation and the HEP. This section presents the studied building and its energy system, the control strategies implemented in the RBC, the indicators used to quantify the results, and the simulation tool.

Building
The simulated building is the virtual residential nearly-zero energy building implemented in the emulator platform at Aalto University [16]. It has a net floor area of 150 m 2 and adheres to the Finnish Building Regulation D3 [17]. The electricity demand profiles for lighting and appliances and the domestic hot water (DHW) demand are based on the D3 regulation and on [18]. Unlike the building in the emulator platform, where heat is supplied through radiators, the building in this study integrates a floor heating (FH) system. The purpose of this modification is to investigate the effect of the building's heat storage capacity. The floor consists of a 4 cm layer of fiberglass, piping embedded in 10 cm of concrete, and 1 cm of ceramic tiling on the upper surface. Table 1 shows the main building features, and further information about the building and the emulation platform is available in [16,19,20].

Energy System
The building is designed to combine onsite renewable energy generation and electrical and heat storage components. Particularly, the storage components are aimed to increase self-consumption and provide more management options. The system includes: a 4.32 kW PV system (based on the one installed in the emulator platform), with a total generation of 2.19 MWh in 2015; a 9.6 kWh electric battery with a charging efficiency of 95%; a 5.1 kW GSHP with a coefficient of performance (COP) between 2.7 and 2.3 depending on the temperature of the return water, calculated based on the guidelines in the National Building Code of Finland, Part D5 [21]; a 600 L HWST dedicated to supply the floor heating system, and a 300 L DHW tank with an electric heater. A diagram of the energy system is shown in Figure 1.

Energy System
The building is designed to combine onsite renewable energy generation and electrical and heat storage components. Particularly, the storage components are aimed to increase self-consumption and provide more management options. The system includes: a 4.32 kW PV system (based on the one installed in the emulator platform), with a total generation of 2.19 MWh in 2015; a 9.6 kWh electric battery with a charging efficiency of 95%; a 5.1 kW GSHP with a coefficient of performance (COP) between 2.7 and 2.3 depending on the temperature of the return water, calculated based on the guidelines in the National Building Code of Finland, Part D5 [21]; a 600 L HWST dedicated to supply the floor heating system, and a 300 L DHW tank with an electric heater. A diagram of the energy system is shown in Figure 1.

Control Strategies
The control strategy consists of the energy management rules designed to enhance energy matching and reduce costs through energy flexibility actions. There are two main sets of rules. The first set aims to maximize the onsite utilization of the energy generated by the PV system, by first covering the electrical loads, then making use of the electric and heat storage capacities and finally exporting any surplus that may remain. The second set aims to minimize the cost of covering the energy demand in the building. To do so, the rules are defined to supply energy to the electricity and heat storage components when the prices are low, and discharge the storage components when the prices are high. The rules also promote the operation of shiftable machine loads when prices are low. Figure 2 illustrates the energy management rules, including the utilization order of the PV output and the price-based management actions.

Control Strategies
The control strategy consists of the energy management rules designed to enhance energy matching and reduce costs through energy flexibility actions. There are two main sets of rules. The first set aims to maximize the onsite utilization of the energy generated by the PV system, by first covering the electrical loads, then making use of the electric and heat storage capacities and finally exporting any surplus that may remain. The second set aims to minimize the cost of covering the energy demand in the building. To do so, the rules are defined to supply energy to the electricity and heat storage components when the prices are low, and discharge the storage components when the prices are high. The rules also promote the operation of shiftable machine loads when prices are low. Figure 2 illustrates the energy management rules, including the utilization order of the PV output and the price-based management actions. The control strategy is composed of two parts: the definition of price thresholds and the energy management rules. To make decisions that depend on electricity prices, it is necessary to define what "low" and "high" prices are. In this study, the low and high thresholds for electricity prices are calculated based on three criteria: the location of the time window with respect to the current time step; its length; and whether percentiles or moving averages are calculated. The time window can be based on past prices (PP), on future prices (FP), or on both past and future prices (PFP). The length of the time window can be 4, 8, and 12 h for FP and PFP, and 4, 8, 12, and 24 h for PP. Day-ahead HEP are published every day at 12:42 by NordPool [22], therefore 24 h cannot be included in FP or PFP because in the hours between 01:00 and until day-ahead prices are published, not all the required hourly price data is available. For instance, on 1 December at 11:00, the HEP until midnight are known but not beyond that time; only at 12:42 will the HEP for 2 December be available. For PP, the shiftable machine loads (see Section 2.4.) are operated when prices are below the low-price threshold; if this does not happen within the operation window, the shiftable machine loads are operated in the last possible time-step. For FP and PFP, the shiftable machine loads are operated at the time-step with the lowest price within the operation window. The different strategy is needed because for PP it is assumed that the system does not know the upcoming prices, and therefore cannot know if lower or higher prices are coming. Figure 3 shows a graphic representation of PP, FP, and PFP, and the time windows. Finally, the thresholds are calculated with the bottom (10, 20, 30, and 40) and upper (60, 70, 80, and 90) percentiles of the HEP time window, or as deviations from the moving average based on the HEP time window: −1, −2, or −3 €cent for the low threshold and +1, +2, or +3 €cent for the high threshold. All the threshold combinations are investigated (i.e., asymmetrical combinations are included), with a total of 250 different cases. The parameters in the RBC have been defined based on preliminary analysis of energy system, and on the context of the study, with the aim to present a reasonably wide array of the results.  The control strategy is composed of two parts: the definition of price thresholds and the energy management rules. To make decisions that depend on electricity prices, it is necessary to define what "low" and "high" prices are. In this study, the low and high thresholds for electricity prices are calculated based on three criteria: the location of the time window with respect to the current time step; its length; and whether percentiles or moving averages are calculated. The time window can be based on past prices (PP), on future prices (FP), or on both past and future prices (PFP). The length of the time window can be 4, 8, and 12 h for FP and PFP, and 4, 8, 12, and 24 h for PP. Day-ahead HEP are published every day at 12:42 by NordPool [22], therefore 24 h cannot be included in FP or PFP because in the hours between 01:00 and until day-ahead prices are published, not all the required hourly price data is available. For instance, on 1 December at 11:00, the HEP until midnight are known but not beyond that time; only at 12:42 will the HEP for 2 December be available. For PP, the shiftable machine loads (see Section 2.4.) are operated when prices are below the low-price threshold; if this does not happen within the operation window, the shiftable machine loads are operated in the last possible time-step. For FP and PFP, the shiftable machine loads are operated at the time-step with the lowest price within the operation window. The different strategy is needed because for PP it is assumed that the system does not know the upcoming prices, and therefore cannot know if lower or higher prices are coming. Figure 3 shows a graphic representation of PP, FP, and PFP, and the time windows. Finally, the thresholds are calculated with the bottom (10, 20, 30, and 40) and upper (60, 70, 80, and 90) percentiles of the HEP time window, or as deviations from the moving average based on the HEP time window: −1, −2, or −3 €cent for the low threshold and +1, +2, or +3 €cent for the high threshold. All the threshold combinations are investigated (i.e., asymmetrical combinations are included), with a total of 250 different cases. The parameters in the RBC have been defined based on preliminary analysis of energy system, and on the context of the study, with the aim to present a reasonably wide array of the results.

Shiftable Machine Loads
There are three shiftable machine loads in the building: a dishwasher, a washing machine, and a clothes dryer, with energy consumption rates of 1.01, 1.15, and 3.24 kW, respectively. All three loads have a weekly operation pattern that is season-dependent, and they operate during one hour within an operation time window. The seasonal operation windows of the shiftable machine loads are shown in Table 2.

Set-Point Temperatures and Comfort Evaluation
The RBC increases or decreases the FH tank and DHW tank set-point temperatures based on onsite generation and electricity prices. The set-point temperature of the conditioned areas is based on these two conditions, yet bounded by recommended indoor temperature limits depending on the outdoor temperature as indicated in the Classification of Built Environment 2008 [23]. The temperature profile applied in this study follows the S2 (Good indoor environment) category in the classification. Cooling is not investigated in this study as it is not customary in residential buildings in Finland. The values of the set-point temperatures defined in the RBC are shown in Table 3.

Shiftable Machine Loads
There are three shiftable machine loads in the building: a dishwasher, a washing machine, and a clothes dryer, with energy consumption rates of 1.01, 1.15, and 3.24 kW, respectively. All three loads have a weekly operation pattern that is season-dependent, and they operate during one hour within an operation time window. The seasonal operation windows of the shiftable machine loads are shown in Table 2.

Set-Point Temperatures and Comfort Evaluation
The RBC increases or decreases the FH tank and DHW tank set-point temperatures based on onsite generation and electricity prices. The set-point temperature of the conditioned areas is based on these two conditions, yet bounded by recommended indoor temperature limits depending on the outdoor temperature as indicated in the Classification of Built Environment 2008 [23]. The temperature profile applied in this study follows the S2 (Good indoor environment) category in the classification. Cooling is not investigated in this study as it is not customary in residential buildings in Finland. The values of the set-point temperatures defined in the RBC are shown in Table 3. Table 3. The set-point temperatures of the floor heating (FH) tank, the domestic hot water (DHW) tank, and of heating in the conditioned areas, the latter according to the guidelines for the S2 category in the Classification of Built Environment [23].

Tank PV Excess Electricity Price Category
Low Normal High Heating in conditioned areas The comfort in the three bedrooms and the living room and kitchen area will be evaluated with two conditions. First, as established in the Classification of the Built Environment 2008, category S2, the operative room temperature must stay within ±1 • C of the set-point temperature when the room is being occupied. Second, drifts (drops in temperature) and ramps (increases in temperature) must remain below the limits established by the ASHRAE 55-2010 Standard [24] as shown in Table 4. The results on thermal comfort are presented as dissatisfaction, which here represents the percentage of the occupied time when the indoor temperature is outside the admissible range according to the S2 category, and the hours throughout the year when the indoor temperature change exceeded the drifts and ramps limits. The results for dissatisfaction do not reflect the Predicted Percentage of Dissatisfied (PPD); instead it has been preferred to directly present the dynamic effect of the RBC actions on the selected factors for thermal comfort.

Indicators
A set of indicators has been designed to compare the energy matching, energy cost, and flexibility between the different cases. The energy matching in the building is presented with two indicators: the onsite energy matching (OEM) and the onsite energy fraction (OEF). OEM indicates the fraction of the onsite energy generation that is consumed onsite (i.e., not exported to the grid), while OEF indicates the fraction of the energy demand that is covered with onsite generation (i.e., not with energy imported from the grid). This means that a value of 1 for OEM indicates that all the onsite generation was consumed onsite, and that a value of 1 for OEF indicates that all the energy demand was covered with onsite generation. OEM and OEF are calculated as: where E and I are the exported and imported electric power, respectively, G and L are the onsite generation and load power, respectively, and dt is the simulation time-step. Further information about these indicators can be found in [20,25].
The energy cost C is calculated as the annual difference between the cost of energy imports and the income from energy exports. This can be expressed as: where p imp and p exp are the HEP for imported and exported energy, respectively. Flexibility is studied with three indicators based on the studies presented in [13,26]. A flexibility factor F is calculated based on the amount of energy that has been consumed at low and high price periods as: where el low is the electric power used at low HEP, and el high is the electric power used at high HEP. The value of the factor lies between −1 and 1, where −1 means that no electric power was consumed during low price hours and 1 means no electric power was consumed during high price hours. The second indicator is the flexibility capacity ∆El, calculated as: where, for one time-step, el RBC is the electric power imported under the RBC, el ref is the electric power imported in the reference case (with no flexibility actions), and ∆el is the power difference. ∆El discharged and ∆El charged are the amounts of electric energy decreased (discharged) and increased (charged) by the RBC when compared to the reference case. ∆El discharged has a negative value. The third indicator is the shifting efficiency η shift , which shows whether the building was predominantly storing (value lower than one) or saving (value higher than one) energy; it is calculated as: where η shift can reach values higher than one in cases where the annual electricity charged is larger than the electricity discharged.

Simulation
The building and its energy system, as well as the RBC, were modelled in TRNSYS 17. The building is represented as a multi-zone building with Type 56, which allows detailed representations of walls, floors, roofs and several other components. The simulation time-step is 6 min. The weather profile consists of measured data for the year 2015 provided by the Finnish Meteorological Institute for the Helsinki Metropolitan area [27]. The HEP consist of the NordPool market prices in Finland during the year 2015 [28]: the export price is calculated as the hourly market price from NordPool minus 0.24 €cent/kWh, while the import price is calculated as the hourly market price from NordPool plus an energy tax of 2.79 €cent/kWh and a transmission fee of 3.98 €cent/kWh [29]. The low and high price thresholds are pre-calculated in MATLAB and given as input to the model. The approach of using weather data and price data for the same year instead of, for example, a test reference year, allows to inherently address the effect that weather conditions may have on electricity prices. As an example, cold temperatures may lead to increased electricity demand, and thus to higher electricity prices.

Reference Case
A reference case has been defined to allow comparing the performance of the flexibility measures against a typical, not price-nor generation-controlled system. The case consists of the same building with fixed set-point temperatures equal to those for "Normal" HEP in the RBC (FH tank: 55 • C, DHW tank: 65 • C, FH: 21.5 • C). The battery is charged when there is surplus generation and discharged when there is an electricity deficit in the system; both actions regardless of the HEP.
The reference case in this study represents the condition of average comfort that provides the widest range of upwards and downwards set-point modulation within the comfort limits, and thus larger flexibility potential. As discussed by Péan et al. [30], using the lowest set-point temperatures instead would give an indication of the lowest energy consumption possible, but it would be detrimental for the study of the flexibility potential with upwards and downwards modulation-as is the case here.

Operation of the RBC
The operation of the RBC is shown in Figure 4 for hours 2280-2448, which correspond to the week from April 6-13. The operation corresponds to the case leading to the lowest operational energy cost (see Table 5). This week has been chosen as it includes significant floor heating demand and onsite generation. A notable characteristic of the operation is that the price level (i.e., whether the price is considered as low, normal or high) can go from low to high and vice-versa with price changes of fractions of a cent (such as between the hours 2280 and 2300), which is due to the percentile approach. The onsite generation is utilized to cover the electrical loads and to charge the battery, yet the surplus is not enough to activate any further actions by the RBC. The price-based management is more active: the battery charging and discharging, as well as the modulation of FH, FH tank, and DHW tank set-point temperatures can be seen throughout the week. Also, examples of the shiftable machine loads can be seen in hours 2354 and 2374, when low prices were available. Instances such as in hour 2357, when the clothes dryer is used at high prices, indicate that the load was shifted to the hour with lowest HEP within the operation time window, as described in Section 2.4.

Price Categorization
The results for the different criteria for price categorization by the RBC, as described in Section 2.3., are shown in Figure 5. The first column shows the results according to the location of the time window (i.e., PP, FP, and PFP); the second column shows the results according to the length of the time window (i.e., 4, 8, 12, or 24 h); the third column shows the results according to the threshold for low price classification, and the fourth column shows the results according to the threshold for high price classification. The top row shows the full set of results, while the bottom row zooms into the results with low cost and load. Using percentiles can lead to the most cost-attractive results (below €1425) yet also to the least attractive ones (up to above €1600), while the results when using averages stay within a narrow range (€1427 to roughly €1500), mostly with lower cost than the reference case. The location of the time window and its length show other defined behaviors. In the first column of Figure 5, the results indicate that price thresholds with PP and 4-h windows lead to the highest costs and loads, and in most cases lead to higher costs and loads than price thresholds with FP and PFP with 8 or 12-h windows. The graphs in the first and second columns thus show two defined behaviors: percentiles with PP can lead to the highest costs and loads (above €1550), and percentiles with 12-h windows can lead to the lowest costs and loads (below €1425).     The graphs in the third column of Figure 5 show that all cases with costs below roughly €1435 are reached with the bottom tenth or twentieth percentiles for the low-price threshold. This indicates that setting the threshold for low prices further from the median price leads to lower costs and loads. That is, the less the RBC categorizes prices as low, the lower costs and loads the system incurs. No clear behavior can be identified for the high-price threshold in the fourth column.

Performance of the Energy Flexibility Actions
To compare the performance of the energy flexibility actions, four cases have been selected based on their cost: the case with lowest cost ("Lowest"), a case with cost similar to the reference case ("Middle"), a case near the middle point between the reference and the highest cost ("High"), and the case with the highest cost ("Highest"). Their parameters and annual results are shown in Table 5. Total load refers to the annual electricity demand of the building, whilst net electricity exchange is the sum of the annual imports minus exports of electricity.
The matching indicators show that matching is only very little negatively affected by the flexibility actions compared to the reference case, with OEM and OEF decreasing as cost and total load increase. The flexibility factor F is positive in all four selected cases, indicating that the electricity consumption was shifted to low HEP more than to high HEP, as intended. Nevertheless, the indicator increases as cost and total load increase; thus, shifting more electricity consumption to low HEP does not necessarily lead to lowering costs nor reducing loads but may instead lead to increasing the cost due to higher energy imports. In other words, the savings from consuming at low prices may be outweighed by consuming more. Regarding ∆El and η shift , the results indicate that: (i) with increasing cost and total load, the system charges increasingly more electricity than it discharges (as shown by the positive, increasing values of ∆El) and (ii) the ratio between discharged and charged electricity decreases (as shown by the decreasing values of η shift ). These two behaviors imply that the electricity charged is higher in both magnitude and proportion than the electricity discharged as cost and total load increase.
The energy shifted by the actions according to the RBC is shown in Table 6. Compared to the reference case, the management of the PV output leads to: (i) lower use of onsite generation to cover the electrical loads; (ii) lower battery charging with onsite generation; (iii) higher use of onsite generation to cover the heat demand; and (iv) higher electricity exports. The action of raising the FH set to maximum was not taken in any of the shown cases because: (a) there was not enough surplus to reach that action or (b) the surplus was available during the summer season when no heating was required.
The price-based management shows that: (i) PFP and FP-based control has higher appliance-shifting capacity than PP-based control; (ii) battery utilization in all RBC cases is higher than in the reference case; and (iii) the largest energy shift happens through the modulation of the FH set-point temperature.

Comfort Evaluation
The dissatisfaction of the thermal comfort based on the S2 category for the heating season, and on the drifts and ramps, is presented for exemplary zones in the lowest, highest, and reference cases in Table 7. The results show contrasting behavior for the cases with energy management actions: the results based on the S2 category are poor, with high percentages of dissatisfaction, while the results based on drifts and ramps limits are satisfactory, with narrow periods when the limits are breached. For the latter indicators, the results in each zone are similar in the three shown cases, as the periods of dissatisfaction take place during the summer season when there is no need for heating and thus there are no actions to control the indoor temperature.

On Price Categorization
As shown in Section 3.1., percentiles lead to a wider range of results than moving averages. This is because small changes in HEP, even lower than 1 €cent, can lead to categorizing the ongoing HEP as high or low under the percentiles approach. The same does not happen with the moving average approach, where the boundaries above and below the moving average are fixed. Thus, the percentiles approach has a higher number of hours considered to be at high or low HEP than the moving average approach. In other words, the percentiles approach is more reactive to price changes and thus leads to a more frequent utilization of the flexibility actions.
The FP and PFP strategies have a clear advantage over the PP strategy: the shiftable machine loads always operate at the lowest HEP within their operation window. Moreover, the PP strategy risks operating the shiftable machine loads at the highest HEP: if prices are increasing continuously, the RBC will delay the load hour after hour until the operation window ends, leading to the highest cost.
Longer price windows lead to the lowest costs and loads since they allow a wider room for comparison of what high, normal, and low HEP are. The more price information is available, the better can the RBC identify when demand should be modulated upwards or downwards. In this study, the longest forward-looking window is 12 h, as this is the longest guaranteed available information on HEP (assuming HEP are published at noon). A supplementary investigation could be performed where the maximum amount of HEP information available for each time step is considered.

On the Performance of the Energy Flexibility Actions
As seen in Table 5, the energy flexibility actions can lead to savings of up to €61, roughly 4% of the annual energy costs. However, through improper selection of price category it can lead to increased costs of up to €137, roughly 9%. The limited potential for cost savings can be partly explained by the behavior of the electricity market prices in 2015, shown in Figure 6. There are two characteristics in the curve that limit the cost-saving potential of the flexibility actions: the narrow variability of the prices, and their limited drops below a moving baseline. The market prices stay within the range from 1 to 6 €cents/kWh for 90% of the year, offering the price categorization a limited range for evaluation. Remarkably, in the cold season from January to end of March (hour 2160), when the energy demand for FH is high, the market prices oscillate between 2 and 4 €cents roughly 80% of the time. That is, the period with large energy demand and thus higher potential to implement the flexibility actions, faces limited price variations and thus provides limited cost savings. As for the limited price drops, it can be seen in Figure 6 that the market prices tend to follow a moving baseline, with prices frequently going up but scarcely going down. This prevents the flexibility actions from providing higher savings, as the prices considered low are only marginally lower than the baseline. Moreover, as shown in Table 5, the flexibility actions lead in all cases to higher net electricity exchange, which further diminishes the savings incurred by the energy modulation: higher imports at low prices offer low saving potential. Finally, the contribution of the market price to the total import price is limited. On average, the market price represents 30% of the import price, where the rest and transmission prices and taxes. Thus, the variation of the hourly market prices has a diminished proportional effect on the price to be paid for the imported electricity. This also has the adverse consequence that each additional kWh of imported electricity can offset the savings by multiple kWh of shifted imports. performed where the maximum amount of HEP information available for each time step is considered.

On the Performance of the Energy Flexibility Actions
As seen in Table 5, the energy flexibility actions can lead to savings of up to €61, roughly 4% of the annual energy costs. However, through improper selection of price category it can lead to increased costs of up to €137, roughly 9%. The limited potential for cost savings can be partly explained by the behavior of the electricity market prices in 2015, shown in Figure 6. There are two characteristics in the curve that limit the cost-saving potential of the flexibility actions: the narrow variability of the prices, and their limited drops below a moving baseline. The market prices stay within the range from 1 to 6 €cents/kWh for 90% of the year, offering the price categorization a limited range for evaluation. Remarkably, in the cold season from January to end of March (hour 2160), when the energy demand for FH is high, the market prices oscillate between 2 and 4 €cents roughly 80% of the time. That is, the period with large energy demand and thus higher potential to implement the flexibility actions, faces limited price variations and thus provides limited cost savings. As for the limited price drops, it can be seen in Figure 6 that the market prices tend to follow a moving baseline, with prices frequently going up but scarcely going down. This prevents the flexibility actions from providing higher savings, as the prices considered low are only marginally lower than the baseline. Moreover, as shown in Table 5, the flexibility actions lead in all cases to higher net electricity exchange, which further diminishes the savings incurred by the energy modulation: higher imports at low prices offer low saving potential. Finally, the contribution of the market price to the total import price is limited. On average, the market price represents 30% of the import price, where the rest and transmission prices and taxes. Thus, the variation of the hourly market prices has a diminished proportional effect on the price to be paid for the imported electricity. This also has the adverse consequence that each additional kWh of imported electricity can offset the savings by multiple kWh of shifted imports. In spite of the actions implemented to promote the consumption of the onsite generation, the results indicate a small negative effect on the OEM and OEF and an increment of the electricity exports. This is because the price-based energy management creates conditions which are not favorable for energy self-consumption. Most notoriously, the price-based battery charge and discharge actions leave less battery capacity available for onsite generation. In the reference case, the battery is emptied every afternoon/evening when generation stops and the demand is covered, and the battery is at its lowest SOC when the generation resumes the next day. Under price-based management, however, if low prices were available during the night, the battery might have energy stored when generation starts. The generation-based modulation of the FH and the FH tank set-point temperatures offer limited possibilities for self-consumption since the FH is shut off during the In spite of the actions implemented to promote the consumption of the onsite generation, the results indicate a small negative effect on the OEM and OEF and an increment of the electricity exports. This is because the price-based energy management creates conditions which are not favorable for energy self-consumption. Most notoriously, the price-based battery charge and discharge actions leave less battery capacity available for onsite generation. In the reference case, the battery is emptied every afternoon/evening when generation stops and the demand is covered, and the battery is at its lowest SOC when the generation resumes the next day. Under price-based management, however, if low prices were available during the night, the battery might have energy stored when generation starts. The generation-based modulation of the FH and the FH tank set-point temperatures offer limited possibilities for self-consumption since the FH is shut off during the summer season, when most of the generation takes place. The modulation of the DHW tank does provide significant availability to consume the onsite generation, but its size is limited and over 65% of the DHW consumption takes place between 3 pm and midnight, after most of the generation happens; this allows the tank to reach the 90 • C limit, which in turn leads to exporting the rest of the surplus electricity.
Another observation is that less frequent categorizing of HEP as low leads to lower costs and loads, which is reinforced by the behavior shown in Figure 7. The observation can be explained by two effects of the frequent low price level categorization: FH demand is increased, and higher losses incur. The first effect derives from a risk inherent to the FH set-point modulation. Increasing the set-point temperature is intended for storing heat in the building when the prices are low and discharging the heat when the prices are high. However, if prices are considered low often, or for long periods of time, the heat is not discharged sufficiently. Thus, the FH set-point modulation does not effectively provide flexibility but increases the heating load. While this increases the comfort inside the building, it is not the purpose of the flexibility actions and is thus undesirable. The second effect derives from the increased set-point temperatures inside the building and in the tanks, and the battery charging. Increased temperatures lead to higher heat losses in the building and through the surface of the storage tanks, which increases the energy demand and cost in the system. While the cost of the losses in the battery might be offset through the cost savings for charging electricity when HEP are low and discharging when they are low, the increment in the load caused by the battery losses is not offset. summer season, when most of the generation takes place. The modulation of the DHW tank does provide significant availability to consume the onsite generation, but its size is limited and over 65% of the DHW consumption takes place between 3 pm and midnight, after most of the generation happens; this allows the tank to reach the 90 °C limit, which in turn leads to exporting the rest of the surplus electricity. Another observation is that less frequent categorizing of HEP as low leads to lower costs and loads, which is reinforced by the behavior shown in Figure 7. The observation can be explained by two effects of the frequent low price level categorization: FH demand is increased, and higher losses incur. The first effect derives from a risk inherent to the FH set-point modulation. Increasing the setpoint temperature is intended for storing heat in the building when the prices are low and discharging the heat when the prices are high. However, if prices are considered low often, or for long periods of time, the heat is not discharged sufficiently. Thus, the FH set-point modulation does not effectively provide flexibility but increases the heating load. While this increases the comfort inside the building, it is not the purpose of the flexibility actions and is thus undesirable. The second effect derives from the increased set-point temperatures inside the building and in the tanks, and the battery charging. Increased temperatures lead to higher heat losses in the building and through the surface of the storage tanks, which increases the energy demand and cost in the system. While the cost of the losses in the battery might be offset through the cost savings for charging electricity when HEP are low and discharging when they are low, the increment in the load caused by the battery losses is not offset. The behavior of the flexibility indicators reinforces the argument that less frequent categorization of prices as low leads to lower costs and loads, due to the demand increase caused by the flexibility actions. Values of F close to 1 indicate that most of the shiftable energy was consumed at low HEP, thus lowering the cost of each unit of imported energy. Yet, as shown in Table 5, higher values of F were found for the options with high costs and loads. For comparison, in the Lowest case, 1858 and 537 kWh were shifted to low and high HEP, respectively, while in the Highest case, 3047 and 462 kWh were shifted. While in the Highest case a larger proportion of energy was shifted to low HEP than to high HEP, the 6.5% increment in the total load compared to the Lowest case lead to higher costs. The detrimental behavior is also shown by the increasing values of ∆El and decreasing values of η , as they indicate that the energy being charged into the system is increasing more than the energy being discharged: the system is using the charged energy inefficiently. Therefore, lower costs and loads are reached when the actions that charge energy into the systemthe actions taken when prices are low-are taken sparsely. Briefly, shifting energy demand to lower HEP may be detrimental when it leads to higher loads. The behavior of the flexibility indicators reinforces the argument that less frequent categorization of prices as low leads to lower costs and loads, due to the demand increase caused by the flexibility actions. Values of F close to 1 indicate that most of the shiftable energy was consumed at low HEP, thus lowering the cost of each unit of imported energy. Yet, as shown in Table 5, higher values of F were found for the options with high costs and loads. For comparison, in the Lowest case, 1858 and 537 kWh were shifted to low and high HEP, respectively, while in the Highest case, 3047 and 462 kWh were shifted. While in the Highest case a larger proportion of energy was shifted to low HEP than to high HEP, the 6.5% increment in the total load compared to the Lowest case lead to higher costs. The detrimental behavior is also shown by the increasing values of ∆El and decreasing values of η shift , as they indicate that the energy being charged into the system is increasing more than the energy being discharged: the system is using the charged energy inefficiently. Therefore, lower costs and loads are reached when the actions that charge energy into the system-the actions taken when prices are low-are taken sparsely. Briefly, shifting energy demand to lower HEP may be detrimental when it leads to higher loads.

On the Comfort Evaluation
The contrasting results for the two comfort indicators are explained by the conditions evaluated by the indicators and the floor heating system. The comfort indicator based on the S2 category establishes that the indoor temperature must stay within a range around the set-point temperature. Thus, when the set-point temperature changes, a system that reacts slowly is penalized as it takes time to adjust. In contrast, the drifts and ramps limits establish that the indoor temperature must not change rapidly. Thus, when the set-point temperature or the outdoor conditions change, a system that reacts slowly creates less rapid changes. The floor heating system in this study consists of pipes embedded in a concrete slab. This provides a large mass where heat can be stored for later release, thus allowing to implement the FH flexibility actions; it also prevents sudden changes in the indoor conditions. Therefore, the poor results based on the S2 category indicator and good results based the drifts and ramps limits are a consequence of the heating system, chosen for its suitability for the flexibility actions.

Single Action Performance
The results of the investigation show the performance of the flexibility actions acting simultaneously, which does not allow identifying the contribution of each action towards the total cost reduction. Thus, four variations of the simulation model have been created, each with only one of the four flexibility sources: storage tank set-point temperatures; FH set-point temperatures; shiftable machine loads; and battery charging and discharging. Table 8 shows the results for each of these variations, for the lowest cost case, and for the reference case; the price categorization in the single-action simulations is set for the lowest-cost case (Perc. PFP 12 h, Low: 20, High: 60). The sum of the savings by the individual flexibility sources is lower than the savings in the lowest cost case. As well, the sums of the total load increments and of the net electricity exchange are larger than the respective increments in the lowest-cost case. This reflects that the flexibility sources affect each other, and the total result is different to the sum of the separate actions. In particular, the actions to modulate the FH and the storage tanks set-point temperatures interact closely with each other, as the temperature in the FH storage tank is partly dependent on the FH demand of the building. The battery management provides marginally larger cost savings than floor heating and tank temperature modulation. Nevertheless, this flexibility source might be the least attractive for two reasons: the cost of the battery, and the increased degradation by the frequent charge/discharge cycles. While the other flexibility sources require investing in the management system, no additional components are required. Not only does the battery represent a cost, but its degradation would reduce the energy storage capacity over time, with the battery eventually needing to be replaced.
The largest increase in the total load, which amounts to less than 1%, is caused by the modulation of the set-point temperature of the storage tanks. The increase is caused mostly by a reduction in the COP of the GSHP due to the temperature in the FH tank: as the temperature of the water inside the tank increases, the COP decreases. On average, the COP in the simulation with tank modulation is 2.44, whereas it is 2.48 in the reference case. Shifting loads and price-based management of the battery have virtually no effect on the total load; however, the battery management leads to an increase in the net electricity exchange due to the higher losses because of the frequent charge/discharge cycles. Shifting loads provides virtually no improvement in cost, load reduction, nor net electricity exchange. Although roughly 1. 16 MWh are shifted throughout the year, this does not translate into savings as low prices are only marginally lower than average. This is an indication that support mechanisms for load shifting must be implemented to make it attractive for the end consumer.

Conclusions
The study evaluated the performance of real-time control for energy matching and price-based management in a nearly-zero single-family building, through four energy modulation actions: battery charging and discharging, storage tanks temperature, floor heating temperature, and load shifting. Moreover, the categorization of hourly energy prices was investigated using a wide set of parameters such as duration of the price window, time location of the price window, calculation method for the dynamic reference price, and threshold for evaluation. The main outcomes of the study are as follows:

•
The energy matching and flexibility actions provided a decrease of up to 4% in annual energy costs, yet risk increasing the cost by 9% when implemented improperly. Shifting electricity consumption to low electricity prices may be counterproductive if the savings are offset by the increase in the energy demand. Thus, improved flexibility may lead to monetary losses if the control parameters are not chosen carefully.

•
Price-based management of the battery, modulation of the set-point temperature of the storage tanks, and modulation of the floor heating offer roughly the same potential for cost savings.
Price-based shifting of the operation of the washing machine, dryer and dishwasher did not provide cost savings in this study. Support mechanisms are needed to make load-shifting more attractive for the end-user. As well, energy matching is negatively affected by the price-based management of the battery. Thus, this flexibility action is detrimental for energy self-consumption.

•
The flexibility actions lead to a decrease in the comfort levels inside the building. Namely, the FH flexibility actions with an in-slab floor heating system lead to slow changes in the indoor temperature, which is detrimental for temperature-range based comfort indicators but beneficial to avoid sudden temperature changes.

•
Categorizing the electricity prices based on percentiles leads to more frequent reactions to price changes than categorizing based on a moving average and a fixed range; that is, the percentiles approach leads to a more frequent implementation of the flexibility actions and thus to a wider range of results. Twelve-hours windows for evaluation of electricity prices show better results than shorter windows, as more price information helps to better classify prices as low or high.

•
The low-price threshold shows more influence on the annual energy cost than the high-price threshold. A high percentage of hours categorized as low-price leads to increased costs and loads, while frequent fluctuations between low, normal, and high categorization enhance the charge/discharge actions.

•
The behavior of the hourly energy price curve limits the savings potential of the energy management actions. Namely, short amplitude of price oscillations leads to limited savings potential, and infrequent drops in prices make energy charging actions less consequential.

•
Modulating the set-point temperature of the FH tank can lead to variations in the COP of the GSHP, as it depends of the temperature of the water stored inside the tank. Particularly, elevating the temperature inside the tank decreases the COP of the GSHP, and thus increases its electricity demand.
The task of implementing effective matching and flexibility actions requires a careful analysis of the wide array of variables and parameters involved, and of the economic and energetic context surrounding the studied building(s). Yet, this task is becoming increasingly essential as onsite generation systems and fluctuating energy sources increase the need to enhance matching and to react to energy price changes. The outcomes of this study provide insight to the characteristics of these energy management actions and may serve as background for the design of similar control systems in other contexts. In this article, the capacities of the system components are fixed; thus, further knowledge on the flexibility actions could be obtained through the investigation of different system capacities and/or configurations. Moreover, the HEP behavior influenced the cost-saving potential of the price-based management. Therefore, using HEP profiles from a different year or country could lead to substantially different result. Finally, the RBC implemented in this study offers a bound universe of possible results, so the performance of the four flexibility sources under a different and/or advanced control method, such as MPC or direct control from an aggregator, could differ from the results presented here.