Smart energy coordination of autonomous residential home

The smart grid technology permits the revolution of the electrical system from a conventional power grid to an intelligent power network which has led the improvements in electrical system in terms of energy efficiency and sustainable energy integration. This study presents the energy management/coordination scheme for domestic demand using the key strategy of smart grid energy efficiency modelling. The structure consists of combining renewable energy resources, photovoltaic (PV) and wind power generation connected to the utility grid with energy storage system (ESS) in an optimal control manner to coordinate the power flow of a residential home. Based on the demand response schemes in the framework of real-time electricity pricing, this work designs a closed-loop optimal control strategy that is created by the dynamic model of the ESS to compute the system performance index, which is formulated by the cost of the energy flows. A dynamic distributed energy storage strategy (DDESS) is implemented to optimally coordinate the energy system, which reduces the total energy consumption from the main grid of more than 100% of the load demand. The designed model introduces a payback scheme while robustly optimising the energy flows and minimising the utility grid's energy consumption cost.


Nomenclature
Indices c(ch), dc(disc) indices of charging and discharging of the battery b, op indices of battery and opportunity gr(ut), inv, d indices of the utility grid, inverter and demand pv, wt, avg indices of photovoltaic (PV), wind turbine and average max, min indices of maximum and minimum

Parameters and constants
A area (wind turbine swept area, PV area) CB capacity of battery C P coefficient of wind turbine performance Ha hours of autonomy of the battery N, N c time horizon and control horizon pr real-time electricity pricing ρ air air density

Variables
C cost E energy Δt time variation J objective function I solar irradiance measured on the PV k sampling of time of control horizon η efficiency P puissance t time V average wind velocity

Introduction
The energy coordination or management strategy has introduced power flow improvement on the electrical power system. From generation to the consumption of electricity, managing energy is becoming one of the most important strategies to enhance the sustainability of the electrical grid [1]. Since the last decade, the complexity of the utility power grid has required several steps of monitoring, control and protection scheme in real time to improve the overall efficiency of the electrical system [2]. The energy system has become increasingly complex due to energy demand growth, energy generation insufficiency and inaccessibility of the utility grid to several people globally. The integration of renewable energy resources (RERs) permits the utility to solve some technical issues [3]. Due to generation uncertainty [4], renewable energy creates several challenges on the quality of the power flows into the electrical system [5,6]. Nevertheless, energy management assists in solving these problems.

Motivation
The smart grid technology is considered as one of the main solutions to several challenging questions of the current power grid. The intelligent electrical system assists in handling uncertainties in schedules and power transfers across sections. By integrating RERs, optimising the transfers' capability of the transmission and distribution networks and meeting the demand requirements for increased quality and reliable supply, the smart grid also introduces a path to manage and solve unpredictable events and uncertainties in operations and planning more aggressively. The smart grid technology is based on real-time control implementation to improve the reliability, security and efficiency of the electrical grid. The intelligent grid environment operates from small/large-scale energy generation to the consumers and guarantees the accommodating increase of distributed generation (DG) and energy storage system (ESS) efficiently [7].

Literature survey
Energy efficiency on a smart grid system reduces the overall cost of power and secures the power flow coordination between the energy supply and demand. Several strategies have recently been implemented to effectively manage the energy flow on the different types of the electrical system; from residential usage to industrial consumption [8][9][10][11][12][13][14][15][16].
In [8], an optimal control strategy for residential usage is designed inside the advanced metering infrastructure to control variable load demand intelligently. To improve the effectiveness of energy consumption, the proposed model needs to incorporate RERs to increase system efficiency. In [17], an intelligent system is presented to evaluate the cost saving of residential energy consumption when three appliances and four pricing schemes are considered. The proposed model implements an optimisation strategy of two stages based on mixed-integer linear programming. These two stages aim to first schedule the power in each appliance and then estimate the energy price of each appliance. In [18], a decentralised strategy is introduced to coordinate the load consumption of a residential home based on demand response (DR). The proposed model seeks to develop an intelligent strategy of reducing end users' electricity bills without compromising their comfort and privacy. The model also embeds several, autonomous home energy management systems using smart distribution system. This scheme contains the distribution energy service which combines electricity and communication networks. Nevertheless, designed systems do not consider the integration of sustainable energy such as wind, photovoltaic (PV) and so on.
Furthermore, the evolution of the smart grid provides a platform for efficient integration of RERs into the utility grid. In [19], a load reduction model based on a self-decision making method is designed using a multi-agent system. The objective of the proposed strategy is to consider the coordination of the upstream grid, RER and DR schemes so that the stress from the peak load on the feeder can be minimised. In [20], a smart home energy coordination system is proposed. The model combines small-scale PV generation with the utility grid using smart metering that collects data and controls the allocated power consumption. The proposed approach operates in two stages-based grid operator and smart scheduler, which can optimise the energy demand from the utility grid and improve the efficiency of the home's electricity usage.
Residential home energy management of a smart grid is a practical solution that assists users to deal with the complexity of dynamic electricity pricing scheme [9]. Additionally, residential energy flow coordination permits the integration of sustainable energy resources. The management of the energy flow for a suburban home is very complex. This mostly depends on the different types of load demand that can be found in residential sectors and their time of operation as well as the availability of RERs when they are integrated into the power distribution system.

