Optimum Energy Flow Management of a Grid-Tied Photovoltaic-Wind-Battery System considering Cost, Reliability, and CO2 Emission

The main goal of this paper is to explore the performance of a residential grid-tied hybrid (GTH) system which relies on economic and environmental aspects. A photovoltaic- (PV-) wind turbine- (WT-) battery storage system with maximizing self-consumption and time-of-use (ToU) pricing is conducted to examine the system efficiency. In so doing, technical optimization criteria with taking into consideration renewable energy benefits including feed-in-tariff (FIT) and greenhouse gas emission (GHG) reduction are analyzed. As the battery has a substantial effect on the operational cost of the system, the energy management strategy (EMS) will incorporate the daily operating cost of the battery and the effect of the degradation. The model can give the opportunity to the network to sell or purchase energy from the system. The simulation results demonstrate the effectiveness of the proposed approach in which the new objective function achieves the maximum cost-saving (99.81%) and income (5.16 $/day) compared to other existing strategies as well as the lowest GHG emission. Furthermore, the battery enhances the best daily self-consumption and load cover ratio. Then, as the model is nonlinear, a comparison with other existing algorithms is performed to select the feasible, robust, and reliable model for the residential application. A hybrid algorithm (HGAFMINCON) is developed to demonstrate the superiority of the algorithm over FMINCON and GA shown in terms of cost savings and income.


