Optimal energy planning of multi-microgrids at stochastic nature of load demand and renewable energy resources using a modified Capuchin Search Algorithm

The concept of interconnected multi-microgrids (MMGs) is presented as a promising solution for the improvement in the operation, control, and economic performance of the distribution networks. The energy management of the MMGs is a strenuous and challenging task, especially with the integration of renewable energy resources (RERs) and variation in the loading due to the intermittency of these resources and the stochastic nature of the load demand. In this regard, the energy management of the MMGs is optimized with optimal inclusion of a hybrid system consisting of a photovoltaic (PV) and a wind turbine (WT)-based distributed generation (DGs) under uncertainties of the generated powers and the load variation. A modified Capuchin Search Algorithm (MCapSA) is presented and applied for the energy management of the MMGs. The MCapSA is based on enhancing the searching abilities of the standard Capuchin Search Algorithm (CapSA) using three improvement strategies including the quasi-oppositional-based learning (QOBL), the random movement-based Levy flight distribution, and the exploitation mechanism of the prairie dogs in the prairie dog optimization (PDO). The optimized function is a multi-objective function that comprises of the cost and the voltage deviation reduction along with stability enhancement. The effectiveness of the proposed technique is verified on standard benchmark functions and the obtained results. Then, the proposed method is used for energy management of IEEE 33-bus and 69-bus MMGs at uncertainties conation. The results depict that the energy management with inclusion of WTs and PVs using the proposed technique can reduce the cost and summation of the VD by 46.41% and 62.54%, and the VSI is enhanced by 15.1406% for the first MMG. Likewise, for the second MMG, the cost and summation of the VD are reduced by 44.19% and 39.70%, and the VSI is enhanced by 4.49%.


