1 Introduction

The likelihood of rising energy distribution disparity due to renewable energy sources is significant, ensuring long-term continuous energy distribution while simultaneously reducing emits of greenhouse gases. This is why most researchers are working on the design and development of distributed energy resources based on the use of renewable sources (photovoltaic panels (PV), wind turbine (WT), diesel generator (DG), biomass gasifier (BG), battery bank, and fuel cell (FC), etc.), especially in rural areas, to be utilized in feeding the required loads [1]. The hybrid energy systems need to be appropriately built and sized for distributed generation microgrids to operate securely, dependably, and economically [2]. This turns determining the hybrid energy system’s ideal size into an optimization issue that includes a set of objectives. In order to optimize hybrid energy systems, many techno-economic issues have been taken into account. Examples of costs taken into account in hybrid systems optimal sizing study include net present cost (NPC), energy cost (COE), annualized system cost (ASC), and life cycle cost (LCC). The main drawback of renewable energy sources is their reliance on the environment. This drawback is reduced by using hybrid energy system combinations, guaranteeing a standard power supply to the loads. This can be achieved by combining sustainable energy sources with being used if a more potent source fails and integrating green energy sources with conventional energy sources. Several studies focus on the effectiveness of hybrid renewable energy systems and different metaheuristic optimization techniques. Most research investigations examine whether energy production can meet load demands [3]. The technical indices used as a result are the loss of power supply probability (LPSP), the loss of load expected (LOLE), loss of energy expected (LOEE), deficiency of power supply probability (DPSP), loss of load hours (LOLH), unmet load (UL), equivalent loss factor (ELF), and renewable energy fraction [3]. Currently, examining the effectiveness of hybrid renewable systems is the subject of numerous papers, as are various optimization algorithms, with the goal being to ascertain the optimal size of the system’s constituent parts and enhance the critical technical and economic indicators in the system’s design. Several papers have presented different operation strategies for many hybrid systems designs that apply different metaheuristics and improved optimization strategies. For example, a standalone hybrid energy system based on PV, WTs, and FC configuration has been described in [4]. This study offered a power management approach that controls the power flow between the various system parts using the metaheuristic optimization technique called the mine blast algorithm (MBA). The obtained findings of the MBA method were compared with other techniques, namely, PSO, artificial bee colony (ABC), and cuckoo search (CS). Based on the same previous system combination, the authors in [5] proposed an optimal sizing optimization strategy for a hybrid system situated in the Ataka area in the Suez Gulf region, Egypt. A novel modified algorithm based on improving the performance of the traditional Artificial Ecosystem Optimization (AEO) method called Improved Artificial Ecosystem Optimization (IAEO) is utilized for this hybrid system. The major objective functions of this hybrid system are to reduce the COE, LPSP, and excess energy while satisfying the operational constraints. To demonstrate the IAEO technique’s effectiveness, a comparison of IAEO, the original AEO, PSO, Salp Swarm Algorithm (SSA), and Gray Wolf Optimizer (GWO) has been performed.

Moreover, the work in [6] developed a new hybrid system strategy based on combining the biomass system as the primary source and the FC as a backup unit. This suggested hybrid system has been offered to supply the electric power of a microgrid in a small tourist hamlet in Hurghada city, Egypt. A Multi-objective Particle Swarm Optimization (MOPSO) method minimizes the COE and the LPSP. HOMER software tool has been utilized in [7] to apply a techno-economic analysis for a new different configurations hybrid system based on PV/WT/BG/Biogas/FC/battery components. This hybrid system is developed to be practical in rural and remote places. This work provided optimal configuration for reducing COE and NPC.

In [8], four different metaheuristic algorithms (PSO, DE, the water cycle algorithm (WCA), and GWO methods) for determining the best size for an isolated microgrid in rural locations are tested for effectiveness and adaptability. In four separate AC-coupled isolated microgrids for a distant community in South Australia, these algorithms maximize the PV, WT, DG, fuel tank, and battery energy storage capacity. In terms of capacity optimization of the system’s components, the PSO and GWO algorithms produced comparable results. While the DE method was unreliable. To obtain the optimal sizing for an isolated hybrid system consisting of PV, WT, and battery units, the authors in [9] applied ten optimization methods which are simulated annealing (SA), Jaya algorithm, moth–flame optimization (MFO), GA, CS, harmony search (HS), firefly optimization algorithm (FOA), flower pollination algorithm (FPA), the simplified squirrel search algorithm (S-SSA), and the brainstorm optimization in objective space (BSO-OS) algorithm. Abd El-Sattar et al. [10] developed a hybrid algorithm, namely the Gradient Artificial Hummingbird Method (GAHA), that combines the Gradient-Based Optimizer (GBO) with the Artificial Hummingbird Algorithm (AHA). This modified GAHA method is utilized to ascertain the optimal size of PV, WT, biomass system, and battery units for a standalone area in the new Tiba city, Luxor, Egypt, considering the reducing the COE and LPSP. In [11], an enhanced Arithmetic Optimization Algorithm known as IAOA was created by updating the original AOA with the aid of the Aquila Optimizer’s leading operators (AO). This developed IAOA technique was used to determine the best design scenario for a standalone hybrid system made up of PV, WT, DG, and battery units in the El Kharga region, Egypt. The authors in [12] concentrated on determining the optimal sizing for an off-grid hybrid system using a novel PV/BG/FC construction. The objective functions of the proposed method are to reduce the COE and minimize CO2 emissions. A novel Mayfly Optimization Algorithm (MOA) has been utilized to obtain the optimal size of this hybrid system. To prove the effectiveness of the suggested MOA method, its outcomes were contrasted with those of the Sooty Tern Optimization Algorithm (STOA), Sine Cosine Algorithm (SCA), and Whale Optimization Algorithm (WOA).

Various hybrid configurations and techno-economic analysis approaches may be used to build diverse renewable systems in the best possible ways. Accordingly, researchers have discovered in recent years that metaheuristic algorithms, which are all-purpose and straightforward to use, can tackle challenging real-world problems. Because metaheuristics are very accurate and straightforward, they have drawn much attention in various challenging optimization issues in engineering, communications, medical, and social sciences [13]. Moreover, metaheuristic algorithms are also used to improve solutions for a variety of problems, such as global optimization [14], energy applications [15], power flow systems [16], image segmentation [17, 18], deep learning-based classification [19], scheduling microgrid systems [20], economic emission dispatch (EED) problems [21], and feature selection [22, 23]. Unlike deterministic approaches, metaheuristic algorithms use randomly generated search agents and specialized operators to find the best solutions in the search space. These operators take inspiration from natural occurrences such as swarm behavior, social behavior, physical theories, and evolutionary principles. There are three primary types of metaheuristic algorithms: (a) Swarm methods contain swarm-based strategies that simulate the social behavior of groups of animals, birds, and humans; (b) evolutionary methods; and (c) natural phenomenon algorithms imitate physics and chemistry principles [24, 25]. Particle Swarm Optimization (PSO) [26], a popular algorithm in this family of algorithms, is regarded as the origin of numerous other optimization methods. For the evolution-based techniques, researchers represent various operators based on the guides of the evolution theory. The well-known evolution-based methods are the Genetic Algorithms (GA) introduced in [27] by Holland and the Differential Evolution (DE) [28]. The physics-based algorithms were driven by the principles of physics and chemistry, such as the laws of gravity and electrical charges. Several algorithms have been presented to address real-world issues based on this inspiration, for example, Gravitational Search Algorithm (GSA) [29], Multi-verse Optimizer (MVO) [30], and the Gradient-Based Optimizer (GBO) [31].

