An Optimized Home Energy Management System with Integrated Renewable Energy and Storage Resources

Traditional power grid and its demand-side management (DSM) techniques are centralized and mainly focus on industrial consumers. The ignorance of residential and commercial sectors in DSM activities degrades the overall performance of a conventional grid. Therefore, the concept of DSM and demand response (DR) via residential sector makes the smart grid (SG) superior over the traditional grid. In this context, this paper proposes an optimized home energy management system (OHEMS) that not only facilitates the integration of renewable energy source (RES) and energy storage system (ESS) but also incorporates the residential sector into DSM activities. The proposed OHEMS minimizes the electricity bill by scheduling the household appliances and ESS in response to the dynamic pricing of electricity market. First, the constrained optimization problem is mathematically formulated by using multiple knapsack problems, and then solved by using the heuristic algorithms; genetic algorithm (GA), binary particle swarm optimization (BPSO), wind driven optimization (WDO), bacterial foraging optimization (BFO) and hybrid GA-PSO (HGPO) algorithms. The performance of the proposed scheme and heuristic algorithms is evaluated via MATLAB simulations. Results illustrate that the integration of RES and ESS reduces the electricity bill and peak-to-average ratio (PAR) by 19.94% and 21.55% respectively. Moreover, the HGPO algorithm based home energy management system outperforms the other heuristic algorithms, and further reduces the bill by 25.12% and PAR by 24.88%.


Introduction
In recent decades, energy demand around the globe has shown the increasing trend.In past, most of the power generation was being done from fossil fuels.However, to fulfil the increasing electricity demand with minimal emissions of green house gases scientists have worked on the new means of electricity generation: renewable and sustainable energy resources (RSERs).But, the penetration of renewable energy sources (RESs) significantly increased power system complexity and dynamics [1], and the existing power system is not capable of maintaining its stability if the integration of RESs and distributed generation (DG) is done at a large scale.In this context, one of the present solutions is the transformation of the existing power grid into the smart grid (SG) with cutting edge information and communication technologies (ICTs) [2].These advanced ICTs not only enable SG to incorporate the DG and RESs but also enhance the stability and reliability of power system.European technology platform (European Commission, 2006) defines the SG as, "a smart grid is an electricity network that can intelligently integrate the actions of all users connected to it-generators, consumers and those that do both in order to efficiently deliver sustainable, economic and secure electricity supplies".SG has different kinds of operational and energy measures like smart meters (SMs), smart appliances, renewable energy and electric energy storage resources.The vital aspect of SG is the control of power production, transmission and distribution through advanced ICTs.These ICTs enable SG to send control commands within the time limits defined by numerous international standards e.g., IEEE standards 1547 (i.e., the standards defined for the control and management of distributed energy resources) [3].Moreover, SG makes possible the access of the power system operator and end-users at the same time intelligently and efficiently.
The key factors that make SG superior over traditional grids are: two-way communication, advanced metering infrastructure (AMI) and information management units (IMUs).They introduce intelligence, automation and realtime control to power system.The two-way communication in SG not only keeps the end-users well informed about the varying electricity prices, maintenance schedules of the distribution network and events/failures that come either due to equipment failures or natural disasters but also enables the operator to monitor and analyze the realtime data of energy consumption and makes realtime decision about the operation activities and standby generators.A comprehensive comparison of traditional grid and SG features is shown in Table 1.
The SG makes the integration of RESs and DGs practicable and involves the residential and commercial users into demand-side management (DSM) and demand response (DR) activities [4].DSM is the modification of consumer demand for energy through various methods such as financial incentives and behavioral change through education.Usually, the goal of DSM is to encourage the consumers to use less energy during peak hours, or to move the time of energy use to off-peak hours [5].DSM techniques are used to optimize energy consumption pattern, to efficiently utilize the limited energy resources and to enhance the overall efficiency of the power system.The term DR is used for the programs designed to encourage end-users to make short-term reductions in energy demand in response to a price signal from the electricity hourly market, or a trigger initiated by the electricity grid operator.It is a change in the power consumption of an electric utility consumer to better match the demand for power with the supply.DR seeks to adjust the demand for power instead of adjusting the supply.However, it is totally impractical to ask the consumers to schedule their energy usage by compromising their comfort level.Therefore, an automatic home energy management system (HEMS) is required, however, a little awareness of consumers is required to know the benefits of various scheduling schemes.In this context, we present an OHEMS which not only integrates RES and ESS into residential sector but also incorporate residential consumers into DSM activities.
The common objectives of different DSM and DR strategies in SG are the reduction of the electricity cost and minimization of energy consumption in peak hours.To achieve these objectives numerous algorithms for an efficient HEMS have been proposed, such as integer linear programming (ILP) [6], mixed integer linear programming (MILP) [7], multi-parametric programming [8], etc.However, these techniques cannot tackle a large range of various household appliances having unpredictable, non-linear and complicated energy usage patterns.

Infrastructure
Traditional Grid SG

Power system
Centralized generation.Uni-directional flow of energy from utility to the consumers.Decentralized generation.Two-way flow of energy between the utility and the prosumers.

Power Losses
High power losses due to centralized structure and inadequate storage facilities.
Significantly reduces the power losses due to DG at distribution level (i.e., the DG eliminates the losses of transmission network).

Information system Aged metering and monitoring system
Advanced metering and monitoring system: AMI and supervisory control and data acquisition system (SCADA)

Communication system Wired technology Both wired and wireless technologies
ESSs Main storage facility is pump-hydro power plants.

Facilitate the distributed ESSs integration
RSERs Mainly includes dispatchable RESs (Hydro-power plants) Provides decentralized control for RSERs (solar, wind, tidal, geo-thermal and biomass energies etc.)

Self-healing
Reacts to stop further damage.Emphasis is on protection of assets following system faults.
Automatically senses and reacts to actual and emerging contingencies.Focus is on prevention.

Optimization of assets
Negligible incorporation of limited operational data with assets management processes and technologies.Time based maintenance.
Greatly expanded sensing and measurement of grid conditions, grid technologies deeply integrated with assets management processes to effectively manage assets and costs.
Condition based maintenance.