Introduction
Microgrid (MG) is the smallest part of the electrical system that consists of generators and loads. It is made up of a variety of loads, storage batteries, and a generating network. In a hybrid power system, electricity is created from renewable sources and stored in energy storage units to offer stabilization to the microgrid. A microgrid is a medium or low voltage power system with a distinct electric border that incorporates various distributed generators and demands [1]. Microgrid (MG) is an efficient low alternative for providing resilient and environmentally friendly power [2,3]. In [4], the US Department of Energy defined a MG as ''a group of connected distributed resources and loads.'' There are two main types of microgrids based on their connection to the main substation. The first type is the on-grid MG where the MG is connected to the electrical network. Therefore, the electrical network shares the connected distributed generators (DGs) to supply the required energy to the loads. The second type is the offgrid MG, where the MG is not connected to the electrical network. Therefore, the DGs should provide the required energy to the loads all the time. The energy management of these types of DGs is an important and challenging task for Extended author information available on the last page of the article many reasons such as reducing the generation and operation costs, reducing the energy losses, enhancing the voltage profile, reliability, and the system stability. Continuous solar and wind energy is employed to develop the MG. Depending on the energy sources employed, the microgrid may run independently or integrated into an electrical system [5,6], and [7]. The most important feature of a microgrid is to guarantee consistent electricity based on demand, which is challenging to predict, and energy output can change depending on the availability of renewable energy sources like solar and wind. Recently, it have been seen a fast increase in the expense of fossil fuels, as well as worries about climate change, prompting environmental effect studies and the usage of reliable and sustainable energy sources in electrical network [8].
Renewable energy has become the dominant source of generating in recent years, accounting for a significant portion of global generation. Renewable energy generation is gaining popularity owing to its little impact on the environment. It is utilized due to its low operating costs and extended life duration, although the construction cost is higher to save money on power in the long run. Renewable energy sources are advantageous since they are abundant in nature and environmentally beneficial. By 2030, the rate of increase in power consumption is predicted to be between 40% and 45 percent. RERs are appealing to environmentalists because they are pollution-free, readily available, and continuous in nature. The PV-based energy system is the most attractive RER commercially available due to its low cost, ease of installation, and mobility. It is coordinated with other RERs such as wind farms, fuel cells, diesel generator, electrolyzed, and set to construct a hybrid solar and wind energy system. In addition, it is having reliable electricity and productivity improvements. In most cases, this is paired with a battery storage unit. Thus, a wind and solar system is established when more than two renewable energy sources are utilized [9]. In residential microgrids, fluctuations in RES generation and the transition between grid-on and off-grid modes may raise concerns about system stability [10]. To meet the resources and load balancing, the MG technical and economic restrictions must be addressed. Many studies in the research, such as those in [11,12], demonstrate that the correct planning of the hybrid MG needs an optimal component rating as per connected load.
Several efforts have been produced for the energy management of MGs. In [13], Bowen Hong et al. presented a useful general framework for designing the scheduling system's energy management core and its constituent parts. In [14], the author proposed a framework for the optimal configuration of a microgrid for minimizing its life cycle cost based on a genetic algorithm to satisfy cooling, heating, refrigeration, and auxiliary demands. The authors in [15] applied a binary integer linear programming for energy management hilly areas microgrid which includes renewable and conventional resources to reduce the cost and emission. A. Rezvani et al. in [16] implemented the lexicographic optimization and hybrid augmented weighted epsilon constraint for optimal and optimal scheduling of MG resources for cost and emission reduction considering market price variation. In [17], the normal boundary intersection (NBI) algorithm has been applied for optimal scheduling of a MG including the PV, FC, microturbine (MT), battery units, and WT for reducing the cost and emission. In this research, an MG is made up of an Energy Storage System (BESS), a PV, and a WT. Greenhouse gas emission reduction rules due to global warming are accelerating the transfer from fossil resources to RES [18].
Several optimization methods have been applied to design, develop, and optimize hybrid MGs. In [19], the overall cost and emissions of a microgrid are reduced by determining the best configuration of DGs while taking voltage stability and energy loss into account as local distribution system restrictions. In [20], an optimization technique is based on Mixed Integer Quadratic Programming (MIQP) for maximizing BESS rating in grid-connected commercial MG to maximize PV capacity and energy storage. In [21], performance the of the Grasshopper Optimization Algorithm (GOA) has been compared with the Cuckoo Search (CS) and Particle Swarm Optimization algorithms to optimize the ratings of various DGs in isolated MG. In [22], the author uses three metaheuristic techniques to optimize the size and position of DERs in a distribution system, Imperialistic Competitive Algorithm (ICA), PSO, and Genetic Algorithm (GA) algorithms. The PSO is used in [23] to optimize DERs in a distribution system while taking into account different sorts of loads. This paper presents a modified Capuchin Search Algorithm (MCapSA) for optimal energy management and planning of multi-microgrids (MMGs). The obtained results demonstrate the best performance of the proposed modified SCSO [24], PSO [25], WOA [26], SCA [27], HS [28], ALO [29], and the conventional CapSA [30]. It is important to note that PV and WT generators are incorporated as renewable energy sources, and 24-h planning is suggested with cost minimization as the primary objective as well as summation the VD and the VSI. This work examines how the planning model may be impacted by load, wind speed, and solar radiation uncertainty. As WT and PV are two popular renewable energy sources in modern electrical installations, weather data information like irradiance and temperature is necessary as input variables to simulate the PV. Because of the sensitivity of the PV output, an accurate model is required. As a result, many models are offered to demonstrate the PV's characteristics. Furthermore, the output power of WT is affected by several factors like as turbine size and wind speed.
The following are the most important contribution of this paper: 1-Implementation of a new modified optimization technique for optimal energy management and planning of multi-microgrids (MMGs). 2-The energy management of the MMGs is solved with optimal integration (sizing and siting) of WTs and PV units at uncertain conditions. 3-Proposing an efficient modified Capuchin Search Algorithm (MCapSA) based on multiple strategies to boost the exploitation and the exploration process of the standard CapSA. 4-The superiority of the proposed algorithms is validated via the statistical results and comparisons with other algorithms on the standard benchmark functions, 33-bus and 69-bus multi-microgrids.
The rest of this paper is listed as follows: The energy management formulation is described in Sect. 2. Section 3 lists the uncertainty representation. The solution technique for solving energy management is provided in Sect. 4. The obtained results are covered in Sect. 5. Conclusions of this work are presented in Sect. 6.