Contributions
Through smart grid technology, different strategies are developed to coordinate energy flow for a residential consumer. The primary objective of these approaches is to minimise energy consumption and to increase the system efficiency by taking into consideration the load diversity. However, there is still a gap in the context of modelling the residential power flow where the dynamic energy storage is used to coordinate a cost function based on real-time electricity pricing scheme, which considers an energy opportunity cost. The effort and performance of such a system minimise the overall cost of power consumption while providing optimal integration of sustainable energy resources. Thus, the proposed system coordinates the energy from the DERs, which include DG and distributed energy storage (DES) to provide a prospect of the total reduction of energy consumption from the utility grid.
In this paper, the DG includes PV and wind power generation. Therefore, the contributions of this work are outlined as follows: • Through the use of smart metering, develop a robust optimal control model to coordinate the energy flow relationship between generation and consumption for a residential smart home application. The model provides an opportunity for the end user to sell the energy to the supplier optimally. • Design a dynamic algorithm of DES based on closed-loop optimal control technique, which implements a real-time electricity pricing scheme through the hourly energy price of different energy generation components. This strategy aims to formulate the system performance index to penalise the use of energy from the utility grid and to hold a profit from other energy generations (DERs including PV, wind turbine and DES as well as opportunity energy). • Present speculative execution of the proposed model by varying the initial state of charge (SOC) of battery systematically within its set minimal and maximal values to analyse the system improvement. Besides, the dynamic distributed energy storage strategy (DDESS) model proves its effectiveness in the context of energy saving, where two scenarios of the performance index are analysed. The saving of the proposed system can vary between 61 and 157% of total energy to pay the utility grid.

Organisation of paper
The remainder of this paper is structured as follows. Section 2 presents a literature survey of the related research works. Section 3 explains the system problem by providing a schematic of the relevant components. Section 4 presents the design approach and the optimisation technique of the described problem. In Section 5, the results of the system design are presented. Finally, Section 6 provides a conclusion and gives suggestions for future work.

