Simulation of Energy Exchange between Single Prosumer Residential Building and Utility Grid

Modern households usually have independent energy sources such as wind generators, photovoltaic (PV) panels, and similar green energy production equipment. Experts predict that soon, there will be an increasing number of such prosumers who both produce and consume energy. This process alleviates and reduces the load on large national electricity networks and also contributes to overall energy security. In this paper, a simulation model of a household, which employs a wind generator as its independent source of electricity, is developed. It is expected that this approach will be easily replicated for more complex configurations. The other components of the single prosumer microgrid that will be assessed are the non-shiftable electricity consumption equipment, which is used mainly in households and deployed separately for water heater, with a separate battery to meet the needs of these non-shiftable consumers. The 5-min data intervals for the year of simulation have been used. The characteristics of energy flow according to production and consumption schedules and the capacity of storage equipment have been modelled and simulated. Results disclose that wind turbine production size and buffer battery have a crucial impact on the demand cover factor.


Introduction
The European Union's energy policy aims to achieve 32% of its total electricity production from renewable sources by 2030 [1]. Increasingly, more attention is being paid to converting energy from renewable sources such as wind and solar [2]. These natural energy sources present new challenges for electrical engineers and researchers regarding maximal extractions of energy for on-site use, and the methods of their deployment besides fossil energy sources [3]. The renewable sources are interfaced with the grid by the means of power electronic converters. Such systems are becoming widespread and getting more efficient with the developments in topologies and power semiconductor components [4,5]. In terms of national energy security, it is important to maintain enough rotating reserve because this helps to maintain the stability of the electricity grid [6,7]. Small cogeneration heat plants that are powered by biofuels can support grid stability to an extent, but the combustion of biofuels on the other hand harms the environment [8]. Hydropower is environmentally friendly and stable in 24-h cycles, although it varies from season to season [9,10].
Another important aspect of electricity use is storage. Storage is possible only at varying levels. Pumped hydropower plants can be used for large-scale electricity storage [11]. Flywheel storage [12] is also used as a storage device in smart grids, transportation and for maintaining grid stability; however, for the most part, private use remains theoretical. Europe largely supports the transition to minimize energy use in which most new buildings will consume nearly zero energy with autonomous energy production and adequate storage systems. In the past decade, microgrid-based prosumers have grown exponentially, and it is desired that these prosumers would play a more appreciable role in optimizing the operations of utility grids [13][14][15].
This article provides a simulation model of a household with a wind generator as its electricity source. The other components of microgrid under review are so-called nonshiftable equipment for electricity consumption, which are used in every home. We consider these appliances and household equipment, known as "non-shiftable" (NS) consumption, in the energy scheme and simulation experiments. Water consumption and water tank as storage are evaluated separately in the model because of the requirement for domestic water to be preheated before use. The final component of the energy scheme within the microgrid or household is a separate battery that ensures that the needs of NS consumers are best met and which can store as much energy as possible when it is produced by the wind generator.
Conventionally, energy consumed in households emanates from either the wind generator [16] or the utility grid. To attain self-sufficiency, i.e., where electricity generated locally matches local consumption, it is necessary to find an optimal combination of installed electricity production units, and storage buffers to mitigate the volatility of the primary energy carrier such as wind or solar irradiation [2]. The present study introduces a buffer battery (BB), which stands between the microgrid and utility grid. BB belongs to the household as material equipment but is virtually considered as energy, being one of the stores for the energy produced by the wind generator. The energy from the wind generator that is not consumed in the microgrid during the observation period is loaded there. If necessary, the energy needed for consumption in the microgrid is also provided from BB. The energy that cannot be contained in the BB is transmitted to the utility grid. It is, thus, possible that the energy consumed in the household can come from either wind generator, buffer or grid.
Cover factor augmentation is indirectly assessed by certain authors. An overview [17] describes loss minimization and power quality in distributed grids and sets as objective the decrease in active losses in batteries. Vanhoudt et al. [18] studied the possibility of increasing self-consumption by heat pump, which is indirectly related to energy storage. By comparing different renewable electricity sources, they found that the wind generator's yield is better compared to photovoltaic (PV) panels. Naval et al. [2] modelled the versatility of electricity sources and related real-time electricity prices, with the wind as one of the most suitable primary energy carriers. The combination of wind and solar generation in a microgrid was studied in [17,19]. For a net-zero energy (NZE) hybrid microgrid, combined wind/solar generation with intermediate storage was analyzed using the HOMER Pro software (Homer Energy LLC, Boulder, USA) )suite [20]. A major disadvantage of this software is the 1-h or longer averaging period that it requires. Therefore, a less granular, self-developed MATLAB (The MathWorks, Inc., Kista, Sweden )model with an averaging period of 5 min was applied in this current research.
The cover factor is an indicator of load-shifting technology and is meant to handle volatile primary energy carriers such as wind and sunlight, by deploying intermediate storage devices [21][22][23][24][25][26]. In addition to shifting, Eltanay et al. [23] prioritized loads by dividing them into two major groups. In some sources, it is described as load matching index (LMI) or load generation matching index (LGMI) [27,28]. In [29] the optimal storage capacity for full ride-throughs was discussed. Households require power supplies from the largest possible number of renewable sources to reduce payoff times [2,30]. Increasing self-consumption not only levels load peaks [31] but also decreases costs on the electrical energy import to an economically feasible point of 60% self-consumption level [32]. The numerous studies described above indicate the increasing attention to the subject of the microgrid. However, despite this proliferation of studies trying to solve and predict the energy exchange between prosumer residential building and utility grid, to the authors' knowledge, there is still insufficient research into or investigation on optimal system design of a microgrid system in terms of wind turbine and buffer battery sizes effects on the system performance and demand cover factor. The main novelty of this work is using a buffer battery between of microgrid and utility grid to increasing of self-consumption. It is not yet met in the scientific literature.
Hence, the main goal of this work is to simulate and establish setup configurations of BB between microgrid and utility grid to increase self-consumption of the prosumer. It is important to note that for evaluation of effectiveness and distinguishing of these configurations, a new cover factor was introduced and used. The microgrid parameters were also set. The approach can easily be generalized and replicated in more complex configurations. Modelling and numerical experiments were carried out in a MATLAB environment.
With these objectives in mind, the remaining article is structured as follows: Section 2 describes the configuration of the modelled household. Section 3 gives an overview of the initial data that are used in simulation experiments. Section 4 describes the simulation setup, while Section 5 presents the main results. Finally, the main conclusions drawn in this work are provided in Section 6.