Motivation and Literature Review.
Recently, the increasing electricity costs and GHG emissions around the world lead to a major transition of energy from fossil fuels to renewable energy sources (RES) [1,2]. It is expected to install above 198 GW of renewable capacity, to break another record, and to account for nearly 90% of the increase in the total power capacity. In 2020, important additions of wind (8%) and hydropower (43%) are expected, whereas the solar PV is stable [3,4]. In North Africa, Morocco is typified by a suitable geographical position and considered the ninth best in the world in terms of the rate of sunshine. With the deficiency of conventional hydrocarbons and the increase of GHG emissions from fuel combus-tion, the kingdom has approved the Kyoto Protocol to support the international efforts about climate change mitigation [5]. In effect, electrical energy has approximately more than half of GHG emissions due to the large dependence on fossil fuels. To do so, the solution to overcome this critical issue incorporates the integration of RE and the enhancement of energy efficiency between different sectors. In Morocco, the residential sector is considered an extensive energy consumer because of the enlargement of the urbanization [6]. However, among the crucial problems associated with renewable energy systems is the fluctuation of PV and WT output power which depends on meteorological situations. Therefore, matching consumer demand continuously is the main challenging task of any power generation system. This issue can be overcome by prosumer energy systems such as the battery which can be used as a supplier of energy or/and a consumer [7]. Thus, the current challenge is to assure the demand while managing the energy flow by controlling the generated power to supply the load and the surplus power to or from the battery/grid. Hence, numerous strategies, algorithms of control, and software tools have been applied to optimize the power flow and reduce the global cost. Concerning grid-connected residential RE systems, the welcomed optimal strategy is when considering the electricity tariffs which have a significant effect on the economic performance system. In Morocco, the common electricity tariffs are the ToU and step-rate tariffs due to their ability to improve the energy efficiency of the electricity grid.
The authors in [8,9] proved that the combination of solar and wind power sources is an efficient solution for Moroccan power grid reliability. In [10], the authors focused on the economic power generation system principally based on residential grid-tied PV/battery power to minimize the electricity cost and obtain an income from the surplus energy. The simulation results demonstrated that the proposed model is effective with low cost. Moreover, the economic analysis is performed in terms of the found levelized cost of energy (LCOE) and net present cost (NPC) calculated by HOMER (Hybrid Optimization Model for Electric Renewable) software. Adeli et al. illustrated that PV cannot establish a net-zero energy building; preferably, other renewable sources should be used. It was concluded that using WT for electricity production especially in winter is an appropriate substitute for the reduction of the produced electricity by PV generators. Furthermore, the better condition for the studied building was afforded through optimization of the parameters of reduction of energy consumption and the hours of residents' thermal dissatisfaction [11]. In Ref. [12], a grid-connected photovoltaic and energy storage system (ESS) is designed to supply a housing demand. The paper aims at increasing the self-consumption of the system and at alleviating the issues resulting from PV power grid  International Journal of Photoenergy injection. Therefore, the proposed energy management algorithm is applied to manage the power flow of the system to maximize self-consumption and reduce household consumption from the utility grid. The authors in Ref. [13] develop a novel optimization method using differential evolution and chaos theory for a microgrid (MG). The MG includes PV, WT, microturbine (MT), and fuel cell (FC). The optimization method is a multiobjective function aiming at reducing the operating cost and pollutants simultaneously during the day. In [14], an optimal EMS of a MG is implemented to reduce the degradation cost of the battery system and the dynamic penalty. The optimization problem is solved using particle swarm optimization (PSO) to control the battery for real-time energy management. The authors in Ref. [15] propose an EMS in MGs which is considered a dynamic economic emission dispatch (DEED). The purpose of this study is to determine the generation level of diesel generator (DG), the cycle of charging and discharging of the ESS, and the energy exchanged with the utility grid. The applied algorithm is the help of whale optimization algorithm (WOA) as the optimization problem is nonlinear, and the results demonstrate that the model with the exchange of zero energy building (ZEB) between the MG and the utility gives an optimal operation cost. In [16], a PV-hydrogen-reusing retired electric vehicle battery (REVB) is designed. A power management strategy is presented to schedule the energy flow while minimizing the loss of power supply and the potential energy waste. The simulation is performed using the evolutionary algorithm (NSGA-II), and the results highlight that the reliability of the system is impaired   International Journal of Photoenergy if ignoring the REVB's capacity loss, and the system has better performance regarding the distribution of solutions. Mellouk et al. designed a grid-tied PV/WT/concentrated photovoltaic panels (CPV) and parabolic through-solar steam turbine technology (SST) system to show the potential of incorporating the RE technologies in a Moroccan region (Laayoune) which is considered a case study. The hybrid system is scheduled under a novel parallel hybrid genetic algorithm-particle swarm optimization algorithm (P-GA-PSO) to minimize energy cost and energy losses and maximizing renewable energy production. Indeed, the results improve that the obtained energy cost does not surpass 0.17 US$/kWh, which is close to the fossil fuel energy cost, and the applied strategy has good performance in terms of simulation time and solution quality [17]. In [18], the study proposes a novel technique for HGT PV/WT/battery system to minimize the purchased energy from the grid as well as maximize the profit from RE and battery sales. In [19], a novel management algorithm is proposed in order to decrease the payback time of a PV-battery system connected to the grid as well as reduce the size of the residential system. The excess energy can be exported to the grid, and the system works using the Maximum Power Point (MPP) or at the Limited Power Point (LPP) modes to meet the management algorithm requests. To achieve the LPP, the Perturbation and Observation (P&O) algorithm is used. The paper in [20] presents a new "mix-mode" (MM) EMS and method to size battery appropriately battery sizing method for a low operating cost. The implemented strategies are the "continuous run mode," "power sharing mode," and "ON/OFF mode" and solved using linear programming (LP) and mixed integer linear programming (MILP) and linear programming (LP) methods. Besides, the PSO algorithm is used to define the optimal energy capacity of the battery. The authors in [21] examine the viability of a combined dispatch (CD) control technique for a PV-diesel-battery system with combining the load following (LF) and cycle charging (CC) strategies. The software used as for the optimization is -P RES →bat ( after meeting the load). -P RES →grid (after meeting the load and charging the bat).
-P bat →Load -P grid →Load (purchasing the needed power).
-P grid →Load (purchasing the needed power).
-P bat →grid (after meeting the load). -P RES →bat (after meeting the load). -P RES →grid (after meeting the load and charging the bat).
-P grid →bat (purchasing power to charge the battery).
-P grid →Load (purchasing the needed power).
-P grid →bat (purchasing power to charge the battery).  International Journal of Photoenergy HOMER in order to investigate the economic and environmental aspect of the system. The results prove that the CD methodology presents the lower net present cost and cost of energy values compared to those of CC and LF strategies. Meanwhile, effects of other parameters such as battery minimum SOC and diesel price are analyzed. Different tariffs (ToU and developed step-rate tariffs) and FITs are applied to schedule the efficiency of the grid and the price of electricity. Besides, many researchers have implemented for optimization problems different software tools such as HOMER and TRYNS [22,23].