Review of related works
Through smart grid technologies, home energy coordination is structured into three main components, which are the energy production system, energy consumption system and prosumer energy system. The production of energy can contain residential PV, micro-wind turbine and utility supplier or main grid [21]. The consumer is mostly based on residential home appliances with different types of load demands (flexible or non-flexible loads, thermal or non-thermal loads). The prosumer is based on two principal dynamic characteristics, which consist of being a supplier and/or a consumer of the energy. Currently, most energy prosumers on the residential side are battery storage system and electric vehicles [22]. Several strategies have been used to manage the energy flows in the residential sector. In [10], a multi-objective mixed-integer non-linear programming model is developed to handle DR strategy through an energy management system of a smart home by taking into consideration the energy saving and the thermal comfort zone for residential users. The system formulates and evaluates a real-time electricity pricing scheme through different operating conditions. The model considers the optimal operation of the management of devices and units while ensuring the heating system based on the thermal demand and user's comfort level. The efficiency and robustness of the model are tested under different heating/cooling scenarios. In [11], DR is developed as a potential structure to evaluate the system air conditioning loads for residential application. The system creates a model based on the aggregated residential air conditioner in which the total system power is a function of indoor and outdoor temperatures. Based on this structure, the system temperatures are taken into account in the evaluation process at the system level with the DR strategy to predict the residential air conditioning loads. It is observed that the residential air conditioner is one of the essential factors to ensure DR strategy and guarantee the effective regulation of the system. This structure increases the economy of grid operation and enhances the capability of resources.
Luo and co-workers [9] have proposed a new home energy management system in the framework of real-time electricity pricing scheme and high residential PV penetration. The energy management system devises the operations model of the appliances and an advanced adaptive thermal comfort model to measure and evaluate the user's indoor thermal comfort level. The designed system coordinates the energy source's scheduling problem, which is solved by a novel biological self-aggregation, intelligent, inspired algorithm. Through the simulation's analysis, it is observed that the proposed model improves the automation of the residential building and can effectively respond to renewable energy output and real-time pricing. An effective energy management system for a residential microgrid is presented in [12]. The model implements a multi-objective optimisation strategy to cover different aspects of the designed system. This scheme consists of distributed heat and electricity generation, heat transfer and thermal dynamics of sustainable residential buildings and load scheduling potentials based on household appliances with system constraints. The proposed model can coordinate all levels of energy management from the supply to the demand side while taking care of the home comfort system. Through optimal scheduling and operation coordination of the energy flow, the proposed model can also conserve energy to reduce the energy consumption cost and efficiently provide an acceptable comfort level. In [23], a residential home energy management system is developed under a DR strategy to minimise the total energy cost. The system coordinates multiple residential households into a decentralised online control algorithm, which is implemented by a Lyapunovbased cost minimisation strategy. The proposed algorithm uses the DR structure to optimise the energy flows on the entire electrical system. The designed model has the possibility of reducing the total power of the system with a condition of having several elastic and delay tolerability of several energy loads on the demand side. In [24], households are categorised into two types of demands, namely essential and flexible demand. The scheme aims to intelligently coordinate energy consumption management, complex demands and operation delay. The delay on the system operation is mostly caused by the flexible load, which is characterised by delaysensitive and delay-tolerant demands. Through a centralised algorithm, an adaptive dynamic programming model is designed to formulate an optimisation-based decision that can minimise the total energy cost and the operation delay for the flexible demands.
An intelligent residential energy management scheme under DR strategy is developed in [25]. The proposed model aims to meet future demand by introducing an alternative solution to energy generation from renewable energy technologies for residential usage. The structure is built under an optimal approach to minimise the electricity bills and maintain the energy demand limits subject to different constraints. This system algorithm implements a performance index that coordinates different types of loads which depend on the electricity price horizon. In [26], a residential energy hub which contains renewable energy, natural gas generation, electric vehicle and storage system is proposed under a probabilistic optimisation scheme. The proposed model optimally deals with the uncertainty from the solar panel and the coordination of varying energy generation to increase system efficiency. In [27], an alternative energy coordination control framework which takes into account demand behaviour is developed to improve the system effectiveness. The model uses the DR strategy through hidden Markov modelling techniques to detect consumer behaviour from real-time aggregate consumption. Additionally, the system considers the dynamic activity recognition model to build up an optimisation strategy to control and schedule user's appliances.
Barmayoon et al. [28] have proposed an economic dispatch approach to assess the impact of energy tariff and storage size optimally. As the battery storage is the leading solution for renewable energy application in the residential sector, it can effectively minimise the overall operation cost by ensuring total supply to the demand side. A stochastic multi-stage decision process that coordinates the relationship of energy from the utility grid, electric vehicle and renewable energy for household electricity demand is proposed in [29]. The model uses a stochastic dynamic programming scheme to manage the strength of a smart home optimally. The model creates an opportunity strategy from the storage system (electric vehicles and battery) to ensure an optimal cost-saving behaviour of the system. However, a gap was observed in the context of opportunity energy that impacts the overall energy saving based dynamic of DES to compute the performance index into all these related works as described in Section 2.
Therefore, this work is an advanced model of creating a flexible communication strategy developed in [30]. This paper develops an optimal control strategy of the energy flow based on the feedback of the dynamic distributed storage using real-time electricity pricing scheme combined with the prepaid tariff scheme. The model incorporates a demand-side management strategy through the consideration of dynamic electrical pricing scheme under realtime electricity pricing model. This scheme, a smart coordination approach, based on data from the system energy flow, is implemented by the dynamic model of the ESS. Besides, the proposed model considers the variation of battery depth of discharge as a function of the SOC to create an optimal dynamic control that can handle the overall system behaviour. Fig. 1 presents the system layout of the proposed model. This system aims to manage the energy generations as a function of energy demand for residential usage. A DER that enables the system to operate as a microgrid connected to the utility grid is coordinated by DDESS to improve energy flexibility on the consumer side. Through the proposed structure of the energy coordination, the model has the opportunity to inject into the main grid a surplus of energy that comes from the DER. It is important to note that the opportunity energy derives from DER and is considered at the time where the energy demand is less than the energy from the DER.