Problem formulation
This section describes the problem formulation for the reduction in operating costs in the microgrid. We explain the total annual cost function, voltage stability, and constraints of the optimization operation management issue.

The objective function
In this work, three objective functions have been optimized which can be listed as follows:

The cost reduction
The overall cost reduction (C) is the first objective function that is taken into consideration, and it comprises the cost of electricity acquired from the network (C Grid ), the cost of PV units (C PV ), the cost of WT (C Wind ), and the yearly cost of energy loss (C Loss ), and it may be expressed as follows: where the following are the detailed elements of Eq. (1), where U Grid is the purchasing electricity cost from the grid where U Loss is the cost of energy loss. P Loss are the active power loss.
where C inst: PV is the cost of installing the PV, C O&M PV is the PV unit's operating and maintenance costs, where CF is a factor affecting capital recovery, P rated PV : is the rated produced power of the PV where C inst: Wind Is the cost of installing the wind turbine, and C O&M wind is the wind's operating and maintenance costs.
where U O&M PV and U O&M Wind represent the PV and Wind unit's operating and maintenance purchase cost ($/kW), respectively.
where P rated wind is the rated produced power of wind turbine where NP is the Wind turbine or PV unit lifetime In addition, the generated power from the PV may be computed using the formula below [31]: where (S i ) stands for solar irradiance. The irradiation of the standard environment (S std ) is 1000 W/m2 and (X s ) for a specific irradiance point, which is equal to 120.
Also, the WT's produced output power may be computed as shown below: where W r is a rated wind speed; W o is a cut-out speed. W i indicates a cut-in speed.

Enhancement of voltage level
To improve the network performance, the voltage deviations should be kept to a minimum that can be defined as: where V k denotes the voltage of the k th bus and NB denotes the buses in the network

Improved system stability
where VSI k is the voltage stability index, R km is the resistance of the TL while the X km is its reactance. P k and Q k define the real and reactive powers, respectively. The following three objective functions are taken into consideration simultaneously:  where, V min , and V max are the lower and maximum voltage limits. P Load and Q Load signified the real and reactive load, respectively; I max;n is the maximum allowable current limit of the n-th line; PF min and PF max are the minimum and the upper and the power factor limits of the WT, respectively; NT defines the number of the TL.

Restrictions on inequality
where,P Grid and Q Grid refer to the active power and reactive power of the mean upstream station, respectively.

Modeling the uncertainties
In this section, the considered uncertain parameters are represented as follows:

The probabilistic model of solar irradiance
The Beta pdf has been employed to model the intermittent nature of the solar irradiance, as follows [37,38]: where the Beta pdf and the gamma function are denoted, respectively, by f b g s ð Þ and ; l is the mean value of the irradiance while r is its standard deviation of historical data which can be employed to calculate them as follows [39,40] The continuous pdfs are divided into several divisions. The probability of divisions occurrence can be given by: where g s;i and g s;iþ1 are the limits of the interval i while prob g s i is its probability.

The probabilistic wind speed representation
For modeling the wind speed uncertainty, a Weibull pdf with a shape parameter of 2 is normally used [35,41]. In this case, it is called Rayleigh pdf [38] which can described as follows: where v represents the wind speed while c denotes the scale parameters of Rayleigh pdf. By dividing the continuous pdf into several intervals, the probability of each interval is given by: v w1 and v w2 are the limits of the wind speed of the interval i. prob v i denotes probability of state i.