Scope and Contribution.
In most of these studies, different energy management strategies are implemented and the main objective of these methods is to minimize the consumed energy from the grid and schedule optimally the energy flow of the hybrid system to maximize the energy efficiency. However, even though the proposed strategies prove good results, their effects on the battery system are still lacking. The battery is discharged when the generated power is less than the power demand, and it is charged if there is excess power. As a result, recurrent variations in renewable power and demand can produce sudden charging and discharging decisions as well as decreasing rates of battery degradation. Consequently, it is required to incorporate the daily operation cost and degradation of the battery in the objective function to reduce the operational cost in the optimization problems. Moreover, to further improve the efficiency of the system, attention to the potential benefits from the carbon emission reduction will be considered.
Concisely, to answer all these questions, this paper presents an original EMS for a Moroccan grid-connected residential system consisting of a PV, WT, and battery bank with taking into consideration economic, technical, and environmental criteria. The electricity tariffs including the grid electricity tariff and the FIT have a significant impact on the economic performance of the system and benefits for the end-user. Hence, contributions of the present study are summarized as follows: (i) The proposed model allows residential end-users to match the energy flow between production and consumption, and it brings the opportunity for the homeowner to sell the energy to the provider. In fact, the economic benefits of the proposed EMS are the reduction of the dependency of the system on the utility grid under the ToU tariff (increasing self-consumption of the generated energy) and reduction of energy costs for the household Determine non-linear, linear fmincon_constraint and bounds Evaluation iteration 1: Iter = Iter+1   International Journal of Photoenergy (ii) The strategy develops the cost function that takes into account the daily operation cost of the battery, which considers the effect of energy storage and degradation. The battery management is aimed at charging the battery during the off-peak price period (iii) The EMS permits the residential application to profit from the selling of excess RE and ESS back to the main grid through appropriate FITs. The developed technical optimization and environmental (GHG emission mitigation) criteria are analyzed and compared with other recent energy management strategies considering different energy sources and load demand to verify the efficiency and effectiveness of the proposed method (iv) A comparison between other modern optimization approaches is performed to prove the robustness of the algorithm in terms of convergence speed and solutions (v) A comparison between FMINCON and developed hybrid algorithm HGAFMINCON approaches is executed to demonstrate the effectiveness of the algorithm in terms of cost savings Subsequent to obtaining the results, it can be revealed that the model is appropriate for the household who plans to increase the efficiency of energy with lower cost and mitigate the GHG emission by integrating RE sources.
1.3. Framework of the Paper. The remainder of the paper is categorized as follows. Section 2 describes the configuration of the HGT system, the mathematical model of each component, and the GHG. Section 3 outlines the suggested energy management strategies under different tariffs and the mathematical formulation of the objective function and the constraints as well as the applied energy management algorithms. In Section 4, the simulation results will be

Structure Presentation and Mathematical Modeling
The proposed residential grid-connected PV-WT-battery installation is shown in Figure 1. The photovoltaic generator, WT generator, and battery storage system are connected to supply the home through bidirectional inverters. The DC bus keeps a constant voltage by DC/DC converters and DC/AC inverter. The interconnection between all energy sources is interconnected by an energy management system to control the different power flows. The hybrid system is also assumed to be connected to the utility grid to import the energy needed and export excess energy. The power generated by PV and WT systems is used to feed the load, and the surplus power is used to charge the battery bank or sold to the grid depending on the electricity price. Besides, if the batteries achieve their maximum charge, the excess power is sold to the main grid. If the PV and WT powers are insufficient to feed the load, the battery is discharged. If the battery power cannot satisfy the load demand, the needed power is purchased from the grid.  Otherwise, the battery is also charged by the utility grid and discharged to maintain the load demand or exported to the grid to save electricity cost.
As shown in the Figure 1, the control variables of the hybrid system are the PV power P pv , WT power P w , battery power P bat , and grid power P grid . The price data is the daily electricity price, and the weather data is the solar irradiation and wind speed over 24 h horizon.
2.1. Photovoltaic System. The output power produced by a PV panel is depending on the solar irradiance, area of the PV panel, ambient temperature, and efficiency of the photovoltaic. Therefore, the power can be given as follows [24]: where P PV is the output power of the PV system; SI refers to the solar irradiance; A and η s denoted the area of the PV array (m 2 ) and the conversion efficiency (%), respectively; γ is the temperature coefficient of the power and is equal to 0.005; and T O defines the outside air temperature (°C). Then, the total power output of PV array for a number of solar panels can be determined as follows: where N PV is the number of PV panels.