Consumer engagement
No proper involvement of the consumers in DSM and DR activities (i.e., no mechanism to send the varying electricity prices to the consumers in realtime and forced load shedding is carried out to maintain the balance between demand and supply) Provides dynamic pricing, net metering and other incentive based schemes.
Power Quality Focus only on the reduction of failures and interruptions.
Ensure the quality of electricity for the smooth operations of sensitive electronics devices/equipments.
To overcome the deficiencies of the previously proposed HEMSs, this paper presents an optimized home energy management system (OHEMS).The proposed scheme not only facilitates the integration of RES and ESS into the residential sector but also reduces the prosumer's electricity bill as well as the PAR.In addition, the performance of the heuristic algorithms: genetic algorithm (GA), binary particle swarm optimization (BPSO), wind driven optimization (WDO), bacterial foraging optimization (BFO) and hybrid GA-PSO (HGPO) are also evaluated in terms of energy consumption pattern, and electricity bill as well as PAR minimization.First, an energy management system (EMS) is designed using exogenous grid signals; day-ahead pricing (DAP) signal, ambient temperature, and solar irradiance.Then, the heuristic algorithms are applied to get an optimum solution for the formulated objective function.The adequacy of proposed OHEMS is validated via simulations.The simulations are conducted in two stages, in the first case, the benefits of RES and ESS integration are highlighted, while in the second case the performance of GA, BPSO, WDO, BFO and HGPO algorithms based HEMSs is compared in terms of electricity bill and PAR reduction, and uniform distribution of energy consumption patterns.
The rest of the paper is organized as follows.Sections 2 and 3 briefly describe the related work and problem statement respectively.Section 4 deals with problem formulation.Section 5 and Section 6 present the proposed system architecture and algorithms respectively.Results and discussions are presented in Section 7, and the paper is concluded in Section 8.

Related Work
Recently, numerous DSM strategies have been proposed.Their common objectives are the minimization of electricity cost, reduction of PAR, mitigation of carbon emissions, and enhancement of power system efficiency.The appliances scheduling problem has been solved as an optimization problem by numerous classical and heuristics algorithms.In this context, some of the recent studies are given below, and a brief review of some state of the art trends is presented in Table 2.
In [9], the authors present a review of current trends in HEMS and DR in the residential sector.The importance of HEMS for relocating and curtailment of the load is also discussed.They give insights on existing optimization techniques: mathematical optimization, model predictive control and heuristics algorithms.The impact of forecasting uncertainty, devices heterogeneity, computational limitation and timing consideration in the design of optimization algorithms are also discussed.However, the user comfort (UC) and appliances waiting time have not been discussed.The authors in [10], present a compact survey of the current trends in HEMS.The challenges in the implementation of HEMS are discussed and give the insights on current literature regarding DR, DSM, appliance scheduling, and on single or multiple objective optimizations in HEMS.However, the integration of RESs and ESSs into residential sector, their impacts on electricity bill and PAR have not been addressed.
In [11], the authors discussed the importance of energy management and planning in smart cities (SC).The paper presents a review on the planning and optimization of SC energy system.Four areas of SC energy system: generation, storage, transportation and end user are addressed in detail.Although, an ESS is integrated to supports residential load in grid events.But, the scheduling of appliances or relocating of load and ESS in response to dynamic pricing of electricity market has not been discussed.The authors in [12], give insights regarding the ways and manners that facilitate the integration of RESs and DG in the SG and the concept of SCs have been comprehensively addressed.The obstacles to the integration of DG into the existing distribution network have been highlighted.The effect of DG on voltage stability and control at low and medium voltages are also discussed.Moreover, the impact of DG on power quality, power system stability, and related events of voltage sag and swell due to the failure of distributed sources are addressed in a comprehensive way.Although, the authors discussed the impact of DGs and RESs integration on power quality and power system stability.However, the integration of RESs and ESSs into residential sector and their role in DSM programs have been ignored.
In [13], the authors present a detailed review of evaluating trends in smart homes (SHs) and SG.They investigate the effectiveness of various communication technologies: Zig-Bee, Z-Wave, Wi-Fi and wired protocols.The authors point out the merits and demerits of existing technologies, and products available in the market.Moreover, the barriers, challenges, benefits, and future trends regarding the communication technologies and their role in the SG and SHs are also discussed.The authors in [14], demonstrate a residential energy monitoring system (REMS).Three SHs powered by an in-house RES (i.e., PV system) are considered for demonstration.The SH is equipped with data logger system to measure and record the electricity production and demand patterns.The internal and external temperature, as well as the humidity is recorded to accurately schedule the operation of heating ventilation and air conditioning (HVAC) system.However, this paper did not address the integration of ESS to utilize the RE more efficiently.
A. Mehmood et al. [15], present an in-depth review of load furcating (LF), current LF techniques in existing power system, future trends, and its importance for the implementation of future SG is discussed.They elaborate the two major types of LF: mathematical modelling and artificial intelligence based computational models and their subcategories as well.The authors also present a comparative study of various dynamic pricing schemes: realtime pricing (RTP), Time of Use pricing (ToUP) and critical peak pricing(CPP).
Lee et al. [16], present linear programming (LP) based REMS for reduction of electricity cost and PAR by charging the ESS from utility in off-peak hours and is discharged in peak hors.The integration of RESs into residential sector is not considered and the charging of ESS from utility is not an economical solution.In [17], the authors propose an ILP based HEMS with integrated RES for appliances scheduling to shift the shiftable appliances from peak hours to off-peak hours.However, the authors did not consider the UC and ESS integration.The authors in [18], discuss the scheduling of home appliances for designed objective of electricity cost minimization or optimization of electricity consumption pattern.MILP is used to schedule the household appliances and the RES.An in-house RES not only reduces the electricity bills but the surplus energy is also sold to the utility to generate revenue.Although, RES with HEMS is fruitful for both the utility and the prosumer, however, the installation of RES may not be feasible for a single/small domestic consumer.
In [19], the authors proposed a hybrid technique of lighting search algorithm (LSA) and artificial neural network (ANN) to generate an optimal operation patterns of the appliances.Four appliances are modeled and developed in MATLAB/SIMULINK, with pre-defined preferences of the consumer.To optimize the appliances ON/OFF time, and to complete the assigned tasks with minimum cost, a hybridization of LSA and ANN is used.The proposed technique significantly reduces the electricity cost and outperforms the hybrid of particle swarm optimization (PSO) based ANN.However, RES and ESS has not been taken into account to more efficiently minimize the electricity bill.In addition, the reduction of PAR and its impact on power system has not been discussed.
A comparative study of WDO and PSO is done in [20].Household appliances are considered for scheduling with the objectives of cost minimization and UC maximization.Moreover, Knapsack-WDO (K-WDO) is also studied for the same objective functions.Results illustrate that K-WDO perform better than WDO and PSO.However, in the proposed model the integration of RES is not considered and an ESS is used to store energy from grid in off-peak hours which is not a viable solution.
Z. Weng et al. [21], demonstrate a fully automated energy management system (EMS) using reinforcement learning (RL) techniques.The energy management and appliance scheduling problem is solved by observe, learn and adapt (OLA) algorithm which adds more intelligence to EMS.The proposed mechanism significantly reduce the cost and PAR, but UC is compromised.
In [22], the authors discuss the problem of peak demand during certain hours.The concept of clustering and smart charging has been introduced to maximize the benefits in term of cost reduction and UC.A GA-based EMS is designed which efficiently utilizes energy within the clusters by scheduling the ESS and appliances.Results show that by appropriate scheduling of ESS and appliances in RTP environment customer can get maximum saving over electricity bill.The authors in [23] present the comparison of GA and PSO in terms of computational cost and computational efforts.Results show that PSO needs less computational effort and computational cost to reach an optimal solution as compared to GA.In [24], the authors demonstrate an efficient HEMS architecture for implementation of DSM in the residential sector.They combine RTP scheme with ToUP because the use of only RTP signal may shift the peak demand to off-peak hours.To eliminate the creation of new peaks, an objective function is properly formulated and solved by using GA.Results illustrate that the hybridization of RTP and ToUP schemes is effective for reduction of bill and PAR.Moreover, an acceptable trade-off between the UC and cost reduction is also achieved.P. Chavali et al. [25], present a distributed mechanism for REMS and grid optimization using the greedy iterative algorithm.In the proposed technique, the electricity price is used as an invisible hand to optimize the appliances scheduling and energy consumption.The proposed scheme did not consider the user comfort in the problem formulation.In [26], the authors proposed an improved-PSO (IPSO) for the solution of cost minimization problem.Results illustrate that the proposed IPSO brings the user load curve near to the objective curve, where the objective curve and electricity price have an inverse relationship.One of the objective functions is power system stability, and the proposed scheme compromise on the UC by rejecting the load in peak hours.