The probabilistic representation of load demand
Normal pdf is employed for representing the demanding uncertainty which is given using (32) [36].
where l l refers the mean load value while r l is the standard deviation, respectively. The probability of a segment can be given by: where the l i and l iþ1 are the limits of the state i.prob l i refers to the probability of interval i.

The combined probabilistic model
The combined probabilistic model (P com;i ) is generated by combining the uncertainty models of irradiance, loading, and wind speed. For interval i, the combined model can be mathematically as below equation.
3 Proposed technique

Capuchin search algorithm
CapSA is a new optimization technique that mimics the movement of the Capuchins in their foraging technique where the Capuchins climb, leap, and swing over the branches of the trees to obtain their food [30]. As the main aspect of the foraging motion, the Capuchins follow their leader and interact together in the same swarm which consists of females, males, and small apes. The motion of the Capuchins in the forest as a group to find the promising regions of food simulates the global searching phase of the optimization algorithms while in case the Capuchins follow their leaders, it mimics the exploitation phase of the algorithms, and they collect the other individuals in the group by barking and postures. The CapSA simulates three motions of the Capuchins which can be presented as follows:

Leaping motion
It is well known that the Capuchins jump between the trees at a large-scale distance like the projectiles which can be represented using the third law of motion according to (35).
Here, x reprints the new placement of the Capuchin while x 0 refers to its initial placement.v 0 denotes the initial speed. Equation (35) can be modified as follows: where g represents the gravitational acceleration and h 0 refers to the leaping angle.

Swinging motion
The swing motion of the Capuchins over the branches of the trees simulates the local searching area of algorithms, and it can be modeled as follows: where L, h are the tail of length and the swing angle.

Climbing motion
The Capuchins climb to the trees to obtain the food; this motion is represented as follows: x The initialization location of the Capuchins can be obtained as follows: where X Lb denotes the upper boundary of the control variables and X Ub denotes its upper boundary and 0 rand 1. The Capuchin swarm includes the leader or the Alpha leader and the follower where both of them look for the food resource location (F). The motion of the leader is represented using (40).
where P bf denotes the probability of the balance. F represents the position of the food. denotes a random number. h denotes the Capuchin's jumping angle, and it can be denoted as follows: where r refers to random value in range [0,1]. For balancing the transposition between the exploration and the exploitation of the algorithm and vector s is used for the pattern which can be represented as follows: where b 0 , b 1 , and b 2 are values number are set to be 2, 21, and 2, respectively, while T and t denote the maximum and current iterations, respectively. The velocity of the Capuchin is calculated using (43) where X i best is the best position. a 1 and a 2 are two positive numbers. that control the effects of F and X i best on the velocity. r 1 and r 2 are random umber with in [0,1]. q is an inertia coefficient equals to 0.7. The leader (Alpha) Capuchin moves in the ground in a large area to search the food location in case of the lake the food over the trees. The Capuchin motion on the ground is represented as follows: where P ef denotes the probability motion of the Capuchins on the ground. The movement of the Alpha on the group is represented as follows: The swinging motion of the Capuchins on the branches of the trees to get the food in the local area is represented as follows: The Alpha and some Capuchins descend several times to search the food; this motion can be expressed as follows: Capuchins may move randomly to find new regions of food resources. This motion is represented mathematically as follows: where Pr is a number selected to be 0.1. The followers flow the Alpha Capuchins; this motion is represented mathematically as follows: where XL i j and X iÀ1 j are the location of the leader and the previous location of the followers, respectively.

The quasi-oppositional-based learning (QOBL)
The oppositional-based learning (OBL) was applied for performance enhancement of several optimization techniques and boost the convergence rapidity. The opposition position has a superior probability to be nearer of the best solution than a random solution [39]. The opposite number means the mirror of this number which can be described as follows: where x min is the lower margin of x o and x max is its upper limit. The opposite point of a multi-dimension point is represented as follows: The quasi-based learning is utilized to improve the oppositional-based method and represents the center point of the search area as follows: The quasi-opposite point means the center and the opposite value. The QOBL combines quasi-and oppositional-based learning to improve which can be o find the global solution and represented as follows :

