Genetic-Moth Swarm Algorithm for Optimal Placement and Capacity of Renewable DG Sources in Distribution Systems

I recent years, the continuous development of electrical loads, especially due to industrial plants and human activities, results in increased number of new transmission lines, power plants, distribution networks and interconnection between different power systems. This effect leads to higher currents and power losses accompanied by voltage drop. Distribution system (DS) is an essential part of this power system problem as it connects loads to the transmission line at substations. About 70% of the power system losses are occurring at distribution system [1]. Therefore, the reduction of the losses in DS is the main concern nowadays. Hence, the world directed to use new generation sources of renewable energy resources (RERs) such as photovoltaic (PV), wind turbines and biomass energy, which are considered economically for supplying energy to electrical grids and suitable for power generation in remote areas [2], [3]. There are many potential benefits of DGs depending on their size and location. Normally, the real power loss and the voltage profile are the base objectives. Some other technical parameters may accompany this base objective such as reactive power requirement, reliability and efficiency of distribution network, emission, load-ability, voltage stability, DG capacity maximization, or economy oriented objectives [4]. There are different types of DG units, which can be classified based on whether they generate or absorb reactive power along with active power generation to (a) type A-DG units or P-type, which produces active power only such as PV (b) type B-DG units or Q-type, which produces reactive power only, like capacitor banks (c) type C-DG units or PQ+-type, which produces active and reactive power like synchronous generators (d) Type D-DG units or PQ--type which produces active power and consumes reactive power, like wind power induction generators. The random placement of DGs and capacitors in DS can cause more voltage drop and higher power losses than losses without them [5], [6]. Therefore, determining the proper placement and capacity of DGs in DS becomes a crucial task for obtaining their maximum possible advantages. Several techniques have been proposed in recent years to determine the optimal locations and sizes of DGs in DS such as Ref. [7], which discussed the adaptive protection using neural networks for high penetration of DGs, but this technique takes very long training time. Ref. [8] made a very hard work to get the effective signals for optimal ratings of RERs as the objective function and Genetic-Moth Swarm Algorithm for Optimal Placement and Capacity of Renewable DG Sources in Distribution Systems