Problem Statement
The rapid increase in household electronic appliances significantly increase the electricity demand of residential sector.Almost 40% of the generated electricity is consumed by the residential sector [27].Currently, power generation is heavily dependent on fossil fuels and the hour of need is to fulfil the inevitably increasing electricity demand with minimal emissions of greenhouse gases.Therefore, scientists have worked to figure out new means of electricity generation i.e., RSERs.In this context, the integration of RSERs and ESSs become lucrative for the researchers.Moreover, the conventional power grid is already vulnerable to instability due to heavy loaded conditions and will be unable to maintain its stability if the integration of RESs is done at a large scale.So, the research is going on to implement the SG in a distributed manner, and HEMS is an integral part of SG to optimize the energy consumption of household appliances.Keeping this objective in mind, we seek to develop an OHEMS.Our objective is twofold: (i) integration of RES and ESS into residential sector; (ii) energy management through appliances and resource scheduling.In order to achieve the above-mentioned objectives, and to design an efficient HEMS, various algorithms such as LP [28], ILP [29], MILP [30], dynamic programming (DP) [31] and convex programming (CP) [32] have been proposed.However, these techniques have very slow convergence rate, and in some cases, they are unable to handle a large number of appliances.So, the heuristic algorithms such as GA [33], BPSO [34], WDO [35] and BFO [36] are introduced to overcome these problems.The heuristic optimizations are used where it is very difficult to find the exact optimal/feasible points.For example, in case of LP, it is understood that the optimal solution must lies within the solutions points in that pool.However, in heuristic optimization, there might be infinite or more solution points in that solution space and optimal solutions should be any one among those.Moreover, in the aforementioned techniques (LP, ILP, MILP, DP and CP) based HEMSs, the integration of RESs, maximization of UC and adaptability with dynamic pricing are ignored.Therefore, in this paper, not only the heuristic algorithms (GA, BPSO, WDO, BFO, and HGPO) are used to design an OHEMS but their performance is also evaluated in terms of energy consumption pattern, electricity bill and PAR reduction.

Problem Formulation
In this section, the mathematical models and constraints of photovoltaic (PV) system, ESS and appliances are presented.Based on these descriptions, the optimization problem is formulated.

Energy Generation Model of PV System
The house of our smart prosumer is equipped with a rooftop PV system (i.e., RES).Although, the RSERs mainly include solar, wind, tidal, geothermal, biomass, and biogass energies, however, among them the most abundant and almost free of cost (i.e., having small operation and maintenance costs) is solar energy and is available everywhere and to everyone.According to [37], the Earth receives 174,000 terawatts (TW) of incoming solar radiation at the upper atmosphere.Approximately 30% is reflected back to space while the rest is absorbed by clouds, oceans and land masses.Most of the world's population live in areas with insolation levels of 150-300 watts/m 2 or 3.5-7.0kWh/m 2 per day.In this regard, the proposed OHEMS tries to maximize the benefits from PV system and to minimize the electricity bill, carbon emissions and PAR.The output power E PV (t) of PV system in kW at time t is calculated by Equation (1) [38], where, η PV is energy conversion efficiency of the PV system (%), A PV is the area of the generator (m 2 ), I r (t) is the solar irradiance (kW/m 2 ) at time t, 0.005 is temperature correction factor [39], T a (t) is the outdoor temperature ( • C) at time t and 25 is standard room temperature ( • C).The distribution of hourly sun irradiation usually complies with a bimodal distribution that can be considered as a linear blend of two unimodal distribution functions.The unimodal distribution functions could be modeled by Weibull probability density function as shown in Equation ( 2) [38], where, ζ is a weighted factor, α 1 and α 2 are shape factors, together with β 1 and β 2 which are scale factors.

Energy Storage Model
A small capacity ESS is used to store a portion of electricity generated by PV system, it is mainly for exploiting the PV energy more efficiently.The ESS stores the energy only when its storage level is lower then upper charge level.Electricity stored in the ESS at time t is presented by Equation (3) [38], and the electricity charged, the electricity discharged and the self-discharging rate is taken into account.The charging and discharging of ESS would lose some electrical energy, so turn-around efficiency of ESS is considered.
where ES is stored energy (kWh) at time t, κ is time slot duration (hour), η ESS is ESS efficiency, EP Ch is the electric power (kW) supplied to ESS from RES at time and EP Dch is is the electric power (kW) supplied to the load from ESS at time t.
In order to maintain the storage and avoid overcharging/deep discharging, charge and discharge rate of electricity, and energy stored in ESS should not exceed the limits defined by the manufacturer.
where EP Ch UB is upper charge limit of ESS charge rate, EP Dch LB is lower limit of ESS discharge rate and ES Ch UB is upper limit of ESS stored energy.