Levy flight random walk
The second modification is based on the Levy flight distribution (LFD) for allowing the populations to jump to new regions far away from the best so far solution. The primary feature of the LFD walk is the movement of the population in random and stochastic movement. Therefore, the application of the LFD to the motion of Capuchins can enhance the performance of conventional CapSA and avoid its stagnation. LFD can be described as follows: where a is to the step size. L evy ðkÞ represents the levy distribution which can be described as follows [40]: here C refers to the Gamma function. b denotes a random value in the range [0,2]. The value of b is selected to be 1.5 [41].

Exploitation boosting based on DOA
The third modification is conceptualized from the exploitation phase of (DOA) where the prairie dogs have a special communication system [42]. Prairie dogs do a special sound in case of food availability or predator threats. The prairie dogs respond to the sound and go directly to the food source's location while in case of the presence of predators or a hawk they make another warring sound and go into hiding. Application of the exploitation mechanism of the prairie dogs into the RBO is formulated using (60).
where GBest i;j is the best solution. e is a small random value.
where GBest i;j denotes the global best solution. eCBest i;j denotes the effect of the current obtained solution and it can be calculated using (61) while CPD i;j denotes the cumulative effect of all prairie dogs and it can be calculated using (62) and PE is the adaptive operator which can be calculated using (63). D is a small number representing a small number.
The steps of applying the proposed algorithm for optimal integration of the RERs are depicted in Fig. 1.

The simulation results
The proposed MCapSA is applied to solving the energy management of MMGs of two standard networks IEEE 33-bus and 69-bus MMGs. Initially, the performance of the proposed method is tested on the standard benchmark functions and the simulation results were compared to other optimization techniques including SCSO [24], GWO [43], WOA [26], SCA [27], PF [44], DO [45], and the standard CapSA [30]. The program code of the proposed MCapSA and the other techniques for energy management was written in MATLAB software (MATLAB R2019b) and carried out on a PC with Intel i5, 2.5 GHz CPU, and 4 GB RAM. The studied cases are presented as follows:

Validation of the MCapSA technique on standard benchmark functions
Here, the proposed MCapSA is tested on 23 benchmark functions including the unimodal, multimodal, and fixeddimension multimodal benchmark functions, which are listed in Appendix A [46][47][48]. For all cases, the parameters are set according to Table 1 and the obtained results are represented over 30 run times.

Statistical results analysis
This section depicts the performance of the MCapSA compared with SCSO [24], PSO [25], WOA [26], SCA [27], HS [28], ALO [29], and the conventional CapSA [30]. Table 2 shows the statistical results including the mean, the worst, the average, the best, the standard deviation (SD) values, and the Wilcoxon P-value between the MCapSA and the other optimizers. According to Table 2, the proposed MCapSA optimizer is superior in terms of the mean, the worst, and the best values for the F1-F5, and F17-F23 while the obtained results for the reported algorithms are similar for F17 to F23. In addition to that for F12, the CapSA is better than MCapSA. The Wilcoxon P-values between the MCapSA and the other optimizers are presented in the 7th column of Table 2. When the P-value is less than 5%, it is a significant difference between optimizers [49]. On the opposite of that when it is more than 5%, there is no significant difference between optimizers.
In addition to that if the results of different algorithms are identical, the P-value will be N/A. From the P-value, it is clear that the proposed MCapSA has significant differences compared with SCSO, PSO, WOA, SCA, HS, ALO, and the standard CapSA for most of the studied benchmark functions.