System Setup
On the base of our computer simulation is a typical private household with an additional buffer battery (BB) between the local microgrid and the utility grid. The term microgrid refers to an electrical installation, which comprises local electricity generation, loads, storage and utility grid connection by default [33].
In Figure 1, the system setup consists of two scenarios. In the first, the microgrid is connected to the utility grid Figure 1a and the energy change between microgrid (MG) and utility grid (UG) is direct and bidirectional. In Figure 1a, Arrow A denotes energy acquired from UG, while Arrow B means excess energy produced by wind generator (WG) and sold to UG. In the second scenario, the microgrid has external buffer battery (BB) storage attached Figure 1b. In Figure 1b, Arrow C means the most expensive energy acquired from UG for a house owner. Arrow D denotes energy, which is taken back to MG and this is free for a homeowner as it was earlier saved to BB (Arrow E), produced by a wind generator, and leftover from household consumption. Arrow F indicates the possibility that wind generator works well and some energy goes to UG. Figure 2 presents MG. All processes are driven by the load controller.   The microgrid described in this work can be connected to the energy hub. An energy hub is considered a unit where multiple energy carriers can be converted, conditioned, and stored [34]. It is to be noted that this microgrid output is very stochastic and has the best cooperation with the UG. Through the UG there is also a possible connection with other energy carriers.