Energy Consumption Model
Let us suppose that the smart prosumer has two sets of appliances i.e., M and N. The set of shiftable (i.e., can be shifted to low price slots) appliances M = {a 1 , a 2 , a 3 , . . ., a m } and the set of non-shiftable (i.e., will start operation on the time defined by the user) appliances N = {b 1 , b 2 , b 3 , . . ., b n } over a scheduling horizon of t = {1, 2, 3, 4, 5, . . ., 24}.The daily energy consumptions of shiftable and non-shiftable appliances are given by Equations ( 7) and ( 8) respectively, where E a t1,m M , E a t2,m M , . . ., E a t24,m M denote the energy consumption of shiftable appliances and E b t1,n N , E b t2,n N , . . ., E b t24,n N represent the energy consumption of non-shiftable appliances at time t.The total daily energy consumption E total of the prosumer load is calculated as,

PAR
PAR is a ratio of peak load consumed in a time slot t and the average of total load consumed over the scheduling horizon, i.e., from t = 1 to t = 24.PAR tells us about the energy consumption behaviour of the consumer and the operation of utility peak plants have a direct relationship with the consumers PARs.So, it is beneficial for the utility and consumer to reduce PAR so that power supply and demand balance can be maintained.For single user it is calculated as follow, For multiple users "N" it can be calculated as,

Energy Pricing Model
Numerous electricity tariffs are available to define the energy pricing over a day.Such as ToUP, DAP, peak pricing (PP), CPP and RTP [40].In most of the appliances scheduling schemes, the pricing of electricity is assumed to be DAP or ToUP, because the RTP increase the communication complexity.Moreover, in ToUP the pricing horizon is divided into different blocks and a fixed price is defined for each block.In this model, we use DAP in which the price of electricity changes on the hourly basis and remains constant in an hour.The daily electricity bill of shiftable appliances E a P and non-shiftable appliances E b P is calculated by Equations ( 12) and ( 13) respectively, where X a m M (t) represent the ON/OFF state of a shiftable appliance M , X b n N (t) represent the ON/OFF state of an non-shiftable appliance N and P DAP (t) is DAP in the particular time slot t.The electricity bill E P (t) an any time slot t after taking RES and ESS into consideration is calculated as, where, τ is a specific time slot between t 20 and t 24 that having highest bill.As shown in Figure 10 that the RE is not available in those slots, so, the ESS is discharged to reduce the prosumer's electricity bill.

Appliance Scheduling Problem
The main objectives of this work are: to minimize the electricity bill and PAR of the prosumer by optimization the energy consumption pattern.The reduction in consumer PAR is beneficial for utility and all connected consumers, because it reduces the operations of utility peak plants: standby generators.Let us suppose that a utility grid provides supply to N number of users and all of them have HEMSs to optimize their energy consumption patterns and PARs which will definitely results in an optimized grid operation.In this paper, the appliances scheduling problem of a single prosumer is formulated as an optimization problem by using multiple knapsack problems (MKP).MKP is a combinational optimization problem: to select the appliances for a particular hour from a given set of appliances (M and N as defined in Section 4.3).Each appliance has a value X which represents the ON/OFF status of it, and a weight which shows the power rating of the appliance.The number of the appliances to be selected (remain ON) for a particular hour depends on the objective function and the constraints i.e., to pay as minimum electricity bill as possible and the total weight (energy consumption) of the appliances must satisfy the constraints given by Equations ( 19) and (20).The optimization problem is defined as, Objective function: Subject to: where, E grid (t) is the sanction load that an end-user can import from the utility grid at time t, E min unsch is the minimum energy consumed in unscheduled scenario, τ 0 represents the lower limit of scheduling horizon, τ sch indicates the scheduling time and τ max shows the upper limit of scheduling horizon.

Feasible Region
An area enclosed by a specific set of points (constraints of optimization problem) is called feasible region of the solution.Here, the objective function of our optimization problem is the minimization of the electricity bill as given by Equation (18).It illustrates that the electricity bill depends on two factors: amount of scheduled load and electricity price in a particular time slot.As the price signal is defined by the utility and we have no control over it, therefore, to minimize the electricity bill we can only modify the shape of energy consumption pattern.The electricity price (DAP signal) we used has range from 8.1 to 27.35 cents/kWh, and the four possible cases of the electricity bill using this DAP signal and unscheduled load are as given in Table 3.
Based upon the values given in Table 3 and maximum electricity bill in unscheduled scenario, the constraints of the feasible region are, where the constraint C 1 shows that in any time slot t the scheduled load must be greater than minimum unscheduled load and less than maximum unscheduled load, C 2 shows that in any time slot t the electricity bill must be less than maximum electricity bill in unscheduled scenario and C 3 represents that in scheduled scenario the total electricity bill must be less than the total electricity bill in unscheduled scenario.

Proposed System Architecture
In SG, DSM and DR ensure more stable and reliable grid operation.The main objective behind the design and implementation of an HEMS is the reduction of electricity bill and PAR.From the utility point of view, its two main benefits are the management of energy resources and reduction of PAR.While from the consumers point of view, it minimizes the electricity bill.These objectives are achieved only with the modification in energy consumption pattern of shiftable appliances in response to DAP signal of electricity market defined and broadcasted by the utility.
In the proposed OHEMS, it is assumed that in future SG each prosumer will have a HEMS.To meet the energy demand with minimum electricity bill smart prosumer utilizes an in-house RES and an ESS along with grid energy.HEMS of the grid friendly prosumer schedules the appliances and the ESS to reduce the electricity bill and PAR in dynamic pricing environment of the electricity market.In this context, the prosumer's appliances are divided into two categories: shiftable (i.e., their start time can be shifted to low price slots and would not be interrupted once they start operation) and non-shiftable (i.e., their start time can not be deferred and would not be interrupted during operation) appliances, as shown in Table 4.The proposed system architecture shown in Figure 1, mainly includes AMI, SM, smart scheduler (SS), master controller (MC), PV system, direct current (DC)/alternating current (AC) inverter, ESS, and appliances.In Figure 1 the energy flow is represented by solid lines while information flow is shown by dotted lines.The integration of advanced ICTs into the conventional power grid for metering and communication is known as AMI.It works as a backbone of the SG and enables the two-way communication between the utility and the consumers.Furthermore, AMI is responsible for the collection and transmission of energy consumption data from SM to the utility as well as for the relaying of exogenous grid signals to the SM.The exogenous grid signals may be the price signal, ambient temperature, solar irradiance or DR signal.The SM works as a communication gateway between the SH and the utility.SM is typically installed between the AMI and EMC.The main functions of SM are reading, processing and sending of energy consumption data to the utility via AMI as well as the receiving and processing of DR and pricing signals from the utility.RSERs are considered as a real alternative to fossil fuel power generation.RSERs mainly includes PV system, wind turbines, small scale hydro-turbines and fuel cells.In the proposed scheme only PV system is utilized due to its easy installation and small capital investment.A DC/AC inverter is used to convert the PV system generated DC electricity into AC.An ESS works as a source and sink is regarded as a promising solution for the integration of RSERs into distribution networks/residential sector.Therefore, in the proposed OHEMS a small capacity ESS is used to efficiently exploit the PV system, and to reduce the electricity bill in peak hours.An SS installed between SM and MC is programmed using heuristic algorithms.The designed SS not only generates the optimal energy usage pattern for all appliances but also sends it to the MC for execution.MC is the core of proposed OHEMS and controls the operation of appliances and ESS according to the generated schedule by SS.