The convergence curves analysis
The convergence curves of the MCapSA and other reported techniques including SCSO [24], PSO [25], WOA [26], SCA [27], HS [28], ALO [29], and the conventional CapSA [30] are shown in Fig. 2. According to the convergence curves, the proposed MCapSA has the best convergence speed for the fixed dimension, the unimodal, and the multimodal functions. In addition to that, the proposed MCapSA is superior and converged to the optimal solution faster than the conventional CapSA due to the proposed modifications which can boost the exploration and exploitation phases of the proposed optimizer.

The boxplot analysis
Boxplots are ideal for displaying data distributions in quartiles that can be used to show the characteristics of data distribution. Figure 3 depicts the Boxplots of the studied optimizer for the reported optimization algorithms. It is obvious that the boxplots of the MCapSA are narrower compared with the other optimizers.

Solving the energy management of MMGs using the MCapSA
The proposed MCapSA is implemented for solving the energy management of MMGs with and without RERs.
The proposed MCapSA method was tested on IEEE 33-bus and 69-bus MMGs. The system data of system are given in [50] while the specification of these networks is depicted in Table 3. It worth mentioning here that Table 3 lists the specifications of the studied systems (33-bus, 69-bus) at 100% loading. The studied distribution networks (DNs) Max. Iteration 300  Fig. 6 while the market price of the purchasing energy is illustrated in Fig. 7 [51]. The expected wind speed and the irradiance are displayed in Figs. 8 and 9, respectively [52]. The cost coefficients for RERs, the purchasing power from the grid, and the constraints are presented in Table 4. The energy management studied cases are listed as follows:

The energy management of 33-bus MMGs system.
The key objective of the energy management of the MMGs is to reduce the total annual cost along with enhancing the system's performance. Initially, without the inclusion of RERs (base case), the total annual purchased from the grid is 3.0539E ? 06 kWh, the energy losses are 1.4759E ? 06 kW, the total purchase energy cost is 7.5653E ? 06 USD, the energy loss cost is 8.855e ? 04 USD, the summation of total annual cost is 7.6539E ? 06 USD, the voltage deviations summation is 38.376 p.u., and the VSI is 6.291E ? 02 p.u. Table 5 shows the simulation results with and without RERs which have been obtained by the MCapSA and other well-known algorithms. Table 5 summarizes the best obtained results including the total costs, summations of the VD, and the VSI. From Table 5, by application of the proposed optimization algorithm, the total annual cost is reduced from 7.65393E ? 06 USD to 4.1019E ? 06 USD. The summation of the voltage Fig. 2 Convergence curves of the test benchmark functions by different optimizers deviations is reduced from 38.376 p.u. to 14.374 p.u. Therefore, the voltage profile is enhanced considerably as illustrated in Fig. 10. Furthermore, the summation of the VSI has been enhanced from 629.02 p.u. to 724.323 p.u. The power losses of the system with and without the inclusion of the hybrid RERs are depicted in Fig. 11. It is obvious that the inclusion of the hybrid RERs in each microgrid optimal decreases the power losses considerably. The optimal locations of the hybrid units in the first, second, and third MGs are 6, 13, and 32, respectively. The rating of the WTs in kW of the first, second, and third MGs is 82, 1021, and 920, respectively, while the rating of the PVs is 151, 1481, and 54. It should be highlighted here that the total annual cost by application is better than the conventional CapSA. The statically results for the considered Fig. 3 Boxplot for test benchmark functions by different optimizers objective function that have been obtained by the application of different optimizers are recorded in Table 6. As depicted in Table 6, the obtained results by the proposed MCapSA are better than other optimizers in terms of the best, the mean, the worst, and the standard deviation (SD) values. The output powers of the PV units are indicated in Fig. 12. From Fig. 12, the yield powers of these units are varied continuously with the irradiance variations. Likewise, the generated powers of the WTs varied with the variation in the wind speed as shown in Fig. 13. Finally, the convergence curves by application of different optimization algorithms are shown in Fig. 14. Referring to this figure, the proposed algorithm has the best convergence characteristics compared with other optimizers.

