Optimized Sizing of Energy Management System for Off-Grid Hybrid Solar/Wind/Battery/Biogasiﬁer/Diesel Microgrid System

: Recent advances in electric grid technology have led to sustainable, modern, decentralized, bidirectional microgrids (MGs). The MGs can support energy storage, renewable energy sources (RESs), power electronics converters, and energy management systems. The MG system is less costly and creates less CO 2 than traditional power systems, which have signiﬁcant operational and fuel expenses. In this paper, the proposed hybrid MG adopts renewable energies, including solar photovoltaic (PV), wind turbines (WT), biomass gasiﬁers (biogasiﬁer), batteries’ storage energies, and a backup diesel generator. The energy management system of the adopted MG resources is intended to satisfy the load demand of Basra, a city in southern Iraq, considering the city’s real climate and demand data. For optimal sizing of the proposed MG components, a meta-heuristic optimization algorithm (Hybrid Grey Wolf with Cuckoo Search Optimization (GWCSO)) is applied. The simulation results are compared with those achieved using Particle Swarm Optimization (PSO), Genetic Algorithms (GA), Grey Wolf Optimization (GWO), Cuckoo Search Optimization (CSO), and Antlion Optimization (ALO) to evaluate the optimal sizing results with minimum costs. Since the adopted GWCSO has the lowest deviation, it is more robust than the other algorithms, and their optimal number of component units, annual cost, and Levelized Cost Of Energy (LCOE) are superior to the other ones. According to the optimal annual analysis, LCOE is 0.1192 and the overall system will cost about USD 2.6918 billion.


Introduction
Currently, fossil fuels are used to generate the majority of the world's electricity. Fast depletion rates and severe environmental impacts caused by the combustion process are the main drawbacks of these resources. Since fossil fuels are being consumed quickly around the world, there is an urgent need to find other sources of energy to meet the current demand. RESs can be derived from a variety of sources, including solar, wind, tidal, biomass, other alternative non-polluting and sustainable energy sources. Since they are non-polluting and long-lasting, RESs are poised to become the dominant form of electricity production in the near future [1][2][3][4][5][6]. Sizing these resources is key to making their systems economical and reliable. MGs are under-or oversized to satisfy electricity demands. An oversized systems will incur high running expenses and produce excess energy. In contrast, an inadequately scaled MG system will be unable to deliver power to the necessary demands. To fully reap the advantages of a RES-based MG, optimal size and energy management are needed. RESs have a considerably larger chance of succeeding agricultural settlement in Palestinian territory. Residential and water pumps are included. The village has 30 houses and a water pumping infrastructure. The typical load requires 300 kWh/day and 12.5 kW. Water pumping uses 49 kWh/day. Daily sun radiation averages 5.6 kWh/m 2 in the area. The finest hybrid system is a PV with battery storage paired with a diesel generator. The PV-biomass system for a farm and nearby residential neighborhood in the Pakistani region of Pinjab was described and optimized in paper [38]. Sensitivity analysis was used to fine-tune the NPV and COE estimates. It factored in the availability of biomass, the cost of biomass, the amount of solar radiation, and the fluctuation of the load. Using a variant of the cascade analysis approach for electric systems, the author of [39] offered a design for a hybrid generating system. A MATLAB/Simulink model was utilized for simulation, and the findings were verified by means of the HOMER program. Decentralized hybrid systems in Sabah, Malaysia, were evaluated for their technical, economic, and environmental performance by the authors of [40]. In order to evaluate the effects of PV integration, several penetration rates were taken into account. The NPV and LCOE were optimized, and a sensitivity study was conducted. PV-DG-ESS not only performed well economically and environmentally, but also technically. An economic feasibility study of a PV/WT system for a typical house in Dubai, UAE, is performed in [41]. Return on investment was computed using several assumptions for inputs such as power price and interest rate. The results reveal that the suggested method became unfeasible at an annual interest rate of more than 8%. In order to meet the 350 kWh/day load demand in a rural area of Bangladesh, [42] analyzes the performance of a PV-diesel-battery system in a stand-alone hybrid application. The study [43] models a MG system using solar photovoltaic, wind, and storage batteries in Bahir Dar, Ethiopia. Continuous power delivery to the load requires a storage or grid system. The system was created to supply the city's load demand reliably and with acceptable power quality, something conventional generating alone cannot do. Residential, commercial, institutional, agricultural, and small manufacturing loads average 15,467 KWh/day. HOMER pro software is used to size MG system components optimally. Size optimization for PV-MHP-based hybrid power systems in rural Himachal Pradesh, India, has been explored by Kumar et al. [44]. Table 1 summarizes the optimal sizing of MG renewable energy systems based on energy management strategy, cost analysis, algorithm comparison, robustness, and speed tests. Table 1. Previous studies considered a taxonomy of optimal sizing of microgrid renewable energy systems considering energy management strategy, cost analysis, reported algorithm comparison, robustness, and speed tests.