Scheduling Algorithms
The appliances scheduling problem formulated in Section 4 is solved by using GA, BPSO, WDO, BFO, and HGPO algorithms.Although, appliances scheduling problem has been solved by different classical optimization techniques: LP, ILP, MILP and DP.However, these techniques can not handle large number of appliances and face a lot of difficulties in convergence.Moreover, most of the classical algorithms do not have the global perspective and often converge at the local optimum solution.
In contrast, the evolutionary algorithms: GA, BPSO, WDO, BFO, and HGPO algorithms give alternate methods to solve complex problems, and outperform the classical optimization techniques.

GA
GA is an iterative optimization algorithm inspired by the natural genetic process of the living organisms.Rather than working on a single solution, GA deals with different possible solutions in each iteration [41].GA begins its search with randomly initialized binary coded chromosomes.The chromosomes pattern of GA represent the ON/OFF state of appliances, and the length of chromosomes shows the number of appliances.

Length of chromosomes = L
where, L is the number of household appliances.
Once the population (a set of solutions that shows the status of each appliance in a particular time slot) is created, fitness function of each possible solution is evaluated according to the objective function of the optimization problem.Here, the fitness of each population is evaluated using Equation (18).Then, a new population is created by applying the natural genetic operators: crossover and mutation.The GA parameters with their values on which it gives optimal results are listed in Table 5.The working flow of GA is shown in Figure 2. In each iteration, a new population is produced through crossover and mutation.In the crossover step, two binary strings are crossover to create a new off spring.Crossover probability says how often crossover will be performed.If there is no crossover, offspring is exact copy of parents.If there is a crossover, offspring is made from parts of parents' chromosome.If crossover probability is 100%, then all offspring is made by crossover.If it is 0%, a whole new generation is made from exact copies of chromosomes from old population [42].Moreover, a larger crossover rate avoids premature convergence to the sub-optimal solutions, so, the best crossover rate selected for optimization problems is 90% as given by, To create randomness in the results so that the repetition of a population could be avoided we use mutation process.It changes one or more principles gene in a chromosome from its initial state.In natural genetic process, the probability of mutation is very low, so, an optimum mutation rate for optimization problems is, Once crossover and mutation are done, again a population is generated and fitness is evaluated and compared with previous population.

BPSO
PSO is a nature-inspired optimization algorithm for finding an optimal solution within the search space.The PSO algorithm inherently exists in the continuous domain.However, it can be modified into the discrete domain, and its variants for the discrete domain is BPSO.The working flow of BPSO shown in Figure 3, mainly depends on four factors; initial position, initial velocity, particle own best position and global best position among all the particles.In this algorithm, a population is randomly initialized and scattered in the search space.The initial positions and velocities of the particles are represented by The particles update their velocities in each iteration by using Equation ( 25) [43], 24 where V t+1 i is the velocity of particle (appliance) in upcoming time slot, w is inertia factor, V t j is current velocity, r 1 and r 2 are random numbers, c 1 and c 2 are local and global pulls respectively, x t i is the particle current position, X lbest is local best position and X gbest global best position.The velocities of the particles are mapped between 0 and 1 by using sigmoid function given by Equation (26), The random values assigned to each particle in the population are compared with the sigmoid function to generate a binary coded population.
In each iteration, particles record their positions with respect to neighbors.The local best positions found by the particles are represented as X lbest =X lbest1 + X lbest2 + • • • + X lbestN .The local best values are then compared with each other to find the global best position.The g th particle among the particles is said to be the global best position if it satisfy the objective function, and the global best positions are represented as X gbest =X gbest1 + X gbest2 + • • • + X gbestN .The main reason behind the use of global best value rather than local best value is its faster convergence to the optimal solution.The global best value is a binary coded string and represents the optimal ON/OFF status of the appliances.The fitness function of each particle is evaluated and compared with the corresponding cost of global best value, and the string with minimum fitness function is selected.The BPSO parameters and their values on which BPSO gives optimal results are given in Table 6.

WDO
WDO is an another nature-inspired optimization algorithm based on the atmospheric motion of air parcels.In this algorithm, infinitely small air parcels move in N-dimensional search space.The major difference between the WDO and other heuristic algorithms is the use of four different forces to control the motion of air parcels in the atmosphere.These forces include pressure gradient force, friction force, gravitational force, and Coriolis force.The pressure gradient force moves the air parcels in the forward direction, while the frictional force resists their motion in the forward direction.Furthermore, the gravitational force is a vertical force in three-dimensional search space that attracts the air parcels towards the origin, and the deflection of air parcels in the atmosphere is due to the Coriolis force.Mathematically, all four forces are represented as [44].
F F = −ραµ (31) where F pg is pressure gradient force, ∆ is pressure gradient, ρ is air density, δν is finite volume of the air, F C is Coriolis force, Ω represents the rotation of the earth, µ is velocity vector of the wind, F G vertical force directed toward the earth's surface, g is acceleration of gravity, F F is friction force, and α is friction coefficient.
In each iteration, the position and velocity of the air parcels are updated by [44], and In Equation (32), the ((1 − α)ν old ) represents the opposite force continuously pushing the air parcels towards their previous positions.Whereas the gx old shows the gravitational force which attracts the air parcels towards the center of the earth.The motion of the air parcels towards the high-pressure point/global best position is described by [| P max P old |RT(x max − x old )] and cν old P old explains the Coriolis force which controls the motion of the air parcels.
WDO creates random solutions from the n number of air parcels.After evaluating the fitness function, and updating velocities a new population is generated.The fitness function of the new and old air parcels are compared to obtain an optimal appliance scheduling pattern.The pressure term used in WDO is just like fitness term used in GA, BPSO and HGPO.The WDO parameters and their values that give optimal results are given in Table 7 and the main steps involved in WDO algorithm are shown in Figure 4.