Problem description
Based on Fig. 1, if the opportunity energy is equal to zero, the energy flowing on the system can be described by (1). When the opportunity energy is greater than zero, the energy flow of the system is expressed by (2). In this case, it is assumed that the energy from DER is superior to the energy demand at a specific given time t of DDESS where E d (t) is the energy flow on the demand side, E wt (t) is the energy generated by the wind turbine, E pv (t) is the energy generated by the PV, E gr (t) is the energy supplied by the utility grid and E dc (t) is the discharge energy from the storage system which is As described in (2), when the energy from DER is of the vital value to cover the total energy demand at a given time, the surplus energy from DER is considered as opportunity energy, and it can be described as follows: where E op represents the opportunity energy. It is important to note that during the charging state of the battery, the opportunity energy is negligible.

Utility grid system
The energy throughout the main grid is a function of its energy generation that is supplied by the distribution system operator to the consumer and the opportunity energy form DER, as shown in Fig. 1. These relations are summarised by where E ug is the energy flow on the utility grid. For the proposed model, the electricity price is considered to be a prepaid tariff, which is combined with a real-time electricity pricing scheme as developed in [30].

Energy storage system
On power system applications, the battery energy storage system (BESS) is considered as one of the best strategies to enhance system operation efficiency in terms of voltage and frequency control, coordinate the power flow and improve short-term capacity of the electrical system [31]. Thus, several relations can define the dynamic model of the battery based on the improvement applications. By considering the battery SOC, a function to establish a dynamic model of the energy storage, this relation is expressed as follows [32]: where SOC(t) is the state of charge at a time t, SOC(0) is the initial state of charge, E ch (t) and E disc (t) are, respectively, energy flows on the battery during charging and discharging period, and it is assumed that n c and n d are charging and discharging parameters, which will be detailed in this subsection. Through the dynamic strategy, the initial SOC can be incremented as each sample of time to the next value of the SOC. In [33], an analytical model of battery energy storage is presented for an optimal cost based model of sizing a hybrid system with energy storage. This model describes the structure of the battery SOC and different parameters that are related to this equation as defined in (6). During charging states of battery, by considering Fig. 1, (6) can be rewritten as follows: where η ch is the charging coefficient of the battery, η inv is the inverter coefficient and CB is the capacity of the battery. While on discharge case, (3) can be taken into consideration to describe the energy on the battery storage. Equation (6) can be rewritten as where η disc is the discharging coefficient of the battery. In this case, the capacity of the battery is determined by (9) below as

CB =
Ha ⋅ E d . avg η inv ⋅ n disc ⋅ DOD (9) where Ha is the hours of autonomy of the battery, E d . avg is the average of hourly demand and DOD is the depth of discharge of the battery. The DOD is varying disproportionally to the SOC.
When it is assumed that the operating efficiency and the battery ageing are negligible, the depth of state of the battery can affect expression as a function of the SOC in the relation below [34]: By updating (10) to (9), it can be seen that the capacity of the battery is also a variable which varies as a function of time. This variation can then be taken into consideration by the SOC during charging (7) and discharging (8). Therefore, the SOC of battery defined in (6) can be rewritten as n dc (t) = 1 η disc ⋅ η inv ⋅ CB(t) It is important to note that the charging and discharging parameters, as described in (14) and (15), are a function of time due to the depth of discharge described in (10), which makes the battery capacity a function of time.

Wind turbine system
The energy generated by the wind turbine depends on the electrical power production. This expression is formulated as follows [30]: where P wt is the average power demand at the given time, η wt is wind turbine efficiency, ρ air is the air density, C P is the coefficient of wind turbine performance, A is the wind turbine swept area and V is the average wind velocity of given time. Suppose the system is implemented at a given time horizon N, the energy generated by the wind turbine can be determined as where t is the sample time, and Δt is the time variation of the selected time horizon N.