Wind Turbine
System. The output power produced by the WT depends on the wind speed, the efficiency of conversion, wind energy, and air density. Equation (3) defines the conversion of wind speed to the hub height [25].
where ν denotes the wind speed (m/s) at the desired hub height h; α refers to the power law exponent ranging; h ref is the reference height (m); and ν ref is the wind speed at h ref .
The wind turbine power P E is represented in terms of wind speed as follows [25]: where P R and v R define the rated power and rated wind speed, respectively; v denotes the wind speed; and v OFF and v IN refer to the cut-off and the cut-in wind speed, respectively. The total generated output power of the WT can be expressed as follows: where η WT is the efficiency of the wind generator and N WT is the number of WT.  (i) If the battery is charged: with (ii) If the battery is discharged: where SoC is the percentage of energy storage; P Ch defines the power for charging the battery; P Dis denotes the power discharged from the battery; ƞ dis and ƞ ch are the battery dis-charging and charging efficiency, respectively; and E nom is the battery system nominal energy. P PV−>batðtÞ and P WT−>batðtÞ are the power of PV and WT to charge the battery bank, and P grid−>batðtÞ is the power imported from the grid to charge the battery. P bat−>LðtÞ is the power used by the battery to supply the load, and P bat−>gridðtÞ is the power exported from the battery to the grid.
2.4. Modeling of the Utility Grid. The grid is considered an infinite source, and the electricity can be exchanged depending on the generation of energy if there is a surplus or deficit.
To compute the cost of purchasing power from the utility grid, Equation (9) is applied.
where p gðtÞ is the daily electricity tariff ($/kWh), P grid−buyðtÞ is the purchasing power from the utility grid (kWh), and N is the daily number of sampling intervals which is calculated in this case as follows: The Moroccan National Office of Electricity and Water (ONEE) is a power supply utility company and able to control the production, distribution, and transmission of electricity. Besides, ONEE is responsible for the purification of wastewater necessary to the sustainable development of the country. A residential demand side management (DSM) program is applied recently in Morocco, and the consumer can choose to subscribe to step-rate or ToU tariffs if the average monthly consumption exceeds 500 kWh. The steprate tariff is listed in Table 1 for each corresponding consumption band (step).
For strengthening energy efficiency, the ONEE applies a new ToU tariff in the residential sector (low voltage) where the electricity price varies depending on the season (summer/winter) and period (peak/off-peak). The pattern of ToU pricing for the winter season is depicted in Figure 2. For summer, the winter schedule will be shifted by one hour. The local currency in Morocco is Moroccan Dirham (MAD) with 1 dollar ð$Þ = 9:80551 MAD.
2.5. Greenhouse Gas Emissions. The greenhouse gases (GHGs) have a great effect on the Earth's warming. Besides, the Global Warming Potential (GWP) is developed to compare the impacts of the global warming of different gases. It is defined as a measure of the amount of energy that emissions of 1 ton of gas can absorb during a period, compared  Figure 13: Impact of battery capacity on the SCREE and LCR. International Journal of Photoenergy to the emissions of 1 ton of carbon dioxide (CO 2 ), which is considered a reference (in Kyoto Protocol). The reduction of greenhouse gas emission reduction by the system is formulated as To compute the emission of the PV (PV_GHG) and WT (WT_GHG) systems, the following expressions can be used: Therefore,