The energy management of 69-bus MMGs system
The optimal sizing and ratings of the PV units and WTs have been assigned optimally for the three microgrids. In the base case, the total annual purchased from the grid is 3.1311E ? 07 kWh, the energy losses 1.5716E ? 06 kW, the total purchase energy cost is 7.7576E ? 06 USD, the energy loss cost is 9.4297E ? 04 USD, the summation of total annual cost is 7.8519 E ? 06 USD, the voltage deviation is 39.0912 p.u. while summation of the VSI is 1.4866E ? 03 p.u. Table 7 summarizes the simulation results with and without RERs which have been obtained by the MCapSA and the standard CapSA including the total costs, summations of the VD, and the VSI. According to Table 7, with implementations of the proposed algorithm, the total annual cost is reduced from 7.8519E ? 06   Therefore, the voltage profile is enhanced considerably as shown in Fig. 15. Furthermore, the VSI during the day ahead has been enhanced from 1.4866E ? 03 p.u. to 1.5533E ? 03 p.u. The system power losses with and without the insertion of the hybrid RERs are illustrated in Fig. 16. It is obvious that with the inclusion the hybrid RERs in each microgrids the power losses decrease considerably. The optimal sites of the hybrid units in the first, second, and third MGs are 12, 22, and 25, respectively. The WTs rating in kW of the first, second, and third MGs are 1119, 488, and 25, respectively, while the optimal sizes of the PV units are 1198, 1119, and 55. The generated power of the PV units WTs is shown in Figs. 17 and 18, respectively. It should be highlighted here that the total annual cost by application is better than the conventional CapSA.
The statistical results that have been obtained by different optimizers for the considered objective function are tabulated in Table 8. It is clear that the proposed MCapSA is superior compared with other optimizers in terms of the best, the mean, the worst, and the standard deviation (SD) values. Finally, the convergence of the objective function by the application of different algorithms is shown in Fig. 19. Referring to this figure, the proposed algorithm MCapSA has the best convergence characteristics compared with other optimizers.

Outcomes and unique features
The summarized unique features can be explained as follows: Proposing a novel Modified Capuchin Search Algorithm (MCapSA) for addressing the stagnation issue of the traditional Capuchin Search Algorithms (CapSA). The modification is based on: quasi-oppositional-based learning (QOBL), Levy flight random walk, and exploitation phase of DOA. The following outcomes can be listed as follows: 1. The purposed algorithm was applied for 33-bus and 69-bus multi-microgrid systems. 2. The suggested MCapSA has been evaluated on 23 different benchmark functions, including unimodal, multimodal, and fixed-dimension multimodal benchmark functions. 3. Obviously, the proposed algorithm is superior and converged to the optimal solution faster than the conventional, where the boxplots of the MCapSA are narrower and have significant difference compared with the other optimizers. 4. The proposed MCapSA algorithm was able to solve the energy management problem compared to the basic algorithm (CapSA) and other well-known algorithms. 5. The obtained results due to the objective functions compared to the basic case can be represented as follows: • For the IEEE 33-bus MMG The interest rate (b PV ) 10% The lifetime (NP PV ) 2 0 WT Cost [53] The investment cost (K WT ) 4000 USD /kW The maintenance and operation costs (Co O&M WT ) 0.01 USD /kWh The interest rate (b WT ) 10% The lifetime (NP WT ) 2 0

Cost coefficients
The energy loss cost ðK Loss ) [54] 0.06 USD/kWh 6. The optimal locations and sizes of the RERs in power system are one of the main features presented in this paper. 7. An optimal integration of the RERs can reduce the energy cost, enhance the voltage profile and the system performance.             Funding Funding for open access publishing: Universidad de Jaén/ CBUA.
Data availability Data are available on reasonable request.

Declarations
Conflict of interest There is no conflict of interest.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons. org/licenses/by/4.0/.