I. Introduction
I N recent years, the continuous development of electrical loads, especially due to industrial plants and human activities, results in increased number of new transmission lines, power plants, distribution networks and interconnection between different power systems. This effect leads to higher currents and power losses accompanied by voltage drop. Distribution system (DS) is an essential part of this power system problem as it connects loads to the transmission line at substations. About 70% of the power system losses are occurring at distribution system [1]. Therefore, the reduction of the losses in DS is the main concern nowadays. Hence, the world directed to use new generation sources of renewable energy resources (RERs) such as photovoltaic (PV), wind turbines and biomass energy, which are considered economically for supplying energy to electrical grids and suitable for power generation in remote areas [2], [3]. There are many potential benefits of DGs depending on their size and location. Normally, the real power loss and the voltage profile are the base objectives. Some other technical parameters may accompany this base objective such as reactive power requirement, reliability and efficiency of distribution network, emission, load-ability, voltage stability, DG capacity maximization, or economy oriented objectives [4]. There are different types of DG units, which can be classified based on whether they generate or absorb reactive power along with active power generation to (a) type A-DG units or P-type, which produces active power only such as PV (b) type B-DG units or Q-type, which produces reactive power only, like capacitor banks (c) type C-DG units or PQ+-type, which produces active and reactive power like synchronous generators (d) Type D-DG units or PQ--type which produces active power and consumes reactive power, like wind power induction generators.
The random placement of DGs and capacitors in DS can cause more voltage drop and higher power losses than losses without them [5], [6]. Therefore, determining the proper placement and capacity of DGs in DS becomes a crucial task for obtaining their maximum possible advantages. Several techniques have been proposed in recent years to determine the optimal locations and sizes of DGs in DS such as Ref. [7], which discussed the adaptive protection using neural networks for high penetration of DGs, but this technique takes very long training time. Ref. [8] made a very hard work to get the effective signals for optimal ratings of RERs as the objective function and Recently, numerous optimization algorithms handled the problem of DGs locations and sizing in DS. Artificial bee colony (ABC) [10], Genetic Algorithm (GA) [11], cuckoo search algorithm (CSA) [12], mixed integer nonlinear programming (MINLP) [13], Differential Evolution (DE) [14], flower pollination algorithm (FPA) [15]. Although these heuristic algorithms have been implemented simply and free derivative, they need numerous iterations to guarantee that the solution is converged. Hence, these techniques are computationally intensive. Furthermore, some studies used hybrid algorithms with analytical to combine their features and eliminate the shortage like, simulated annealing uses Loss Sensitivity Factor (LSF) in [16], PSO uses sensitivity analysis in [17], and hybrid PSO in [18]. There is another type of hybridization, which is combining metaheuristic algorithms together such as, genetic algorithm (GA) with imperialist competitive algorithm [19], ant colony optimization with artificial bee colony (HACO) [20], hybrid grey wolf optimizer (HGWO) [21], backtracking search optimization algorithm (BSOA) [22], and in [23], which used particle ant bee colony with harmony search (PABC). Other studies used the analytical approach such as in [24], which uses efficient analytical with optimal power flow (EA-OPF), an improved analytical (IA) method in [25] and machine learning method in [26]. In addition to Naresh, who used an analytical expression for optimum location for DG [27]. Most of previous techniques use a simple single objective function for minimizing the power losses except [19], [21], [23] that use a multi-objective functions to reduce real losses and improve voltage stability. Further, only few methods deal with the renewable DGs like in [20], [22], ant lion optimization (ALO) algorithm in Ref. [28], and backtracking search (BSA) algorithm in Ref. [29]. The above mentioned algorithms seem to be efficient. However they may not guarantee reaching the optimal value and face difficulty in escaping from the local minimum as the power losses face nonlinear equality constraints. This makes the problem non-convex.
A new hybrid GMSA is developed based on the incorporation of GA operations with adaptive mutation operator on the reconnaissance phase using genetic pathfinder moths and the expanding of artificial light sources over the swarm. The GMSA has some advantages over the other swarm algorithms such as (i) its simplicity and flexibility as it can be applied to different problems without changing the main algorithm structure. (ii) ability on avoiding the trap in local minima. (iii) achieving fast convergence characteristics [30]. Ref. [30] determined the optimal sizes and locations of DGs without considering the different types of DGs. In this paper, three types of DG units including PV, WTG, and capacitor bank based DGs are embedded in distribution system optimally for minimizing the power losses. A sensitivity analysis based-Voltage Stability Index (VSI) has been performed to determine the most candidate locations for inclusion the compensation devices in DS to reduce the search space of optimization techniques and simulation time. Then, the hybrid approach based on the genetic algorithm (GA) and moth swarm algorithm (MSA) [31], is presented to determine the optimal renewable DG capacity and locations in the DS to minimize the system power losses, and maintain the voltage profile for various electrical distribution systems. It is tested on standard distribution systems i.e., (33 and 69 -bus). In addition, the obtained results from the proposed approach are compared with those obtained from other algorithms to confirm its superiority. The article is organized as follows; section II provides the objective function formulation. GMSA algorithm is represented in section III. In section IV, the implementing of GMSA code for solving the DGs allocation problem has been presented. Section V shows the numerical results of the proposed technique applied on multiple standard systems. The last section concludes the results and advantages of the proposed method.

A. Load Flow Calculation
Radial distribution networks (RDN) creates some negative conditions such as radial meshed networks, unbalanced operation, high R/X ratios and distributed generation. Due to these problems, the Newton Raphson, Gauss Siedel and other conventional load flow algorithms are not effective to solve the load flow calculation of the distribution systems [32]. Therefore, the modern algorithm called backward/forward sweep [32] is used in this work to analyze the power flow in the tested IEEE distribution systems. Fig. 1 shows a single line diagram of RDN. The active power flow (P k+1 ) and reactive power flow (Q k+1 ) in RDN including DG unit at bus (k+1) are calculated by (1) and (2): where, k is the sending end and k+1 is the receiving end. Voltages of a transmission line and real power losses in the line can be calculated from (3), (4), and (5) respectively: The total system loss is calculated by summing all line losses in the system as shown in (6): The system security level is important and can be determined using the voltage stability index as follows: VSI should be high in order to improve the voltage profile and this can be achieved by minimizing the voltage deviations (VD) as follows: (8) where, n is the number of buses and V ref is the reference voltage, which commonly is 1 p.u.