The performance of a metaheuristic algorithm typically refers to the level of the optimized solution, and the time needed for the algorithm to converge. Even though many MAs have produced good results, optimization issues have grown more complex (as the number of optimized variables has grown) while still adhering to various constraints and requirements. However, despite the advantages of algorithms, numerous existing metaheuristic algorithms only sometimes guarantee the globally optimum solution. In addition, in solving the problems of conducting the parameters of the hybrid energy systems, no algorithm can be considered the better quality in determining the optimal sizing of an isolated hybrid system with reducing the COE within the limitations of LPSP. Therefore, developing new metaheuristic algorithms can effectively handle the issue of computing the optimal sizing for an off-grid hybrid system comprising PV/BG/Hydrogen Tank units (HT)/FC/Electrolyzer (ELE) modules. The hybridization concept of two or more metaheuristics and modified or improved existing algorithms effectively addresses the current optimization challenges [32]. Although hybridization enhances the performance of optimization, it must be carried out with suitable algorithms. So choosing the algorithms is a crucial step. Moreover, it is standard to choose them based on how well they function independently.

Therefore, to develop a more effective algorithm used for solving the hybrid energy system problems, we have studied more recent algorithms and features. In particular, Orca Predation Algorithm (OPA) is a novel algorithm that has begun to attract interest. The OPA algorithm has several advantages. The performance of OPA is evaluated using 23 well-known unconstrained benchmark functions, recent CEC2015 and 2017 benchmark functions, and five constrained engineering issues. Although the OPA algorithm has achieved encouraging results, it is not entirely impervious to the flaws that metaheuristics may experience. Indeed, despite being effective and powerful optimization tools, metaheuristics can run into problems. Nonetheless, any original metaheuristic algorithm has some drawbacks that impair functionality and cause slow convergence or trapping in local optima. As a result, these algorithms must be enhanced by changing the original method [33] or combining two algorithms to adjust the search techniques [34, 35]. According to the optimization problem, the main problems mentioned in the studies are the algorithm’s slow convergence speed, its tendency to get stuck in local optima, how much algorithm parameters affect algorithm performance, and how poorly exploration and exploitation are balanced. So, this paper proposes a modified Orca Predation Algorithm (mOPA) to address these limitations. The Lévy flights (LF) strategy has shown good results in enhancing metaheuristics performance [36]. Also, OBL [37] is one of the most beneficial methods for improving the search performance of the metaheuristics [38]. The mOPA method was utilized to compute the optimal sizing for an off-grid hybrid system comprising PV/BG/Hydrogen Tank units (HT)/FC/Electrolyzer (ELE) modules to demonstrate this modified approach’s usefulness. The results obtained from utilizing the mOPA are compared with results from the original OPA method and other techniques used in [12] for the same hybrid system. This work brought attention to the possibilities of using biomass systems with fuel cell technology for energy storage. Utilizing recent developments in data science and modeling methodologies, which give the required technical tools for informing decision-making, will help to enable the successful realization and deployment of these sophisticated technologies.

The contributions of the paper are summarized in the following points:

  • This paper proposed an improved mOPA algorithm that combines two enhancing strategies: Levy flight and OBL.

  • mOPA is applied to solve global optimization problems. Moreover, we compare its performance with different well-known metaheuristic algorithms.

  • The performance of mOPA compared to competitors is demonstrated using the CEC’20 test suite problems.

  • The proposed mOPA is applied to develop an optimal design for an isolated hybrid PV/BG/HT/FC/ELE system for supplying a load in Abu-Monqar region, located in Egypt.

  • The proposed mOPA method is used to solve the problem of reducing the COE, within the limitations of LPSP.

  • To prove the superiority of the recommended mOPA technique for the suggested optimization problem, the mOPA results compared with other well-known algorithms (Mayfly optimizer (MOA), Sooty Tern optimizer (STOA), and Sine Cosine optimizer (SCA)).

This paper is structured as follows: Section 2 describes the mathematical model for the original OPA method required to construct the suggested modified algorithm, the OBL concept, and the Lévy flight method. The mathematical model of the suggested mOPA algorithm is presented in Sect. 3. Section 4 discusses the real-world application, divided into four subsections. These subsections describe the suggested hybrid system components design, the optimization problem formulation, the operation energy management strategy, and the description of the site of the project study, respectively. Section 5 discusses the design findings, and the discussion contains the performance results of the proposed mOPA on CEC’20 benchmark functions and the results of the proposed hybrid system. Finally, Section 6 provides this paper’s conclusion and future work.

2 Preliminaries

This section will discuss the techniques essential to building the proposed method. The original Orca Predation Algorithm (OPA) mathematical model and the OBL idea, and the Lévy flight technique are described in detail.

2.1 Orca predation algorithm (OPA)

OPA is a novel bio-inspired metaheuristic algorithm developed by Yuxin et al. [39]. It mimics the hunting manners of orcas and simplifies it into three phases: driving, encircling, and attacking phase. OPA gives various qualities to the driving and encircling in parameter modification to balance the exploitation and exploration processes. In the attacking phase, the best solution may be determined without sacrificing the particles’ variety after considering the positions of many best orcas and several randomly chosen orcas.