Global Prospects for Renewable Power Stations and Investment Costs
There are several renewable power plants constructed in various countries at varying costs. According to the study [45], the cost of constructing 1.1 GW of wind power capacity in Africa is expected to be USD 1.8 billion, with development finance institutions contributing 59 percent. Saga Energy of Norway has agreed to invest USD 2.9 billion in a state-owned Iranian firm called Amin Energy to build around 2 GW of solar power facilities in Iran over the next five years. Scatec Solar, a Norwegian solar energy company, has said it is in discussions to create a 110 MW solar project for USD 132 million, with the possibility of expanding the project to 500 MW [46]. In Iran, the Mahan Solar Power Station has the potential to generate 20 MWh per day. This power plant has a total of 76,912 solar panels installed, with roughly 21,000 bases hammered, and the amount of investment is USD 27 million [47]. The same paper demonstrated that in the provinces of Fars, Kerman, and Isfahan, solar energy has the ability to provide the demands of industry and agriculture. A 10 MW solar station facility in Sirjan would require around USD 16.14 million, according to an economic analysis. In order to create more than 2 GW of renewable wind generation and 50 MW of solar electricity generation in Iowa, United States, MidAmerican Energy says it intends to spend USD 3.9 billion [48]. Turkey's energy needs are predicted to double by 2023. Thus, Turkey's 2023 strategy includes ambitious renewable energy ambitions. The Ministry of National Resources and Energy intends to increase the renewable energy capacity to 61,000 MW by 2023. The hydroelectric capacity will be 34,000 MW, wind capacity 20,000 MW, geothermal capacity 1000 MW, solar capacity 5000 MW, and biomass capacity 1000 MW. This will cost over USD 60 billion [49]. Photovoltaic power units at Pakistan's Quaid-e-Azam Solar Park are among China Pakistan Economic Corridor's 14 priority energy projects. The 4500-acre project has a 1000 MW capacity and costs approximately USD 1.50 billion [50]. Mohammed bin Rashid Al Maktoum's solar project is the largest solar park in the world, with a total area of 77 km 2 at Seih Al-Dahal, approximately 50 km south of Dubai. The Dubai Electricity and Water Authority (DEWA) created this undertaking. It is anticipated to have a 5000 MW output capacity by 2030, with total cost of up to 50 billion AED (USD 13.6 billion). When finished, this solar building project will reduce CO 2 emissions by more than 6.5 M tons annually [51,52].