RES GHG = WT GHG + PV GHG, ð13Þ
where P PV and P WT are the daily power generated by the PV and WT systems and em_pv and em_wt are the PV and WT factors of emission which equal to 0.045 and 0.011 (kgCO 2 _ eq/kWh), respectively [28,29]. The grid GHG emission is expressed as follows: where F egrid is the electricity_specific factor which is equal to 0.731211458 (kgCO 2 /kWh) in Morocco [30]. In this study, GHG emissions are calculated in two cases to calculate the net savings of GHG emissions for the proposed system. The case of meeting the load only from the utility grid is considered a baseline case and the case after implementing RES. Therefore, the net savings will be expressed as follows: with

Problem Formulation
This study is aimed at minimizing the daily operating costs of the hybrid system "Cop" and improving the selfconsumption of the RE sources of the system. The formulation of the optimization problem is performed comprising the cost function and the constraints.
3.1. Objective Function. The developed objective function includes three main costs: firstly, (a) the cost of buying electricity from the utility grid to charge the battery and supply the load; secondly, (b) the revenues generated from the surplus energy sold to the main grid; finally, (c) the daily operation cost of energy storage, which incorporates the daily operation of the battery system and the battery degradation.
The daily cost function of the studied system is formulated as follows: where P grid−>bat and P grid−>L are imported from the grid to the battery and load, respectively; Δt is the sampling time, and it is equal to 1 h in this study; FIT RES is the PV and WT feed-in tariffs [31]; P RES−>grid and P bat−>grid are the excess renewable energy and energy storage sold to the grid, respectively; p g−p is the peak-price of energy to pay the utility grid; C bat defines the capital cost of the battery system; C Deg is a coefficient to penalize the degradation operation of the battery bank; N Cyc denotes the number of the life cycle of the battery system, and P bat is the produced power by the battery and it is expressed as follows:

Constraints and Variable Limits
3.2.1. Power Balance Constraint. The power balance equation of the system is valid when the load demand is exactly satisfied by the sum of renewable power, battery, and grid at each sampling time (t). This can be expressed as follows: Equation (21) prohibits the import and export of grid power simultaneously. This can be formulated mathematically as follows: Furthermore, charging and discharging the battery at the same time should be inhibited. This constraint can be rewritten as follows: 3.2.4. Grid Power Limits. The limit of the grid power exchanged is subjected to the following constraints: where P max grid is the maximum grid power to feed into the utility grid.
Besides, the installation cost of RES is not considered in this study since the optimization process is restricted to an analysis of how to schedule the proposed system optimally.

Proposed Energy Management Strategy.
The proposed EMS is aimed at the one hand maximizing selfconsumption of the PV-WT-battery system and the other hand applying the ToU strategy. Figures 3 and 4 represent the flow chart of the two strategies to describe the procedure of scheduling the power of the HGT system.

Calculation of Optimization Problem.
In this paper, different methods of optimization will be applied to validate the appropriate one. The algorithms are deterministic and metaheuristic which are used to solve linear and nonlinear The syntax of the three algorithms is formulated as follows [32]: where FðxÞ presents the objective function; cðxÞ and c eq ðxÞ are the linear and nonlinear functions; A and b define the coefficients of inequality constraints; A eq and b eq denote the coefficient of equality constraints.
3.4.1. Fmincon Optimization Solver. As "Fmincon" solver employs the Hessian as the optional input, many "Fmincon" algorithms manipulate this type of input such as interior point, active set. In this work, the algorithm selected for the solver "Fmincon" is the interior point due to its faster convergence and the capacity to solve large-scale kind of optimization problems [33]. The flow chart in Figure 5 represents the main steps of the algorithm.
3.4.2. Genetic Algorithm. GA involves three main rules to develop the next generation from the current population [34]. Figure 6 describe the flow chart of the method. It continues to vary the search direction and increases/decreases frequently the increment until the end condition is attained or the objective function is satisfied [35]. The procedure of the algorithm is presented in Figure 7.