The detailed mathematical formulations of the OPA algorithm are as follows:

  1. 1.

    Development of a colony of orcas A group of \(N_n\) oracs are used in OPA and represent in 1D, 2D, 3D, or extra-dimensional space. It is represented in Eq. 1

    $$\begin{aligned} X=[x1, x2, x3, ......, xN_n]= \begin{bmatrix} X_{1,1} &{} X_{1,2} &{} \ldots &{} X_{1,\text {Dim}}\\ X_{2,1} &{} X_{2,2} &{} \ldots &{} X_{2,\text {Dim}}\\ \vdots &{}\vdots &{}\vdots &{}\vdots \\ X_{N_n,1} &{} X_{N_n,2} &{} \ldots &{} X_{N_n,\text {Dim}} \end{bmatrix} \end{aligned}$$
    (1)

    where X denotes the orca population of the candidate solutions. \(xN_n\) denotes the position of the \(N^{th}\) individual orca, and \(xN_n,\text {Dim}\) is the position of the \(\text {Dim}^{th}\) dimension of the \(N^{th}\) population.

  2. 2.

    Chasing phase This phase is divided into two steps: driving and encircling. \(p_1\) is used to adapt the probability of the orca performing these two steps individually. It is a constant in [0, 1], and a random number is generated between [0, 1]. If this random number is greater than \(p_1\), the driving process is applied; other else, the encircling process will be applied.

  3. 3.

    Driving process In order to prevent the orca group from straying from the target, it is also vital to regulate the orca group’s central position and keep it near to the prey. The moving speed of the orca and the relevant position is shown in the following equations:

    $$\begin{aligned} V^t_{\text {chase},1,i}= \, {} a \times ( d \times x^t_{\text {best}} - F \times ( b \times M^t + c \times x^t_{i})) \end{aligned}$$
    (2)
    $$\begin{aligned} V^t_{\text {chase},2,i}= \, {} e \times x^t_{\text {best}} - x^t_{i} \end{aligned}$$
    (3)

    where t indicates the number of iterations, \(V^t_{\text {chase},1,i}\) represents the chasing speed after choosing the first chasing step. \(V^t_{\text {chase},2,i}\) represents the chasing speed after choosing the second chasing. Moreover, a, b, and d are randoms in [0, 1]. e is a random value in [0, 2], F is equal to 2, and q is in [0, 1] that used for choosing the chasing technique. While, M indicates the average location of the orca population as shown in Eq. 4.

    $$\begin{aligned} M= \, {} \frac{ \sum \nolimits _{i=1}^{N_{n}} x^t_i}{N_n} \end{aligned}$$
    (4)
    $$\begin{aligned} c= \, {} 1-b \end{aligned}$$
    (5)

    There are two chasing methods depending on the orca population size. If the orca is large, i.e. \((rand > q)\), the first process is applied; otherwise, if \((rand \le q)\), the second process is applied as shown in Eq. 6.

    $$\begin{aligned} {\left\{ \begin{array}{ll} x^t_{\text {chase},1,i}=x^t_i + V^t_{\text {chase},1,i} &{} if \quad rand > q \\ x^t_{\text {chase},2,i}=x^t_i + V^t_{\text {chase},2,i} &{} if \quad rand \le q \end{array}\right. } \end{aligned}$$
    (6)
  4. 4.

    Encircling of prey In this step, the orcas updating using the positions of three randomly orcas that can be expressed as follows:

    $$\begin{aligned} x^t_{\text {chase},3,i,k}= \, {} x^t_{ d1,k }+ u \times \left( x^t_{ d2,k} - x^t_{ d3,k}\right) \end{aligned}$$
    (7)
    $$\begin{aligned} u= \, {} 2 \times \left( randn - 1/2\right) \times \frac{\text {Maxitr}-t}{\text {Maxitr}} \end{aligned}$$
    (8)

    where Maxitr is the maximum iteration numbers, d1, d2, and d3 represent the three randomly selected orcas from \(N_n\) orcas and \(d1 \ne d2 \ne d3\). \(x^t_{\text {chase},3,i}\) is the position after selecting the third chasing technique.

  5. 5.

    Position changes during the encircling phase The positions are adjusted according to the following equations:

    $$\begin{aligned} \left\{ {\begin{array}{*{20}l} {x_{{{\text {chase}},i}}^{t} = \,x_{{ {\text {chase}},i}}^{t} } &{} {IF\quad f\left( {x_{{ {\rm {chase}},i}}^{t} } \right) < f\left( {x_{i}^{t} } \right) } \\ {x_{{{\text {chase}},i}}^{t} = \,x_{i}^{t} } &{} {IF\quad f\left( {x_{{ {\text {chase}},i}}^{t} } \right) \ge f\left( {x_{i}^{t} } \right) } \\ \end{array} } \right. \end{aligned}$$
    (9)

    where \(f(x^t_{\text {chase},i})\) is the fitness function relevant to \(x^t_{\text {chase},i}\), and \(f(x^t_i)\) is the fitness function relevant to \(x^t_i\).

  6. 6.

    Attacking of prey The four best-attacking positions in a circle are represented by four orcas. The following equations are used to determine the orca’s movement speed and location during an attack.

    $$\begin{aligned} V^t_{\text{attack},1,i}= \, {} \left( x^t_1 + x^t_2 + x^t_3 + x^t_4 \right) /4 - x^t _{\text {chase},i} \end{aligned}$$
    (10)
    $$\begin{aligned} V^t_{\text{attack},2,i}= \, {} \left( x^t_{ \text {chase},d1} + x^t_{\text {chase},d2} + x^t_{\text {chase},d3}\right) /3 - x^t_i \end{aligned}$$
    (11)
    $$x^t_{\text{attack},i}= x^t_{ \text {chase},i} + g_1 \times V^t_{ \text{attack},1,i} + g_2 \times V^t_{\text{attack},2,i}$$
    (12)

    where \(V^t_{\text{attack},1,i}\) and \(V^t_{\text{attack},2,i}\) are the speed vectors, \(x^t_1, x^t_2, x^t_3, and \, x^t_4\) are the four orcas in the best position, \(d1, d2, and \, d3\) are the three randomly choosen orcas from \(N_n\) in the chasing step and \(d1 \ne d2 \ne d3\), \(x^t_{\text{attack},i}\) identifies the position after the attacking process, \(g_1\) is a random number in [0, 2], and \(g_2\) is a random number in \([- 2.5, 2.5]\).

  7. 7.

    Position changes during the attacking phase The position of the orca is determined by the lower boundary \(l_b\) of the problem that can be identified using the following scheme:

    $$\begin{aligned} \begin{aligned}&\text { If} \ f(x^t_{\text{attack},i})< f(x^t_{ \text {chase},i}) \\&\quad X^{t+1}_i= x^t_{\text{attack},i}\\&\text { Else}\\&\quad Q=randn\\&\quad \text {For K from 1 to D}\\&\quad \quad \text {If } Q < p2\\&\quad \quad \quad x^{t+1}_{j,k} =l_b(k)\\&\quad \quad \text { Else}\\&\quad \quad \quad x^{t+1}_{j,k} = x^t_{\text {chase},i,k}\\&\quad \quad \text {End}\\&\quad \text {End}\\&\text {End}\\ \end{aligned} \end{aligned}$$
    (13)

    where p2 is a value in [0, 1].

To conclude, the following steps illustrate the implementation of the OPA algorithm

  • Step 1: Initialize the parameters and orca populations; number of population \(N_n\), dimension Dim, maximum number of iterations Maxitr, selection probability p1, p2, lower bound \(l_b\), and upper bound \(u_b\). The positions of orcas are defined randomly using \(l_b\) and \(u_b\).

  • Step 2: Each orca’s fitness value is determined, and the optimal fitness is selected as \(X_{\text {best}}\).

  • Step 3: The orca group’s position is being updated during the chasing phase. Depending on the selection factor p1, orcas decide whether to drive or encircle the prey at this stage. The positions are updated as shown from Eqs. 2 to 9.

  • Step 4: The orcas changed their positions throughout the attacking phase. The positions are updated using Eqs. 1012, and their positions are then replaced by \(l_b\) as shown in Eq. 13.

  • Step 5: After the attacking process, the new population will be expanded into a new group.

  • Step 6: Termination criteria: the process is terminated if the current iteration number exceeds the allowed number of iterations. Step 2 of the preceding procedures will be repeated if the optimal output solution is not reached.

2.2 Opposition-based learning (OBL)

Metaheuristic algorithms often begin with a random initial population, and over-optimization process iterations, population agents increase the chance of reaching the best solutions. Since these algorithms have a stochastic nature, the convergence time is mainly related to the distances between the initial guesses and the promising or optimal solution. As a result, the more used initial solutions close to the best solution, the more the metaheuristic algorithm quickly converges through problem search space and vice versa. OBL is a metaheuristic optimization technique used to improve a search algorithm’s convergence rate. It is an effective technique to prevent stagnation in candidate solutions [37]. The main idea of OBL is to evaluate candidate solutions in pairs, with one solution representing the current best solution and the other solution representing the "opposition" or "antithesis" to the current best solution. Comparing these two solutions allows the algorithm to identify promising areas of the search space more quickly, thereby speeding up the convergence process toward an optimal solution. HR. Tizhoosh developed the idea of the OBL [40]. OBL improves the exploitation ability of a search mechanism. In metaheuristics, convergence typically occurs when the initial solutions are nearer the optimal site; otherwise, late convergence is anticipated. By considering opposing search regions, which may be nearer to the global optimum, the OBL technique discovers better solutions in this case. The OBL works by traversing the search space in both directions. These two approaches make use of one of the initial solutions, while the opposite approach establishes the other path and then takes the most optimal solution [41]. The following describes the concept of OBL:

  • Opposition number OBL is defined as being explained by the concept of opposite numbers. The following expressions can present the opposition-based number. Consider \({\dot{x}}\) is a real number belongs to the range [uw], \([u, w] \in R\) , the opposite number of \({\dot{x}}\) is defined by Eq. (14) [41]

    $$\begin{aligned} \begin{aligned} \overline{{\dot{x}}}=u+w-{\dot{x}} \end{aligned} \end{aligned}$$
    (14)
  • Opposition point Assuming, \(P_x=\dot{x_1}, \dot{x_2}, \dot{x_3},...,\dot{x_D}\) be a point in D-dimensional space, where \(\dot{x_i}\in [u_i,w_i]\), \(u_i, w_i \in R\), i = 1, 2, 3,..., D. The point \((\overline{P_{x}})\)= \(\overline{\mathrm{\dot{x}}}_{1}, \overline{\textrm{x}}_{{\dot{x}}}, . . .,\overline{\mathrm{\dot{x}}}_{D}\). All items in \(\overline{\mathrm{\dot{x}}}\) computed by Eq. (15)

    $$\begin{aligned} \begin{aligned}&\overline{\mathrm{\dot{x}}}_{j}={u_{j}+w_{j}} - {{\dot{x}}_{j}} \quad where \quad j = {1, 2, 3, ... , D} \end{aligned} \end{aligned}$$
    (15)
  • The Opposition in optimization In the optimization method, the opposite number \(\overline{{\dot{x}}}\) is replaced by the equivalent point \({\dot{x}}\) according to the objective function. If \(f({\dot{x}})\) is better than \(f(\overline{{\dot{x}}})\), then \({\dot{x}}\) not replaced; otherwise, \({\dot{x}}\) = \(\overline{{\dot{x}}}\), so, the solutions of the population are updated according to the best value of \({\dot{x}}\) and \(\overline{{\dot{x}}}\) [42].

In OBL, the optimization process is completed using the solution with the best fitness determined by simultaneously evaluating both current candidate and opposition-based solutions. This comparison process helps to increase the speed at which the optimizer converges to promising solutions.

2.3 Lévy flight (LF)

Paul Lévy proposed the LF, and Benoit Mandelbrot elaborated on it. The step lengths in LF follow a probability distribution with hefty tails. It is one of the most common flight patterns in naturally occurring surroundings [43]. The step sizes of LF calculated using the probability function as shown in Eq. (16) [44]:

$$\begin{aligned} L(x_{j})\approx |x_{j}|^{1-\alpha } \end{aligned}$$
(16)

where \(x_{j}\) denotes the flight length, and \((1 < \alpha \le 2)\) is the power exponent. The probability density of Lévy step in integral form is shown in Eq. (17):

$$\begin{aligned} f_{v}(x;\alpha ,\rho )=\frac{1}{\pi }\int _0^\infty \exp (-\rho q^{\alpha })\cos (qx)dq \end{aligned}$$
(17)

\(\alpha\) decides the distribution index, and \(\rho\) sets the scale unit. When (\(\alpha\) = 2), it signifies Gaussian distribution, and when (\(\alpha\) =1), it signifies a Cauchy distribution [45]. Equation (17) uses a series expansion technique only when x has a vast value as Eq. (18):

$$\begin{aligned} f_{v} (x;\alpha ,\rho ) \approx \frac{{\rho \,\Gamma (1 + \alpha )\,\sin \left( {\frac{{\pi \alpha }}{2}} \right) }}{{\pi \,x^{{(1 + \alpha )}} }},\quad x \rightarrow \infty \end{aligned}$$
(18)

where \(\Gamma\) is the gamma function.

For an index distribution, \(\alpha\) value between 0.3 and 1.99 is a practical approach to generate a Lévy stable process. Mantegna et al. [46] creates random numbers method based on the Lévy distribution by Eq. 19:

$$\begin{aligned} levy(\alpha )=0.05\times \frac{x}{|y|^{1/\alpha }} \end{aligned}$$
(19)

where x and y represent normal distribution parameters with the standard deviations of \(\sigma _{x}\) and \(\sigma _{y}\) given in Eqs. (20 and 22).

$$\begin{aligned} x= \, {} \text{Normal}(0,\sigma _{x}^{2}) \end{aligned}$$
(20)
$$\begin{aligned}y= \, {} \text{Normal}(0,\sigma _{y}^{2}) \end{aligned}$$
(21)
$$\begin{aligned} \sigma _{x}= \, {} \begin{bmatrix}\frac{\Gamma (1+\alpha ) \sin \left(\frac{\pi \alpha }{2}\right)}{\Gamma \left(\frac{(1+\alpha ))}{2}\right)\alpha \, 2^{\frac{(\alpha -1)}{2}}}\end{bmatrix}^{1/\alpha }\, , \sigma _{y}=1 , \alpha =1.5 \end{aligned}$$
(22)

3 The proposed mOPA algorithm

This section provides the proposed mOPA algorithm in detail. mOPA is proposed to enhance search efficiency and avoid the limitations of the original OPA.

3.1 Shortcomings of mOPA

The original OPA algorithm has shown good performance in solving global and real-world optimization problems. However, it suffers from the lack of exploration problem as it searches inside the search region identified by the orcas. This behavior of the basic OPA algorithm stuck the whole population into local optima and may lead the algorithm to premature convergence, especially in complex and high-dimensional problems. So, referring to the No Free Lunch (NFL) that promotes the concept that no stronger optimization algorithm can perform well at all the optimization problems. Therefore, the Lévy flight strategy and the OBL mechanism have been introduced in the proposed mOPA algorithm to overcome the shortcomings of the original OPA.

3.2 Initialization phase of mOPA

According to the OPA algorithm, the mOPA algorithm begins by developing an initial population (\(N_n\)); each population has a dimension (\(\text {Dim}\)) in the search space limited by the lower and upper boundaries (\(l_b \, and \, u_b\)). The positions of orcas are defined according to \(l_b\) and \(u_b\) as shown in Eq. 23 in addition to the maximum number of iterations Maxitr and the selection probability p1 and p2.

$$\begin{aligned} Xb_i = lb_i+rand\times \left( ub_i-lb_i\right) ; \, \, i={1,2,...,N_n} \end{aligned}$$
(23)

Then, the mOPA’s diversity was improved in the search process using the OBL strategy during the initialization phase to enhance the search operation by Eq. 24:

$$\begin{aligned} \text{Opp}_s = l_b + u_b- x_b, b \in {1,2,...,N_n} \end{aligned}$$
(24)

where \(\text{Opp}_s\) is a vector obtained by performing the OBL.

3.3 The fitness evaluation phase of mOPA

Each orca’s fitness value is determined, and the best one is selected as \(X_{\text {best}}\).

3.4 Chasing phase

This phase is divided into two steps: driving and encircling process. \(p_1\) is used to adjust the probability of the orca performing these two steps individually. It is a constant in [0, 1], and a random number is generated between [0, 1]. If this random number is greater than \(p_1\), the driving phase is applied; other else, the encircling phase will be applied.

3.4.1 Perform the LF

LF is applied to acquire new positions during the chasing phase in the driving step using the following equations:

$$\begin{aligned} \text{VL}^t_{\text {chase},1,i} = a \times \left( d \times x^t_{\text {best}} - F \times \left( b \times levy(\alpha )^t + c \times x^t_{i}\right) \right) \end{aligned}$$
(25)
$$\begin{aligned} \text{VL}^t_{\text {chase},2,i}= \, {} levy(\alpha ) \times x^t_{\text {best}} - x^t_{i} \end{aligned}$$
(26)

There are two chasing methods based on the orca population size as illustrated in Eq. 27.

$$\begin{aligned} {\left\{ \begin{array}{ll} x^t_{\text {chase},1,i}=x^t_i + \text{VL}^t_{\text {chase},1,i} &{} if \quad rand > q \\ x^t_{\text {chase},2,i}=x^t_i + \text{VL}^t_{\text {chase},2,i} &{} if \quad rand \le q \end{array}\right. } \end{aligned}$$
(27)

3.4.2 Encircling step

After applying the LF strategy in the previous step, the position updated using equations from Eqs. 7 to 9 as shown in Sect. 2.1.

3.5 Attacking phase

The orcas changed their positions throughout the attacking phase as disscussed in Sect. 2.1. The positions are updated using Eqs. 1012, and their positions are then replaced by lower bounds \(l_b\) as shown in Eq. 13.

3.6 Termination criteria of mOPA

The proposed mOPA optimization process is repeated until the stopping criteria is met. The pseudo-code of the proposed mOPA algorithm is provided in Algorithm 1. Also, the flowchart of the mOPA algorithm is presented in Fig. 1.

Fig. 1
figure 1

Flowchart of mOPA algorithm

figure a

4 Real-world application

4.1 The proposed hybrid system design

In order to service a tiny remote area in Egypt, an off-grid hybrid system is simulated and evaluated to determine the best size and satisfy the electricity demand while reducing costs. This hybrid system’s primary components are PV, BG systems, ELE units, HT, and FC, which is described in detail as below:

4.1.1 Photovoltaic solar module (PV)

The following equations can be utilized to compute the PV array’s generated power \(P_{\text{PV}}(t)\) and cell temperature \(T_\text{CELL}\) [47,48,49]:

$$P_{{{\text{PV}}}} (t) = \left( {\frac{{{\text{ISR}}(t)}}{{1000}}} \right)\left( {N_{{{\text{PV}}}} P_{{{\text{PV}}}}^{{{\text{rat}}}} \eta _{w} \eta _{{{\text{PV}}}} } \right)\left( {1 - T_{\gamma } \left( {T_{{{\text{CELL}}}} - 25} \right)} \right){\text{ }}$$
(28)
$$\begin{aligned} T_\text{CELL}(t)= \, {} ISR(t) \left( (T_{N}-20)/800\right) + T_{A} \end{aligned}$$
(29)

ISR(t) is the solar radiation intensity that is present at any given time (t), \(N_{\text{PV}}\) is the PV units number, \(P_{\text{PV}}^{rat}\) is the PV rated power,\(\eta _{w}\) is the wiring efficiency, and \(\eta _{\text{PV}}\) is the PV module efficiency. While \(T_{\gamma }\), \(T_{N}\), and \(T_{A}\) are the maximum power temperature coefficient for PV modules, the cell temperature at normal operating conditions, and the ambient temperature, respectively. The main characteristics of the PV and inverter unit are indicated in Table 1.

Table 1 Main characteristics of the PV and inverter units

4.1.2 Biomass system (BG)

A small-scale downdraft gasification technique was employed in this study, which transforms solid biomass into a gaseous fuel (called producer gas or syngas) that is used to power turbines. The system performance can be expressed as follows [50,51,52]:

$$\begin{aligned} \eta _\text{sy}= \, {} \left( \text{LHV}_\text{sy} m_\text{sy}) / (\text{LHV}_{B} m_{B}\right) \end{aligned}$$
(30)
$$P_{G} (t) = {\text{ }}\left( {N_{{{\text{BG}}}} /F_{m} } \right)\left( {\frac{{\eta _{{{\text{sy}}}} {\text{LHV}}_{B} B_{{{\text{rat}}}} (t)}}{{}}{\text{LHV}}_{{{\text{sy}}}} - F_{0} P_{{G_{{{\text{rat}}}} }} } \right){\text{ }}$$
(31)
$$F_{{BG}} (t) = \left( {LHV_{{sy}} /(\eta _{{sy}} LHV_{B} )} \right)\left( {N_{G} F_{0} P_{{G_{{rat}} }} + F_{m} P_{G} (t)} \right)$$
(32)
$$\begin{aligned} E_{BG}= \, {} P_{G} (GF * 8760) \end{aligned}$$
(33)

The following expression is used to describe the amount of power produced from renewable sources \(P_{RS}\):

$$\begin{aligned} P_{\text{PV}}(t) + \left( {\frac{P_{G}(t)}{\eta _\text{inv}}}\right) \end{aligned}$$
(34)

where \(\eta _\text{sy}\) is the producer gas efficiency. \(\text{LHV}_\text{sy}\) and \(\text{LHV}_{B}\) are, respectively, the product gas’s and biomass material’s lower heat values. \(m_\text{sy}\) and \(m_{B}\) are the mass of the producer gas flowing and the biomass material, respectively.\(N_{BG}\) is the biomass generators number, \(P_{G}\) is hourly biomass consumption rate, \(B_\text{rat}(t)\) is the rated power of biomass generators, \({P}_{{{G}_\text{rat}}}\) denotes the rated power of biomass generators, and \(F_{m}\) and \(F_{0}\) represent, respectively, the marginal and no-load fuel usage.\(F_{BG}(t)\) is the generator rated power, \(E_{BG}\) presents the yearly (8760 hours) power generated by the biomass generator, and GF denotes the gasifier utilization factor. The main characteristics of the BG unit are indicated in Table 2.

Table 2 Major characteristics of the biomass system

4.1.3 Electrolyzer (ELE), hydrogen tank unit (HT), and fuel cell (FC) modeling

The electrolyzer (ELE) is a technology that uses an electric current to pass through the liquid, creating a chemical reaction. In this study, a water ELE is used in order to produce ultra-pure hydrogen in an unpolluted manner, where the hydrogen gas is produced and collected at a pressure of 30 bar [53]. This hydrogen cannot be transferred directly to the FC because the reactant pressures within it are up to 1.2 bar [53]. Therefore, a hydrogen tank is used to link directly with the ELE [7, 54]. Following the process of separating hydrogen and oxygen, the hydrogen gas is moved and saved in HT before being utilized in the FC to produce energy. The energy transferred to the HT from the ELE (\(P_\text{ELE/HT}\)) is stated as [5, 53]:

$$\begin{aligned} P_\text{ELE/HT} = \eta _\text{ELE} * P_{RS/ELE} \end{aligned}$$
(35)

where \(\eta _\text{ELE}\) indicates the ELE efficiency, and \(P_{RS/ELE}\) symbolizes the renewable energy that powers the ELE. The lowest and highest parameters constrain the stored hydrogen mass in the HT (\(m_\text{HT}\)) during the operation [5], according to this formulation:

$$\begin{aligned} m_\text{HT}^{min} \le m_\text{HT}(t) \le m_\text{HT}^\text{max}, \end{aligned}$$
(36)

The hydrogen power (\(P_\text{HT}(t)\)) and mHT(t) kept in the HT at a time interval (t) are stated as follows [7, 55]:

$$\begin{aligned} P_\text{HT}(t) = P_\text{HT}(t-1) \left( P_\text{ELE/HT}(t) -\left( {\frac{P_\text{HT/FC}(t)}{\eta _\text{HT}}}\right) \right) * \delta t \end{aligned}$$
(37)
$$\begin{aligned} m_\text{HT}(t)= \, {} P_\text{HT}(t) / \text{HHV}_{H} \end{aligned}$$
(38)

where \(P_\text{HT/FC}(t)\) is the power that the HT sends to the FC, \(\eta _\text{HT}\) is the efficiency of the HT, \(\delta t\) is the simulation’s time period, and \(\text{HHV}_{H}\) is the stored hydrogen gas’s higher heat value. The major characteristics of the ELE, HT, and FC units are indicated in Table 3. Depending on the fuel cell’s total efficiency (\(\eta _{FC}\)), the amount of electricity that FC produces (\(P_{FC}\)) can be stated as follows [7, 55]:

$$\begin{aligned} P_{FC} = \eta _{FC} * P_\text{HT/FC} \end{aligned}$$
(39)
Table 3 Main characteristics of the ELE, HT, and FC

4.2 The optimization issue formulation

4.2.1 Objective function

The main objective purpose of this system is to minimize the COE and estimate the chance of insufficient power supply operation using the LPSP, and minimizing the dummy load’s (\(L_{dum}\)) consumption of extra energy (\(P_{EX}\)) to keep the system’s cost as low as possible. The values of the objective functions are determined using the following expressions [5, 56]:

$$\begin{aligned} Min_{Z}(F)= \, {} Min \left( \alpha _{1} COE + \alpha _{2} \text{LPSP} + \alpha _{3} P_{EX}\right) \end{aligned}$$
(40)
$$\begin{aligned} Z= \, {} \left[ N_{\text{PV}} N_\text{BG} m_\text{HT} P_\text{ELE/HT} P_{FC} \right] \end{aligned}$$
(41)
$$\begin{aligned} \text{LPSP}= \, {} \sum _{1}^{8760} \left( {\frac{P_\text{dem}(t) - P_{RS}(t) - P_{FC}(t)}{P_{dum}(t)}}\right) \end{aligned}$$
(42)
$$\begin{aligned} P_{EX}= \, {} \sum _{1}^{8760} \left({\frac{L_{dum}}{P_\text{dem}}}\right) \end{aligned}$$
(43)

\(\alpha\) indicates the value of each objective function’s weight factor (\(\alpha _{1}\) = 0.3, \(\alpha _{2}\) = 0.5, and \(\alpha _{3}\) = 0.2), Z stands for the optimization problem’s control variables, and \(p_\text{dem}(t)\) is the power load demand (kWh).

4.2.2 Constraints

According to the decision variables’ higher and lower bounds, the optimization method operates within the limitations listed below:

$$\begin{aligned} 1 \le N_{\text{PV}} \le N_{\text{PV}}^\text{max}, \end{aligned}$$
(44)
$$\begin{aligned} 1 \le N_\text{BG} \le N_\text{BG}^\text{max}, \end{aligned}$$
(45)
$$\begin{aligned} 1 \le m_\text{HT} \le m_\text{HT}^\text{max}, \end{aligned}$$
(46)
$$\begin{aligned} 1 \le P_\text{ELE/HT} \le P_\text{ELE/HT}^\text{max}, \end{aligned}$$
(47)
$$\begin{aligned} 1 \le P_{FC} \le P_{FC}^\text{max}, \end{aligned}$$
(48)
$$\begin{aligned} LSPS \le 0.06, \end{aligned}$$
(49)

\(N_{\text{PV}}^\text{max}\) and \(N_\text{BG}^\text{max}\) represent the max items of PV modules and the generators, respectively. \(m_\text{HT}^\text{max}\) is the HT’s maximum capacity (kg). \(P_\text{ELE/HT}^\text{max}\) and \(P_{FC}^\text{max}\) represent the ELE’s and the FC’s units’ maximum ratings (kW), respectively.

4.2.3 Cost analysis

The total COE, which is created by microgrid components, is regarded as an objective function that should be reduced in this work. The hybrid microgrid’s total annual cost (TAC), the NPC ($), and COE ($/kWh) are expressed as follows:

$$\begin{aligned} {\text {COE }} = \left( {\frac{{{\text {NPC}}}}{{\sum \nolimits _{1}^{{8760}} {P_{{{\text {dem}}}} } }}} \right) *{\text {CRF}} \end{aligned}$$
(50)
$$\begin{aligned} {\text {NPC}} = \left( {\frac{ {\text {TAC }} }{\text {CRF}}}\right) \end{aligned}$$
(51)
$$\begin{aligned} {\text {CRF}}(r,s) = \left( {\frac{r(r+1)^{s}}{(r+1)^{s} -1 }}\right) \end{aligned}$$
(52)
$${\text{TAC}} = {\text{ }}\sum\limits_{1}^{{8760}} {C_{{{\text{OM}}}}^{y} } + \sum\limits_{1}^{{8760}} {C_{{{\text{rep}}}}^{y} } + C_{{{\text{an - cap}}}}^{y} + C_{{{\text{an - fuel}}}} {\text{ }}$$
(53)

where CRF indicates the capital recovery parameter, r represents the interest rate (r = 6 %), and s denotes the lifespan of the proposed hybrid system (s = 25 years). \(C_\text{OM}^{y}\) represents the total operation and maintenance cost for each component (PV, BG, ELE, HT, and FC), \(C_{\text{rep}}^{y}\) is the total replacement cost for each unit, \(C_\text{an-cap}^{y}\) denotes the annualized cost of each subsystem, and \(C_\text{an-fuel}\) is the biomass unit’s annual fuel costs.

4.3 Operation energy management strategy

The three key cases that make up the operational strategy of the suggested hybrid system are as follows and are indicated in Fig. 2 which shows its flowchart:

  1. 1.

    When the power generation produced from renewable sources (PV and BG) \(P_\text{RS}(t)\) covered the load requirement, in this situation, the produced power is delivered to satisfy the necessary load demand \(p_\text{dem}\), and no power is required from the FC or supplied to the ELE;

  2. 2.

    The ELE will be fed with excess energy when the amount of renewable energy produced exceeds the load requirement; the hydrogen produced from this process is then utilized to charge the HT units;

  3. 3.

    In this situation,the FC will utilize hydrogen contained in the HT to compensate for the lack of energy production when the power generated from renewable sources is not enough to fulfill the load requirement. Once the HT capacity is at its lowest point, there is a loss of load.

Fig. 2
figure 2

The suggested hybrid system’s strategy diagram

4.4 The site of the project study

The suggested hybrid system is located in Abu-Monqar region, Egypt, as indicated in the map in Fig. 3. Figures 4, 5, 6, and  7 indicate the profile load and the meteorological conditions.

Fig. 3
figure 3

Map location of Abu-Monqar region, Egypt

Fig. 4
figure 4

The profile of the daily and annual load

Fig. 5
figure 5

Average daily PV radiation measured per hours

Fig. 6
figure 6

Average daily PV temperature per hours

Fig. 7
figure 7

The quantity of biomass consumed annually

5 Design results and discussion

Before applying the proposed mOPA to estimate the optimal sizing for an off-grid hybrid system comprising PV/BG/HT/FC/ELE modules, we assess its efficiency at the IEEE Congress on Evolutionary Computation 2020 (CEC 2020) [57]. The proposed mOPA’s results are compared with those obtained with WOA [58], SCA [59], the Tunicate Swarm Algorithm (TSA) [60], the Slime Mold Algorithm (SMA) [61], the Harris Hawk Optimization algorithm (HHO) [62], the Runge Kutta optimization algorithm (RUN) [63], and the original OPA. We choose the comparing algorithms according to different criteria, such as the size and complexity of the optimization problem and the algorithms’ convergence speed. In addition to the robustness of the optimization algorithms, these comparison algorithms have recently gained much popularity in several engineering and complex applications fields and have already been applied to the same problem.

5.1 Parameter settings

The algorithm settings are shown in Table 4. Since the study in [64] demonstrates that default values are an appropriate parametrization for algorithm comparison, we set them to their default values. Additionally, default values reduce the possibility of comparison bias because no algorithm might benefit from improved tuning. Simulation is independently run 30 times to ensure fair benchmarking comparison. Both qualitative and quantitative measurements assess the efficiency of algorithms. Experiments are done using "Windows 10 (64 bit)" running on "CPU Core i7 with 8 GB of RAM," and "Matlab 2016b" is used.

Table 4 Parametrization of mOPA and the compared algorithms

5.2 Performance of the proposed mOPA on CEC’20 benchmark functions

5.2.1 CEC’20 benchmark functions

We used the benchmark functions of the CEC’20 [57] to validate the performance of the proposed algorithm since they are among the most recent benchmarks and are challenging to solve. Table 5 presents the CEC’20 functions with their corresponding optimum valußes "Fi*" [65]. Figure 8 illustrates in two dimensions the different shapes of the CEC’20 functions.

Table 5 CEC’20 functions
Fig. 8
figure 8

The two dimensional of the CEC-2020 benchmarks

5.2.2 Statistical results analysis

This subsection presents the comprehensive results and comparisons demonstrating the basic exploratory and exploitation of mOPA compared with OPA and other well-known algorithms. Table 6 reports the mean fitness, standard deviation, and best and worst results for mOPA compared with other algorithms over 10 CEC’20 test functions with a dimension (Dim = 10). The best values (minimum) are highlighted in bold. As demonstrated in Table 6, the proposed mOPA algorithm achieves the optimal value for the unimodal F-1 test function. While for multi-modal functions F-2, F-3, and F-4, RUN gives the optimal value on the F-2 function, SMA obtains the optimal values on the F3 function, and the proposed mOPA indicates superior performances on F-4 test functions. Moreover, for the hybrid F-5, F-6, and F-7 test functions, the proposed mOPA algorithm is performing better than the remaining algorithms. For the composite functions F-8, F-9, and F-10, the mOPA outperforms other algorithms and gives the optimal values for F-8 and F-9. In contrast, the original OPA achieves the optimal values for the F-10 test function. Generally, the results demonstrated that mOPA outperformed other algorithms in solving eight of the CEC’2020 benchmark functions in terms of mean, standard deviation, and best and worst values. Additionally, mOPA acquired the first rank in the Friedman mean rank-sum test.

Table 6 The mean, STD, BEST, and WORST of fitness values over 30 experiments acquired by the competitor algorithms on the CEC’2020 functions

5.2.3 Boxplots behavior analysis

Boxplots are regarded as effective analysis tools because they interpret the data distributions to quartiles to show the realistic distribution of the data in a graphical representation. We displayed the data distribution with boxplots to further analyze the results of Table 6. The algorithm’s minimum and maximum data points constitute the lowest and highest whisker’s edges. The ends of the rectangles separate the low and high quartiles. A narrow boxplot indicates a high level of data agreement. Figure 9 presents the boxplots of the data for CEC 2020 test functions from F-1 to F-10 for \(\text {Dim}=10\). The boxplots of mOPA are pretty narrow for most functions, with the lowest values among all comparison algorithms. It is noticed that the distribution of boxplots achieved by the mOPA algorithm is narrower for most test functions and achieves the minimum values compared to the other algorithms. The boxplot graphics shows that the mOPA algorithm consistently finds the best locations for solving the test problems.

Fig. 9
figure 9

The boxplot curves of mOPA and the compared algorithms obtained over CEC’20 functions with \(\text {Dim}=10\)

5.2.4 Convergence behavior analysis

This subsection analyzes the convergence of the algorithms; Fig. 10 shows the convergence performances of the WOA, SCA, TSA, SMA, HHO, RUN, and OPA against the proposed mOPA for the CEC 2020 test problems for dimension 10. In Fig. 10a, the convergence curves of the F-1 function with a unimodal space are presented. The mOPA method shows an early exploration rather than the original OPA algorithm. Over the test functions of F-2–F-4 with multimodal functions, as shown in Fig. 10b–d, the mOPA exhibits a significant performance through the remaining algorithms for F-3 and F-4, while the RUN algorithm shows a significant performance for the F-2 test function. So, the mOPA has better results in handling the hybrid functions, as shown in Fig. 10e–g, for F-5, F-6, and F-7. The composition functions (F-8, F-9, and F-10), as presented in Fig. 10h–j, exhibited that the proposed mOPA obtains comparative performance in solving problems with complex spaces.

Fig. 10
figure 10

Convergence curves of mOPA and the compared algorithms on CEC’20 functions with \(\text {Dim}=10\)

5.2.5 Qualitative metric analysis

Figure 11 presents the qualitative analysis of mOPA on CEC’20. The agent’s behaviors are depicted in Fig. 11, which includes a two-dimensional (2D) representation of the functions, search history, average fitness history, optimization history, and diversity. The dimension of these functions is 10. The parameters for the mOPA are the same as in the previous experiment.


From the qualitative analysis, the following points are remarkable:

  • According to the domain’s topology The first column in Fig. 11 displays the function in 2D space. The functions have a specific structure that equips sense to decide which functions the algorithm produces the better performance.


  • According to the search history The search history of agents for all iterations is displayed in the second column of Fig. 11. The search history indicates that mOPA can determine the regions with the lowest fitness values for some functions.


  • Regarding the average fitness history The third column of Fig. 11 equips the average fitness history. This average gives details about the agents’ overall behavior and their assistance in the optimization process. The history curves are rising, illustrating that the population is enhanced with each iteration.


  • According to the optimization history Column no. four of Fig. 11 presents the optimization improvement that conveys 100 fitness achieved from 100 iterations per experiment to depict the progress of fitness achieved in each iteration. The convergence curves decrease in all test functions, revealing that mOPA has highly with agents during searching for the best solution.

  • According to the diversity metric The diversity plot is displayed in the last column. The average distance traveled by the agents during the process is shown in this graph.

Fig. 11
figure 11

The qualitative metrics on CEC’20 functions: two-dimensional views of the functions, search history, average fitness history, optimization history, and diversity

5.3 Results of the proposed hybrid system

The convergence curves for the optimization process using the mOPA, and the OPA approaches are shown in Fig. 12. These optimization techniques were applied 50 times over 50 iterations to select the proper fitness function rate to regulate the randomness of the suggested techniques, verify their stability, and certify their robustness. All optimization approach is applied in the same manner for the suggested case study. The developed mOPA consistently identifies the best solution to the optimization issue, as shown by the objective function’s final outcomes for the developed mOPA, which fall within a narrow limit.

Fig. 12
figure 12

The convergence curves of the memetic and original Orca Predation Algorithms (mOPA and OPA) for 50 iterations

The suggested enhanced mOPA technique’s convergence curve (the best functions profiles with the iterations) is compared to those produced from the original OPA algorithm as well as other conventional optimization methods (MOA, STOA, and SCA) for showing the convergence performance and speed of these techniques. Figure 13 depicts the convergence curves for all these algorithms. As shown in this figure, the proposed mOPA method reachs the final value of the objective function faster than other algorithms. Moreover, the mOPA converges at a lower value of the objective function than the original OPA.

Fig. 13
figure 13

The optimal convergence curves of the all optimization techniques for 50 iteration

The sizing and objective function results of the mOPA and OPA algorithms compared to other optimization techniques [12] utilized are indicated in Table 7. This table indicates that the proposed mOPA has the optimal fitness function (0.1219895), followed by OPA (0.12199026), MOA (0.1219998), STOA (0.1221296), and SCA (0.1224865). By comparing the outcomes shown in this table, it can be seen that the suggested mOPA is the best-founded algorithm for optimal sizing of the proposed hybrid system with COE of 0.209626 $/kWh, followed by OPA, MOA, STOA, and SCA, respectively.

Table 7 The optimization characteristics parameters using mOPA, OPA, MOA, STOA, and SCA methods

The participation of all components in the annual cost of the suggested hybrid system by utilizing the mOPA and OPA optimization algorithms is shown in Fig. 14. For the two techniques, it is clear that the FC represents the highest annual percentage cost, followed by PV units, ELE units, inverters, BG system, and finally the HT unit.

Fig. 14
figure 14

The annual cost of the proposed system’s parts using mOPA and OPA techniques

The proposed hybrid system’s power output performance over a 24-hour cycle is shown in Fig. 15. According to the mOPA technique results, the electrolyzer for producing hydrogen is powered by the extra energy from PV and BG units \(P_\text{RS}\), in case of the generated \(P_\text{RS}\) exceeded the required loads. The \(P_{dum}\) will use up this extra power if the HT fills up. While, the FC will use the hydrogen stored in the HT unit to make up for a lack in power generation when the \(P_\text{RS}'s\) output is unable to satisfy the load’s power requirements.

Fig. 15
figure 15

The operation of the suggested hybrid system during a certain 24 hours using the recommended mOPA

For each of the employed optimization algorithms mOPA and OPA, the statistical performance measures are shown in Table 8. For a more precise comparison of the two optimization approaches, parametric and non-parametric statistical measurements were carried out based on the obtained values of the objective function across 50 iterations with 50 distinct runs for the proposed hybrid system. The target function’s minimum, maximum, and mean values are all parametric measurements, whereas the efficiency, median, standard deviation, relative error, mean absolute error, and mean absolute error are all non-parametric measurements. Based on the outcomes, the suggested mOPA outperformed the original OPA optimization technique in terms of best values.

Table 8 The statistical performance of the mOPA and OPA methods

Figure 16 displays the graphical representation of the end values of the objective function over 50 individual executions for the proposed hybrid system using the recommended mOPA and the original OPA techniques. It can be noted that, the suggested mOPA’s fitness values fell within a specific range, demonstrating the suggested technique’s superior stability to the competing techniques. Consequently, using the mOPA optimizer compared to the original OPA optimizer results in better parametric and nonparametric metric values.

Fig. 16
figure 16

End values of the objective function of 50 implements

6 Conclusion and future work

This paper proposes a new improved optimization algorithm based on modifying the original Orca Predation Algorithm (OPA) which is a hybrid between two methods, namely, Lévy flight (LF) and opposition-based learning (OBL). This modified algorithm is called mOPA. The mOPA’s performance is evaluated on the CEC’2020 test suit. It was applied to an isolated hybrid power system to obtain its optimal sizing. The proposed system consists of photovoltaic panels (PV), biomass gasifier (BG), electrolyzer units (ELE), hydrogen tank units (HT), and fuel cells (FC) to meet the load demand in the Abu-Monqar region, in Egypt. The main objectives of the mOPA method are to minimize energy cost (COE), the loss of power supply probability (LPSP), and excess energy under the constraints of the suggested hybrid system. In order to demonstrate the effectiveness of the mOPA methodology, the optimization results from other algorithms, including the original OPA, Sooty Tern Optimization Algorithm (STOA), and Sine Cosine Algorithm (SCA), were compared to the mOPA technique’s results. Comparisons results illustrate the dominance of the proposed improved mOPA technique against the other metaheuristic methods in obtaining the minimum COE of the proposed hybrid system (the mOPA achieved the best results with the lowest COE by 0.209626$/kWh, NPC by 6,140,053$, and LPSP by 0.059926%). Moreover, the recommended mOPA algorithm outperforms the original OPA algorithm in achieving the best minimum values for the objective function as well as the lowest COE value with a quick convergence characteristic and better system performance. Based on the demonstrated results, the recommended mOPA algorithm proved to be more suitable for solving the suggested optimization problem.

Future research may concentrate on the following points:

  • Applying the proposed optimization algorithms for solving other complex optimization problems in electrical applications.

  • Using the proposed mOPA algorithm for various real-world applications, such as calculating solar cell parameters, object tracking, hyperparameter optimization, and image segmentation.

  • It may be used on the internet of things for task scheduling and preprocessing of data.

  • Developing various modeling, operation, and control methods, algorithms, methodologies, and techniques for use in the future development of micro/smart grid technologies.

  • Creates a binary version of OPA and applies it to binary problems, such as feature selection problems.

  • Determine and investigate the possible configurations of the hybrid renewable systems using different types of storage technologies and components, for effective energy management.