Research Gap and Contributions
The aforementioned studies in the literature have not explicitly outlined specific design approaches, and some of the proposed design methodologies [18,20,22,23,[31][32][33][34] are quite complex. To date, no exhaustive evaluations on the techno-economic assessment of WT-PVbattery-diesel generator-bio-gasifier hybrid systems have been conducted. Additionally, the absence of dispatch strategies in such MG optimization and management systems, which are necessary to ensure technical and economic feasibility. Moreover, focusing on a hybrid WT-PV-battery system or the system with a diesel-based backup may still leave a gap between the supply and demand or lead to high total system annual costs, respectively. MG design decisions must be based on a variety of technical, environmental, and financial factors. Taking advantage of RESs may lower installation costs for power plants, utilities, and responsible governments while also lowering CO 2 emissions and electricity rates for end-users. According to the available literature, this work is one of the earliest attempts to use GWCSO algorithm for the optimal design of a stand-alone MG. However, no effort has been made to provide a comprehensive comparison of the performance of the adopted GWCSO algorithm with other ones, including PSO, GA, CSO, GWO, and ALO, to optimize the size of such a hybrid energy system. An actual case study is investigated to assess the feasibility of employing these techniques to develop the hybrid energy system based on tech-economic and eco-indicators. This feasible renewable energy-based MG system is utilized in Basra, Iraq, using real weather and load data. A sensitivity analysis has been conducted to assess the economic and operational effectiveness of the hybrid system in response to variations in certain factors. These factors include the real interest rate, the climate data-based renewable energy (solar irradiance, temperature, and wind speed), the capacity shortage, and the battery's minimal state of charge (SOC). In addition, statistical analyses have been carried out to assess the stability of the implemented algorithms. Specifically, this paper makes the following contributions:

1.
This study proposes an optimal size for the energy management MG system in Basra, Iraq, based on renewable, storage, and backup nonrenewable energy sources. This system includes a brand-new hybrid MG system with WT, PV, batteries, a diesel generator, and a biogasifier to address the unreliability of power in off-grid areas. Several aspects of the proposed system's mathematical modeling, including its components and operational processes, have been discussed in detail.

2.
In this study, GWCSO algorithm is used. With this algorithm, the optimal component sizes for the system can be determined, resulting in the lowest yearly cost and LCOE.
To the best of our knowledge, the sizing of such system components has not previously been determined by combining GWO and CS for an islanded MG.

3.
The GWCSO cost analysis results have been compared to the GA, PSO, CS, GWO, and ALO algorithms to determine the most cost-effective one.

4.
This study illustrates the techno-economic and environmental consequences of islanded hybrid MG systems at various integration levels by reducing the total number of used components and prioritizing renewables units to meet power demands, making it easier for investors to choose the best system for their investment objectives.

Research Organization
The remaining sections of this paper are structured as described below. The problem statement is presented in Section 2. In the third section, a general description of the system is given. The proposed system is modeled mathematically in Section 4. A technique for optimization is presented in Section 5. The discussion of objective functions and economic modeling can be found in Section 6. The results of the simulation were presented and discussed in Section 7. In the end, the conclusions of this study are presented in the Section 8.

Problem Statement
Basra's power system is centralized, relies on conventional power stations, and participates in and is connected to the Iraqi central network. Annually, substantial sums are paid to meet fuel expenditures. This network is now experiencing a number of challenges. It depends on one thermal station (Al-Hartha) and four gas plants (other stations) as shown in Figure 1, which pollute, make radioactive waste, and can produce up to 4 GW at their peak without spare units. optimization is presented in Section 5. The discussion of objective functions and economic modeling can be found in Section 6. The results of the simulation were presented and discussed in Section 7. In the end, the conclusions of this study are presented in the Section 8.

Problem Statement
Basra's power system is centralized, relies on conventional power stations, and participates in and is connected to the Iraqi central network. Annually, substantial sums are paid to meet fuel expenditures. This network is now experiencing a number of challenges. It depends on one thermal station (Al-Hartha) and four gas plants (other stations) as shown in Figure 1, which pollute, make radioactive waste, and can produce up to 4 GW at their peak without spare units. According to Table 2 [7], the minimum annual overall cost necessary to fulfill 22,092,570.7 MW (the complete annualized load of basrah city in 2022) is up to USD 1.946 billion, based on fuel and operation expenses. This cost is incurred if thermal station (Al-Hartha) and other gas power plants are employed to serve the above-mentioned annualized demand. The annual fuel and operating cost can reach up to (USD 2.209 billion) if only gas stations are used to meet the annualized load. This proves that the current stations are connected to the centralized Iraq network and cost the state budget heavily. To lower expenses and CO2 emissions, and to remove centralized power system issues, it is crucial to install islanded MG using clean, renewable, and sustainable power plants. Moreover, the optimal size configuration for hybrid power plants is an issue that this study aims to address. The main issue is selecting the optimal capacity to reduce system costs while maximizing reliability. However, optimum sizing techniques cannot be carried out until the components to be hybridized have been mathematically modeled.  Figure 2 represents the structure of the islanded MG to be optimized. This MG consists of AC and DC buses that are linked through a bidirectional main inverter. Solar PV, DC loads, and BESS are linked to the DC bus, while wind turbine, diesel generator, and biomass gasifier are connected to the AC bus. The primary purpose of the According to Table 2 [7], the minimum annual overall cost necessary to fulfill 22,092,570.7 MW (the complete annualized load of basrah city in 2022) is up to USD 1.946 billion, based on fuel and operation expenses. This cost is incurred if thermal station (Al-Hartha) and other gas power plants are employed to serve the above-mentioned annualized demand. The annual fuel and operating cost can reach up to (USD 2.209 billion) if only gas stations are used to meet the annualized load. This proves that the current stations are connected to the centralized Iraq network and cost the state budget heavily. To lower expenses and CO 2 emissions, and to remove centralized power system issues, it is crucial to install islanded MG using clean, renewable, and sustainable power plants. Moreover, the optimal size configuration for hybrid power plants is an issue that this study aims to address. The main issue is selecting the optimal capacity to reduce system costs while maximizing reliability. However, optimum sizing techniques cannot be carried out until the components to be hybridized have been mathematically modeled.  Figure 2 represents the structure of the islanded MG to be optimized. This MG consists of AC and DC buses that are linked through a bidirectional main inverter. electricity generation is to meet the load requirement of the Basra city. The size evaluation approach takes into account the system's load profile, reliability restrictions, and economic and environment data. Once the foundation is laid, the assessment approach executes a year-long optimization model simulating an economic dispatch with the goal of reducing the annual cost and meeting the load.

Climatological and Load Data of Basra
As solar and wind energy are only available intermittently, hybrid systems are typically employed to ensure uninterrupted power. Input parameters for program simulations include data such as load demand, component costs, solar irradiance, temperature, and wind speed. The input utilized weather parameters for various components are illustrated in Figure 3. In winter, Basra can receive 965 W/m 2 and in summer, 1040 W/m 2 . The wind speed in Basra can reach 10 m/s or more. As mentioned before, Basra is the excellent place for collecting both wind and solar power.
Electricity consumption may be influenced by several factors, such as the economy, the weather, and how efficiently loads are managed. The annual load profile is shown in Figure 4. Figure 5a shows the daily summer load in Basra for the first day of August, whereas the daily winter load (the first day of December) is depicted in Figure 5b. As seen in Figure 5, the summer loads are greater than the winter loads. The peak season for demand is between June and September, when high summer temperatures necessitate the Solar PV, DC loads, and BESS are linked to the DC bus, while wind turbine, diesel generator, and biomass gasifier are connected to the AC bus. The primary purpose of the electricity generation is to meet the load requirement of the Basra city. The size evaluation approach takes into account the system's load profile, reliability restrictions, and economic and environment data. Once the foundation is laid, the assessment approach executes a year-long optimization model simulating an economic dispatch with the goal of reducing the annual cost and meeting the load.

Climatological and Load Data of Basra
As solar and wind energy are only available intermittently, hybrid systems are typically employed to ensure uninterrupted power. Input parameters for program simulations include data such as load demand, component costs, solar irradiance, temperature, and wind speed. The input utilized weather parameters for various components are illustrated in Figure 3. In winter, Basra can receive 965 W/m 2 and in summer, 1040 W/m 2 . The wind speed in Basra can reach 10 m/s or more. As mentioned before, Basra is the excellent place for collecting both wind and solar power.
Mathematics 2023, 11, x FOR PEER REVIEW 9 of 36 usage of air conditioning. Consequently, the high electrical demands are driven by variations in the weather, particularly the increase or decrease in temperature and humidity.
In the southern Iraqi city of Basra, where summer temperatures and humidity are quite high, consumers do not switch off the air conditioning, and air chillers are ineffective for cooling. It is evident that summertime loads and winter loads differ greatly, and that the summer peak load is larger than the winter peak load.

Dispatch Strategy
The proposed hybrid islanded MG system relies on solar PV, WT, biomass gasifier, battery units, with the diesel generator serving as a backup. First priority is given to renewable solar and wind energies to supply demand, followed by battery units to handle energy shortages. Then, if the available resources are insufficient to fulfill demand, a biogasifier energy source is utilized. Finally, a nonrenewable source (diesel generator) is employed if all adopted energy sources are deficient to meet demand. An optimal hybrid system size can be determined by considering the available RESs, the load at the chosen site, the economic and technical features of the hardware components, and the dispatch technique. The dispatch strategy or energy management algorithm have a significant impact on the optimal size and, as a result, on the post-optimization performance indicators. Since a load-following dispatch approach can reduce wasteful energy consumption and has cheaper LCOE and annual cost values, it is the focus of this research. Figure 6 shows the proposed operational energy management strategy. Figure 7 shows a pseudocodebased proposed energy management strategy.

Dispatch Strategy
The proposed hybrid islanded MG system relies on solar PV, WT, biomass gasifier, battery units, with the diesel generator serving as a backup. First priority is given to renewable solar and wind energies to supply demand, followed by battery units to handle energy shortages. Then, if the available resources are insufficient to fulfill demand, a biogasifier energy source is utilized. Finally, a nonrenewable source (diesel generator) is employed if all adopted energy sources are deficient to meet demand. An optimal hybrid system size can be determined by considering the available RESs, the load at the chosen site, the economic and technical features of the hardware components, and the dispatch technique. The dispatch strategy or energy management algorithm have a significant impact on the optimal size and, as a result, on the post-optimization performance indicators. Since a load-following dispatch approach can reduce wasteful energy consumption and has cheaper LCOE and annual cost values, it is the focus of this research. Figure 6 shows the proposed operational energy management strategy. Figure 7 shows a pseudocode-based proposed energy management strategy. Mathematics 2023, 11, x FOR PEER REVIEW 11 of 36 Figure 6. The proposed optimal sizing-based operational energy management strategy. Figure 6. The proposed optimal sizing-based operational energy management strategy.

Solar PV
According to [53,54], Equation (1) combines all the essential elements that determine PV output, such as solar radiation and temperature. A solar PV panel's power output can be written as where P s (t) represents solar PV output power, PV nominal power under normal test conditions is denoted by P nom PV , solar radiation is denoted by G, reference radiation is denoted by G re f = 1 kW/m 2 , and K is the power-temperatures coefficient (for monocrystalline and polycrystalline (Si) solar cells, it is −3.7 × 10 −3 1/C o [55,56]), T re f = 25 • C is the standard temperature at standard conditions, and T amb refers to the ambient temperature.

Wind Turbine
A wind turbine's output can be determined using the following formula: where P W (t) represents wind turbine output power, P W r is the single wind turbine rating power, V cin is the cut-in speed, V rat is the rated wind speed, V cout is the cut-out speed, and V(t) is the required reference height-based wind speed. Hub height wind speeds are not always the same as reference height speeds because they are dependent on both the geographical location and the site. The full form of this expression is as follows: where V(t) denotes the wind speed at height H WT , V r (t) denotes the wind speed at the reference height (H r ), and is the friction coefficient. For flat, well-lit areas, the friction coefficient is often just 1/7, according to studies [57,58].

Battery Unit
When PV and WT renewable energies are insufficient, a hybrid system can use batteries to store extra energy and release it when needed. An accurate estimate of the charge state allows for the measurement of energy. Using the following formula, one may determine the SOC of a battery as a function of time [57,58].
where V bus represents the bus voltage, P b (t) the input/output power, and η batt denotes the round trip efficiency of the battery. Positive P b (t) indicates that the battery is being charged; negative P b (t) indicates that the battery is being discharged. The battery's charging efficiency is denoted by η c batt , and its discharging efficiency is denoted by η d batt [59]. The efficiency of charging is assumed to be 85%, while the efficiency of discharging is assumed to be 100%. The aggregate capacity (C n ) of a battery bank is equivalent to the maximum state of charge (SOC max ). This idea is stated as follows: where C b is the battery capacity, N batt is the number of batteries, and V batt represents the battery voltage. There is a minimum state of charge, denoted by SOC min , which the battery bank must not be discharged. If the battery bank is being heavily utilized, this restriction can serve as a system constraint. The required bus voltage is attained by connecting batteries in series. Maximum charge and discharge power are also important factors to consider when simulating battery behavior. It is determined by the following formula and is directly proportionate to the maximum charge current.
where I max represents the maximum charge current.

Diesel Generator Modeling
The diesel generator is utilized as a backup power supply if the renewable energy sources and battery bank are insufficient to meet the required load power demand. The diesel generator's hourly fuel consumption can be determined using the following equation [60,61]: where F(DG) is the generator's fuel consumption in liters per hour, P DG (t) is the output power in kilowatts, P rated DG is the generator's rated output in kilowatts, A is the slope coefficient of the fuel curve, and B is the intercept coefficient. The values of A and B employed in this investigation are 0.2461 L per hour per output kilowatts and 0.08415 L per hour per rated kilowatts [60,61].
To calculate the cost of fuel consumption, one can use the following formula [62]: where FCC DG is the cost of fuel consumption, and FC DG represents the fuel cost per liter, which is assumed to be USD 0.3/liter.

Biomass Gasifier
Through a process called biomass gasification, solid bio-residue is transformed into a gaseous fuel that can be burned to power generators. In the case of a biomass gasifier, the producer gas generated during partial combustion serves as an input fuel. A biomass gasifier's yearly electricity output in kilowatt-hours can be determined by using the formula where E bio represents the biomass gasifier's yearly electricity output, CUF represents the capacity utilization factor and P bio represents the system's rating power. Several factors, including the biomass's calorific value, its availability (Ton/year), and the biomass gasifier's operating hours, are crucial in a biomass-based energy system. The following is the maximum capacity for a biomass gasifier: where P m bmg denotes the maximum capacity for a biomass gasifier, CV bm represents the calorific value of the biomass and η bmg represents the overall efficiency of converting biomass to electricity [57,58].

Power Converter Modeling
Having both DC and AC buses necessitates the use of a power DC/AC converter. The peak power demand establishes the size of the converter. As shown in Equation (11), the inverter power rating can be calculated [58].
where P inv (t) represents the inverter power rating, η inv represents the inverter's efficiency, and P max L (t) is the peak power demand.

Optimization Technique
Using a combination of algorithms to find better solutions for optimization problems has become increasingly popular in recent years. Hybrid optimized algorithms are more effective at resolving the problems because they incorporate many well-known optimization techniques. The GWO algorithm models the hunting process and pack structure of gray wolves. There are four different kinds of wolves represented here. The alpha (α) wolf is the pack's dominant member and occupies the pinnacle of the social hierarchy.
There is no requirement that the alpha be the strongest wolf in the pack, but it does have to be the best leader. It is responsible for coordinating the group's activities, such as foraging and predation. The alpha assistant beta (β), who is situated on the second level of the pyramid and assists the alpha in leading the group. Delta (δ), the third-level wolf, must obey the commands of the upper wolves, alpha and beta. When an alpha or beta has reached the end of its useful life, it is demoted to delta. The letter omega (ω) denotes the bottom of the pyramid. Omega is obligated to follow the group's directives [58].
The meta-heuristic algorithms GWO and cuckoo search (CS) are widely used today. However, their methods of searching are different. The CS algorithm is inspired by cuckoos' parasitic breeding. Cuckoo parasitism on other birds' broods serves as inspiration for CS, which employs Lévy flight to come up with original ideas. Many studies have shown that GWO is more adept at exploitation, while CS is more drawn to global exploration [58]. The optimal sizes of the suggested system components have been determined using the GWO algorithm, which reduces the system's cost while still satisfying the load demand. Inspecting a high-fitness individual with GWO causes a reduction in global search ability, making it easier to settle for a suboptimal solution. When it comes to updating the nest's position, a CS Algorithm (CSA) does so with a probability that fluctuates and is not tied to the search path. This makes traveling between different spaces of the world a lot less difficult. Therefore, CSA is a powerful method that can be implemented to enhance GWO.

Mathematical Model of GWO
The level of grey is governed by the fitness function. It turns out that the alpha wolf, the beta wolf, and the delta wolf are the top three fitness options. The key-group designates these three solutions. The alpha wolf is responsible for the pack's welfare. In order to develop GWO, researchers have mathematically modeled the social structure and hunting strategies of grey wolves. The following are the proposed mathematical models for social hierarchy, encircling, hunting, and attacking prey [63,64]:

1.
Encircling prey Grey wolves often use a pack strategy to catch prey. For a mathematical description of encircling behavior, we provide the following equations: where the position of a single wolf is denoted by → X, and t + 1 represents the next iteration.
The vectors A and D are the coefficients, and the vector ( → X p ) denotes the position of the prey. The process of calculation is represented by the following equations.
where r 1 and r 2 are two arbitrary positive integers between zero and one. To achieve a linear decrease in the number of iterations, the vector a is given a value between 2 and 0.

Hunting prey
When the pack locates prey, the alpha, beta, and delta wolves are responsible for encircling it. It is safe to assume they have already spotted the prey. Consequently, a key-group is formed by combining the top three solutions and reordering the wolves accordingly. The position is updated using the following equations.
where → X α , → X β , and → X δ represent the best three solutions so far in the iteration process, which together form the key-group. More parameters are defined by the following equations. 3.

Attacking prey
For grey wolves, the moment an animal stops moving is the perfect time to pounce. As a result, the following formula describes how grey wolves approach their prey.
where t is an integer between zero and the maximum number of iterations of the current algorithm (max iteration number).

Cuckoo Search
One popular meta-heuristics algorithm takes inspiration from cuckoos' parasitic breeding behavior and is known as cuckoo search (CS) [61]. An analogy of the cuckoo egg in computer science is the solution. The CS algorithm should follow the three guidelines presented. Firstly, cuckoo birds lay only one egg at a time and choose their nests at random. Second, only the best nests will produce offspring that are desirable. Third, there is a predetermined number of bird nests and an equal chance of finding an egg. The host bird will leave the nest if it finds an intruder's egg and start a new one. During iteration, the nests are kept up-to-date by applying the next equations in accordance with the aforementioned three rules. At each iteration, a new set of candidate solution, X t i (i ∈ [1, . . . ., N]) is generated using Lévy flight by introducing a shift of position c i into the current value of X t i . To find c i , a random step, s i , is generated by a symmetric Levy distribution. Utilizing Mantegna's algorithm to generate s i [58,65]: where the random numbers u and v are, respectively, satisfied by the normal distribution [61]: where gamma Γ(.) stands for the gamma function. Following the determination of s i , the necessary shift in coordinates c i is determined as follows.
where ⊕ is an entry-wise multiplication and X best is the best solution found so far in terms of fitness. Finally, we use Equation (28) to find the new candidate solution, X t+1

Hybridized Grey Wolf and Cuckoo Search
Formula (16) demonstrates that the GWO algorithm uses a key-group called trend search to update the positions of high-fitness individuals. Therefore, it will be unable to perform well in global searches and may easily settle for a suboptimal solution when working with large sets of data. The CS algorithm repositions the nest using a random walk and levy-flights, where the length of the search path and the direction of travel are both highly arbitrary. As a consequence of this, the CS algorithm is able to seek the solution space effectively due to the fact that its step changes with the detection of small distances and occasionally walks over long distances, and the step length becomes significantly longer over the course of the algorithm. The pseudocodes for the GWO and GWCSO algorithms are shown in Figure 8.
In this work, CSA is used within the GWO algorithm to both refine the locations of previously established search agents and generate a brand new group. By obtaining the sizing components of solar PV, wind turbine, storage batteries, and biomass gasifier in an islanded MG, the new hybrid GWCSO is effective and can solve optimization problems rapidly. Here, the grey wolf agent's position, velocity, and convergence accuracy are adjusted using the CS position updated equation. Equation (28) has been used to update Equations (16)- (19). In this work, CSA is used within the GWO algorithm to both refine the locations of previously established search agents and generate a brand new group. By obtaining the sizing components of solar PV, wind turbine, storage batteries, and biomass gasifier in an islanded MG, the new hybrid GWCSO is effective and can solve optimization problems rapidly. Here, the grey wolf agent's position, velocity, and convergence accuracy are adjusted using the CS position updated equation. Equation (28) has been used to update Equations (16)-(19).

Objective Functions and Economic Modeling
This paper optimizes the energy flow-based component sizing of the hybrid energy system while reducing the total annualized cost ( ). The number of WT, solar PV panels, battery capacity, and biomass gasifier rating have been selected as the four major decision factors for optimal configuration. The concepts of and are utilized in this economic analysis. The solution with the smallest values of all constraints and parameters is proven to be the best solution. The replacement cost, operational and maintenance

Objective Functions and Economic Modeling
This paper optimizes the energy flow-based component sizing of the hybrid energy system while reducing the total annualized cost (ANC). The number of WT, solar PV panels, battery capacity, and biomass gasifier rating have been selected as the four major decision factors for optimal configuration. The concepts of ANC and LCOE are utilized in this economic analysis. The solution with the smallest values of all constraints and parameters is proven to be the best solution. The replacement cost, operational and maintenance cost, salvage cost, and total capital cost make up the objective function of the overall system cost. The main objective function that needs to be minimized within the given constraints is taken to be the following function: Minimizing ANC ANC = F N s C s + N W C W + N bat C bat + P inv C inv + P bmg C bmg + P DG C DG (29) where C W , C s , C inv , and C bat represent the cost of a wind turbine (per kilowatt-hour), solar PV panel (per kilowatt-hour), inverter (per kilowatt-hour), and battery (per unit), respectively. C bmg represents the biomass gasifier's price (per kilowatt) and P bmg represents its power output. C DG denotes the diesel generator's cost (per kilowatt) and P DG represents its power output. The inverter has a power output of P inv . The total number of wind turbines, solar photovoltaic panels, and batteries are denoted by N W , N s , and N bat , respectively. The ANC of an installed component includes the capital costs, replacement costs, salvage costs, annual operation and maintenance costs. Additionally, the total ANC value can be expressed as follows for each component: where the capital costs denoted by C c , C r represents the replacement costs, and C s represents the salvage costs, annual operation and maintenance costs denoted by C om . The objective function is minimized while a number of constraints are enforced, which can be summed up as follows: where N max s , N max batt , and N max W represent the maximum numbers of solar PV panels, batteries, and wind turbines, and P max bmg represents the maximum rating of a biomass gasifier. (46) where N is the project life, i is the interest rate, and P m DG is the maximum DG energy production.   [58,66].
A microgrid's "Renewable Factor" (RF) is the ratio of its power generated from renewable sources relative to the power generated from nonrenewable sources [67,68]. When the RF is 100%, the system is considered to be in its ideal state and is wholly powered by renewable energy sources. When it is equal to 0, it means that the amount of energy produced by renewable energy resources and nonrenewable energy sources is equal [36].

Simulation Results
The adopted annual ambient temperature, solar irradiance, and wind speed as weather data inputs are shown in Figure 9a, b, and c, respectively. The Basra city total consumption load profile is shown in Figures 5 and 6 and is composed of the Commercial Load (CL), Residential Load (RL), Industrial Load (IL), and DC load. The weather and load data have been adopted in order to identify the optimal size of components and to carry out energy management analysis. Other Interest rate (i) and project Life 6% and 20 years

Simulation Results
The adopted annual ambient temperature, solar irradiance, and wind speed as weather data inputs are shown in Figure 9a, b, and c, respectively. The Basra city total consumption load profile is shown in Figures 5 and 6 and is composed of the Commercial Load (CL), Residential Load (RL), Industrial Load (IL), and DC load. The weather and load data have been adopted in order to identify the optimal size of components and to carry out energy management analysis.

Optimal Sizing Results
The optimal results include the total required number of WT units, solar PV panels, batteries, and the maximum gasifier rating. Figure 10 illustrates the economic evaluation procedure for determining the optimal configuration. The minimum ANC and LCOE metrics are used to determine which solution is the most cost-effective and practical choice. The optimization algorithms used to model the proposed method in MATLAB are controlled by the parameters shown in Table 4. Figure 11 shows the complete optimal results found by all applied algorithms. The optimal estimated costs for each individual system component are shown in Figure 12. All algorithm-based optimal sizes give nearly identical results. The GWCSO algorithm is able to provide the most optimal solution at the lowest possible cost. The GWCSO estimates 8,683,501.427 kW of solar PV, 1,999,999.046 kW of wind turbines, 26,675,783.63 batteries, and a 3,783,107.662 kW biomass gasifier. Using GWCSO-based proposed MG, the ANC and LCOE metrics are shown in Figure 13a and b, respectively. The GWCSO offers the lowest ANC and LCOE, which are, respectively, 2.6918 × 10 9 and 0.1192. The solar PV, WT, and biogasifier fractions are shown in Figure  14. The figure clearly shows that 63%, 26%, and 11%, respectively, of the system's total energy production are made up of solar, wind, and bio-gasifier energy. In Figure 15, the adopted algorithms' convergence curves are shown. In light of the findings, it is evident that GWCSO coverage extends down to the ANC's minimum value of 2.6918 × 10 9 , followed by PSO and ALO (2.6919 × 10 9 and 2.6923 × 10 9 , respectively).

Optimal Sizing Results
The optimal results include the total required number of WT units, solar PV panels, batteries, and the maximum gasifier rating. Figure 10 illustrates the economic evaluation procedure for determining the optimal configuration. The minimum ANC and LCOE metrics are used to determine which solution is the most cost-effective and practical choice. The optimization algorithms used to model the proposed method in MATLAB are controlled by the parameters shown in Table 4. Figure 11 shows the complete optimal results found by all applied algorithms. The optimal estimated costs for each individual system component are shown in Figure 12. All algorithm-based optimal sizes give nearly identical results. The GWCSO algorithm is able to provide the most optimal solution at the lowest possible cost. The GWCSO estimates 8,683,501.427 kW of solar PV, 1,999,999.046 kW of wind turbines, 26,675,783.63 batteries, and a 3,783,107.662 kW biomass gasifier. Using GWCSO-based proposed MG, the ANC and LCOE metrics are shown in Figure 13a and b, respectively. The GWCSO offers the lowest ANC and LCOE, which are, respectively, 2.6918 × 10 9 and 0.1192. The solar PV, WT, and biogasifier fractions are shown in Figure 14. The figure clearly shows that 63%, 26%, and 11%, respectively, of the system's total energy production are made up of solar, wind, and bio-gasifier energy. In Figure 15, the adopted algorithms' convergence curves are shown. In light of the findings, it is evident that GWCSO coverage extends down to the ANC's minimum value of 2.6918 × 10 9 , followed by PSO and ALO (2.6919 × 10 9 and 2.6923 × 10 9 , respectively). Mathematics 2023, 11, x FOR PEER REVIEW 23 of 36     Figure 11. Comprehensively optimal outcomes achieved through the adoption of algorithms. Figure 12. Comprehensively optimal costs of system's components. Figure 11. Comprehensively optimal outcomes achieved through the adoption of algorithms.
Mathematics 2023, 11, x FOR PEER REVIEW 24 of 36 Figure 11. Comprehensively optimal outcomes achieved through the adoption of algorithms. Figure 12. Comprehensively optimal costs of system's components. Figure 12. Comprehensively optimal costs of system's components.

Energy Management Results
Figure 16a-d, respectively, display the annualized power produced by solar PV, WT, bio-gasifiers, and diesel generators. Similarly, monitoring the charging and discharging rates of the battery is essential, and Figure 17 illustrates the annual input and output en- Figure 15. The applied algorithms' convergence curves.

Energy Management Results
Figure 16a-d, respectively, display the annualized power produced by solar PV, WT, bio-gasifiers, and diesel generators. Similarly, monitoring the charging and discharging rates of the battery is essential, and Figure 17 illustrates the annual input and output energy of the adopted battery units. The excess energy at any one-hour can be utilized as a deferred load or dumped if it is not needed immediately. If the amount of energy needed to discharge exceeds the rate at which batteries can be discharged, a biomass gasifier will be adopted as the power source.  The proposed system utilized renewable energy sources such as solar panels, wind turbines, batteries, and a gasifier, in addition to the diesel energy as a backup source. The average monthly energy balance over one year is shown in Figure 18. Each monthly bar represents a month's value of energy production from a given source, such as wind, solar PV, batteries (input and output), a gasifier, and a diesel generator. Batteries are used to make up for the shortfall in supply when renewable energy sources cannot meet demand by themselves. The gasifier will provide output power if and only if the combined power from the solar system, the wind, and the batteries output is not sufficient to fulfill the load demand. Therefore, if there is still energy after meeting the load demand, it is essential to determine whether it can all be stored in the battery; if so, the residual energy must be stored in the battery. When solar PV, WT, batteries, and the bio-gasifier are unable to supply enough energy to meet demand, a diesel generator is used to make up the shortfall.   To ensure the proposed system would function optimally over a year, a period of one week has been selected for testing. For the purpose of illustrating the power flow throughout the system, Figure 19 illustrates a full power exchange for the first week of August (summer demand peaked here). As illustrated in the first day (Figure 20), the battery output (black curve) met the load demand between (4 h-6 h), (14 h-19 h), and (19 h-21 h), as solar and wind energy alone are insufficient to meet the deficit. Solar, wind, and battery energies were unable to meet the demand in the intervals (1 h-5 h), (5 h-7 h), (18 h-20 h) and (20 h-24 h) on the first day of August, so the bio-gasifier is adopted to meet the demand. Solar and wind power have been providing the day's other demand intervals without a doubt. All the adopted resources are insufficient to meet load by the end of the fifth day of this week, so the diesel generator is operating to do so as shown in Figure 21.
In systems employing batteries as storage devices, the measuring of SOC becomes crucial. Figure 22 shows the energy and average charge level of the battery bank for the first week of August. Initiating SOC is set at 100%, and the minimum acceptable SOC is set at 20%. In addition, as shown in Figure 22, battery SOC is good in most cases apart from when adopted resources are scarce or when load demand is high. To ensure the proposed system would function optimally over a year, a period of one week has been selected for testing. For the purpose of illustrating the power flow throughout the system, Figure 19 illustrates a full power exchange for the first week of August (summer demand peaked here). As illustrated in the first day (Figure 20), the battery output (black curve) met the load demand between (4 h-6 h), (14 h-19 h), and (19 h-21 h), as solar and wind energy alone are insufficient to meet the deficit. Solar, wind, and battery energies were unable to meet the demand in the intervals (1 h-5 h), (5 h-7 h), (18 h-20 h) and (20 h-24 h) on the first day of August, so the bio-gasifier is adopted to meet the demand. Solar and wind power have been providing the day's other demand intervals without a doubt. All the adopted resources are insufficient to meet load by the end of the fifth day of this week, so the diesel generator is operating to do so as shown in Figure 21.      In systems employing batteries as storage devices, the measuring of SOC becomes crucial. Figure 22 shows the energy and average charge level of the battery bank for the first week of August. Initiating SOC is set at 100%, and the minimum acceptable SOC is set at 20%. In addition, as shown in Figure 22, battery SOC is good in most cases apart from when adopted resources are scarce or when load demand is high. The results for the first week of the month of January are shown in Figure 23 (as a winter case study). The load demand is low during the winter months. Wind and solar energies are adequate to meet the demand in the interval (5 h-15 h) of the first day of January, as shown in Figure 24. These energies alone are insufficient to meet the demand, so the battery output (black curve) fulfilled the load demand at all other intervals. The bio-gasifier has not been utilized in the majority of winter days because the load demand is low and can be satisfied by wind, solar, and storage energy. Figure 25 illustrates the energy and average charge level of the battery for the first week of January. The SOC of the battery is verified to be within the acceptable range, proving that the proposed method has been properly sized. The results for the first week of the month of January are shown in Figure 23 (as a winter case study). The load demand is low during the winter months. Wind and solar energies are adequate to meet the demand in the interval (5 h-15 h) of the first day of January, as shown in Figure 24. These energies alone are insufficient to meet the demand, so the battery output (black curve) fulfilled the load demand at all other intervals. The bio-gasifier has not been utilized in the majority of winter days because the load demand is low and can be satisfied by wind, solar, and storage energy. Figure 25 illustrates the energy and average charge level of the battery for the first week of January. The SOC of the battery is verified to be within the acceptable range, proving that the proposed method has been properly sized.

Robustness and Speed Tests
Each algorithm has been independently run twenty times to establish its stability. Figure 26 shows the average and standard deviation of annual cost values. It is clear that the GWCSO algorithm is superior to other algorithms because it displays the lowest amount of deviation, leading to a small deviation from the mean. It is evident that GWCSO produces a lower mean value = 2.6963 × 10 9 and standard deviation = 9.23381 × 10 4 . Figure 27 illustrates the computation time required by each algorithm to determine the optimal sizing of system components. The optimal solution can be found quickly with the GWO, GWCSO, and ALO algorithms, as contrasted to the other algorithms. The computation time for the GWO, GWCSO, and ALO is 403.3 s, 413.8 s, and 502.139 s, respectively. The results indicate that the GWCSO outperforms its competition in both robustness and speed.

Robustness and Speed Tests
Each algorithm has been independently run twenty times to establish its stability. Figure 26 shows the average and standard deviation of annual cost values. It is clear that the GWCSO algorithm is superior to other algorithms because it displays the lowest amount of deviation, leading to a small deviation from the mean. It is evident that GWCSO produces a lower mean value = 2.6963 × 10 9 and standard deviation = 9.23381 × 10 4 . Figure 27 illustrates the computation time required by each algorithm to determine the optimal sizing of system components. The optimal solution can be found quickly with the GWO, GWCSO, and ALO algorithms, as contrasted to the other algorithms. The computation time for the GWO, GWCSO, and ALO is 403.3 s, 413.8 s, and 502.139 s, respectively. The results indicate that the GWCSO outperforms its competition in both robustness and speed. amount of deviation, leading to a small deviation from the mean. It is evident that GWCSO produces a lower mean value = 2.6963 × 10 9 and standard deviation = 9.23381 × 10 4 . Figure 27 illustrates the computation time required by each algorithm to determine the optimal sizing of system components. The optimal solution can be found quickly with the GWO, GWCSO, and ALO algorithms, as contrasted to the other algorithms. The computation time for the GWO, GWCSO, and ALO is 403.3 s, 413.8 s, and 502.139 s, respectively. The results indicate that the GWCSO outperforms its competition in both robustness and speed.

Conclusions
A method for calculating the optimal size of an energy management standalone MG system was proposed in this study. An integration of renewable and conventional sources, such as solar PV, WT, biomass gasifiers, diesel generators, and battery storage units, is used to power this system, which connects a DC bus and an AC bus using a power electronics conversion. The proposed hybrid MG system's primary objective is to provide the city of Basra, Iraq, with all the clean energy it requires, thereby eliminating the problems caused by the city's current grid, which include excessive fuel and operating costs, CO2 emissions, and a centralized power structure. This paper proposes an optimization design based on a recently developed nature-inspired metaheuristic GWCSO optimization algorithm in order to find the lowest annual electricity costs with the fewest system component units. In the proposed energy management strategy, WT and solar PV renewable sources are prioritized for energy management, followed by energy storage units, then the biomass gasifier is adopted if the renewable and storage energies are insufficient to meet the demand; finally, the most expensive option, diesel generator, is used as a backup. This model takes into consideration resource coordination, system size, and component capacity. With this approach, the system can engage in energy trading and investment. To demonstrate the validity and efficacy of the proposed method utilizing GWCSO, simulations based on actual weather data gathered from the study site have been conducted. The results of the proposed energy management system based on the GWCSO algorithm have been compared to those of the PSO, GA, CS, GWO, and ALO. The results indicate that the GWCSO algorithm is capable of determining the lowest LCOE, costs, and minimum number of component units for the system. According to the results, GWCSO generates the lowest ANC value (2.6918 × 10 9 ), followed by PSO and ALO (2.6919 × 10 9 and 2.6923 × 10 9 , Figure 27. The processing times of the applied algorithms.

Conclusions
A method for calculating the optimal size of an energy management standalone MG system was proposed in this study. An integration of renewable and conventional sources, such as solar PV, WT, biomass gasifiers, diesel generators, and battery storage units, is used to power this system, which connects a DC bus and an AC bus using a power electronics conversion. The proposed hybrid MG system's primary objective is to provide the city of Basra, Iraq, with all the clean energy it requires, thereby eliminating the problems caused by the city's current grid, which include excessive fuel and operating costs, CO 2 emissions, and a centralized power structure. This paper proposes an optimization design based on a recently developed nature-inspired metaheuristic GWCSO optimization algorithm in order to find the lowest annual electricity costs with the fewest system component units. In the proposed energy management strategy, WT and solar PV renewable sources are prioritized for energy management, followed by energy storage units, then the biomass gasifier is adopted if the renewable and storage energies are insufficient to meet the demand; finally, the most expensive option, diesel generator, is used as a backup. This model takes into consideration resource coordination, system size, and component capacity. With this approach, the system can engage in energy trading and investment. To demonstrate the validity and efficacy of the proposed method utilizing GWCSO, simulations based on actual weather data gathered from the study site have been conducted. The results of the proposed energy management system based on the GWCSO algorithm have been compared to those of the PSO, GA, CS, GWO, and ALO. The results indicate that the GWCSO algorithm is capable of determining the lowest LCOE, costs, and minimum number of component units for the system. According to the results, GWCSO generates the lowest ANC value (2.6918 × 10 9 ), followed by PSO and ALO (2.6919 × 10 9 and 2.6923 × 10 9 , respectively). These three algorithms yield a LCOE of 0.1192. The proposed algorithm also outperformed others in terms of robustness, as its deviation over multiple runs was lower (9.23381 × 10 4 ).
In the future, we will research recent optimization techniques to further reduce the system components, annual cost, and LCOE. To enhance the load factor and optimize load supply, a demand-side management program might be incorporated for future research. Additionally, the impact of transmission packet losses on a supply-demand mismatch can be added and studied.