Input Data
As input data, a time series of production of the WG which is scaled to rated power Pnom = 5 kW, manufactured by TUGE Ltd (TUGE Ltd., Paldiski, Estonia) [35] was used. It is located in a coastal area with coordinates N 59.087694, E 23.591719. The dataset collected The microgrid described in this work can be connected to the energy hub. An energy hub is considered a unit where multiple energy carriers can be converted, conditioned, and stored [34]. It is to be noted that this microgrid output is very stochastic and has the best cooperation with the UG. Through the UG there is also a possible connection with other energy carriers.

Input Data
As input data, a time series of production of the WG which is scaled to rated power P nom = 5 kW, manufactured by TUGE Ltd (TUGE Ltd., Paldiski, Estonia) [35] was used. It is located in a coastal area with coordinates N 59.087694, E 23.591719. The dataset collected covers the period from 1 December 2015 to 30 November 2016, taking into consideration that December is the first winter month, and facilitating further seasonal analysis. The average WG power output is derived by dividing the electricity generated during the last sampling period by the length of the sample period ∆t. In the actual research, ∆t = 5 min, and a year is divided into intervals of 5 min in length. Raw consumption data is measured at a frequency of 4 times per second with the network analyzer-Chauvin Arnaux (Chauvin Arnaux Metrix, Paris, France). Unfortunately, raw data have not survived. After the measurement, raw data have been averaged to 10 s of time series data. In the next step, data were converted to 5 min averaged interval data. Production data was processed from the 5 min averaging interval. Generation and loads are sampled equally. Figure 3 shows the data for one week in December 2015 in 5 min periods of energy units. Battery and WH capacities are considered usable net values. Adding supercapacitors as levelling elements to decrease excess power from wind generator to batteries in our case is not used because of the small probability to increase maximum power allowed to batteries. Energy-related parameters such as WH temperature are not appraised, and neither is the energy necessary to reach WH minimal temperature of 55 • C, to avoid proliferating Legionella bacteria [36]. Operating temperature is assumed to have been attained, and the state-of-charge charge/discharge dependency is neglected. supercapacitors as levelling elements to decrease excess power from wind generator to batteries in our case is not used because of the small probability to increase maximum power allowed to batteries. Energy-related parameters such as WH temperature are not appraised, and neither is the energy necessary to reach WH minimal temperature of 55 °C, to avoid proliferating Legionella bacteria [36]. Operating temperature is assumed to have been attained, and the state-of-charge charge/discharge dependency is neglected. The annual output of the WG is scaled to match the annual load as closely as possible. A typical private household's load pattern is considered with non-shiftable (NS) and hot water production (B) parts. The recorded annual electricity consumption was 3473 kWh, 47% (1632 kWh) being allocated to NS, and 53% (1841 kWh) to B, based on real measurement data [37]. We aimed to test the developed model and algorithm from our measured data. The Nordic climate conditions in Estonia are very changeable and even harsh given the very cold weather conditions in winter. Climate conditions are also accompanied by consumption data. The annual output of the WG is scaled to match the annual load as closely as possible. A typical private household's load pattern is considered with non-shiftable (NS) and hot water production (B) parts. The recorded annual electricity consumption was 3473 kWh, 47% (1632 kWh) being allocated to NS, and 53% (1841 kWh) to B, based on real measurement data [37]. We aimed to test the developed model and algorithm from our measured data. The Nordic climate conditions in Estonia are very changeable and even harsh given the very cold weather conditions in winter. Climate conditions are also accompanied by consumption data.