PV system
For the PV system, the power that can be generated is expressed by (18). This relation expresses that the power produced by a PV panel varies proportionally as a function of the surface of the panel and the level of solar radiation which that surface can receive [30] P pv = η pv ⋅ A p ⋅ I where P pv is the power generated by the PV for a given time, η pv is the PV efficiency, A pv is the active surface of the PV and I is the solar irradiance measured on the PV for a given time. For a specified time horizon N, it can be calculated as for wind turbine the energy generated by the PV as follows: Assuming the system horizon is about a day, namely N = 24 h, the energy consumption or daily load demand from the residential home as presented in Fig. 1, and the average wind velocity described in (17) as well as the solar irradiation on the PV can be given in Table 1 [30].

System design and optimisation technique
The designed DDESS principally aims to optimise the system energy flow by providing a significant reduction of the energy cost from the utility grid. The model also maximises the energy flow on the DER side and creates an opportunity to supply the utility grid when there is surplus energy. The design of the system consists of implementing a performance index of each component, as presented in Fig. 1. Additionally, this structure is based on realtime electricity pricing scheme combined with the prepaid electricity tariffs. Fig. 2 presents the schematic overview of the system design based on DDESS. The optimal control system aims to coordinate different switching systems represented by S1, S2, S3, S4, S5 and S6. Suppose a given electrical system which is only supplied by the utility grid and if the sample time t is identified in time horizon N, the energy cost of the consumption can be determined as follows: where C gr is the cost of energy consumption from the utility grid when the energy opportunity is assumed to be negligible and p r gr is the price of energy to pay the utility grid. It is important to note that this price is supposed to be a combination of real-time electricity pricing scheme and the prepaid electricity tariffs in terms of design implementation. For the DER, the energy consumption cost is seen on the demand side, and the opportunity cost of the energy can be determined using the same structure developed in (20). However, in this case, real-time electricity pricing is combined with renewable energy pricing, which is represented by p r DER . Equations (21)-(24) represent the different energy costs from DER as follows: where C wt , C pv , C b , C op are the energy costs from the wind turbine, PV, DES and the opportunity energy cost. The performance index of the DDESS system is based on (20)- (24). The objective function consists of creating an optimal structure within which the closed-loop model will be implemented. This optimal control structure is presented as where J(k) represents the system performance index, k is the sample of time which is assigned at system control horizon N c and j is the level or the time variation of the control horizon. From the second term of (25), it indicates that the design model shown in Figs. 1 and 2 minimise the energy cost from the utility grid while maximising the use of energy from the DER.
The opportunity cost (24) can also be set in the function of the utility grid electricity price. Thus, the performance index (25) can be rewritten as

System constraints
Based on the system performance as described in (25) and (26), the limitations of DDESS can be defined. The mutual energy flow relation of the system as illustrated in Figs. 1 and 2 describes the constraints of the structure of the DDESS.
For energy consumption, the system constraints depend on all components that supply the load demand. The energy consumption constraints are a function of (1). This relation is assumed to be an equality constraint, and it is expressed as a function of the sample time k as Based on the restriction of (27), the utility grid constraints can be determined as The DG (PV and wind turbine) will be limited as The DES, as described in Section 3.2, assists in determining the SOC constraints and the energy flow on the battery constraints. For the energy flow on the battery, these constraints are the same during the charging and discharging period. Thus, battery constraints are as follows: It is important to note that the limitations on the energy flow on the battery can be changed from a negative value to positive reciprocally. This charging variation depends on the state in which the energy storage is operating. However, in this case, it is assumed to be taken positively based on the formulation of the performance as described in (25) and (26). Some additional constraints are added to the system implementation. These are the opportunity constraints which are based on (4) and (5), and the system lower and upper limits which are assigned to the energy flow limits of each parameter on the system, as shown in Fig. 2. Thus, the computing of the DDESS is based on the implementation of (25) and (26) subjected to all given constraints in Section 4.1.