BFO
BFO is a new addition to the family of nature-inspired optimization algorithms.BFO algorithm is inspired by the social foraging behaviour of Escherichia coli.Since its inception, BFO has drawn the attention of researchers from diverse fields of knowledge.In the BFO algorithm, the bacteria swim in search of nutrients and select the best nutrients (solutions) to maximize its energy.The parameters used in BFO and the values on which it gives optimal results are listed in Table 8.BFO algorithm consists of four steps; Chemotaxis, Swimming, Reproduction, and Elimination-dispersal.BFO algorithm starts its search with parameters initialization, and after initialization of parameters, under the chemotaxis step, initial states of appliances are evaluated and then our system computes the new positions of bacteria (solution matrix).Mathematically the chemotaxis steps of a bacterium can be represented by Equation (34) [45], where θ i (j, k, l) represents i-th bacterium at j-th chemotactic, k-th reproductive and l-th elimination-dispersal step.C(i) is the size of step taken in the random direction specified by the tumble, and ∆ indicates a vector in the random direction whose elements lie in [−1, 1].In next step, swimming loop is initialized to find the current best state of appliances.The swimming step is represented by Equation ( 35) [46], where J cc (θ, P( j, k, l)) is the objective function, S is the total number of bacteria, n is the number of appliances, and θ=[θ 1 ,θ 1 ,• • • ,θ n ] n is a n-dimensional search space.The d attractant , w attractant , h repellant and w repellant are different coefficients that should be selected properly [47].When swimming steps complete, iterations of reproduction loop start in which only feasible solutions are recorded to produce next generation.Then, the elimination-dispersion steps discard the least feasible solutions, and new random samples are inserted with a low probability.This is a very important process because infeasible solutions are eliminated, and the chances of repetition are avoided.The working flow of BFO algorithm is shown in Figure 5.

HGPO
Our proposed HGPO algorithm combines the features of BPSO and GA to effectively reduce the electricity bill and PAR.The GA and BPSO are chosen for hybridization because the GA is good in PAR reduction, and BPSO is effective in bill reduction.Working procedure of HGPO consists of two stages, first, all steps of BPSO are followed, then, the crossover and mutation operators of GA are applied to the current global best position X t gbest and the previous global best position X t−1 gbest found by BPSO algorithm.The application of crossover and mutation operators to the best positions give better results than their application to the random population.The proposed HGPO algorithm is shown in Figure 6.

Results and Discussions
In this section, simulation results of the proposed OHEMS are presented.In the proposed scheme, the integration of RES and ESS, as well as the performance of various heuristic algorithms (GA, BPSO, WDO, BFO, and HGPO), is evaluated via two stages simulations.In the first case, the integration of RES and ESS into the residential sector are evaluated in terms of energy consumption pattern, and electricity bill as well as PAR reduction.While in the second case, the same performance metrics (energy consumption pattern, and electricity bill as well as PAR minimization) are used to evaluate the effectiveness of GA, BPSO, WDO, BFO and HGPO algorithms for HEMSs.For simulations, we have used MATLAB installed on Intel(R) Core(TM) i3-2370M CPU @ 2.4GHz and 2GB RAM with Windows 7. The computational time of all heuristic algorithms is given in Table 9.To demonstrate the proposed OHEMS, an end user with 11 passive appliances and an ESS which works as a source and sink is considered.The descriptions of the appliances are shown in Table 10, the column III shows the power rating of the appliances and column IV shows the length of operation time of the corresponding appliance.In this paper, the length of operation time is arbitrarily taken and remains the same in both scenarios (i.e., unscheduled and scheduled) to have a fair comparison.It is assumed that the utility power supply is available around the clock to support the prosumer's load.Moreover, the utility has AMI to get the forecasted data of weather conditions, ambient temperature, and solar irradiance from the metrological department, and to broadcast it to the prosumers.The exogenous grid signals (DAP signal, forecasted ambient temperature, and solar irradiance) used in the proposed OHEMS are shown in Figures 7-9 respectively.The DAP shown in Figure 7 is defined by the utility operator and the normalized form of solar irradiance and temperature data obtain from METEONORM 6.1 for Islamabad region of Pakistan is presented in Figures 8 and 9.The electricity generation by PV system modeled in Equation (1) mainly depends on energy conversion efficiency of the solar generator, the effective area of the generator, solar irradiance, and ambient temperature.Ninety percent of the estimated RE in any time slot of the scheduling horizon is considered for consumption.This uncertainty of 10% is included to cater for the disparity between the estimated and the actual generation.Moreover, 30% of the 90% of estimated RE in each time slot is used for the charging of ESS as long as the charging level of ESS is between 10-90%.The estimated RE, RE after taking 10% uncertainty, remaining RE after the charging of ESS and charging level of ESS system are presented in Figures 10 and 11 respectively.The ESS is charged only from the PV system in the day time.After the ESS charged fully, it is utilized in a high price time slot i.e., τ as given by Equation ( 17).

Case 1: Integration of RES and ESS
In this case, the benefits of RES and ESS integration into the residential sector are highlighted in terms of energy consumption pattern, and electricity bill as well as PAR reduction.The load distribution among the utility, RES and ESS is shown in Figure 12.It illustrates that in second scenario a portion of the prosumer load shifted from utility to RES, and in the third scenario an ESS is also integrated to support the prosumer's load in peak hours.

Energy Consumption
To explain the behavior of the energy consumption pattern, we define some arbitrary thresholds.The descriptions of load and thresholds are given in Table 11.

Load Range (kW)
High peak 5 and above Peak 4-4.9 Moderate 2-3.9 Minimum 1-1.9 Negligible 0.1-0.9 The energy consumption pattern of the prosumer load is shown in Figure 13.Results illustrate that in the first scenario (unscheduled load without RES and ESS), the energy consumption pattern has a high peak load of 5.95 kW in time slot 1, and peak loads of 4.7 kW and 4.2 kW in time slots 21 and 9 respectively.Moreover, the energy consumption pattern shows a moderate behaviour in time slots 2-8, 10, 13-14, 17-20 and 22-24, and minimum energy is consumed in time slots 11-12 and 15-16.
The energy consumption pattern of the second scenario (unscheduled load with RES), shows that the energy consumption remains the same in time slots 1-6 and 20-24.This is because the RE is available from the PV system as shown in Figure 10.This illustrates that the in-house RES generates electricity only in the time slots 7-19.Therefore, in time slots 7-19, the energy consumption is reduced by the corresponding amount of RE available in that time slot.
In the third scenario (unscheduled load with RES and ESS), we also integrate an ESS to the proposed SH.After the integration of ESS, energy consumption remains same in time slots 1-6 and 20-24; however, in time slots 7-8 and 10-19 the energy consumption becomes higher than the second scenario.This increase occurs because 30% of the RE available in time slots 7-19 is used for the charging of ESS.While, in time slot 9, the ESS is discharged and load on the utility is reduced by 73.60% and 67.16% as compared to first and second scenarios respectively.