Simulation Model
In our simulation model, we first consider the control of energy flows in the power supply system of a private house that is sourced from a wind generator and that also has access to a utility grid. In Figure 2 we see the configuration of the microgrid (MG). The load controller in the center regulates sharing of energy produced by the generator. This model has been created based on the principle that has been introduced in the sources [18,38]. This model belongs to multi-period multiple time scales over the year type [39]. In selecting wind turbine production data, we have based our analysis on one-year data with average wind conditions. Thus, the results of the simulation do not reflect the results for the different years to be taken into account when using outputs. This methodology does not command forecasting or economic issues [40]. These topics are planned in the following studies.
The sharing algorithm in every time interval is as follows [41], the variables denote (all in kWh): X 1 : is the output energy of wind generator in the current interval. X 2 : is the energy stored in a battery in the current interval. Z 1 : is the energy needed for NS consumption in the current interval. Z 2 : is the energy needed for hot water equipment in the current interval.
The simulation algorithm is delineated as follows: (1) Next time interval is opened. Main action-the rest of the energies from previous intervals is transferred to the current one. (2) WG output X 1 first satisfies NS loads Z 1 . (3) If X 1 > Z 1 , the quantity X 1 -Z 1 forwarded to WH. Steps 4 and 5 are skipped. (4) If X 1 < Z 1 , the quantity Z 1 -X 1 is taken from the battery, if possible, i.e., if Z 1 -X 1 < X 2 .
Otherwise, missing energy comes from UG. (5) Energy Z 2 is taken from a battery or UG. (6) Energy movements saved.
If the process does not require all the energy produced in the current time interval, the excess will move to the battery, and if there is still more energy left after that, it will go to the utility grid.
For evaluation of effectiveness and distinguishing these configurations and energy flows, this paper introduced and used a new cover factor. In literature, one can find several forms of cover factors. In our numerical experiments, expressed in detail below, the following formula was applied: where: 1. Y D is the demand cover factor.

2.
W 1 is the total annual amount of energy produced by WG, which is directly consumed by NS devices needs.

3.
W 2 is the total annual amount of energy produced by WG, which is used with hot water consumption from WH.

4.
W 3 is the total annual amount of energy produced by WG, which is used for NS consumption from the battery during the year. If the WG is unable to supply directly to NS load, the missing energy will be taken from the battery.

5.
W 4 is the total annual amount of energy flowing back from BB to MG. This is if there is not enough power in the battery and WH, then the energy is taken from BB. This is new in this paper. The flow is depicted as Arrow D in Figure 1b and is decisive for finding the new demand cover factor value Y D . If there is not enough energy in BB, it is taken directly from UG Arrow C on Figure 1b. 6.
W total is the total annual amount of energy consumed for water heating and nonshiftable load, in other words, the total energy consumption of the entire household.
The cover factor, shortly, is the ratio of energy produced by the wind generator, which is consumed in the household under consideration. It is easy to see that the following inequalities hold: Indeed, Y D = 0 only when the wind generator exceptionally does not produce anything during the year. Denote with W the total annual amount of energy produced by the wind generator. For batteries in microgrid and BB, one can only load energy from a wind generator. It means that energy flow through Arrow E on Figure 1b can be only from the wind generator. The same holds for Arrow D and the same fact is true for MG battery. Y D has no unit.
We have, therefore, the following expression: Because the energy amounts W 1 , W 2 , W 3 , and W 4 used for microgrid consumption loads are produced by the same WG during the year. Mention that the initial conditions for energy in storage devices are set to zero in simulations. As the consumption from WG cannot exceed the total consumption inside MG then: The last inequality holds because the total consumption load W total may contain a part of energy acquired from the utility grid as we see from Steps 4 and 5 of the algorithm. According to the definition based on Equation (1) of cover factor Y D , calculation from Equation (4) concludes that Y D ≤ 1. Therefore, the inequalities in Equation (2) are proved.
The microgrid solution we offer, together with the BB between MG and UG, is subject to certain limitations. This solution is designed to meet the needs of a private house as it is detailed in the above described methodology. This system is built on the principle that the uncertain parameters of the WG output power are grounded in storage devices such as WH and batteries. The present approach adopted in this work is mainly focused on componentand system-level design approaches rather than taking system parameter uncertainty modelling as done by the source [42] or by using robust optimal energy management [40]. There is no way to include electric car chargers in this system, nor, for example, fast boilers. To do this, the microgrid must be built differently, given the larger instant consumer power.