Simulation Results and Discussion
The case study location is Tangier city in Morocco. The region has quite favorable solar and wind resource patterns. The data and parameters used in this study are listed in Table 2. The simulation is performed for a time horizon of 24 h and a sampling time of 1 h. The algorithms are executed on a computer with Intel Core i7 processor with 8 GB of RAM using MATLAB (R2015a). The daily profile of load demand and the hourly RE for the selected day are shown in Figures 8(a) and 8(b).

Simulation Analysis.
The study is focused on the daily operational behavior of the hybrid system. Then, a comparison with the cost function without taking into consideration the daily operation cost of the battery is performed. The optimization problem is solved in MATLAB environment using the FMINCON algorithm. The load demand profile as shown in Figure 8(b) reaches a peak of 32 kWh during the peak price period, and the monthly energy consumption exceeds 500 kWh. Therefore, as mentioned previously, the ToU tariff is applied instead of the strep-rate tariff.
From Figure 9(a), it can be noticed that the battery is charged from RES power during the day and from utility  13 International Journal of Photoenergy especially during the off-peak price period (Figure 9(b)). These are pointed out when the SOC increases in Figure 10(d). An important power is provided from battery to meet the household during the high demand (Figure 9(c)).
The householder's demand is exclusively supplied by the PV and WT power in conjunction with the battery power in the peak demand and during 22 h and 5 h when the RE is minimal. Besides, Figure 10(a) illustrates that the grid does not provide any power to the load during the peak pricing time interval and a very small amount of power is generated during off-peak hours. However, as shown in Figure 10(b), there is a sufficient power generated from RES to fill in the deficit during the day. Figure 10(c) reveals that there is significant income generated from the excess energy sold to the grid during the day. A poor surplus of energy storage is also exported to the utility grid, notably over the peak price period (Figure 9(d); this can explain the SOC's decrease (Figure 10(d)).
In Figures 11 and 12, P1 defines the power obtained by the proposed method and P2 is the power of the baseline method without considering the daily operation cost of the BESS. Figures 11(a)-11(c) illustrate that the baseline method uses the grid as the main supplier, then the renewable power combined with the ESS, on contrary to the proposed method (P1), where any power is purchased from the main grid. Consequently, the energy not used by the load from the battery is fed into the grid as shown in Figure 11(d). However, the PV and WT systems generate less income compared to the proposed method (Figure 12(c)). These can explain the deep decrease of the SOC in the baseline method as shown in Figure 12(d).

Economic and Environmental
Analysis. The baseline cost is considered the bill that the consumer should pay without optimization, whereas the optimal cost is the grid energy cost after applying the optimal control. The bill refers to the grid energy imported to supply the load and battery storage system. The income is the surplus of PV, WT, and battery energy sold to the utility grid.
Equation (27) represents the calculation of the cost saving: Cost saving % ½ = baseline cost − optimal cost baseline cost × 100: ð27Þ Table 3 shows the cost savings per day of the case study, and the results reveal that the optimal control presents a large benefit with the proposed model. The maximum cost saving was achieved with 91.82%, and a reduction of the bill with 5.75 $/day compared to the baseline method.

Technical Optimization
Indicator and Impact of the Battery. A technical criterion, such as the self-consumption ratio of RE (SCRRE) to assess the energy supply performance and the load cover ratio (LCR) for demand evaluation, is calculated as shown in Equations (28) and (29).  14 International Journal of Photoenergy where E RES−>L is the total daily electricity from PV and WT system to meet the household (kWh). E RES−>bat is the total daily PV and wind electricity to charge the battery system (kWh). E RES is the daily power production of PV and wind turbines (kWh). The daily average LCR is formulated as the ratio of the generated electricity of renewable systems to the total daily household as follows: where E bat−>L represents the electricity discharged from the battery to the load (kWh). E Load denotes the total daily electrical demand of the household (kWh). The effect of the battery capacity on the technical indicators comprising the LCR and the SCRRE is presented in Figure 13. It can be noticed that LCR increases when the battery capacity increases because the amplitude of energy from renewable sources and battery to supply the load rises. On the other hand, the SCRRE decreases with the increased capacity of the battery where more energy will be needed to charge the battery system from RES and utility grid, as well as the increasing of the replacement and investment costs. Table 4 illustrates that the proposed strategy presents the maximum ratios, which means the increase of the selfconsumption performance of the system.