Electricity Cost
The corresponding electricity bill of the energy consumption is shown in Figure 14.Results illustrate that in time slots 1-6 and 20-24 the electricity bill of all the three scenarios remains the same.While, in time slots 7-19, the RE is available and significantly reduces the electricity bill.Particularly, in time slot 9, the RE reduces the electricity bill by 19.55%, and after the discharge of ESS, the total reduction of 71.41% is achieved in the electricity bill.

Total Cost
The total electricity bill of case 1 is shown in Figure 15.Results illustrate that the investment of a small capital cost on the integration of RES reduces the electricity bill by 17.25%, and after adding EES too, the bill is reduced by 19.94%.The reduction in electricity bill due to RES and ESS is summarized in Table 12.The PAR of the prosumer load is shown in Figure 16.Results illustrate that the integration of RES reduces the PAR by 15.68% and after incorporating the ESS as well, the PAR is reduced by 21.55%.The reduction in PAR in all three scenarios is shown in Table 13.This reduction in PAR not only enhances the stability and reliability of the power system but also reduces the electricity bill of the prosumer.

Feasible Region of the Objective Function
The feasible region of the objective function (electricity bill) formulated in Equation ( 18) is shown in Figure 17.In Figure 17, the trapezoid of P 1 (0.1, 0.81), P 2 (0.1, 2.735), P 4 (6, 48.6) and P 6 (6, 164.2) represents the overall region of electricity bill.Where, the point P 1 (0.1, 0.81) represents the electricity bill when minimum possible load (0.1 kW) is scheduled in minimum price slot (21) of RTP signal, and if the energy consumption is 0.1 kW in the maximum price slot (9) of RTP signal, the electricity bill will be represented by the point P 2 (0.1, 2.735).Moreover, the points P 4 (6, 164.2) and P 6 (6, 48.6) represent the bill when all appliances are in ON status in minimum and maximum price slots of RTP signal respectively.Equation (18) shows that the objective function depends on two factors: amount of load and electricity price in that time slot.The price signal is defined by the utility and we have no control over it; therefore, to minimize the electricity bill we can only modify the shape of the energy consumption pattern.Furthermore, in scheduled load scenarios, the electricity cost in any time slot must not exceed the maximum cost of the unscheduled scenario, i.e., 59.5 cents.After applying the limit of 59.5 cents the feasible region of scheduled load electricity bill is shown by the pentagon of P 1 (0.1, 0.81), P 2 (0.1, 2.735), P 3 (2.13,59.5), P 5 (6, 59.5) and P 6 (6, 48.6).Where, the point P 3 (2.13,59.5) shows that in maximum price time slot of RTP signal the scheduled load must not exceed than 2.13 kW, and point P 5 (6, 59.5) shows that the maximum possible load (6 kW) must not be scheduled in time slots having price greater than 9.92 cents.

Case 2: OHEMS with Integrated RES and ESS
The distribution of the prosumer load among the utility, RES and ESS is illustrated in Figure 12.It shows that in the second scenario of case 1, an RES is integrated to the SH while, in the third scenario, an ESS is also utilized to support the prosumer's load.
Here, in this section, the simulation results of the heuristic algorithms (GA, BPSO, WDO, BFO and HGPO) based OHEMS are presented.In this case, the cost of unscheduled load with RES and ESS is taken as a reference to validate the effectiveness of the heuristic algorithms for HEMSs.The performance of heuristic algorithms (GA, BPSO, WDO, BFO and HGPO) is evaluated by using the same performance metrics (energy usage pattern, and electricity bill as well as PAR reduction) of case 1.The designed SS generates an optimal energy usage pattern for shiftable appliances in response to grid signals and a large portion of load is shifted toward off-peak hours.This relocating of load significantly reduces the electricity bill as well as the PAR.Simulation results of the proposed scheme are as follows:

Energy Consumption
The energy consumption patterns of scheduled and unscheduled loads with RES and ESS are shown in Figure 18.In unscheduled load with RES and ESS scenario, the prosumer's energy consumption pattern has a high peak of 5.95 kW in time slot 1 and followed by a peak load of 4.8 kW in time slot 21.A moderate behaviour of load is recorded in time slots 2-8, 13-14, 17-20, and 22-24.Moreover, the energy consumption is found to be minimum in time slots 9-10, and negligible in time slots 11-12 and 15-16.
GA-based scheduling creates no high peaks, and a peak load of 4.75 kW is consumed in time slot 21; 4.12 kW in time slot 20; 4.07 kW in time slot 22; and 4.01 kW in time slot 24.The energy consumption pattern is found to be moderate in time slots 1-6, 16-19 and 23.Furthermore, the energy consumption is minimum in time slots 7-8, 10 and 13-15, and negligible in time slots 9 and 11-12.The comparison of GA-based scheduled and unscheduled load shows that the maximum load in GA-based scheduling is 20.16% less than the maximum load in the unscheduled scenario.
BPSO-based scheduling also does not create high peaks, and the energy consumption pattern has peak load of 4.96 kW in time slots 2 and 22; 4.9 kW in time slot 21; 4.81 kW in time slot 20; 4.76 kW in time slot 19; 4.67 kW in time slots 17 and 19; 4.2 kW in time slot 3; and 4.12 kW in time slot 16.The energy consumption is found to be moderate in time slots 5, 15 and 23.Additionally, a minimum amount of energy is consumed in time slots 1, 4, 6 and 18, and negligible in time slots 7-14.The comparison of BPSO-based scheduled and unscheduled load shows that the maximum load in BPSO is 16.63% less than the maximum load in the unscheduled scenario.
In WDO-based scheduling, a high peak load of 5.75 kW is consumed in time slot 19 and 5.12 kW in time slots 22-23.The energy consumption pattern has peak load of 4.95 kW in time slot 21; 4.08 kW in time 20; and 4 kW in time slots 2 and 24.In addition, a moderate amount of energy is consumed in time slots 3, 5, 16 and 17.The energy consumption is minimum in time slots 1, 4, 6, 15 and 18, and negligible in time slots 7-14.The comparison of WDO-based scheduled and unscheduled load shows that the maximum load in WDO is 3.36% less than the maximum in the unscheduled scenario.
The BFO algorithm neither creates high peaks nor peaks in energy consumption pattern.The energy consumption is moderate in time slots 1-5, 17 and 19-24, and minimum in time slots 6-8, 11, 13-16 and 18.Moreover, the energy consumption is negligible in time slots 9-10 and 12.The comparison of BFO-based scheduled and unscheduled load shows that the maximum load in BFO is 36.13%less than the maximum load in the unscheduled scenario.
The proposed HGPO-based scheduling creates no high peaks, and a peak load of 4.7 kW is consumed in time slot 19 and 4.61 kW in time slots 21-23.The energy consumption is moderate in time slots 1-2, 4-6, 17 and 18.Moreover, minimum load is scheduled in time slots 3, 10, 13, 16, 20 and 24, and negligible in time slots 7-9, 11-12 and 14-15.The comparison of HGPO-based scheduled and unscheduled load shows that the maximum load in case of HGPO is 22.52% less than the maximum load in the unscheduled scenario.
Figure 18 illustrates that the load shifting pattern of HGPO is balanced, and uniformly distribute the load over the scheduling horizon.On the other hand, the other heuristic algorithms either completely shift the load towards off-peak hours or consume higher energy in peak hours.The HGPO outperforms the GA, BPSO, WDO and BFO algorithms by allowing the appliances to complete their tasks with minimum delay and avoids peak formation as well.