System algorithm
In this paper, the system implementation is a function of the control horizon and the assigned time horizon N that make up the DDESS. By accomplishing a structure of the designed model optimally, the following steps describe the system implementation: Step 1: Determination of the control horizon N c and simulation time horizon N.
Step 2: System parameters updates at a sample of time, chosen to be k * .
Step 3: Smart meter reading of the energy flows on the different components of the model as described in Fig. 1.
Step 4: System constraints updates at the chosen sample time, as described in step 2.
Step 6: Find the optimal value of the energy flow.
Step 8: Repeat the system process from step 2 to step 7 until it reaches the simulation time horizon N.
Step 9: Generate the optimal solution of the system. Table 2 defines the essential values of the simulation for the proposed DDESS. The values presented here are mostly for the DES and the installed capacity for DG (PV and wind turbine). The amount of E d . avg (the average hourly demand) is determined by using the daily average of energy demand as described in Table 1.

Simulation results and discussion
All minimum values of the system are set to zero except the minimal value of the SOC of the battery as described in Table 2.
The maximum values of the energy flow for each component are limited in the function of the maximal value of the energy demand. This strategy is made by hypothesising that the given energy generation system can supply the demand on its own. Except for the DG, based on their installed capacity, the maximum values of the PV and wind turbine can be limited to their capacities as described in Table 2. However, for the optimal solution to satisfy the system constraints, the hypothesis of assigning all maximal values to the peak value of the energy demand is accepted.

Simulation results
The results of simulations for the designed DDESS are presented in Figs. 3-8. Those results are implemented by considering the different values of the initial SOC of the battery. Based on the maximal and minimal values of the SOC of the battery as described in Table 2, eight different initial values of SOC of the battery are selected to test the performance of the system vis-à-vis energy saving. The selected values are 90, 85, 80, 75, 70, 65, 60 and 55%. It is necessary to note that these values are not presented as a percentage as described in Figs. 3-8. Thus, all values are divided by 100 and presented in a unit range to avoid congestion on the label of figures. Fig. 3 presents the optimum results of DG (PV and wind turbine) during the selected values of SOC of the battery. In  The same profiles are compared to the generating energy from the PV when the PV is not supplying any load. In Fig. 3d, the same structure for Fig. 3c is used to show the flow of energy on the wind turbine. It is observed that the energy flow on the DG, as described in Fig. 3, has the same pattern for each setting value of the SOC of the battery. The profile confirms that the system is robust enough in terms of energy generation from renewable energy. It can be concluded that there is no loss of energy from DG because what is produced is also consumed by either consumer or prosumer (battery storage). Figs. 4 and 5 show the pattern of the energy flow for the battery, from the utility grid to the consumer, and from the DER to the utility grid. The profiles are presented for different set values of the initial SOC of the battery, namely the first four and last four settings of the initial value of the SOC. Figs. 4a and 5a give the different patterns of the energy consumption from the utility grid. The first four set initial values provide the same profile of the energy consumption from the utility grid, but for the last four values, a change of each set of values is observed as shown in Fig. 5a. The same patterns are also seen in Figs. 4c and 5c for the energy from DES to the consumer, which is the discharging of the battery. However, the energy flow during the charging of battery has kept the same profile during each change made for the initial value of the SOC, as shown in Figs. 4b and 5b. Additionally, for the opportunity energy that flows from the DER to the utility grid, the existence of an opportunity for the first four initial values of the SOC is observed (Fig. 4d). In the last four (Fig. 5d) there is no opportunity pattern provided on the system.

