1 Introduction

In the past few decades, factors such as an increase in population and the expansion of industrial activities have contributed to an increase in energy demand. Currently, the majority of electricity generation relies heavily on finite fossil fuels such as oil, natural gas, and coal. In fact, over 70% of the world's energy demand is met by these sources [1]. Leading up to COP27, numerous nations have announced fresh pledges outlining their contributions to the worldwide endeavor of achieving climate objectives, specifically net zero emissions targets. According to this scenario, the most of new electricity production capacity added by 2030 will come from sources with few emissions, with wind and solar photovoltaic (PV) alone contributing nearly 500 GW annually. Consequently, the usage of coal in power production is expected to decline by 20% from its recent peak by 2030. If all the pledges announced are successfully implemented, worldwide carbon dioxide (CO2) emissions caused by energy are projected to decrease by 40% by 2050 [2].

In order to create a more sustainable energy system with reduced CO2 emissions, energy production from sources such as wind, solar, biofuels, and others is crucial. The use of RESs has several advantages, including a decrease in reliance on fossil fuels, which can help protect the environment. This also reduces dependence on energy imports and promotes rural development by expanding access to electricity in remote areas, which can help alleviate energy scarcity. Despite their numerous benefits, some of these sources, such as solar and wind, have a serious drawback in that their generation is dependent on weather conditions, which can lead to unpredictability and non-continuity in energy supply [3]. The limitation mentioned earlier means that relying solely on RESs may not be efficient due to their low reliability when compared to on-grid systems and traditional power sources [4]. To enhance reliability, AHPSs incorporate various sustainable power sources along with one or more backup systems. Due to previous limitations, AHPS faces several critical challenges, such as power management (to ensure balance between supply and demand throughout the year), generation unit sizing (both undersized and oversized AHPS components could cause system failure and increase costs), and demand response strategies (for achieving high reliability without increasing the size of the hybrid system) [5].

In isolated regions where the cost of building electric utilities is becoming too expensive due to increasing transmission line expenditures, AHPSs may be the most suitable option [6]. Finding the right system size to fulfill the energy requirements of a specific location and achieving an optimal system that satisfies economic, environmental, and reliability objectives can be challenging for several reasons. First, the unpredictable nature of energy sources. Second, creating an accurate cost estimate for different system sizes is challenging. Finally, applying optimization algorithms to determine the best size requires significant effort and complexity [7].

Researchers have suggested different approaches, including computational software and meta-heuristic optimizers, to address this issue. Some examples of these methods include using meta-heuristic methods like particle swarm optimization (PSO) [8], cuckoo search (CS) [9], ant colony optimization (ACO) [10], and marine predators algorithm (MPA) [11], as well as utilizing software applications such as HOMER [12] and iHOGA [13]. These methods have gained significant attention for addressing this challenge. Furthermore, Table 1 illustrates various techniques for attaining the optimal design of AHPSs and some of the objectives related to sizing.

Table 1 An overview of recent optimization approaches and evaluation indicators for designing AHPSs

In remote areas such as islands, rural, and certain urban regions in developing countries, electricity supply for isolated communities is commonly reliant on diesel generators. This dependence introduces uncertainties due to the fluctuating costs of fuel and the adverse environmental impact caused by high pollution [14]. Consequently, hybrid power systems emerge as a promising solution for supplying electricity to isolated communities. Siwa Oasis, located in Egypt's western desert, is an exceptionally appealing investment area. The average load demand for this isolated site, approximately 262 kW, is met by a diesel generating station. Considering the national energy sector's strategy to elevate the use of renewable resources to 20% by 2027, WTs and PVs emerge as the most promising energy sources in Egypt [15]. Optimal sizing of AHPS poses a significant challenge, with the primary goal being to ensure high system reliability and minimize carbon emissions without increasing system expenses [16]. A recent optimization approach called 'Dandelion Optimizer' was applied to address the sizing issue. The DO method proposed in this study exhibits superior performance, featuring exceptional iterative optimization and robustness when compared to established algorithms like Whale Optimization Algorithm (WOA), Moth Swarm Algorithm (MSA), and Seagull Optimization Algorithm (SOA) [17].

The major contributions of this research are outlined below:

  • The research outlines a plan of action for renewable energy development designed for an isolated region in Egypt that is without grid infrastructure.

  • Various AHPS configurations are presented, and their performance is evaluated based on the most commonly used economic, technical, and environmental indexes.

  • Introducing a recent optimization approach called 'DO' to address the sizing issue.