B. Objective Functions
The main aim of the optimal DG placement problem is to minimize the voltage deviation, reduce the real power losses and improve the system voltage stability. There is a contrasting relation between these objectives, as clearly identified and numerically obtained by [33]. Hence, the multi-objective functions have been performed by using the following mathematical statements: (9) (10) (11) where, n l is number of branches in RDN and n b is number of buses. The weighted sum method is used to evaluate the effectiveness of the proposed approach for optimal placement and sizing of DG units. The concept Pareto strategy is not appropriate for such purpose, where the challenge in multi-objective optimization based on Pareto strategy is to find the Pareto optimal point that meets the decision maker's given preferences. From the perspective of mathematical optimization, the weighted sum method allows the multi-objective to be cast as a singleobjective mathematical optimization problem resulting in only one solution, in addition to its lower computational cost (CPU-time). These advantages are more proper for real world problems. Therefore, the generalized objective function based on weighted sum method can be formulated as follows: (12) where, w 1 , w 2 , and w 3 are weighting factors. The value of any weighting factor is selected based on the relative importance on the related objective function with others objective functions. The sum of the absolute values of the weight factors in (12) subjected to all impacts should equal one: (13)

C. Constraint Conditions
The multi-objective functions are subjected to the following constraints:

Active and Reactive Power Balance
The active and reactive power flow constraints, which represent the equality constraints could be established for maintaining the balance between generation and consumption.

Voltage Constraints
The buses voltages are the inequality constraints. The bus voltage magnitude of each bus must be maintained within the following range: (16) where V max and V min are the maximum and minimum values of bus (k) voltages. The lower and upper values are taken as 0.9 and 1.05 Pu, respectively.

DG Capacity Limits
The constraints of DG capacities are as follows: where, and are the minimum and maximum real outputs of the DG source. and are the minimum and maximum power factor of the DG source.
The input control vector x c is composed of independent adjustable variables for each DG units. Each DG has three input control variables: location (L), power factor (PF) and injecting active power (P DG ). Multiple DG units can be installed in a system as follows: In this paper, in the case of capacitor banks, the PF is zero and for PV units, the PF is considered to be unity thus the DG unit only delivers active power. While, in the case of wind, the DG unit delivers active and reactive power.

D. Equality and Inequality Constraints Treatment
Power-flow equations, equality constraints (14) and (15), can be satisfied during the process of power-flow calculation. In the encoding period, the inequality constraints (16)-(21) can be satisfied through adding penalty function into the objective function in such a way that it penalizes any violation of the constraints. Consequently, the constrained optimization problem is then converted into an unconstrained form.

A. Genetic Algorithms
Genetic algorithms (GAs) were initially introduced by John Holland as the main global optimization technique. These algorithms have been applied successfully to solve a large number of problems in different real-world fields by simulating the natural evolution systems. The recombination operation produces offspring that carry a combination of genetic material information from each parent where crossover operations are applied to exchange the chromosomes. The natural selection determines the evolution where the fittest survives with higher probability. Therefore, a suitable selection strategy is then used to determine the solutions that survives to the next generation based on their fitness values. The mutation operation is the main genetic operator that can achieve some diversity in the population.
The steps of the MSA technique are discussed below.

B. Moth Swarm Algorithm
The moth swarm algorithm has been presented in 2017 by Al-Attar et al. [30]. It is inspired by the orientation of moths towards moonlight. The available solution of an optimization problem using MSA is performed by the light source position, and its fitness is the luminescence intensity of the light source. Furthermore, the proposed method consists of three main groups, the first one is called pathfinders which are considered a small group of moths over the available space of the optimization. The main target of this group is to guide the locomotion of the main swarm by discriminating the best positions as light sources. Prospectors group is the second one which has a tendency to expatiate in a non-uniform spiral path within the section of the light sources determined by the pathfinders. The last one is the onlookers, this group of moths move directly to the global solution which has been acquired by the prospectors.

C. Genetic Moth Swarm Algorithm (GMSA)
The proposed hybrid based algorithm aims to integrate advantages of the well-known GA in terms of sharing information and global search ability to find the optimal value of a given function using the following steps:

Initialization
Initially, the positions of moths are randomly created for dimensional (d) and population number (n) as seen in (23). (23) where, x j max and x j min are the upper and lower limits, respectively.
Afterwards, the type of each moth is selected based on the determined fitness. Consequently, the worst moths are selected as pathfinders that are modified to act genetically in the following reconnaissance phase. In the next two phases, the best individuals of the swarm are regarded as prospectors and onlookers, respectively, according to their fitness. In addition, each moth in the modified algorithm has its own light source which is available to share with others in the swarm.

Genetic Reconnaissance Phase
The moths may be concentrated in the regions which seem to provide good performance. Therefore, the swarm quality for reconnaissance may be decreased during processing the optimization and this process may lead to a stagnation case. To avoid the early convergence and enhance the solution diversity, a part of the swarm is compelled to determine the less congested area. The pathfinder moths that perform this role are manipulated to evolve by the genetic operators, with the size of (n p =floor (n/2)) selected from the worst-performing individuals in the swarm. The crossover and mutation operators of GA are applied on all moths in the swarm to improve the pathfinder group. Therefore, after the sorting of the population, the first half of the individuals that have better luminescence intensity values are regarded as candidate parents (elite individuals). The size of the elite individuals can be simply calculated using (n e =n-n p ).
The probability distribution function (pdf) is used to select parents, which is increased as the fitness of the individual is greater. Therefore, two of the moths from the elite individuals are randomly selected as parents for one pathfinder moth. In order to perform the possible mating, a single crossover point is identified on both parents' vectors at random. The elite individuals are then divided at this point to exchange their tails thereby giving birth to the new child pathfinder (x p ). This ensures that the best candidates (local optima) are copying into the next generation. After the reproduction operation, a mutation operator based on normal distribution is applied on these offspring in order to increase their diversity and increase the ability to jump out of suboptimal/local solutions. For exploitation purpose, an adaptive mutation rate (m rate ) is proposed to decrease through all iterations T as follows: (24) The fitness value of the genetic pathfinder solution, x p t+1 , is determined after finishing the last procedure. The structure of worst half of the old population is then redesigned by comparing the fitness of these offspring with that of their previous positions f (x p t ). The suitable solutions that have the highest luminescence intensity are chosen to retain for the next generation, which is used for minimization problems as follows: (25) Finally in this phase, the light sources are elected from among the combined population (survivors of the previous equation and their parents) to continue as guidance of the next phases. Therefore, the moths are changed dynamically in the GMSA model where any pathfinder moth uplifts to become prospector or onlooker moth if it discovers a solution with more luminescence than the existing light sources. That means the new lighting sources will be presented at the end of this stage. The probability p i of selecting the i th moth as a light source is proportional to the corresponding fitness, which can be calculated as follows: (26)

Transverse Orientation
Individuals that have been selected as elites or parents have another role at this stage as prospectors. The number of these moths � f is proposed to decrease with time progress as follows: (27) After the pathfinders have finished their search, the information about luminescence intensity is shared with prospectors, which attempt to update their positions in order to discover new light sources. Each prospector moth X j is soared into the logarithmic spiral path as shown in Fig. 2(a) to make a deep search around the corresponding artificial light source X i , which is chosen on the basis of the probability P i using (26). The new position of jth prospector moth, can be expressed mathematically as follows: (28) where, θ ϵ [r, 1] is a random number to define the spiral shape and (r = -1-t/T). The GMSA is dealing with each variable according to the previous formula as an integrated unit. At the end of this stage, only moonlight is updated. It should be noted that all moths in the modified swarm cooperate to discover new sources of light, which increases the area of selection and prevents from falling into local solutions and thus increases the efficiency of the proposed algorithm.