Results and Discussions
To achieve the goals of this work, computer simulations were carried out. The whole energy system of the household Figures 1 and 2 is inserted into a simulation model with linear charge and discharge characteristics. The input variables for the model are the yearlong time series of wind generator output; non-shiftable loads; hot water consumption. The length of all three time series is 105, 120 and this is also the number of time intervals we used.
To estimate the coincidence between generation and load, the cover factor described by Equation (1) is applied. Cover factor Y D characterizes the local generation/demand ratio. The simulation is based upon flow charts in Figure 1.
Based on Figure 4, the values of microgrid equipment parameters for numerical simulation experiments have been fixed. Because of practical considerations and expert assessment, the capacitance values of both the microgrid battery and WH are chosen to be 6 kWh. In future work, we intend to find a numerical method for the quantitative evaluation of these values and estimation of cover factor Y D increments.  In the next stage of the simulation experiment, the amplification coefficient RS was introduced to find the dependence in wind generator production of energy flow from microgrid through BB to utility grid Arrow F in Figure 1b and vice versa Arrow A in Figure 1a. The amplification coefficient (RS) is the ratio of the energy produced per year In the next stage of the simulation experiment, the amplification coefficient R S was introduced to find the dependence in wind generator production of energy flow from microgrid through BB to utility grid Arrow F in Figure 1b and vice versa Arrow A in Figure 1a. The amplification coefficient (R S ) is the ratio of the energy produced per year by the wind generator to the energy consumed in the microgrid. With different values of coefficient R S , the output of the wind generator is multiplied. Figure 4 depicts energy flows, where R S varies between 0.8 and 3. At the crossing point or collocation point of two lines, R S = 1, (it means the original production time series), the absorbed and injected energy become equal. Further increase of R S results in a linearly growing part of generated electricity fed into the utility grid. The energy, absorbed from the UG, is characterized by a slightly falling line.
In equilibrium Figure 5, the exported and imported energy equal both 1401 kWh, with Y D being = 0.597. Even a minor wind generator over-leverage results in significantly more electricity being injected into the utility grid. The next experiment examines the dependency of energy flows from the buffer batter size. Figure 6 shows the direct energy flow from grid to MG Figure 1b Figure 5, the grid-to-microgrid energy is equal to 1180 kWh, while BB-t microgrid energy becomes equal to 221 kWh Figure 6. These two numbers sum up as 140 kWh, which is valid for the "bufferless" case Figure 5. The same approach can be applie to other RS and BB values.  The next experiment examines the dependency of energy flows from the buffer battery size. Figure 6 shows the direct energy flow from grid to MG Figure 1b, Arrow C. Figure 6 depicts the electricity flow back from BB to MG Figure 1b Arrow D. Considering BB size 10 kWh in Figure 5, the grid-to-microgrid energy is equal to 1180 kWh, while BB-tomicrogrid energy becomes equal to 221 kWh Figure 6. These two numbers sum up as 1401 kWh, which is valid for the "bufferless" case Figure 5. The same approach can be applied to other R S and BB values. size. Figure 6 shows the direct energy flow from grid to MG Figure 1b, Arrow C. Figure 6 depicts the electricity flow back from BB to MG Figure 1b Arrow D. Considering BB size 10 kWh in Figure 5, the grid-to-microgrid energy is equal to 1180 kWh, while BB-tomicrogrid energy becomes equal to 221 kWh Figure 6. These two numbers sum up as 1401 kWh, which is valid for the "bufferless" case Figure 5. The same approach can be applied to other RS and BB values.   Figure 7 depicts the electricity flowing back from BB to MG Figure 1(b) (D). Considering BB size 10 kWh Figure 5 the grid-to-microgrid energy is equal to 1180 kWh, while BB-to-microgrid energy becomes equal to 221 kWh Figure 5. These two numbers sum up as 1.401 kWh, which is valid for bufferless operation Figure 4. The same approach applies to other RS and BB values as well. In Figure 7, energy amounts are in the y-axis on the Formula 2 fraction line the fourth member W4.  Figure 8 depicts the energy flow from BB to UG. If RS = 1 when moving to UG energy amount is 1164 kWh, which is nearly equal to MG entering energy flow, that is 1180 kWh, as in Figure 5. It was found that this difference is not decisive. The small difference is caused by RS = 1 overproduction of 100 kWh from consumption, which is due to scaling conditions. Energies 2021, 14, 1553 Figure 8 depicts the energy flow from BB to UG. If R S = 1 when moving to UG energy amount is 1164 kWh, which is nearly equal to MG entering energy flow, that is 1180 kWh, as in Figure 5. It was found that this difference is not decisive. The small difference is caused by R S = 1 overproduction of 100 kWh from consumption, which is due to scaling conditions. Increasing RS moves all residual energy to UG, as seen in Figure 8. In Figure 9, it can be seen dependence from BB size to cover factor by different RS. The reasonable capacity of BB is 10 kWh. If BB = 0 when by RS = 1 is YD = 0.597 and by BB = 10 kWh YD = 0.66. If we have RS = 2, when YD = 0.796. As seen in Figure 9, the cover factor increase occurs when RS is much bigger than the BB size, but BB size multiplies RS influence. Based on Figure 9, results reveal that both, the BB and RS have an obvious influence on the demand cover factor. This suggests that the greater capacity factor of WG causes an additional increment in YD. Increasing R S moves all residual energy to UG, as seen in Figure 8. In Figure 9, it can be seen dependence from BB size to cover factor by different R S . The reasonable capacity of BB is 10 kWh. If BB = 0 when by R S = 1 is Y D = 0.597 and by BB = 10 kWh Y D = 0.66. If we have R S = 2, when Y D = 0.796. As seen in Figure 9, the cover factor increase occurs when R S is much bigger than the BB size, but BB size multiplies R S influence. Increasing RS moves all residual energy to UG, as seen in Figure 8. In Figure 9, it can be seen dependence from BB size to cover factor by different RS. The reasonable capacity of BB is 10 kWh. If BB = 0 when by RS = 1 is YD = 0.597 and by BB = 10 kWh YD = 0.66. If we have RS = 2, when YD = 0.796. As seen in Figure 9, the cover factor increase occurs when RS is much bigger than the BB size, but BB size multiplies RS influence. Based on Figure 9, results reveal that both, the BB and RS have an obvious influence on the demand cover factor. This suggests that the greater capacity factor of WG causes an additional increment in YD. Figure 9. Influence of BB size and R S on cover factor. Based on Figure 9, results reveal that both, the BB and RS have an obvious influence on the demand cover factor. This suggests that the greater capacity factor of WG causes an additional increment in Y D .