Electricity Cost
The corresponding electricity bill of unscheduled and scheduled load with RES and ESS is shown in Figure 19.Results illustrate that the electricity bill of heuristic algorithms (GA, BPSO, WDO, BFO and HGPO) based scheduled load remains within the feasible region.In GA-based scheduling, the maximum electricity bill is 39.7 cents in time slot 7. The electricity bill in case of BPSO has a maximum value of 43.6 cents in time slot 2 which is also less than the maximum bill (59.5) of unscheduled scenario.In the case of WDO, the maximum electricity bill is 47.3 cents in time slot 21, and the bill in all other slots also remains within the feasible region.The BFO-based scheduled load has maximum bill of 49.8 cents in a time slot 8.In the proposed HGPO algorithm, the electricity bill satisfies all the limits of the feasible region, and a maximum bill of 43.6 cents is recorded in time slot 6.Moreover, in peak hours the electricity bill of scheduled load is comparatively less than the unscheduled load, and the comparison of total electricity bills of the heuristic algorithms shows that the performance of HGPO-based HEMS in term of bill reduction is better than GA, BPSO, WDO and BFO based HEMS.

Total Cost
The comparison of overall electricity bill of the unscheduled and scheduled load with RES and ESS is shown in Figure 20.The total electricity bill in unscheduled, and in scheduled load scenarios using GA, BPSO, WDO, BFO and HGPO algorithms are 690.63,622.97, 555.32, 584.24, 581.56 and 517.15 cents respectively.The comparison of total electricity bill shows that GA, BPSO, WDO, BFO and HGPO algorithms based HEMS reduces the electricity bill by 9.80%, 19.60%, 15.40%, 15.80%, and 25.12% respectively.The changes in electricity bill due to scheduling are listed in Table 14.In peak hours the electricity charges of heuristic algorithms based scheduled load scenarios are significantly less than the unscheduled scenario.However, when the overall cost reduction is concerned the HGPO gives better results than the other optimization algorithms.Moreover, the electricity consumption pattern of HGPO is uniform, while the GA, BPSO, WDO and BFO algorithms create new peaks in off-peak hours that degrade their overall performance.The PAR of unscheduled and scheduled load is shown in Figure 21.It illustrates that the proposed HGPO algorithm minimizes the PAR by 24.88%.The GA, BPSO, WDO and BFO algorithms also reduce the PAR by 14.09%, 3.30%, 22.10% and 33.54% respectively.The changes in PAR of the heuristic algorithms based scheduled load are shown in Table 15.Although these algorithms are designed to reduce the PAR and avoid peaks formation, the BPSO and WDO algorithms shift most of the load to off-peak hours that creates new peaks.This new peaks formation disturbs the entire operation schedule of the utility peak plants and utility impose a penalty on the consumer.The HGPO and BFO based HEMS uniformly distributes the loads over the scheduling horizon and achieves the desired objective.The performance of the GA, BPSO and WDO algorithms may be enhanced by setting the proper thresholds of energy consumption in each slot; however, it will affect the UC and will increase the waiting time of the appliances.

Conclusions and Future Work
In this paper, an OHEMS is proposed, which incorporates the RES and ESS into the residential sector.Results illustrate that the integration of RES and EES minimizes the electricity bill by 19.94% and PAR by 21.55%.After the integration of RES and ESS, the constrained optimization problem is mathematically formulated by using MKP, and solved by heuristic algorithms: GA, BPSO, WDO, BFO and HGPO algorithms.The performance of the scheduling algorithms is evaluated in terms of uniform distribution of load over the scheduling horizon, and reduction of electricity bill as well as PAR.Simulation results show that, unlike GA, BPSO, WDO, and BFO, the HGPO algorithm uniformly distributes the load over the scheduling horizon, and further reduces the electricity bill by 25.12% and PAR by 24.88%.This reduction of PAR enhances the power system stability and ensures the stable and reliable grid operation.From the above discussion, it is concluded that the HGPO-based HEMS performs better than other heuristic algorithms and an overall reduction of 40.05% is achieved in cost and 41.07% in PAR as compared to the unscheduled load without RES and ESS.
In future, we are interested in the coordination among the distributed micro sources, i.e., RES and ESS to exploit the RSER utilization.This coordination of micro sources in a residential area will not only enable the exchange of surplus RE among the prosumers but will also reduce the load on utility.
Author Contributions: Adnan Ahmad, Asif Khan, and Nadeem Javaid proposed the system model and classified the appliances.All authors performed extensive simulations for the manuscript.Hafiz Majid Hussain, and Iftikhar Azim Niaz wrote related work and simulation sections.Wadood Abdul, Ahmad Almogren, and Atif Alamri wrote rest of the manuscript.Nadeem Javaid and Adnan Ahmad organized and refined the manuscript.

Conflicts of Interest:
The authors declare no conflict of interest.

Figure 15 .
Figure 15.Total electricity cost of the prosumer in case 1.

Figure 17 .
Figure 17.Feasible region of objective function.

Table 1 .
A brief comparison of traditional grid and smart grid (SG).

Table 2 .
Recent Trends: State of the art.
Figure 4. Main steps of WDO algorithm.

Table 10 .
Description of the appliances.

Table 11 .
Thresholds of energy consumption.

Table 12 .
Comparison of case 1 cost.

Table 13 .
Comparison of case 1 PAR.

Table 14 .
Comparison of case 2 cost.

Table 15 .
Comparison of case 2 PAR.