Celestial Navigation
The diminishing of the number of prospectors during the optimization process increases the onlookers number (n o =n e -n f ). This may lead to an increase in the speed of the convergence rate of GMSA towards the global solution. The onlookers are the moths that have the lowest luminescent sources in the parent group. Their main aim for traveling directly to the moon is the most shining solution Fig. 2(b). In the GMSA, the onlookers are forced to search for the hot spots of the prospectors effectively. These onlookers are divided into the two following parts: The first part, with the size of n G =round (n o ⁄2), walks according to Gaussian distributions. The new onlooker moth in this sub-group x i (t+1) moves with series steps of Gaussian walks, which can be described as follows: Where ε 1 is a random number generated from Gaussian distribution, ε 2 and ε 3 are random samples drawn from a uniform distribution within the interval [0,1]. best g is the global best solution (moonlight) obtained in the transverse orientation phase. Based on many optimization algorithms, there is a memory to transfer information from the current generation to the next generation. However, the moths may fall into the fire in the real world due to the lack of an evolutionary memory. This is due to the fact that the performance of moths is intensely affected by the short-term memory and the associative learning between the moths. Therefore, the second part of onlooker moths (n A =n e -n G ) will sweep toward the moonlight using associative learning immediate memory (ALIM) to imitate the actual behavior of moths in nature. The instantaneous memory is initialized from the continuous uniform of Gaussian distribution on the range from (x i min -x i t ) to (x i max -x i t ). The updating equation of this type can be completed in form:  Where, r 1 and r 2 are random numbers within the interval [0, 1], 2g/G is the social factor, (1-g/G) is the cognitive factor and best p is a light source selected from the modified swarm based on the probability p i .

IV. Results and Discussion
To evaluate the validity and efficiency of the proposed GMSA method against power loss minimization, the distribution systems of 33 and 69-bus have been applied for this simulation. The MATLAB 8.6 ® is used and run on a personal computer that has core i5 processor, 2.50 GHz, and 4 GB RAM to implement the GMSA technique for the optimal renewable DGs placement and sizing problems. The backward/forward sweep load flow program is used to solve the equations iteratively and update the voltage profile. The parameters of the GMSA are adopted after many trails and errors for all the test cases of RDNs mentioned in Table I appendix (A). Three types of DG units including P-type, Q-type, and PQ--type are considered in this study. Each type is applied to the three cases of one DG, two DG, and three DG units. The GMSA is compared with all other types of algorithms such as analytical, metaheuristic methods, classical, and hybrid approaches.

A. 33-Bus Test System
To evaluate the impact of the proposed hybrid GMSA on the medium network of the RDN, the 33-bus system has been tested. Fig. 3 shows the single line diagram of this system. The system rated voltage is 12.66 kV with 100 MVA base. The total real and reactive power demands are 3,715 kW and 2,300 kVAR respectively. The load and line data are given in [34]. Load flow calculation is run before using DG units, the minimum bus voltage is registered as 0.9036 p.u at node 18 and the total active power loss at nominal load is 210.98 kW. The best locations and sizes of the three types of PV, WTG, and capacitor banks that are captured by the proposed GMSA, and all obtained results, are listed in Table II appendix (A), such as, total power loss, minimum bus voltage, VD, VSI, and loss reduction percentage.