Conclusions
This paper developed and presented a simulation model of energy flows to investigate the self-consumption of a household with a wind generator as its independent source of electricity. The main assessment parameter is the demand cover factor (1). As input data, time series of typical private household load patterns with non-shiftable (NS) and hot water consumption (B) parts Figure 3, as well as the time series of production of the wind generator (WG) with rated power P nom = 5 kW, were used. This simulation approach is easily generalized/replicated in more complex configurations of households, and also for different individual places such as warehouses, industrial buildings, etc. By increasing local consumption from renewable energy sources, energy losses in the utility grid and greenhouse gas emissions are reduced.
The study demonstrated that a buffer battery introduced between the utility grid and household inner microgrid has a notably positive influence on the demand cover factor. As a result, it is possible to reduce the amount of energy purchased from the utility grid, as seen in Figures 6 and 7. Figure 6 shows that if BB = 10 kWh, R S = 1, is purchased from UG to MG 1180 kWh. If R S = 2 and BB= 10 kWh, we only need to buy 701 kWh of electricity from UG. Wind turbine oversizing is reasonable based on these calculations, as wind production varies greatly over the years. Figure 7 shows the amounts showing how much less electricity we buy from UG compared to BB = 0.
It was proved that the production of the wind turbine is crucial for the value of the demand cover factor. To demonstrate this, the amplification coefficient R S was introduced to find the dependency of wind generator production of energy flow from microgrid to the utility grid and vice versa. Figure 9 shows that compared to the baseline situation as R S = 1 and BB = 0 Y D = 0.597 then in a situation where R S = 2 and BB = 10 kWh are Y D = 0.796. This is a significant increase.
Moreover, the amplification coefficient R S affects the cover factor only when applied to wind generator production. Numerical experiments showed that when applied to consumption data, the change is marginal.
Future research may focus on the WG production forecast and economic factors and parameters, which should be included in real simulation models.