Environmental Aspect.
From an environmental prospect, Table 5 shows that the proposed model presents the best results with the lowest total GHG emissions and the maximum net savings. The reason for the notable increase is when the purpose is to increase the reliance on RES instead of purchasing energy from the utility grid, as well as considering the degradation of the battery will be the favorable economical and environmental solution.

Economic and Environmental
Analysis. In this part, a comparison with other strategies is performed to examine the feasibility of the proposed method. These strategies are presented for grid-connected hybrid system and described in the following points: (i) The first strategy [36] presents an EMS where the cost function does not take into consideration the cost operation of the battery and degradation. The excess power sold to the UG is used only from the battery and not from RES (ii) The second strategy [37] proposes also a cost function without taking into consideration the operating cost of the battery and degradation. In this case, the exchange power between grid and battery is not applied (iii) The cost function of the third strategy [7,38] involves the excess power from battery and RES and the daily operating cost of ESS without exercising the effect of battery degradation Figures 14 and 15 show the power flow imported with the utility grid of the different strategies. The system in the three strategies purchased significant energy from the UG to supply the load in contrast to the proposed strategy (Figures 11 and 12). The grid power used from the battery in the strategies compared with that in the proposed strategy is very low. This condition leads to charge more the battery from RES instead of supplying the load. Table 6 reveals that the developed strategy achieves the maximum cost savings of 5.75$/day and the optimal cost of 91.82% compared to other methods. 4.6. Stochastic and Deterministic Algorithm Analysis. To achieve the best results of the proposed strategy, a comparison between different algorithms such as FMINCON, PS, and GA will be performed. Figures 16 and 17 compare the daily economic benefits of the three algorithms to validate the effective approach. It can be noticed that the "FMINCON" algorithm presents the best results on the bill after optimization and sales,   In general, the steps of the hybridization of FMINCON and GA are presented in Figure 18 as follows: The optimization by FMINCON and GA algorithms applied to the hybrid system gives a good result and management as shown in the figures below.
Comparing the results in Figures 19(a) and 19(b) and Figures 20(a) and 20(b), it can be shown specially from 5 h to 15 h that hybrid algorithm uses the battery optimally by giving the priority to supply the load demand then sell the excess energy to the UG.
In Figures 21(a) and 21(b) and 22(a) and 22(b), the power purchased from the grid to charge the battery and meet the load demand is more minimized in the hybrid algorithm. Moreover, there is no power imported from UG  As is evident from Table 8, the minimum cost of the hybrid system is obtained from the HGAPSO algorithm as well as substantial income and cost savings.

Conclusion
This paper presents an energy management strategy that minimizes the daily operation cost of the residential gridtied PV-WT-battery system. Execution of the proposed system under the increasing self-consumption and ToU strategies is performed to investigate the hybrid system operational performance and prove the energy balance and energy management strategy. A comparison is conducted with a baseline method where the strategy is applied without considering the operation cost and degradation of the BESS. An analysis of technical indicators and the impact of batteries and an environmental study are performed. The following findings can be concluded based on the simulation results: (i) Results show that the proposed EMS succeeded in reducing the daily operating cost of the gridconnected system and maximizing the selfconsumption of RE sources (ii) Comparison between the proposed and other strategies showed that the developed strategy has successfully proved an important cost reduction of 70.44 $/day to 5.75 $/day, maximum cost savings (99.81%), and significant cost-benefit (iii) The proposed strategy can improve a great selfconsumption (SCREE) and load cover (LCR) ratio compared to the baseline method. The comparison was performed based on analyzing the impact of variation of the battery capacity (iv) From an environmental perspective, it can be deduced that the proposed model is the best, with less GHG emissions 20.1071 (kgCO 2 -eq).
(v) A comparison between deterministic and stochastic algorithms was made to demonstrate that the FMINCON algorithm can give accurate results and low processing time (vi) A HGAFMINCON algorithm is designed and gave the better results than the FMINCON and GA algorithm in terms of reduced cost and earnings

Data Availability
All data used to support the findings of this study are included within the article.

Conflicts of Interest
The authors declare that they have no conflicts of interest.