Case 1: Q-Type DG
In this case, Table III appendix (A) shows a comparison of different algorithms for the Q-type with three cases of 1DG, 2DGs, and 3DGs. For single DG unit, most methods selected bus 30 as the best location for the DG unit with different size values. GMSA produced better solutions, whereas the real power loss is diminished to 150.43 kW as 28.7% of the base case by using 1200 kVAR of capacitance. It is considered the lowest value compared to the other methods. Moreover, The GMSA has increased the minimum voltage value to 0.9175 p.u after compensation. For two DG units allocation, the optimal locations selected by the GMSA method are buses 12 and 30 with 450 and 1050 kVAR, respectively. The reduction in power losses is 140.87kW, which is the best comparing with 141.83kW for HGWO, 141.94kW for Hybrid method, 143.11kW for MSA, and 151.12 kW with GA. Furthermore, the minimum bus voltage enhanced from 0.9175 p.u with one DG to 09332 p.u with two DGs. In the case of determining three DG units, the GMSA performed well as the active power loss is diminished to 137.46 kW. This value is the least of all other methods as seen in Table III. In addition, the system voltage profile is improved and the worst bus voltage is enhanced to 0.9334 p.u. It is shown that the proposed GMSA is more effective than the other approaches in case of Q-type DG under the medium scale of distribution system. IV appendix (A) shows the optimal locations and capacities of PV units by the proposed GMSA method compared to different algorithms for the same three cases (1 DG, 2 DGs, and 3 DGs). The GMSA presented the best solutions as the power losses reduced to 110.267 kW with only one PV unit installed at bus 6. This value is considered the best value comparing with other techniques and also better than the all three cases of Q-type DG. Moreover, it enhanced the voltage profile as the minimum bus voltage at bus 18 increased from 0.9036 p.u to 0.9427 p.u. For 2 PV units case, the optimal bus places are at 13 and 30 for most methods. However, the proposed technique reduced the active power loss to 86.58 kW compared to 87.17 kW with PSO, 87.164 kW with HGWO, and 87.172 with EA. It is also observed from the results that the VD is enhanced to be 0.6723 p.u while the voltage stability is also enhanced to be 29.4035 p.u. In the last case of installing three PV units, GMSA selected buses 13, 24, and 30 to locate the PV units with 801, 1091, 1053 kW, respectively, which helps in reducing the real power loss to 72.299 kW and increasing the minimum bus voltage to 0.9712 p.u. These results prove the superiority of the proposed GMSA compared to other methods as seen in Table IV. It is also observed that the power loss is minimized significantly as compared with the Q-type DGs, this helps in improvement in the system voltage profile.  Table V appendix (A) shows the results for the PQ+ -type such as, wind turbine generators (WTG), which injects both active and reactive power for the three cases. The results stated that this type of DGs is the best as only one WTG installed at bus 6 with the size of 3105 kVA and 0.82 pf using the GMSA. This one unit improved the minimum bus voltage value from 0.90369 p.u to 0.9586 p.u and reduced the total power loss to about 67.42kW, which is considered the least value compared to the three capacitor banks and the three PV units. Furthermore, it is the best compared with other algorithms as seen in Table V. Moreover, increasing the number of WTGs, leads to minimizing more in power loss. It is clearly seen from the results that two WTG diminished the power losses to 28.33 kW, while three WTGs reduced it to 11.68 kW, which is the best-minimized power losses value for all cases of different DGs. Further, the voltage stability is enhanced to be 31.53 p.u and the VD is minimized to 0.1223 p.u.

Case 3: PQ--Type DG
For this case of 33 bus system, the GMSA, HGWO, and EA produce better solutions compared to the other methods, whereas the best power loss value obtained by BSOA is much more than the rest of algorithms. The GMSA has a speedy and smooth rate of convergence to the minimum value without any oscillations and settles down early as shown in Fig. 4. On the other hand, the WTG has the best effect on the system performance as one WTG gave better results than 3 units of capacitor banks or 3 PV units. Fig. 5(a, b, c) shows a comparison between the different types of DGs in terms of voltage profile improvement.

B. 69-Bus Test System
To investigate the effectiveness of the proposed GMSA on a large scale of RDN, it is applied on the 69-bus system, which consists of 69 buses and 68 branches as shown in Fig. 6. This system is operated with 100 MVA base, 12.66 kV rated voltage, and the total system load is (1.896MW+j1.347MVAR). All data of lines and loads are given in [35]. The total real power loss for the base case without using capacitors or DGs is found at 224.99 kW with the lowest bus voltage at bus 65 is 0.9092 p.u. The best locations and sizes of the three types of PV, WTG, and capacitor banks that are obtained by the proposed GMSA and all results are listed in Table VI appendix (A) in terms of power losses, minimum and maximum bus voltages, VD, VSI, and the percentage of loss reduction.

Case 1: Q-Type DG
In this case, using the capacitors banks as Q-type helps in reducing the 69 bus system power loss by 32.61% from the base case using one DG unit at bus 61 with the size of 1200 kVAR, using the GMSA. It is considered the lowest value compared to the other methods. Moreover, the GMSA has increased the minimum bus voltage value to 0.9296 p.u after compensation. While, the power losses are reduced to 35.27% and 35.83% with two and three capacitors, respectively. Table VII appendix (A) summarized the obtained results by GMSA technique in case of installing 1 capacitor bank, 2 capacitor banks, and 3 capacitor banks units compared to other four algorithms. The results stated that as the number of capacitor banks units increased, the minimizing of power loss increased and consequently improved the whole system profile.