To outline the structure of this paper, Sect. 2 covers the modeling of a hybrid system, including its components and energy management strategy. Section 3 includes the estimation of cost, reliability, and CO2 emissions, followed by the presentation of the utilized optimizer. Section 4 is devoted to the results and discussions, where the study region is introduced and the results of each scenario are presented. Finally, Sect. 5 presents the conclusion.

2 Modeling of a hybrid system

In this research study, three various AHPS scenarios are compared in terms of cost, reliability, and environmental impact in order to satisfy the load requirement as displayed in Fig. 1. In the first case, all available sustainable resources (PV and wind) along with systems of back-up (diesel and battery) were employed. A hybrid system composed of a wind turbine in addition to a system for backup is assessed in the second configuration, whereas in the last one, the same backup power sources with PV modules were integrated.

Fig. 1
figure 1

The three examined configurations of a hybrid system

2.1 PV system

The output energy of PV modules is negatively impacted by raising the ambient temperature, whereas it is positively impacted by increasing solar radiation. The following formula can be used to compute the electrical energy that solar modules can produce (\({P}_{PV}^{t}\)) [18].

$$\begin{aligned} {P}_{PV}^{t}& ={\eta }_{pv}*{N}_{pv}*{S}_{PVR}\\ & \quad *\frac{{R}^{t}}{{R}_{nom}}\left[1-\left(\sigma *\left(\left({T}_{a}^{t}+0.034\begin{array}{c}{R}^{t}\end{array}\right)-{T}_{SCR}\right)\right)\right]\end{aligned}$$
(1)

where \({\eta }_{pv}\), \({N}_{pv}\), \({S}_{PVR}\), \({R}^{t}\), \({R}_{nom}\), \(\sigma \), \({T}_{a}^{t}\), and \({T}_{SCR}\) represent the PV system's efficiencies, number, rated power of PV modules, solar radiation at time \(t\), solar irradiance at standard conditions, temperature coefficient of power, ambient temperature, and cell temperature under standard conditions.

2.2 Wind turbine

The electricity produced by a wind turbine is determined by utilizing wind power curves created by the designers of the WT and the wind speed information specific to the location. In accordance with the underlying principles of wind energy, the anticipated energy provided by a WT (\({P}_{w}^{t}\)) can be summed up as follows [30, 31]:

$${P}_{w}^{t}=\left\{\begin{array}{ll} 0, &\quad U\left(t\right)<{U}_{L} or U\left(t\right)>{U}_{H}\\ \left({{\eta }_{W}*N}_{W}*{S}_{WR}\right)*\frac{{U}^{2}\left(t\right)-{U}_{L}^{2}}{{U}_{R}^{2}-{U}_{L}^{2}}, &\quad {U}_{L}<U\left(t\right)<{U}_{R} \\ {{\eta }_{W}*N}_{W}*{S}_{WR}, &\quad {U}_{R}<U\left(t\right)<{U}_{H}\end{array}\right.$$
(2)

where, \({S}_{WR}\), \({N}_{W}\), and \({\eta }_{W}\) indicate rated power, number, and efficiency of the wind turbine, respectively, \(U(t)\), \({U}_{R}\), \({U}_{L}\), and \({U}_{H}\) are wind speed at a time \(t\), rated speed of WT, lowest and highest allowable wind speed for WT, respectively. When the wind speed is either less than \({U}_{L}\) or in excess of \({U}_{H}\) (regions 1 and 4), no power is produced by the wind turbine for reasons of safety. However, the turbine's output power grows linearly when the wind speed is between \({U}_{L}\) and \({U}_{R}\) (region 2). The wind must blow between \({U}_{R}\) and \({U}_{H}\) (region 3) for the turbine to produce its rated power as shown in Fig. 2.

Fig. 2
figure 2

Wind turbine power curve in its ideal form and recommended modes of operation

2.3 Diesel system

The diesel is a backup in AHPSs. It is a traditional energy source that comes into operation when renewable sources are unable to meet the energy demand and the battery system has exhausted its stored energy capacity. Its purpose is to ensure a continuous and reliable power supply, bridging the gap between demand and the available renewable energy generation. The DG's hourly fuel consumption can be calculated using the following equation [32].

$${F}_{C}^{t}=A*{S}_{di}^{t}+B*{S}_{di\_r}$$
(3)

where, \({F}_{C}^{t}\), \({S}_{di}^{t}\), and \({S}_{di\_r}\) are fuel consumption (L/h), hourly generated power output, and rated power of diesel, respectively, \(A\) and \(B\) are constant parameters that represent the coefficients for fuel consumption. These coefficients have values close to 0.246 and 0.08415, respectively.

2.4 Battery

Ensuring a consistent and uninterrupted power supply is crucial when dealing with unpredictable fluctuations in wind speed and solar radiation. Therefore, the implementation of an energy storage system becomes essential to maintain a steady flow of power to the desired load. By storing excess energy during periods of high wind speed or solar radiation. When the electricity generated from renewable sources exceeds the demand of the load, the charging process initiates. When the electricity produced from renewable sources falls short of the load, the cycle of discharge starts. Battery state of charge (SOC) during the charging and discharging cycles can be calculated using Eqs. (4), and (5), respectively [33].

$$SO{C}_{BS}^{t}=SO{C}_{BS}^{t-1}(1-{\mu }_{BS})+\left[\frac{{P}_{w}^{t}-{P}_{L}^{t}}{{\eta }_{conv}}+{P}_{PV}^{t}\right]*{\eta }_{c}$$
(4)
$$SO{C}_{BS}^{t}=SO{C}_{BS}^{t-1}(1-{\mu }_{BS})-\left[\frac{{P}_{L}^{t}-{P}_{w}^{t}}{{\eta }_{conv}}-{P}_{PV}^{t}\right]*{\eta }_{d}$$
(5)

where, \(SO{C}_{BS}^{t}\), \(SO{C}_{BS}^{t-1}\), \({P}_{L}^{t}\), and \({\mu }_{BS}\) denote the battery's state of charge at a time \(t\), (\(t-1\)), load demand, and self-discharge rate, respectively, \({\eta }_{conv}\), \({\eta }_{c}\), and \({\eta }_{d}\) signify the efficiency for converter, battery charging, and discharging, respectively.

2.5 Converter

A converter is an equipment that uses the reverse current technique to change direct current (DC) into alternating current (AC). The converter also performs rectification, or AC to DC conversion. The AHPS peak load requirements dictate the capacity of the converter that is needed; thus, this capacity must be adequate to handle this value. To ensure safety, it is recommended to have a converter capacity that is approximately 25% to 30% larger than the peak load (\({P}_{L,P}\)). Converter's rated power (\({P}_{Cnov\_R}\)) can be calculated using Eq. (6) [7].

$${P}_{Conv\_R}={P}_{L,P}*Safety \, Factor$$
(6)

2.6 Energy management strategy

To control the production of electricity and satisfy load requirements, the energy management technique is employed, as depicted by a flowchart in Fig. 3. According to this flowchart, the extra energy will be used to recharge the battery when there is more energy available from sustainable resources than there is a requirement for load and in this case, LPSP is equal to zero. In addition, the excess energy after completing the charging cycle will be used in dumping load. On the other side, the battery will be in the discharge state if the amount of energy produced by the available renewable resources remains lower than the amount of electricity required by the load. A DG will be run to make up for any energy shortfall if the utilized sustainable energy sources plus a battery system are unable to meet the demand for electricity. During diesel running mode, LPSP becomes zero if the DG is able to make up for the energy shortfall; otherwise, it can be computed using the formula discussed in the next section.

Fig. 3
figure 3

The strategy of energy management

3 Optimization technique

3.1 Dandelion-optimizer

The Dandelion-Optimizer (DO) is a new metaheuristic optimization technique presented in 2022 by Shijie Zhao [17]. This approach emulates the path of the seeds of dandelion which detach from the flower and travel through the air to a different location, where they can settle and replicate. The next three phases are used to describe how dandelion populations develop as a result of seed dispersal to the following generation.

(i) 1st phase; the ascending

During this phase, the seeds of dandelion require to attain a specific height before they can disperse from the parent plant. Factors like wind speed, air moisture, and other environmental conditions affect the level to which the dandelion seeds rise. The update of a new solution in this stage is categorized into two cases: the first is on a clear day, while the second is on a rainy day, as described in the upper and lower parts, respectively, of the following equation.

$${Y}^{t+1}=\left\{\begin{array}{ll}{Y}^{t}+\omega *{\varphi }_{1}*{\varphi }_{2}*{F}_{D}*\left({Y}^{s}-{Y}^{t}\right)&\quad rand <1.5 \\ {Y}^{t}*C &\quad else\end{array}\right.$$
(7)

where, \({Y}^{t+1}\), \({Y}^{t}\), and \({Y}^{s}\) denote the seed's position at iteration (\(t+1\)),\(t\), and a position chosen at random in the population, respectively, \(\omega \), \({\varphi }_{1}\), \({\varphi }_{2}\), and \({F}_{D}\) are adaptive, lifting, and distribution parameters, respectively.

(ii) 2nd phase; the descending

In this phase, which is also known as the exploration phase, dandelion seeds ascend to a specific level and then descend gradually. The second phase's update of a new solution is defined as follows:

$${Y}^{t+1}={Y}^{t}-\omega *\gamma *\left({Y}_{aver}-\omega *\gamma *{Y}^{t}\right)$$
(8)

where \(\gamma \), and \({Y}_{aver}\) signify Brownian motion, and population’s average position, respectively.

(iii) 3rd phase; the landing

The final stage, which is commonly referred to as the exploitation stage, involves the dandelion seed choosing its landing location based on the outcomes of the preceding two stages. The update of new solutions is simulated in the final step as follows:

$${Y}^{t+1}={Y}_{Elite}+LV*\omega *\left({Y}_{Elite}-{Y}^{t}*\sigma \right)$$
(9)

where \({Y}_{Elite}\), \(LV\), and \(\sigma \) represent the seed's optimum position in the current iteration, the Levy distribution's value, and linear coefficient ranging from 0 to 2, respectively.

The DO algorithm's flow flowchart is illustrated in Fig. 4.

Fig. 4
figure 4

Flowchart of DO

3.2 Cost estimate

One of the most popular and widely used indexes of the economic viability of hybrid systems is the cost of energy (\(COE\)). Depending on the annual cost of the hybrid system (\({C}_{Tot}^{Ann}\)) and the summed hourly demand for the load, \(COE\) can be summed up by Eqs. (10), and (11). The capital cost is changed to yearly capital cost by implementing the capital recovery factor (\(CRF\)), which is computed by Eq. (12) [34].

$$COE=\frac{{C}_{Tot}^{Ann}}{{\sum }_{H=1}^{8760}{P}_{L}}$$
(10)
$${C}_{Tot}^{Ann}={C}_{C}^{Ann}+{C}_{O\&M}^{Ann}+{C}_{R}^{Ann}$$
(11)
$$CR{F}^{a,{m}_{P}}=\frac{a{\left(1+a\right)}^{{m}_{P}}}{{\left(1+a\right)}^{{m}_{P}}-1}$$
(12)

where, \({C}_{C}^{Ann}\), \({C}_{O\&M}^{Ann}\), and \({C}_{R}^{Ann}\) are the yearly capital, maintenance, and replacement cost of the utilized hybrid system equipment, respectively, \({m}_{p}\) and \(a\) denote the lifespan of the project under study and the interest rate, respectively.

3.2.1 The annual capital cost

The yearly capital expenditures for all employed equipment in the hybrid system can be determined using the formula below [34, 35].

$${C}_{C}^{Ann}=1.4\cdot {N}_{PV}\cdot {C}_{C,PV}\cdot CR{F}^{a,{m}_{PV}}+1.2\cdot {N}_{w}\cdot {C}_{C,w}\cdot CR{F}^{a,{m}_{W}}+{N}_{B}\cdot {C}_{C,B}\cdot CR{F}^{a,{m}_{B}}+{S}_{di\_R}\cdot {C}_{C,Di}\cdot CR{F}^{a,{m}_{Di}}+{P}_{Conv\_R}\cdot {C}_{C,Conv}\cdot CR{F}^{a,{m}_{Conv}}$$
(13)

where \({C}_{C,PV}\), \({C}_{C,w}\), \({C}_{C,B}\), \({C}_{C,Di}\), and \({C}_{C,Conv}\) signify PV panels, WT, battery, DG, and converter initial costs, respectively, \({S}_{di\_R}\) is DG rated power. In addition to \({m}_{PV}\), \({m}_{w}\), \({m}_{B}\), \({m}_{Di}\), and \({m}_{Conv}\) represent the lifespan of PV panels, WT, battery, DG, and converter, respectively. For the PV part, the civil work and installation expenses have been assumed to be 40% of the PV initial cost, while for the wind part, they have been estimated as 20% of the WT initial cost [36].

3.2.2 Operating and maintenance cost

For acquiring the yearly operating and maintenance expenditures of the system equipment, the equation utilized is as follows [33, 37]:

$${C}_{O\&M,PV}=1\% \,of\, {C}_{C,PV}$$
(14)
$${C}_{O\&M,w}=3\%\,of\,{C}_{C,w}$$
(15)
$${C}_{O\&M,B}=3\%\,of\,{C}_{C,B}$$
(16)
$${C}_{O\&M,Di}=3\%\,of\,{C}_{C,Di}$$
(17)
$${C}_{O\&M}^{Ann}={N}_{PV}\cdot {C}_{O\&M,PV}+{N}_{w}\cdot {C}_{O\&M,w}+{N}_{B}\cdot {C}_{O\&M,B}+{P}_{Di\_R}\cdot {C}_{O\&M,Di}$$
(18)

where, \({C}_{O\&M,PV}\), \({C}_{O\&M,w}\), \({C}_{O\&M,B}\), and \({C}_{O\&M,Di}\) are PV panels, WT, battery, and DG yearly operating and maintenance expenditures, respectively. The converter's operating and maintenance expenditures are disregarded.

3.2.3 The annual replacement cost

Over the course of the project, certain hybrid system equipment requires to be changed into new ones more than once. With the exception of the PV modules, which have a lifespan that is equivalent to the project's lifespan, all system equipment in this study requires to be replaced. The yearly replacement expenditures of some system equipment and the total of these expenditures can be determined as follows [37]:

$${C}_{R,w}^{Ann}={N}_{w}\cdot {C}_{C,w}\cdot \left(\frac{1}{{\left(1+a\right)}^{20}}\right)\cdot CR{F}^{a,{m}_{W}}$$
(19)
$$ C_{R,B}^{Ann} = N_{B} \cdot C_{C,B} \cdot CRF^{{a,m_{B} }} \cdot \sum\limits_{{m_{B} = 10,20}} {\frac{1}{{\left( {1 + a} \right)^{{m_{B} }} }}} $$
(20)
$$ C_{R,Di}^{Ann} = P_{Di\_R} \cdot C_{C,Di} \cdot CRF^{{a,m_{Di} }} \cdot \sum\limits_{{m_{Di} = 10,20}} {\frac{1}{{\left( {1 + a} \right)^{{m_{Di} }} }}} $$
(21)
$$ C_{R,Conv}^{Ann} = P_{Conv\_R} \cdot C_{C,Conv} \cdot CRF^{{a,m_{Conv} }} \cdot \sum\limits_{{m_{Conv} = 10,20}} {\frac{1}{{\left( {1 + a} \right)^{{m_{Conv} }} }}} $$
(22)
$${C}_{R}^{Ann}={C}_{R,w}^{Ann}+{C}_{R,B}^{Ann}+{C}_{R,Di}^{Ann}+{C}_{R,Conv}^{Ann}$$
(23)

where, \({C}_{R,w}^{Ann}\), \({C}_{R,B}^{Ann}\), \({C}_{R,Di}^{Ann}\), and \({C}_{R,Conv}^{Ann}\) denote the yearly replacement costs of WT, battery, DG, and converter, respectively. In this work, the lifespan of WT, battery, DG, and converter is set to be 20, 10, 10, and 10 years, respectively.

The system's net present cost (\(NPC\)) can be computed by the following formula.

$$NPC=\frac{{C}_{Tot}^{Ann}}{CR{F}^{a,{m}_{P}}}$$
(24)

3.3 Reliability modeling

\(LPSP\), which stands for Loss of Power Supply Probability has been utilized in optimization issues. Incorporating \(LPSP\) into the optimization process allows for more accurate decision-making and helps identify optimal solutions that minimize the risk of power supply failure. \(LPSP\), which ranges from 0 to 1, serves as an index of the power supply system's reliability. A value of 1 signifies that the load demand is in no way fulfilled, indicating a high probability of power supply failure. On the other hand, a value of 0 indicates that the load demand is consistently met, reflecting a highly reliable power supply system. It can be summed up by the formula as follows [38]:

$$LPSP=\frac{{\sum }_{t=1}^{8760}LP{S}^{t}}{{\sum }_{t=1}^{8760}{P}_{L}^{t}}$$
(25)

where \(LP{S}^{t}\) denotes loss of power supply at time \(t\) and the following formula can be used to compute it based on load demand and the total quantity of electricity produced by the various sources within the system.

$$LP{S}^{t}={P}_{L}^{t}-{P}_{G}^{t}$$
(26)

3.4 Environmental analysis

As previously stated, the reduction of greenhouse gas (GHG) emissions is a primary consideration in the implementation of AHPS. This study focuses on assessing carbon emissions as the environmental index in designing AHPS. Although solar and wind energy sources themselves do not emit GHGs during operation, it is important to consider the emissions associated with their manufacturing and disposal processes. Furthermore, throughout the transportation and fitting of the components in the project area, there are adverse environmental effects that can be observed [39]. It is crucial to adopt a holistic perspective when evaluating the environmental impact of renewable energy technologies. Nevertheless, the carbon emissions associated with renewable energy are significantly lower compared to those derived from fuel burning -based systems. CO2 emissions of various components of the hybrid system can be summed up using the next equations [40].

$$P{E}_{PV}={\sum }_{t=1}^{T}{P}_{PV}^{t}*{F}_{E,PV}$$
(27)
$$P{E}_{w}={\sum }_{t=1}^{T}{P}_{w}^{t}*{F}_{E,w}$$
(28)
$$P{E}_{Di}={\sum }_{t=1}^{T}{F}_{C}^{t}*{F}_{E,Di}$$
(29)
$$P{E}_{Tot}=P{E}_{PV}+P{E}_{w}+P{E}_{Di}$$
(30)

where \(P{E}_{PV}\), \(P{E}_{w}\), \(P{E}_{Di}\), and \(P{E}_{Tot}\) are the pollution emissions of PV, WT, DG, and the total CO2 emissions of a hybrid system during a time (\(T\) =8760 h), respectively, \({F}_{E,PV}\), \({F}_{E,w}\), and \({F}_{E,Di}\) represent the factor of emission for PV, WT, and DG, respectively. \({F}_{E,PV}\), \({F}_{E,w}\), and \({F}_{E,Di}\) have the following values: 0.045 kg(CO2)/kWh, 0.011 kg(CO2)/kWh, and 2.64 kg(CO2)/L, respectively [40, 41].

3.5 Multi objective optimization

In this study, multi-objective optimization is performed considering three factors: the cost of energy (\(COE\)), the loss of power supply probability (\(LPSP\)), and the total CO2 emissions,\(P{E}_{Tot}\). The aim was to find an optimal solution that considers all three factors simultaneously, as follows:

$$Optima{l}_{fitness}\begin{array}{c}=\mathit{min}\left({\gamma }_{1}*COE+{\gamma }_{2}*LPSP+{\gamma }_{3}*P{E}_{Tot}\right)\end{array}$$
(31)

where \({\gamma }_{1}\), \({\gamma }_{2}\), and \({\gamma }_{3}\) are weight values were carefully chosen using trial and error method to strike a balance between the objectives different and optimize the overall outcome of the multi-objective optimization process. These weights have been chosen as 0.4, 0.599, and 0.001 in this study, respectively.

This system works under some constraints. The system's optimal functioning must satisfy the constraint function outlined in Eq. (32), ensuring power balance at all times. The constraint, as specified in Eq. (33), is employed to guarantee that the power supplied by the DG on an hourly basis remains below or equal to the rated power of the DG. The battery system is limited to prevent issues with charging excessively and undercharging, as expressed in Eqs. (34), and (35). In this work, the maximum and minimum SOC% (\(SO{C}_{BS,Max}\) and \(SO{C}_{BS,Min}\)) percentages for the battery system are set at 80% and 20%, respectively. Another constraint in this work is \(LPSP\) which cannot exceed 5% as presented in Eq. (36).

$${P}_{PV}^{t}+{P}_{w}^{t}+{S}_{di}^{t}+{P}_{battery}^{t}={P}_{L}^{t}$$
(32)
$${S}_{di}^{t}\le {S}_{di\_r}$$
(33)
$$SO{C}_{BS,Min}\begin{array}{c}\le SO{C}_{BS}^{t}\le SO{C}_{BS,Max}\end{array}$$
(34)
$$SO{C}_{BS}^{t}=SO{C}_{BS}^{t-1}(1-{\mu }_{BS})$$
(35)
$$LPSP\le 5\%$$
(36)

4 Results and discussions

4.1 Study region

An actual case study of an AHPS was used in Siwa Oasis, which is positioned in Egypt's western desert and is part of the Matrouh governorate. The oasis, which is located at 29°12′ 11.52″ N, 25°31′ 10.74″ E, has inhabitants of about 33 thousand people. In the Western Desert, the power grid terminates in Bahariya Oasis (approximately 350 km southwest of Cairo) and Dakhla (about 300 km southwest of Assiut). Consequently, Siwa Oasis lacks connectivity to the electricity grid [42].

For the case study, Fig. 5 illustrates the hourly profile of irradiance, ambient temperature, wind speed at a height of 50 m, and load demand for the full year [43]. According to available data, the chosen site experiences an annual average wind speed of approximately 5.44 m/s, with an average horizontal solar irradiance of 6.15 kWh/m2/day. The average power demand is 262 kW, while the peak power reaches 410.4 kW. Additionally, Table 2 includes certain AHPS component specs [33]. In this study, a 6% interest rate and a system lifespan of 25 years have been employed. The simulation program MATLAB was used in this study to model and optimize an AHPS's capacity. The simulations were performed utilizing a Matlab 2021a on a PC with an Intel Core i3-10100F, 3.60 GHz processor, and 16 GB of RAM. The maximum iterations and search agents were selected as 100 and 20, respectively, in order to get the desired outcomes. The perfect system configuration is identified by analyzing and comparing the suggested various cases in the following sections.

Fig. 5
figure 5

The hourly input data of a radiation, b ambient temperature, c wind speed, and d load demand

Table 2 Characteristics of system components [33]

4.2 An optimum design of case I

The first scenario in this study is a hybrid system constructed from both available renewable sources; PV and WT in addition to backup units; battery and DG. It is evident from the comparison between the proposed cases tabulated in Table 3 that this system, which includes 1998 PV modules, 36 WTs, 399 batteries, and 131.37 kW DG, has a \(COE\) of 0.2533 $/kWh resulting in \(NPC\) of 7,419,625 $ and \(LPSP\) of \(4.55*{10}^{-6}\). The lowest annual emissions of carbon are in this instance, at 409.33 ton.

Table 3 An overview of the three suggested scenarios' simulation results

This case provides the best-balanced performance for the utilized three objectives function and this is obvious from the convergence curves shown in Fig. 6. From Fig. 7a, it is clear that, more than 82% of the carbon emissions in the first scenario are connected to DG. In addition, PV panels cause more carbon than WTs do according to the aforementioned emission factors. 90% of the total energy is provided by available sustainable sources, and the remaining 10% is provided by DG as displayed in Fig. 8a. In this construction, each component of the produced power's hourly variation can be seen in Fig. 9. The parameters involve energy supplied by PV (Ppv) and wind (Pw), charging and discharging the energy of battery (Ec and Ed), SOC of the battery as a percentage of the battery-bank's capacity (SOC %), the power that comes from DG (Pdi) and lastly, fuel burned by DG (Fc).

Fig. 6
figure 6

Convergence curves for the three cases

Fig. 7
figure 7

Percentage of carbon emissions from each energy source for all scenarios

Fig. 8
figure 8

Percentage of energy produced annually by PV, WT, and DG in the three cases

Fig. 9
figure 9

Results of the simulation of the best solution found in case I for a year of operation (i.e., 8760 h)

Figure 10 illustrates the results of the most environmentally efficient scenario, highlighting a specific day in a year (e.g., from time 3648 to 3672). The daily load profile (PL) displays two peaks: the initial peak around 13:00, coinciding with high temperatures and the need for air conditioning, and the second peak around 17:00 after sunset when workers return home. During the night and early hours, when power generation from renewable sources is minimal, the DG operates at high capacity. Between 12:00 and 17:00, when power from nonconventional sources exceeds demand, the DG is switched off, and excess power charges the batteries until reaching capacity. Once the battery is fully charged, excess power is redirected to a dummy load. After sunset, the battery discharges energy until reaching its minimum SOC, and the DG resumes operation.

Fig. 10
figure 10

Case I simulation results for a specific day of operation (from 3648 to 3672 h)

4.3 An optimum design of case II

This case has the same configuration as the first case but without the PV system and consists of 49 WTs, 399 batteries, and 176.21 kW DG. According to the results, scenario II is more costly than the other cases, with a \(COE\) of 0.3282 $/kWh, \(NPC\) of 9,613,773 $, and \(LPSP\) of 4.84*10–7. The annual pollutant (CO2) emission is 582.16 ton with an increase of 42% compared to the first case. DG is responsible for over 94% of CO2 emissions, with WT causing the remaining 6% as shown in Fig. 7b. As apparent in Fig. 8b, WTs and diesel generators contribute roughly 85% and 15% of the overall energy output, respectively. Figure 11 depicts each part of this construction's hourly changes in produced power comprising energy from the wind (Pw), battery charging and discharging (Ec and Ed), battery SOC (SOC%), power from DG (Pdi), and the fuel used by DG (Fc).

Fig. 11
figure 11

Results of the simulation of the best solution identified in case II for a year of operation (equ to 8760 h)

Figure 12 illustrates the results of the second scenario for a specific day in the year. The daily load profile shows two peaks, and during periods with positive power difference (PDif = PL − Pw) between 04:00 and 15:00, when power generated from WTs is insufficient, the battery discharges energy until reaching its minimum SOC. The DG is then activated at high capacity. For the rest of the day, WT energy is adequate, and excess power charges the batteries until capacity. Once fully charged, excess power is diverted to a dummy load.

Fig. 12
figure 12

Case II simulation results for a specific day of operation (from 3648 to 3672 h)

4.4 An optimum design of case III

The last case in this research study is a hybrid system built from a single renewable source (PV system) in addition to batteries and DG as backup equipment. It is evident from the results that this system, which is comprised of 2000 PV panels, 400 batteries, and 262.53 kW DG, has the lowest \(COE\) of 0.2311 $/kWh and \(NPC\) of 6,770,448$. The results also show that scenario III produces more annual pollutant (CO2) emissions than the first two scenarios, totaling 1347.3 ton. As seen in Fig. 7c, DG produces over 96% of CO2 emissions, and WT is accountable for the remaining 4%. The percentage of power produced by PV modules and DG to the overall production of electricity is roughly 43% and 57%, respectively as presented in Fig. 8c.

Figure 13 shows the hourly changes of produced power for each component in this configuration. Figure 14 reveals the outcomes of the most economically efficient scenario, focusing on a particular day in a year (for example, starting from time 3648 to 3672). The daily load profile (PL) exhibits two peaks, and during these periods, the power difference (PDif = PL − Ppv) has negative values. During the night and early morning hours, there is no power generated from PV sources. As a result, the diesel system operates at a high capacity to meet the demand for power. Once the sun rises, the power output from the PV source rises, resulting in a decrease in the power generated from the DG. In summary, the first case is quite similar to the last case economically and the second case environmentally. The most economical case is case III, whereas case II is the most costly one and all cases have approximately the same value of \(LPSP\). Among the three scenarios, the first has the lowest CO2 emissions, while the third has the highest level of pollution.

Fig. 13
figure 13

Results of the simulation of the best solution identified in the last case for a year of operation (8760 h)

Fig. 14
figure 14

Case III simulation results for a specific day of operation (from 3648 to 3672 h)

5 Conclusion

This paper focuses on the analysis and optimization of a PV/WT/battery/DG system that caters to the load demand of an isolated community located in Egypt. The optimization framework employed in the research evaluates three various system configurations, including PV/WT/battery/DG, WT with both backup equipment, and PV with both backup equipment systems, based on their technical, environmental, and economic criteria. The study utilizes the metaheuristic optimizer DO to determine the perfect design of the suggested AHPS. The results indicate that the most cost-effective scenario is case III, with a \(COE\) of 0.2311 $/kWh and \(NPC\) of 6,770,448 $. On the other hand, case II is the most expensive one, with a \(COE\) of 0.3282 $/kWh and \(NPC\) of 9,613,773 $. Based on the results, the first case has the least amount of CO2 emissions, with a total of 409.33 ton/year, while the third case has the highest level of pollution, with a total of 1347.3 ton/year. The study demonstrates that the first case is economically comparable to the last case, while the second case is environmentally similar to the first case.