Discussion and analysis of results
Figs. 6 and 7 give the profile of the different set values of the initial SOC inside their limitations, namely maximal and minimal SOC of the battery. The designed DDESS is robust enough to ensure optimal energy flows on the residential sector under the smart grid framework. The model gives the consumer the possibility to optimise the total energy consumption by minimising the energy from the utility grid. Besides, Fig. 8 presents the optimal control behaviour of the intelligent smart switching system. Different switching devices, namely S1 to S6, are presented. Fig. 8a confirms the energy pattern of Figs. 3, 4b and 5b. The same observation is also made from Figs. 8b and 8d. Additionally, in Fig. 8c, it is seen that S5 (energy from the utility grid switch) is on during all system horizon, but no opportunity energy flows on the system, Fig. 8c (S6 is off). The energy from the utility grid is still minimised, as described in Fig. 5a. Thus, the optimal behaviour of S6 for the last four values of the initial SOC of the battery depends on the availability of DERs (Figs. 8b and c (S5)).
By considering Figs. 6 and 7, it is also observed that the optimal solution of the energy storage is a function of the optimal probability from the performance index. By observing the availability of the opportunity energy in the relation of the SOC pattern, it is deduced that even between 75 and 55% of the initial SOC, it is possible to have opportunity energy. However, the optimal solution does not allow the performance index to generate any opportunity energy so that the system can conserve its robustness. This mostly depends on battery parameters, such as capacity and hourly discharging. Increasing the capacity of the battery can provide a large energy opportunity in the system but will require a large-scale RERs component. Thus, it is observed that the system saving of energy and cost, in which the consumer can use to pay the utility grid, depends on the initial value of the SOC of BESS. When this value is close to the maximal value of SOC of the battery, there is an essential saving, but when the initial value is closer to the minimal value of the SOC battery, the saving decreases.
Suppose the optimal energy that the consumer is supplied from the utility grid, as described in Figs. 4a and 5a, represents the optimal energy (O-Energy), and the energy supply without the implementation of DDESS is called normal energy (N-Energy), two concepts can, therefore, be defined. These are consumer energy payback (CEPB) and consumer excess energy payback (CEEPB). The CEPB is considered as the opportunity energy which is presented in Figs. 4d and 5d, and the CEEPB is the difference between the O-Energy and CEPB. The same procedure is also developed for the cost of energy consumption where O-Cost presents the optimal cost of energy consumption, and N-Cost denotes the normal cost of energy consumption. CEPB and CEEPB conserve the same notation of energy for the cost of energy. Tables 3 and 4 represent the analysis of the results found from the DDESS. In Table 3, the energy consumption of the end user analysis shows that the consumer has a significant value of paying back (CEEPB) between the setting points of 0.9 and 0.85 where the end user can benefit as described in Table 3. However, for the values between 0.8 and 0.55, the CEEPBs are negative. Compared with N-Energy, these values are considered as the minimum energy consumption that the consumer can pay the supplier. Table 4 analyses the cost of energy on the system. It is important to note that the CEPB cost is derivate based on the system performance as described in (25) and the opportunity cost formulated in (24). The same saving observation for the energy structure as described in Table 3 is observed in Table 4. However, in terms of comparison, a significant increase is observed in the cost analysis, as shown in Table 4 compared to the energy analysis in Table 3. This increase is due to the price of renewable energy that was used to compute the CEPB or the opportunity cost. However, saving is of less value. Therefore, the second scenario of the system performance, as presented in (26), can be considered through the computation of the DDESS to improve the system regarding the energy cost saving. It is important to note that system behaviour based on the energy flow is not affected by the two important scenarios as described in (25) and (26). Table 5 gives the energy saving analysis when the opportunity energy, as described in the schematic of Fig. 2, is evaluated at the same electricity price as the utility electricity price. This computation is the result of computing (26). This means that the opportunity energy cost does not contain the DER electricity price but the utility energy price. An important energy cost saving of about 61 to 157% is observed when the DDESS computed (26) as described in Table 5. The saving can reach a peak of about 125% when the opportunity is evaluated at DER electricity pricing. It is necessary to note that the evaluation of the opportunity energy depends on the set policy of a given utility company and its relationship with different energy stakeholders.

Conclusion
This paper has developed an energy coordination structure for an independent residential smart home. An optimal control approach is formulated under a closed-loop algorithm based on the DDESS to compute the performance index of the system through a realtime electricity pricing scheme. The proposed approach is robust in the context of optimal energy flows coordination of DER, utility grid and end user with the consideration of opportunity energy. It is found that the designed algorithm has maximised the use of DG to provide opportunity energy, which brings a significant improvement to the reduction of total energy cost to pay the utility grid. Besides, an intensive energy flowing has been provided to coordinate the DES optimally. The initial value of battery SOC plays an important role in the saving of energy and minimisation of the utility grid's energy cost. It is observed that the system saving improvement of the energy and cost can vary between 61.18 and 157.48% of the total energy to pay the utility grid. Through the smart switching system of the designed model, it is found that the DDESS based on real-time pricing can optimally coordinate the energy flows of a smart home regardless of load demand diversity and different energy resources. Therefore, this work has significant value that can satisfy both the energy supplier and the consumer.
Future research work will be focused on the integration of this approach into a given residential electrical network, which contains several autonomous smart homes to coordinate the electrical grid behaviour in the context energy flowing and voltage regulation at each bus. Additionally, future work can also look at the optimal approach where the electricity pricing is variable in function of the energy flow within a given sampling time expressed in a range of minutes.