Case 2: P-Type DG
As for the previous system 33-bus, the installing of PV units enhances the voltage profile of the 69 bus system. It is seen from Table VIII appendix (A) that the GMSA selected bus 61 to install 1.87 MW PV unit, which reduces the power losses to 82.4 kW compared to 83.22 kW with MFO, HGWO and PSO, and 83.34 kW with EA. These four algorithms came in the second order after the GMSA method. While, a hybrid approach, MINLP, and IA came after that with 83.37, 83.38 and 83.44 kW, respectively. Moreover, GMSA enhanced the minimum bus voltage from 0.9036 p.u to 0.9686 p.u. For 2 PV units, the optimal bus locations are the same at 17 and 61 for all the methods, except the GMSA at 15 and 61. The power loss is 71.37 kW by GMSA. It is the lowest of all techniques as seen in Table VIII. In the last case of installing three PV units, GMSA selected buses 11, 17, and 61 to place the PV units with 526, 380.7, 1718 kW, respectively, which helps in reducing the real power loss to 68.974 kW and increasing the minimum bus voltage to 0.9799 p.u. It is also observed from the results that the VD is enhanced to be 0.4471 p.u, while the voltage stability is also enhanced to be 66.2363 p.u.

Case 3: PQ--Type DG
To verify the effectiveness of the proposed GMSA method, it has been applied to assign the best locations of one, two, and three WTGs. In case of inclusion of one WTG DG, the kW loss is reduced to 22.98 kW and the VD is enhanced to be 0.5825 p.u while the voltage stability is also enhanced to be 65.7382 p.u. Furthermore, it increased the minimum bus voltage to 0.9728 p.u. In this case, it can be seen from Table IX appendix (A) that the results of the GMSA are the best compared to all other methods in terms of power loss and minimum bus voltage. Further, it can be noted that the use of only one WTG is better than the usage of 3 capacitor banks or 3 PV units. Moreover, increasing the number of WTGs, leads to more reduction in power loss. The results stated that two WTG reduced the power losses to 7.144 kW, while three WTGs reduced it to 4.21 kW, which is the best-minimized power losses value for all cases and types of DGs. Further, the voltage stability is also enhanced to be 67.7559 p.u with minimizing the VD to 0.0617 p.u. The proposed hybrid algorithm provides a significant improvement of bus voltage profile and power loss in the case of PQ--type as compared with other cases. Fig. 7(a, b, c) shows a comparison between the different types of DGs in terms of voltage profile improvement.
The results stated that the GMSA method performed better than the other algorithms over all cases of the 69-bus system. In addition, the best performance of the proposed GMSA is noted by the flat and stable convergence curves of total real power losses as shown in Fig. 8.

V. Conclusion
In this article, the exploitation ability of the GMSA, in terms of quick convergence and fast execution time, has been maintained by using the best moths in the swarm to perform that role in the phases of the transverse orientation and celestial navigation. The tradeoff between the global and local search has been regulated by introducing an adaptive mutation operation of GA on the pathfinders as the largest population group in the swarm. In addition, individuals have cooperated to produce the light sources for the guidance of the transverse orientation phase, which assists the exploration ability in such exploitation phase and enhances the solution diversity. The complexity of reconnaissance phase has been reduced. The GA operations increased the information sharing and the performance of the proposed algorithm.
The new GMSA approach has been successfully applied on multiple systems (33 and 69-bus systems) for solving the problem of renewable energy distributed generation sources placement and ratings for minimizing the total power losses. A sensitivity analysis based-Voltage Stability Index (VSI) has been performed to determine the best candidate locations for inclusion of the compensation devices in distribution systems to reduce the search space of GMSA and simulation time. Furthermore, a detailed comparison has been conducted with other best results of alternative methods in the literature. The P-type, Q-type and PQ--type DG units have been used in this study. The PQ--type presented the best results for all three cases of the two test systems. This is due to the variability in the solution vector and flexibility of power factor, which leads to more availability to select of other variables. The proposed GMSA can improve the voltage profile at each bus in these systems. Consequently, enhances the performance of distribution networks. GMSA method presented a desirable and superior performance with stable convergence. Results stated that the proposed GMSA minimized the objective function, and provided remarkable results compared to other algorithms. Hence, the applications of the proposed GMSA method can be considered as the most recent optimization algorithms for the network reconfiguration and dealing with the protection coordination system in presence of capacitors banks and renewable energy distributed generation sources during grid faults are the future scope of this work.