# Three-Partition Multistrategy Adaptive Fruit Fly Optimization Algorithm for Microgrid Droop Control

Authors: Xinkun Tao; Li Zhang; Fuzhong Wang; Guangqiang Tian; Hongwei Zhang
Journal: International Transactions on Electrical Energy Systems
 (2022)

---

## Abstract

Summary. When the microgrid topology changes, the power output of the inverter cannot be adaptively adjusted by traditional droop control, and the dynamic performance and steady-state accuracy of the inverter are affected. To solve this problem, a three-partition multistrategy adaptive fruit fly optimization algorithm (MSAD-FOA) is proposed, which performs a real-time optimization of the PI parameters to realize microgrid droop control. The fruit fly population is divided into three regions according to the ranking of the fitness values of the algorithm. Next, the multistrategy model is automatically updated according to the difference in the fruit fly performance in each region. The local fine search in zone I ensures that the population does not degenerate. Zone II pertains to the adaptive adjustment to ensure the diversity and convergence of the algorithm. Zone III guides the fruit flies to accelerate convergence. The effectiveness of the algorithm and feasibility of the proposed control strategy are verified through a theoretical simulation and microgrid droop control simulation. The comparison with other algorithms demonstrates the superiority of the development and exploration ability of the proposed algorithm. The response speed of the inverter is 40 times higher when the proposed control strategy is used, and the steady-state error is reduced by 4.3%.


---

## Body

## 1. Introduction

Microgrid droop control refers to a double closed-loop control system, which is composed of multiple PI controllers in series and parallel [1]. The control effect of the system varies in cases involving different PI parameters. Because the microgrid is a dynamic system, when the system topology changes, the conventional PI controller cannot adapt to the changes in the system parameters, thereby reducing the response speed of the inverter. The output power, frequency, and voltage of the inverter tend to be out of limit and oscillatory, and the dynamic performance and steady-state accuracy of droop control are reduced. Therefore, it is necessary to adjust the PI parameters online in real time.In recent years, the research on microgrid has been continuous. Under the premise of considering voltage stability, a microgrid dispatching model for economy and environmental pollution was established by Reddy et al. [2], using multiobjective particle swarm optimization for optimization, fuzzy logic selection of compromise solutions, thereby improving the economy and stability of the system. The thermoelectric and wind energy integrated energy-saving system was built by Reddy et al. [3], the adaptive differential evolution algorithm was used to optimize the solution, and it makes the operating cost of the microgrid and the emission of pollutants be controlled in the best condition. This kind of literature is devoted to the research of microgrid optimization dispatching, by establishing the economic and environmental pollution model of the microgrid, using intelligent algorithm optimization that reduces operating costs and environmental pollution. However, in addition to considering the economics of microgrid operation, the stability of the microgrid should also be considered. The research and education microgrid control model was established in Momoh et al. [4], which solved the control problems of voltage, reactive power, and frequency. At present, droop control is a popular control strategy of microgrid multimachine parallel operation in the island mode. The principle is to realize the load power distribution according to the capacity by adjusting the characteristic curve [5]. Many scholars have conducted considerable research on droop control, for example, to address the fluctuation and out of limit tendencies of the frequency and voltage in droop control. Ling et al. [5] attempted to prevent the overlimit frequency resulting from the switching of heavy load or large-capacity DGs by using an inverted-S droop control strategy. The microsource could promptly adjust the frequency in case of large load fluctuations to prevent the values from exceeding the limit. However, the problem of the voltage being out of limit was not considered. A droop control strategy based on self-recovery was proposed by Chai et al. [6]. When the load changed suddenly, the proposed approach could prevent the dynamic response oscillation of the inverter output voltage. However, the response speed of the inverter was low. For complex nonlinear systems, it is difficult to simplify the model and deduce the formula [7]. Therefore, certain researchers introduced an intelligent optimization algorithm in droop control. The method of fuzzy sliding mode droop control was studied by Zhu et al. [8]. The fuzzy control strategy adjusts the parameters for droop control in an online manner. When the load fluctuates, this method can reduce the voltage error and increase the accuracy of the power distribution. Shivam et al. [9] and Taghizadeh et al. [10] used different algorithms to optimize the droop control parameters. The robustness of droop control was enhanced, and the fluctuation of the voltage and frequency was suppressed. Although many scholars have proposed improvement methods, the adaptive ability of droop control strategies in events including microgrid topology changes has not been considered. In practice, a microgrid is a dynamic system, and a microgrid performs not only load switching but also microsource switching. Therefore, wind and light abandonment caused by the uncertainty in the renewable power output and load demand often occurs [11]. Therefore, when the microgrid topology changes, it is necessary to maintain the stability of droop control.The traditional droop control strategy includes many PI controls. When the microgrid topology changes, the PI parameter must be reset. If the PI parameters are not set, the stable operation of the microgrid may be affected. With the emergence of intelligent algorithms, many scholars have introduced intelligent algorithms to adjust the PI parameters of microgrids. A control algorithm based on GOA optimized PI was proposed by Jumani et al. [12]. The minimum fitness value was used as the optimization objective, the PI parameters were determined, and the problems of voltage and frequency overshoot and total harmonic distortion were solved. A PI automatic gain controller based on the genetic algorithm was proposed by Ismayil et al. [13]. The optimization objectives were the steady-state error, response time, and maximum overshoot/undershoot of the system response; the robustness of PI control was enhanced. A PI inverter controller scheme based on the particle swarm optimization algorithm was proposed by Roslan et al. [14]. The inverter could effectively reduce the harmonics and stabilize the frequency. Moreover, the online PI parameter optimization strategy of the VSI inverter based on the fruit fly algorithm was designed by Liu et al. [15]. Four PI controls were simultaneously optimized, and the output performance of the VSI inverter was enhanced. Among the abovementioned algorithms, the GOA formula is highly complex and difficult to program, the genetic algorithm is complex and easily falls into the local optima, and the computational stability of the particle swarm optimization algorithm is low [16]. In comparison, the fruit fly algorithm exhibits a high optimization speed, simple structure, low amount of calculation, adjustable parameters, outstanding global search ability [16, 17], and strong ability to solve nonlinear problems. Therefore, many scholars have applied the fruit fly algorithm for the parameter optimization of microgrids.The fruit fly algorithm exhibits an outstanding global optimization ability in the early stage and can rapidly find the optimal value. However, the search ability in the later stage is inferior, the algorithm easily falls into the local optima, and it exhibits a low optimization accuracy in solving complex problems [18]. These deficiencies were highlighted by Xiong et al. [19]. In terms of population zoning, the sentinel mechanism and the multigroup mechanism were introduced by Chen et al. [20]. The sentinel mechanism consists of greedy selection and Gaussian variation to enhance the convergence speed of the algorithm. The multigroup mechanism divides the fruit fly population into several subgroups to enhance the exploration ability of fruit flies. A double-driven fruit fly algorithm was proposed by Feng et al. [21]. In this framework, fruit fly flight is guided by the concept of multiple repellents and attractants. Adaptive determination of the search radius is performed. The algorithm is used to optimize and enhance the performance of the PID framework. To introduce a novel search mechanism, a fruit fly algorithm for adaptive cloud escape search was proposed by Zhang et al. [22]. The search method considered the number of iterations as the guiding factor to adjust the global and local search. Moreover, a new evolutionary direction intelligent selection mechanism was proposed by Wu et al. [23]. This selection mechanism provides the correct direction for fruit flies, and the convergence speed of the algorithm is increased. An improved fruit fly optimization algorithm (IFOA) was proposed by Yuan et al. [24]. By introducing the inertial weight function to the search step, the search ability of the algorithm was improved. In the abovementioned techniques, the introduction of a new search mechanism can compensate for the defects of the fruit fly algorithm; however, the improved FOA algorithm relies on a single strategy to update the positions of the fruit flies and thus cannot distinguish fruit flies with different performances. In addition, real-time detection of the optimization effect of the fruit fly algorithm is not implemented in the improved methods. Therefore, in the context of the online optimization of droop control PI parameters, the output of the droop control inverter cannot be fed back in time, and the convergence and diversity of the algorithm cannot be adjusted in time, causing the algorithm to perform many invalid calculations.To enhance the adaptive ability of the inverter of a microgrid droop control system, this paper analyzes the basic principle of droop control and limitations of the standard fruit fly algorithm. A three-partition multistrategy adaptive fruit fly algorithm for microgrid droop control is proposed. The algorithm can detect and feedback the optimization effect and adjust the PI parameters in real time. When the topology and load change, a rapid response and an accurate output of the inverter are ensured during the operation of the microgrid. Consequently, the response speed of the inverter can be increased, the error can be decreased, and a more stable output can be obtained.The main contributions are as follows. A novel three-partition multistrategy adaptive fruit fly optimization algorithm is proposed in this paper. It has made great progress in promoting the convergence and diversity of the algorithm. The algorithm is applied to droop control strategy, providing online optimization strategy and theoretical framework. In terms of algorithm: (1) Three-partition and multistrategy modes are proposed, the optimization ability of each fruit fly is fully exploited, and invalid calculations are avoided. (2) An evaluation index for the average individual increment in the fruit fly population is proposed. The effect of the algorithm optimization can be fed back in real time, and the convergence and diversity of the adaptive adjustment algorithm can be ensured. In terms of droop control optimization, (1) the absolute value integral term of the PI error derivation is introduced in the objective function of microgrid online optimization, and the oscillation and deviation of the inverter output power are effectively suppressed. (2) In noninitial optimization, the use of adaptive and optimal delivery strategies shortens the online optimization time.


## 2. Preliminary Study on FOA

In recent years, optimization technologies have continuously developed, and intelligent optimization algorithms, represented by particle swarm optimization algorithms and genetic algorithms, have provided a strong technical support to solve complex nonlinear problems. However, for the particle swarm optimization and genetic algorithms, it is necessary to update a variety of attributes, the calculation is complex, and the program is difficult to implement. In comparison, the update strategy of the fruit fly algorithm is simple, easy to implement, and requires a small amount of calculation, rendering this algorithm more suitable for online optimization.The fruit fly algorithm is a new algorithm that imitates the search of food by fruit flies [25]. The flowchart is shown in Figure 1, and the updated formula is as follows:(1)xi,jk+1=xi,jk+c⋅L⋅rand,Yi,jk+1=Yi,jk+c⋅L⋅rand,where L is the optimization step size, c is a nonnegative acceleration constant, rand is a random number generated between 0 and 1, i is the number of fruit flies, j is the dimension, xi,jk,yi,jk represent the global optimal position, and xi,jk and Xgbesti,jt, described in the following text, are values with the same meaning.Figure 1
Flowchart of standard fruit fly algorithm.The fruit fly algorithm is applied to the PI parameter optimization of droop control to ensure the stability of droop control (minimum error) and obtain the optimal droop control parameters. Parameterkp is a proportional adjustment term to ensure the speed of adjustment. An increase in kp can increase the regulation speed of the inverter, but an extremely large kp may lead to the instability of the inverter output. Parameter ki pertains to integral regulation, aimed at eliminating the steady-state error. An increase in ki can shorten the time required for the inverter to reach steady state; however, if ki is extremely large, the overshoot may increase. The goal of the microgrid is to ensure that in events involving topology changes, the droop control promptly responds without any overshoot. After the microgrid enters the steady state, the output power, voltage, and frequency do not fluctuate, and the error is small. Four PI controllers are included in droop control. The interactions among the PI controllers [26] form a complex control system. The dynamic performance and the steady-state accuracy of the microgrid system are affected by the value of each PI parameter; therefore, the accuracy of optimization should be ensured. Online optimization should ensure a higher optimization speed.In the preliminary study, the standard FOA is applied to the online optimization of droop control after many experiments: (1) The FOA leads to a low response speed of the inverter and a large error in the steady state (Figure2). (2) When many microsources exist, the FOA cannot ensure the normal operation of each microsource, and the output power of the inverter considerably fluctuates. (3) The optimization results of the FOA cannot be improved by adjusting the algorithm step size and number of iterations (Figures 2 and 3). Notably, the accuracy of FOA optimization is not high, the algorithm falls into a local optimum, and the optimal PI parameters cannot be identified to ensure the microgrid performance. (4) The convergence curve of the FOA indicates that the algorithm needs at least 80 iterations to ensure a low convergence accuracy. When the number of microsources increases, the algorithm dimension increases, and cliff convergence occurs in the optimization of the FOA (Figure 4); thus, convergence in each iteration cannot be ensured. The convergence of the FOA cannot be changed by increasing the number of populations because the algorithm performs many invalid calculations, which adversely influence the convergence.Figure 2
Results by changing the number of iterations.Figure 3
Results of changing step size.Figure 4
Optimization results of adding microsource.According to this analysis, the standard FOA can be enhanced in terms of the following aspects: (1) Increase the convergence accuracy and speed of the fruit fly algorithm as follows: (i) adopt the updating method of the variable step size; (ii) introduce the flight experience of the optimal individual of the fruit fly population in the updated formula. (2) Enhance the development and exploration ability of the fruit fly algorithm as follows: (i) adopt a new idea of population zoning and use different update strategies for fruit flies with different performances to fully exploit the optimization ability of each fruit fly; (3) the algorithm can perform detection and feedback optimization in real time, closed-loop control can be formulated, and negative feedback adjustments can be performed in the algorithm in time, thereby avoiding invalid calculations.The population includes fruit flies with high, average, and low performances. Fruit flies with different performances exhibit different abilities, and it is easy to distinguish superior and inferior fruit flies. However, the existing approaches cannot yield an accurate evaluation of fruit flies with average performances because of the lack of a clear evaluation standard. In practice, fruit flies with average performance account for the majority of the flies, and these fruit flies contain both slightly superior fruit flies and slightly inferior fruit flies. In the process of optimization, these fruit flies serve as a “pillar rock in midstrea.” Therefore, in the optimization process, it is necessary to effectively partition the fruit fly population and consider their characteristics. Division schemes for the fruit fly population were proposed by Wang et al. [27] and Wang et al. [28]. Subgroups 1 and 2 adopted the methods of local search and global search, respectively, to enhance the algorithm stability. The experiment was conducted using dichotomy concepts. It was noted that the convergence speed of the algorithm was not increased. This phenomenon occurred because the method considered only an extremely small number of optimal fruit flies. Fruit flies with average and low performances were not distinguished, the phenomenon of fuzzy partition occurred, and the performance of each fruit fly could not be exploited. The strategy of dividing the population into multiple subgroups was proposed by Yang et al. [29] and Zhang et al. [30]. Each subgroup performed a parallel search, and the convergence accuracy was increased. The experiment was conducted using the multipartition method, and it was noted that with the increase in zoning, the number of fruit flies was required to be increased to ensure that a large number of fruit flies were present in each subgroup, leading to a significant increase in the amount of calculation of the algorithm. Therefore, while the partition strategy should ensure that fruit flies with different performances can be distinguished and avoid the phenomenon of partition ambiguity, the increase in the amount of calculation due to an increase in the number of partitions must also be considered.Considering the advantages and limitations of zoning in the literature, in this paper, fruit flies with an average performance are placed in the same area. Three partitions are formed based on two partitions. The convergence and diversity of the algorithm are adaptively adjusted by these fruit flies. According to the unique search mechanism of the fruit fly algorithm and problems associated with its optimization, a closed-loop control algorithm that can detect the optimization effect in real time is proposed. The algorithm adaptively adjusts the fruit fly population in the target search and explores and develops the region in an optimal manner. Increasing the population diversity can accelerate population convergence, considering the diversity and convergence of the fruit fly population. This algorithm is named the three-partition multistrategy adaptive fruit fly optimization algorithm (MSAD-FOA).


## 3. Implementation of MSAD-FOA Algorithm

### 3.1. Three Divisions of the Fruit Fly Population

This paper considers the optimization minimum as an example. After 5 iterations of the algorithm, three partitions of the population are schematically illustrated in Figure5. The fruit fly population is sorted according to the individual evaluation index of the fruit flies. A three-partition formula is as follows:(2)regionftI,rankft<α⋅n,II,α⋅n≤rankft<β⋅n,III,rankft≥β⋅n.Figure 5
Schematic diagram of population zoning.In equation (2), α and β are positive numbers between 0 and 1, and n is the number of fruit flies. The fruit fly population is divided into three regions based on the values of α and β, and the number of fruit flies in each region is determined. The values of α and β can be specified only after determining the multistrategy mode and adaptive strategy. Section 3.4 discusses the impact of the values of α and β on the algorithm.


### 3.2. Determination of Multistrategy Mode

Different renewal strategies should be formulated according to the different performances of fruit flies to enhance the exploration and development ability of the fruit fly populations.The fruit flies in zone I exhibit the highest performance, suggesting that the fruit fly population in zone I is closest to the optimal target. The elite fruit fly population should be maintained; no population degradation occurs, and the local search capability increases. The concept of the historical individual optimal is introduced in the fruit fly algorithm by referring to the particle swarm optimization formula [31]. The next position of a fruit fly is updated through a combination of the fruit fly global optimum and the fruit fly individual optimum. The updated formula for zone I is as follows:(3)Xi,jt+1=Xi,jt+φ⋅L⋅rand1Xpbesti,jt−Xi,jt+rand2Xgbesti,jt−Xi,jt,Yi,jt+1=Yi,jt+φ⋅L⋅rand1Ypbesti,jt−Yi,jt+rand2Ygbesti,jt−Yi,jt,φ=12×1+cosπ×t−1tmax.In equation (3), φ is the weighting factor, which decreases with the number of iterations. Xgbesti,jt,Ygbesti,jt represent the global fruit fly optimal positions at time t, and Xpbesti,jt,Ypbesti,jt represent the optimal positions of the individual fruit flies at time t. This equation shows that for the fruit fly population of zone I, the update direction of the fruit fly position at the next moment is always toward the optimal position.The fruit flies in zone II exhibit an average performance but reach the fruit fly optimal target after a relatively small number of iterations. In zone II, the superior or inferior fruit flies are not distinguished, and thus, the fruit fly population in zone II takes into account multiple styles and convergence. The updated formula is as follows:(4)Xi,jt+1=Xgbesti,jt+φ⋅L⋅rand,randi,j>G,Xi,jt+φ⋅L⋅rand⋅Xgbesti,jt−Xi,jt,randi,j≤G,Yi,jt+1=Ygbesti,jt+φ⋅L⋅rand,randi,j>G,Yi,jt+φ⋅L⋅rand⋅Ygbesti,jt−Yi,jt,randi,j≤G,where G is the evaluation index of the population convergence and diversity.The fruit flies in zone III exhibit a low performance, with no notable contribution to the fruit fly population, and are far from the optimal target. The convergence of fruit flies in zone III should be accelerated. The update formula is as follows:(5)Xi,jt+1=Xi,jt+φ⋅L⋅rand⋅Xgbesti,jt−Xi,jt,Yi,jt+1=Yi,jt+φ⋅L⋅rand⋅Ygbesti,jt−Yi,jt.


### 3.3. Implementation of the Adaptive Mode

In algorithm, the convergence and diversity contradict each other to a certain extent. However, adaptively adjusting the convergence and diversity according to the environment of the algorithm can enhance the comprehensive performance of the algorithm. Certain fruit flies are randomly selected from zone II to perform diverse location updating. The remaining fruit flies perform convergent position updating. The selection method is randomized. The first update formula is selected when the random number is larger thanG. This update formula is the standard update formula for the fruit fly optimization algorithm, which has a global search capability that can ensure population diversity. The second update formula is selected when the random number is less than G. This update formula is based on the position in the previous instance; the updated orientation ensures that the individual fruit flies fly along the global optimal direction, and the flight distance decreases with the number of iterations. This update method promotes the accelerated convergence of fruit fly individuals. Thus, the adaptive G-value can automatically adjust the convergence and diversity of the algorithm. An evaluation index of the average individual increment (AII) of the fruit fly population is proposed as the basis for adaptive adjustment:(6)DIt=1n∑i=1n∑j=1dimXtij−Xpbestij+Ytij−Ypbestij,DIt−1=1n∑i=1n∑j=1dimYt−1ij−Ypbestij+Yt−1ij−Ypbestij,AII=DIt−DIt−1,G=η⋅AII.In equation (6), DIt−1 is the dimensional difference between the fruit fly position at the previous moment and the historical optimal position, and DIt is the dimensional difference between the fruit fly position at the current moment and the historical optimal position. AII is the increment of the difference in the current moment and the previous moment. η is the weighting factor. G is the adaptive adjustment parameter. When the fruit fly updates its position to be near the optimal position, the DI decreases. In contrast, a larger DI. A smaller AII (G) means that the fruit fly population is closer to the optimal position of the fruit fly at the current moment compared with that in the previous moment. In this case, the diversity of the fruit fly population should be increased, thereby enhancing the exploitation ability of the fruit fly population. Similarly, when AII (G) is large, the convergence of the fruit fly population should be accelerated, thereby enhancing the exploratory capabilities of the fruit fly population.The dimensional difference between the positions at the same moment is considered. The advantages of this method are as follows: the same fruit fly may exhibit low and high performances on different dimensions. However, the comprehensive evaluation of the individual fruit flies is enhanced, and a direct summation can offset the deviation of the dimension extremes to a certain extent, thereby preventing the bias from affecting the overall evaluation of the individual fruit flies.


### 3.4. Partition Parametersα and β

Zone II can adaptively adjust the convergence and diversity according to the environment of the algorithm; therefore, determining partition parametersα and β is expected to affect the comprehensive performance of the algorithm. Figure 6 shows the variation curve of the AII evaluation index when solving F3 and F5. The value schemes are as follows: Case 1: α=0.1N, β=0.9N; Case 2: α=0.2N, β=0.8N; and Case 3: α=0.3N, β=0.7N.Figure 6
Variation of AII indicators under different zoning parameters taking schemes. (a) Optimization F3. (b) Optimization F5.
(a)(b)According to Figure2, the convergence rate of the algorithm gradually decreases with the increasing population size in zone II. Reducing the number of populations in zone II accelerates the convergence of the algorithm. When the number of fruit flies in zone II increases, the variation range of the AII evaluation index increases and fluctuates more significantly, indicating a higher diversity of the algorithm. In contrast, less diversity is observed. When testing function F3, the number of fruit flies in zone II is small in Case 3, and the AII evaluation indicators are less volatile and exhibit a steep descent, which shows that the algorithm lacks the development capability. Consequently, the algorithm likely falls into a local optimum. In Case 2, an increase in the number of fruit flies leads to a larger range of variation in the AII evaluation metrics, and thus, the performance of the algorithm is improved. Moreover, according to the test for function F5, when the number of fruit flies in zone II decreases to a certain value, the convergence speed of the algorithm does not significantly change. However, the addition of a large number of flies leads to slower convergence of the algorithm. To ensure the performance of algorithm exploration and development, in this study, the partition parameters α and β are set as 0.2 and 0.8, respectively.


### 3.5. Steps of the MASD-FOA

The flowchart of the MASD-FOA is shown in Figure7, and the implementation process is performed through the following steps.Figure 7
MASD-FOA optimization flowchart.Step 1.
Initialize the maximum number of iterations, partition parameters, population size, and other relevant parameters.Step 2.
Calculate the fitness value of each fruit fly and update the global optimal positionXgbesti,jt,Ygbesti,jt and the historical individual optimal position Xpbesti,jt,Ypbesti,jt according to(7)IFbestSmellt<smellbestXgbest=XtbestIndex,Ygbest=YtbestIndex,IFpbestti<smelliXpbestti=Xti,Ypbestti=Yti.Step 3.
Calculate the convergence evaluation indexAII of the average individual increment of the fruit fly population and rank the values based on the fitness value and zoning population according to equation (2).Step 4.
Update the position of the fruit fly according to the different update strategies for different zones, as indicated in equations (3)–(5).Step 5.
Determine if the algorithm has reached the maximum number of iterations. If the maximum number of iterations has been attained, output the optimal result; otherwise, repeat steps two through four.
In equation (7), smellbest is the global optimal odor concentration, bestSmellt is the current optimal odor concentration, pbestti is the current individual odor concentration, smelli is the historical individual optimal odor concentration, and bestIndex is the returned position coordinate.


### 3.6. Complexity of Algorithm Calculation

Assuming that the population size is N, the dimension to solve the problem isD, and the number of iterations is T, we can easily get the computational complexity of each part. The computational complexity of fitness value is O (N), the computational complexity of fitness value sorting is O(NlogN) (assuming that the quick sort method is used), the complexity of population partition is O(N), and the position of fruit flies is updated. The complexity is O (ND), and the calculation complexity of the adaptive evaluation index is O(ND). The computational complexity of this algorithm is O (NT (2D + logN)).


## 3.1. Three Divisions of the Fruit Fly Population

This paper considers the optimization minimum as an example. After 5 iterations of the algorithm, three partitions of the population are schematically illustrated in Figure5. The fruit fly population is sorted according to the individual evaluation index of the fruit flies. A three-partition formula is as follows:(2)regionftI,rankft<α⋅n,II,α⋅n≤rankft<β⋅n,III,rankft≥β⋅n.Figure 5
Schematic diagram of population zoning.In equation (2), α and β are positive numbers between 0 and 1, and n is the number of fruit flies. The fruit fly population is divided into three regions based on the values of α and β, and the number of fruit flies in each region is determined. The values of α and β can be specified only after determining the multistrategy mode and adaptive strategy. Section 3.4 discusses the impact of the values of α and β on the algorithm.


## 3.2. Determination of Multistrategy Mode

Different renewal strategies should be formulated according to the different performances of fruit flies to enhance the exploration and development ability of the fruit fly populations.The fruit flies in zone I exhibit the highest performance, suggesting that the fruit fly population in zone I is closest to the optimal target. The elite fruit fly population should be maintained; no population degradation occurs, and the local search capability increases. The concept of the historical individual optimal is introduced in the fruit fly algorithm by referring to the particle swarm optimization formula [31]. The next position of a fruit fly is updated through a combination of the fruit fly global optimum and the fruit fly individual optimum. The updated formula for zone I is as follows:(3)Xi,jt+1=Xi,jt+φ⋅L⋅rand1Xpbesti,jt−Xi,jt+rand2Xgbesti,jt−Xi,jt,Yi,jt+1=Yi,jt+φ⋅L⋅rand1Ypbesti,jt−Yi,jt+rand2Ygbesti,jt−Yi,jt,φ=12×1+cosπ×t−1tmax.In equation (3), φ is the weighting factor, which decreases with the number of iterations. Xgbesti,jt,Ygbesti,jt represent the global fruit fly optimal positions at time t, and Xpbesti,jt,Ypbesti,jt represent the optimal positions of the individual fruit flies at time t. This equation shows that for the fruit fly population of zone I, the update direction of the fruit fly position at the next moment is always toward the optimal position.The fruit flies in zone II exhibit an average performance but reach the fruit fly optimal target after a relatively small number of iterations. In zone II, the superior or inferior fruit flies are not distinguished, and thus, the fruit fly population in zone II takes into account multiple styles and convergence. The updated formula is as follows:(4)Xi,jt+1=Xgbesti,jt+φ⋅L⋅rand,randi,j>G,Xi,jt+φ⋅L⋅rand⋅Xgbesti,jt−Xi,jt,randi,j≤G,Yi,jt+1=Ygbesti,jt+φ⋅L⋅rand,randi,j>G,Yi,jt+φ⋅L⋅rand⋅Ygbesti,jt−Yi,jt,randi,j≤G,where G is the evaluation index of the population convergence and diversity.The fruit flies in zone III exhibit a low performance, with no notable contribution to the fruit fly population, and are far from the optimal target. The convergence of fruit flies in zone III should be accelerated. The update formula is as follows:(5)Xi,jt+1=Xi,jt+φ⋅L⋅rand⋅Xgbesti,jt−Xi,jt,Yi,jt+1=Yi,jt+φ⋅L⋅rand⋅Ygbesti,jt−Yi,jt.


## 3.3. Implementation of the Adaptive Mode

In algorithm, the convergence and diversity contradict each other to a certain extent. However, adaptively adjusting the convergence and diversity according to the environment of the algorithm can enhance the comprehensive performance of the algorithm. Certain fruit flies are randomly selected from zone II to perform diverse location updating. The remaining fruit flies perform convergent position updating. The selection method is randomized. The first update formula is selected when the random number is larger thanG. This update formula is the standard update formula for the fruit fly optimization algorithm, which has a global search capability that can ensure population diversity. The second update formula is selected when the random number is less than G. This update formula is based on the position in the previous instance; the updated orientation ensures that the individual fruit flies fly along the global optimal direction, and the flight distance decreases with the number of iterations. This update method promotes the accelerated convergence of fruit fly individuals. Thus, the adaptive G-value can automatically adjust the convergence and diversity of the algorithm. An evaluation index of the average individual increment (AII) of the fruit fly population is proposed as the basis for adaptive adjustment:(6)DIt=1n∑i=1n∑j=1dimXtij−Xpbestij+Ytij−Ypbestij,DIt−1=1n∑i=1n∑j=1dimYt−1ij−Ypbestij+Yt−1ij−Ypbestij,AII=DIt−DIt−1,G=η⋅AII.In equation (6), DIt−1 is the dimensional difference between the fruit fly position at the previous moment and the historical optimal position, and DIt is the dimensional difference between the fruit fly position at the current moment and the historical optimal position. AII is the increment of the difference in the current moment and the previous moment. η is the weighting factor. G is the adaptive adjustment parameter. When the fruit fly updates its position to be near the optimal position, the DI decreases. In contrast, a larger DI. A smaller AII (G) means that the fruit fly population is closer to the optimal position of the fruit fly at the current moment compared with that in the previous moment. In this case, the diversity of the fruit fly population should be increased, thereby enhancing the exploitation ability of the fruit fly population. Similarly, when AII (G) is large, the convergence of the fruit fly population should be accelerated, thereby enhancing the exploratory capabilities of the fruit fly population.The dimensional difference between the positions at the same moment is considered. The advantages of this method are as follows: the same fruit fly may exhibit low and high performances on different dimensions. However, the comprehensive evaluation of the individual fruit flies is enhanced, and a direct summation can offset the deviation of the dimension extremes to a certain extent, thereby preventing the bias from affecting the overall evaluation of the individual fruit flies.


## 3.4. Partition Parametersα and β

Zone II can adaptively adjust the convergence and diversity according to the environment of the algorithm; therefore, determining partition parametersα and β is expected to affect the comprehensive performance of the algorithm. Figure 6 shows the variation curve of the AII evaluation index when solving F3 and F5. The value schemes are as follows: Case 1: α=0.1N, β=0.9N; Case 2: α=0.2N, β=0.8N; and Case 3: α=0.3N, β=0.7N.Figure 6
Variation of AII indicators under different zoning parameters taking schemes. (a) Optimization F3. (b) Optimization F5.
(a)(b)According to Figure2, the convergence rate of the algorithm gradually decreases with the increasing population size in zone II. Reducing the number of populations in zone II accelerates the convergence of the algorithm. When the number of fruit flies in zone II increases, the variation range of the AII evaluation index increases and fluctuates more significantly, indicating a higher diversity of the algorithm. In contrast, less diversity is observed. When testing function F3, the number of fruit flies in zone II is small in Case 3, and the AII evaluation indicators are less volatile and exhibit a steep descent, which shows that the algorithm lacks the development capability. Consequently, the algorithm likely falls into a local optimum. In Case 2, an increase in the number of fruit flies leads to a larger range of variation in the AII evaluation metrics, and thus, the performance of the algorithm is improved. Moreover, according to the test for function F5, when the number of fruit flies in zone II decreases to a certain value, the convergence speed of the algorithm does not significantly change. However, the addition of a large number of flies leads to slower convergence of the algorithm. To ensure the performance of algorithm exploration and development, in this study, the partition parameters α and β are set as 0.2 and 0.8, respectively.


## 3.5. Steps of the MASD-FOA

The flowchart of the MASD-FOA is shown in Figure7, and the implementation process is performed through the following steps.Figure 7
MASD-FOA optimization flowchart.Step 1.
Initialize the maximum number of iterations, partition parameters, population size, and other relevant parameters.Step 2.
Calculate the fitness value of each fruit fly and update the global optimal positionXgbesti,jt,Ygbesti,jt and the historical individual optimal position Xpbesti,jt,Ypbesti,jt according to(7)IFbestSmellt<smellbestXgbest=XtbestIndex,Ygbest=YtbestIndex,IFpbestti<smelliXpbestti=Xti,Ypbestti=Yti.Step 3.
Calculate the convergence evaluation indexAII of the average individual increment of the fruit fly population and rank the values based on the fitness value and zoning population according to equation (2).Step 4.
Update the position of the fruit fly according to the different update strategies for different zones, as indicated in equations (3)–(5).Step 5.
Determine if the algorithm has reached the maximum number of iterations. If the maximum number of iterations has been attained, output the optimal result; otherwise, repeat steps two through four.
In equation (7), smellbest is the global optimal odor concentration, bestSmellt is the current optimal odor concentration, pbestti is the current individual odor concentration, smelli is the historical individual optimal odor concentration, and bestIndex is the returned position coordinate.


## 3.6. Complexity of Algorithm Calculation

Assuming that the population size is N, the dimension to solve the problem isD, and the number of iterations is T, we can easily get the computational complexity of each part. The computational complexity of fitness value is O (N), the computational complexity of fitness value sorting is O(NlogN) (assuming that the quick sort method is used), the complexity of population partition is O(N), and the position of fruit flies is updated. The complexity is O (ND), and the calculation complexity of the adaptive evaluation index is O(ND). The computational complexity of this algorithm is O (NT (2D + logN)).


## 4. Verification of the Algorithm Performance

### 4.1. Test Problems

To verify the performance of the proposed algorithm, the MASD-FOA is compared with four algorithms pertaining to the FOA, PSO, and NSGA in the experiments. To ensure a fair comparison, the number of iterations and the number of populations are set as 100 for all algorithms. Three typical unimodal functions (F1–F3) and three typical unimodal functions (F4–F5) are used in the experiment, as shown in Table1. The six typical test functions have different characteristics, and the optimization performance of the algorithms for different types of problems can be investigated. Dimension D of the six test functions is set as 2, 5, 8, and 10, as indicated in Table 1. Fifty experiments are conducted for each dimension, and the average value (mean) of the convergence accuracy and the standard deviation (Std) of the optimal value are calculated.Table 1
Six test functions.
FunctionFormula representationExtreme valuesF1 (Sphere)fx=∑i=1Dxi20F2 (Rosenbrock)fx=∑i=1D100xi2−xi+12+xi−120F3 (Ackley)fx=−20exp−0.21/n∑i=1nxi2−exp1/n∑i=1ncos2πxi+20+e0F4 (Rastrigin)fx=10⋅D+∑i=1Dxi2−10cos2π⋅xi0F5 (Griewank)fx=∑i=1Dxi2/4000−∏i=1Dcosxi/i+10F6 (Schwefel)fx=418.9829⋅n−∑i=1nxisinxi837.9658


### 4.2. Algorithm Comparison Results and Analysis

The algorithms are implemented in MATLAB r2020a. The experimental results are shown in Tables2 and 3. In 24 experiments, the MASD-FOA obtains the optimal average value 21 times and the optimal standard deviation 16 times, and the optimization effect is superior to those of the other algorithms. The NSGA achieves the optimal results in the 2-dimensional test of F3, and PSO achieves the optimal results in the 8-dimensional and 10-dimensional tests of F2. However, the MASD-FOA exhibits a reasonable performance even in these tests. This phenomenon occurs because when the local extreme value is far from the optimal value point, in a certain iteration, the MASD-FOA falls into the local optimum, resulting in partition blur. However, the adaptive strategy increases the diversity of the algorithm, enabling it to rapidly jump out of the local optimum. Therefore, the MASD-FOA exhibits a high performance (the convergence accuracy and optimal result are only slightly different). When the other algorithms fall into the local optimum, because there is no adaptive strategy, the probability of jumping out of the local optimum only by relying on the algorithm’s random update strategy is very small. It is worth noting that the farther the difference between the global optimal and the local optimal is, the smaller the probability of the algorithm jumping out of the local area, which makes the algorithm’s convergence effect worse. Therefore, an adaptive update strategy is necessary.Table 2
Comparison of convergence accuracy and standard deviation of optimal values of different algorithms.
2 dim5 dimMASD-FOAFOAPSONSGAMASD-FOAFOAPSONSGAF1Mean7.03e − 211.87e−41.06e−41.22e−63.38e − 200.0012.21e−93.41e−10Std4.15e − 201.01e−51.49e−112.18e−72.0e − 194.24e−56.8e−91.51e−15F2Mean7.03e − 211.87e−41.06e−41.22e−63.38e − 200.0012.21e−93.41e−10Std9.41e−40.00116.56e − 090.26510.19340.17081.45190.1645F3Mean9.56e−110.0432.35e−68.88e − 161.21e − 100.0677.57e−52.24e−9Std1.99e − 100.25555.48e−063.88e−093.30e − 100.00180.16463.06e−08F4Mean7.93e − 150.03792.93e−91.85e−107.11e − 150.72183.78095.03e−12Std00.39260.0099507.11e − 141.15651.78983.99e−9F5Mean1.11e − 166.31e−52.00e−81.26e−131.11e − 162.13e−40.01550.0031Std00.00270.0033000.00160.01158.93e − 4F6Mean837.96748.05830.62691.9e−31.9e + 32.04e + 32.08e + 32.08e + 3Std0.022152.28484.91e − 120.29518.436772.7871.5e − 91.7428Bold numbers are the best optimization results.Table 3
Comparison of convergence accuracy and standard deviation of optimal values of different algorithms.
8 dim10 dimMASD-FOAFOAPSONSGAMASD-FOAFOAPSONSGAF1Mean1.69e − 200.00242.3e −74.21e −83.31e − 190.00363.12e −67.78e −6Std1.10e − 191.33e −42.28e −78.25e −85.79e − 191.86e −63.36e −64.17e −5F2Mean6.85655.45183.30146.86128.22147.6947.23258.8979Std0.01410.20072.02170.16820.08350.284111.15220.2525F3Mean1.65e − 100.08520.26674.93e −46.08e − 100.009470.6010.0025Std2.53e − 100.00240.66742.74e −44.33e − 100.00280.80540.0036F4Mean1.42e − 141.42998.40091.49e −41.42e − 52.303313.25940.0201Std0.03812.374.43610.00870.60422.67125.87350.1046F5Mean4.28e − 83.58e −40.03171.3e −31.78e − 144.64e −40.03090.00201Std01.57e −50.03090.001920.0010.0590.02340.0039F6Mean3.15e + 33.28e +33.33e +33.33e +34.16e +34.09 + 34.15e +34.16e +3Std27.2146134.31861.33e − 72.472239.646547.04890.5262.7432Bold numbers are the best optimization results.


### 4.3. Comparison of Convergence Curves

Griewank (F5) is a multimodal function that exhibits fluctuations and jumps in the peak shape, and a higher dimension can more accurately reflect the convergence of the algorithm. Therefore, an experiment with 10 dimensions is performed for test function F5 to compare the convergence speed and convergence accuracy of the algorithm. The results are shown in Figure8. The 2-D line plot shows that the convergence speed of the MASD-FOA is the highest. The log-log scale plot shows that the convergence accuracy of the MASD-FOA is the highest. Figure 8 shows that in the whole convergence process, the MASD-FOA evenly converges. This phenomenon occurs because the MASD-FOA can adaptively adjust the convergence and diversity according to the environment of the algorithm. The multistrategy update mode enhances the exploration and development ability of the algorithm. However, the PSO algorithm drops steeply in the early stage, does not converge in the late stage, and falls into the local optimal solution. A single update strategy will make the algorithm weaker in development and exploration and cannot guarantee the uniform convergence of the algorithm. Therefore, the multistrategy update mode is necessary to improve the algorithm development and exploration capabilities.Figure 8
Comparison of convergence speed and accuracy of optimized F5.


### 4.4. Adaptive Index Change Curve

Figure9 shows the adaptive G-change curve with 6 test functions and 10 dimensions. To prevent excessive divergence and convergence of the MASD-FOA, the range of variation of the adaptive G is set between 0.2 and 0.8. The change curve is determined according to the proposed evaluation index of the average individual increment of the fruit fly population.Figure 9
Adaptive index change curve.WhenG > 0.5, the diversity of the algorithms is maintained. When G < 0.5, the convergence of the algorithm is maintained. When F4 and F6 are optimized, G continuously fluctuates because the test function has more local extremes; however, overall, the value exhibits the same trend as the other four test functions. The fluctuation range is mostly less than 0.5 in the late iteration, conforming to the algorithm convergence variation.


## 4.1. Test Problems

To verify the performance of the proposed algorithm, the MASD-FOA is compared with four algorithms pertaining to the FOA, PSO, and NSGA in the experiments. To ensure a fair comparison, the number of iterations and the number of populations are set as 100 for all algorithms. Three typical unimodal functions (F1–F3) and three typical unimodal functions (F4–F5) are used in the experiment, as shown in Table1. The six typical test functions have different characteristics, and the optimization performance of the algorithms for different types of problems can be investigated. Dimension D of the six test functions is set as 2, 5, 8, and 10, as indicated in Table 1. Fifty experiments are conducted for each dimension, and the average value (mean) of the convergence accuracy and the standard deviation (Std) of the optimal value are calculated.Table 1
Six test functions.
FunctionFormula representationExtreme valuesF1 (Sphere)fx=∑i=1Dxi20F2 (Rosenbrock)fx=∑i=1D100xi2−xi+12+xi−120F3 (Ackley)fx=−20exp−0.21/n∑i=1nxi2−exp1/n∑i=1ncos2πxi+20+e0F4 (Rastrigin)fx=10⋅D+∑i=1Dxi2−10cos2π⋅xi0F5 (Griewank)fx=∑i=1Dxi2/4000−∏i=1Dcosxi/i+10F6 (Schwefel)fx=418.9829⋅n−∑i=1nxisinxi837.9658


## 4.2. Algorithm Comparison Results and Analysis

The algorithms are implemented in MATLAB r2020a. The experimental results are shown in Tables2 and 3. In 24 experiments, the MASD-FOA obtains the optimal average value 21 times and the optimal standard deviation 16 times, and the optimization effect is superior to those of the other algorithms. The NSGA achieves the optimal results in the 2-dimensional test of F3, and PSO achieves the optimal results in the 8-dimensional and 10-dimensional tests of F2. However, the MASD-FOA exhibits a reasonable performance even in these tests. This phenomenon occurs because when the local extreme value is far from the optimal value point, in a certain iteration, the MASD-FOA falls into the local optimum, resulting in partition blur. However, the adaptive strategy increases the diversity of the algorithm, enabling it to rapidly jump out of the local optimum. Therefore, the MASD-FOA exhibits a high performance (the convergence accuracy and optimal result are only slightly different). When the other algorithms fall into the local optimum, because there is no adaptive strategy, the probability of jumping out of the local optimum only by relying on the algorithm’s random update strategy is very small. It is worth noting that the farther the difference between the global optimal and the local optimal is, the smaller the probability of the algorithm jumping out of the local area, which makes the algorithm’s convergence effect worse. Therefore, an adaptive update strategy is necessary.Table 2
Comparison of convergence accuracy and standard deviation of optimal values of different algorithms.
2 dim5 dimMASD-FOAFOAPSONSGAMASD-FOAFOAPSONSGAF1Mean7.03e − 211.87e−41.06e−41.22e−63.38e − 200.0012.21e−93.41e−10Std4.15e − 201.01e−51.49e−112.18e−72.0e − 194.24e−56.8e−91.51e−15F2Mean7.03e − 211.87e−41.06e−41.22e−63.38e − 200.0012.21e−93.41e−10Std9.41e−40.00116.56e − 090.26510.19340.17081.45190.1645F3Mean9.56e−110.0432.35e−68.88e − 161.21e − 100.0677.57e−52.24e−9Std1.99e − 100.25555.48e−063.88e−093.30e − 100.00180.16463.06e−08F4Mean7.93e − 150.03792.93e−91.85e−107.11e − 150.72183.78095.03e−12Std00.39260.0099507.11e − 141.15651.78983.99e−9F5Mean1.11e − 166.31e−52.00e−81.26e−131.11e − 162.13e−40.01550.0031Std00.00270.0033000.00160.01158.93e − 4F6Mean837.96748.05830.62691.9e−31.9e + 32.04e + 32.08e + 32.08e + 3Std0.022152.28484.91e − 120.29518.436772.7871.5e − 91.7428Bold numbers are the best optimization results.Table 3
Comparison of convergence accuracy and standard deviation of optimal values of different algorithms.
8 dim10 dimMASD-FOAFOAPSONSGAMASD-FOAFOAPSONSGAF1Mean1.69e − 200.00242.3e −74.21e −83.31e − 190.00363.12e −67.78e −6Std1.10e − 191.33e −42.28e −78.25e −85.79e − 191.86e −63.36e −64.17e −5F2Mean6.85655.45183.30146.86128.22147.6947.23258.8979Std0.01410.20072.02170.16820.08350.284111.15220.2525F3Mean1.65e − 100.08520.26674.93e −46.08e − 100.009470.6010.0025Std2.53e − 100.00240.66742.74e −44.33e − 100.00280.80540.0036F4Mean1.42e − 141.42998.40091.49e −41.42e − 52.303313.25940.0201Std0.03812.374.43610.00870.60422.67125.87350.1046F5Mean4.28e − 83.58e −40.03171.3e −31.78e − 144.64e −40.03090.00201Std01.57e −50.03090.001920.0010.0590.02340.0039F6Mean3.15e + 33.28e +33.33e +33.33e +34.16e +34.09 + 34.15e +34.16e +3Std27.2146134.31861.33e − 72.472239.646547.04890.5262.7432Bold numbers are the best optimization results.


## 4.3. Comparison of Convergence Curves

Griewank (F5) is a multimodal function that exhibits fluctuations and jumps in the peak shape, and a higher dimension can more accurately reflect the convergence of the algorithm. Therefore, an experiment with 10 dimensions is performed for test function F5 to compare the convergence speed and convergence accuracy of the algorithm. The results are shown in Figure8. The 2-D line plot shows that the convergence speed of the MASD-FOA is the highest. The log-log scale plot shows that the convergence accuracy of the MASD-FOA is the highest. Figure 8 shows that in the whole convergence process, the MASD-FOA evenly converges. This phenomenon occurs because the MASD-FOA can adaptively adjust the convergence and diversity according to the environment of the algorithm. The multistrategy update mode enhances the exploration and development ability of the algorithm. However, the PSO algorithm drops steeply in the early stage, does not converge in the late stage, and falls into the local optimal solution. A single update strategy will make the algorithm weaker in development and exploration and cannot guarantee the uniform convergence of the algorithm. Therefore, the multistrategy update mode is necessary to improve the algorithm development and exploration capabilities.Figure 8
Comparison of convergence speed and accuracy of optimized F5.


## 4.4. Adaptive Index Change Curve

Figure9 shows the adaptive G-change curve with 6 test functions and 10 dimensions. To prevent excessive divergence and convergence of the MASD-FOA, the range of variation of the adaptive G is set between 0.2 and 0.8. The change curve is determined according to the proposed evaluation index of the average individual increment of the fruit fly population.Figure 9
Adaptive index change curve.WhenG > 0.5, the diversity of the algorithms is maintained. When G < 0.5, the convergence of the algorithm is maintained. When F4 and F6 are optimized, G continuously fluctuates because the test function has more local extremes; however, overall, the value exhibits the same trend as the other four test functions. The fluctuation range is mostly less than 0.5 in the late iteration, conforming to the algorithm convergence variation.


## 5. Application of MASD-FOA in Microgrid Droop Control

### 5.1. Overall Structure of the Droop Control System Based on MASD-FOA

The droop control strategy is similar to the primary frequency regulation of the grid and regulation of the grid voltage and frequency by changes in the inverter output power. Since the inverter output impedance is highly inductive, its resistance can be ignored. The droop control equation is defined as(8)f=f0−mP0−P,E=E0−nQ0−Q,where P0 is the reference active power; Q0 is the reference reactive power; f0 is the reference frequency, generally set as 50 Hz; E0 is the reference voltage; m and n are droop control coefficients of the active and reactive power, respectively; E is the actual voltage; and f is the actual frequency.The overall block diagram of the MASD-FOA applied to droop control is shown in Figure10. The droop control strategy includes voltage and current dual loop closed control, which refers to the decoupling control of the active and reactive power. In the event of a sudden change in the load, the dual closed-loop voltage and current control schemes regulate the inverter to track the load power, control voltage, and current stability. DC voltage source is used to provide electric energy for the load.Figure 10
Overall structure of the improved fruit fly optimization algorithm for optimal droop control.The voltage outer loop refers to the difference in the given reactive power and actual reactive power aftern regulations. The value is compared with the given voltage to obtain the difference and further compared with the value after the outer loop controller to obtain the reference value of the current inner loop control to ensure a stable output voltage. The regulation formula is as follows:(9)idref=Cfkp+kisudref−ud−ωCfud,iqref=Cfkp+kisuqref−uq+ωCfuq,where udref and uqref are the reference voltages and ud and uq are the instantaneous voltages. kp and ki are the proportional and integral parameters of the PI controller, respectively. ω is the grid angular frequency.The current inner loop refers to the difference between the reference value of the current inner loop and feedback current and current internal loop regulation via the internal loop PI controller. The adjustment formula is as follows:(10)usd=kp+kisidref−id−ωLi+ud,usq=kp+kisiqref−id−ωLiq+uq.The basic principle of the online optimization of the dual closed-loop PI parameters for a microgrid drooped control system is to optimize the parameters of the four PI controllers defined in equations (9) and (10) by using the MASD-FOA algorithm: kp,1,ki,1kp,2,ki,2,kp,3,ki,3,kp,4,ki,4.


### 5.2. Determination of the Objective Function

In traditional PI controller optimization, the PI error evaluation performance indexITAE=∫0∞tetdt is often used as the objective function. Considering the droop control, the change in the output power is realized by adjusting the frequency and voltage, and the stability of the frequency and voltage can ensure the stability of the active and reactive power. Therefore, the frequency deviation Δf and the voltage deviation ΔU are introduced in the objective function. Specifically, Δf=f−fref and ΔU=U−Uref, where Δf and ΔU are the system reference values. The objective function matrix is defined as(11)E1t=∫errordt,∫f−frefdt,∫U−Urefdt,θ1=1,1,1T,where error is the error of the PI controller and θ1 is the weight matrix of the droop control.When the microgrid is optimized using equation (11) as the objective function, the microgrid output is expected to be unstable. Figure 11 shows that in the multiple simulation experiments, when the objective function is extremely small, the output power of the microgrid exhibits four characteristics: startup oscillation, small amplitude oscillation, small amplitude rise, and continuous oscillation. These four phenomena are not conducive to the stable operation of microgrids. By changing the number of iterations of the algorithm, resetting the initial parameters and adjusting the step size, these phenomena cannot be effectively suppressed. A several-cause analysis indicates that these four cases correspond to the PI error curve. For example, when the PI error output oscillates, the inverter output power also oscillates. Therefore, while the stability of the PI error is guaranteed, the stable output of the inverter can be ensured. To solve this problem, the absolute value integral term of the PI error derivation is introduced in the objective function in this paper. When the PI error oscillates or deviates, the value of the objective function continuously increases, and the unstable output of the inverter can be avoided in the optimization iteration. The new objective function is shown as follows:(12)Et=∫errordt,∫derrordtdt,∫f−frefdt,∫U−Urefdt,θ=1,1,1,1T.Figure 11
Power oscillations and deviation.


### 5.3. Optimization Ideas and Processes

The core concept of the optimization is to solve for the nonnegative minimum of the objective function. Online optimization is transformed to a mathematical solution problem. The proposed algorithm is applied to microgrid-drooped control, and the optimization process of the algorithm is shown in Figure12. During microgrid operation, when the microgrid topology changes, the control module sends the deviation information to the MASD-FOA module. The process can be summarized as follows: (1) Perform weighted calculation of the deviation information. (2) Calculate the target fitness function and result of the fruit fly concentration. (3) In this paper, the fruit fly population is divided into three regions according to Formula (2), and then the multistrategy model is updated according to the performance of the fruit fly and the environment in which the algorithm is located, and the calculation is iteratively calculated until the end. The MASD-FOA module interacts with the control module in real time, transmitting the parameters to the PI controller of the control module and dual closed-loop controls to regulate the voltage and current, and a sine wave pulse width modulation (SPWM) signal is generated.Figure 12
Flowchart of inverter droop control algorithm for microgrid based on improved fruit fly optimization algorithm optimization.


### 5.4. Microgrid Model

To verify the effectiveness of the proposed control strategy, build Simulink simulation according to the basic principle of Section5.1; set the DC voltage source as 800 V according to the load capacity in the simulation [32]. Other simulation parameters are shown in Table 4. The line impedance is negligible, and off grid operation is considered. Figure 13 shows a frame diagram of multiple microsources in parallel.Table 4
Simulation parameters.
Parameter nameNumerical valueDC side voltage (V)800Filter inductors (H)1.35×10−3Filter capacitor (F)50×10−6Rated frequency (Hz)50Rated voltage (V)311Active power droop factor1e−4Reactive power droop factor3e−4Reference active power (W)3000Reference reactive power (Var)0Figure 13
Online optimization framework of microgrid based on MASD-FOA.Experiment 1.
Optimization results of different objective functions.
Experiment1 verifies that the introduction of the PI error derivative absolute value integral term into the objective function can effectively suppress the oscillation and deviation of the inverter power output. Only microsource 1 runs for 0.2 s (to more clearly display the output waveform at the startup time of the microgrid). MASD-FOA is used to optimize microsource 1; load: 3000 W, 1000 Var. In situations 1 and 2, Formulas (12) and (11) are used as the objective functions for the optimization, respectively. In this case: STS1 and STS3 are closed, and STS1 and STS3 are disconnected.Experiment 2.
Control effects of different strategies.
Experiment2 verifies the performance of the MASD-FOA online optimized PI control strategy. When the topology of the microgrid changes, the MASD-FOA can optimize the PI parameters of the microgrid in time and ensure the stable output of the inverter. At 0 s, microsource DG1 works independently. In this case, STS1 and STS3 are closed, and STS1 and STS3 are disconnected. load: 3000 W, 1000 Var. After 0.5 s, microsources DG1 and DG2 simultaneously operate with loads of 8000 W and 3000 Var. In this case, STS1 to STS4 are all closed. Equation (12) is used as the objective function.
In the experiment, MASD-FOA is compared with FOA, PSO, NSGA, and traditional methods. Among them, the traditional method 1: do not adjust the PI parameters; the traditional method 2: manually adjust the PI parameters;


### 5.5. Comparison and Analysis of Experiments

#### 5.5.1. Comparison and Analysis of Experiment1

As shown in Figures14 and 15, in situation 1, the output power of the inverter slowly fluctuates in a small range, and the range of fluctuation is constant. After optimization based on Formula (12), when the system starts, the output power of the inverter considerably fluctuates. In the steady state, the output power continues to oscillate at a high frequency, and the oscillation range is large. With time, the output power exhibits a small deviation. Therefore, the absolute value integral term of the PI error derivation can suppress the oscillation and deviation of the output power.Figure 14
Output of active power.Figure 15
Output of reactive power.


#### 5.5.2. Comparison and Analysis of Experiment2

Figures16 and 17 show the frequency and voltage output by the inverter, respectively. The MASD-FOA is adopted to ensure prompt responses of the inverter. In terms of the frequency, the output is stable, and no frequency overshoot occurs. At 0.5 seconds, both the topology and the load have changed (the topology is changed after STS2 is closed, and the load is changed after STS4 is closed), so it is necessary to reoptimize the droop control PI parameters. The increase of the load leads to the increase of the output power because the increase of the output power causes the frequency to decrease slightly. The frequency stability complies with the national standard GB/T15945-1995 [33]: the frequency of the power system is controlled within the range of 50 ± 0.2 Hz. The other four algorithms exhibit frequency oscillations; for example, after NSGA optimization, the frequency of the microgrid greatly fluctuates at the moment of startup, and the overshoot reaches 0.3 Hz. Although PSO stabilizes the frequency output, the difference in the output frequency and reference frequency is large. It can be observed from Figure 16 that the error of inverter output frequency can be reduced by the MASD-FOA algorithm, which is caused by the introduction of the frequency error term in the objective function. In the algorithm optimization, the steady-state frequency with smaller error can be obtained. Both exploitation and exploration capabilities of the proposed algorithm are greatly improved by population partitioning, multistrategy, and adaptive scheme, respectively. Facing the complex nonlinear systems, according to the evolutionary environment where the algorithm is located, the convergence and diversity of the algorithm are adaptively adjusted by the MASD-FOA algorithm, and the best PI parameters can be found. With the increase of dimension of the optimization problem, the remarkable performance of the MASD-FOA algorithm can be still remained, and the small error of the inverter output is guaranteed. In terms of the voltage stability, the MASD-FOA can render the inverter voltage output highly stable, and no fluctuation occurs in a small range, corresponding to the minimum error. In the traditional method 1, because there is no online optimization of PI parameters, causing huge fluctuations in microgrid frequency and voltage, microgrid cannot work properly. In the traditional method 2, the PI parameters are properly adjusted according to human experience. It can be seen that the artificial adjustment accuracy is not high, especially with the increase of microsources, the adjustment difficulty increases, resulting in high-frequency oscillation of inverter output voltage and frequency, and the oscillation amplitude is large.Figure 16
Comparison chart of inverter output frequency.Figure 17
Comparison chart of inverter output voltage.Figure18 shows that the MASD-FOA ensures the rapid response of the inverter when the microsource is started or the topology changes. Almost no overshoot occurs, the inverter can promptly follow the load change, and a precise power output can be guaranteed in the steady state. In contrast, the NSGA algorithm decreases the response speed of the inverter. The standard FOA increases the steady-state error of the inverter and decreases the response speed. The MASD-FOA is compared with the PSO algorithm: the locally magnified view indicates that in the case of the MASD-FOA, the response of the inverter is a smooth rising curve; however, PSO causes the output power of the inverter to oscillate at startup. At 0.5 s, in the case of the MASD-FOA, the steady-state response time of the inverter is extremely small, and no overshoot occurs. In contrast, the steady-state response time of the inverter is extremely large in the case of the PSO. In the traditional method 1, the output of the inverter will oscillate because the PI parameters do not adjust in time when topology changes. The original PI parameters do not enable stable operation of the microgrid. In the traditional method 2, due to the insufficient regulation accuracy, the output power of the inverter fluctuates after 0.5 seconds, and the steady-state error is large.Figure 18
Comparison chart of inverter output power.In order to measure the deviation between the output power of inverter and the required power of load, Formulas (13) and (14) are used to calculate the relative error of the power.(13)Perror=Pi−PloadPload%.(14)Qerror=Qi−QloadQload%,where Pi is the effective value of active power, Qi is the effective value of reactive power, Pload is the required active power of the load, and Qload is the required active reactive power of the load.Table5 shows the comparison of the results under different algorithm optimizations. Microsources 1 and 2 correspond to the statistics of operation for 1 s and 0.5 s, respectively. The overshoot amount is the maximum overshoot that occurs during the entire operation of the microsource. The rise time is the time required for the inverter output to reach the first extreme value at system startup. The steady-state response time is the time at which the system enters the steady state. The performance of the MASD-FOA is summarized in Table 6. The MASD-FOA is slightly inferior to the other algorithms in terms of the overshoot; however, it outperforms the other algorithms in terms of the error and response speed. The performance in terms of the amount of overshoot is not optimal, but the value of overshoot is extremely small and in accordance with microgrid operation requirements. In terms of the stabilization time, the stable state of the system can be induced in 0.005 and 0.008 s after MASD-FOA optimization, almost 40 times faster than other algorithms.Table 5
Comparison of algorithm stability margins.
Comparison algorithmMicrosourceRelative error of active powerRelative error of reactive powerFrequency deviationVoltage deviationPi1 errorPi2 errorOvershootRise timeSteady-state response timeMASD-FOAMicrosource 11.0611.4280.0053520.10630.45540.68711040.0050.005Microsource 20.2170.34638.681e−50.015580.4240.3649330.0080.008FOAMicrosource 110.6210.890.046180.351310.856.53200.2350.235Microsource 27.0677.2540.036280.20776.023.16900.250.25PSOMicrosource 11.1822.7980.16480.37840.63870.856236900.0050.22Microsource 20.34880.62970.080.22510.56320.5424950.0050.2NSGAMicrosource 14.6735.1910.054490.37645.2053.6400.20.2Microsource 23.7363.8480.051120.22472.2411.42100.20.2Traditional method 1Microsource 1312.3641.11.555.45428.3135.053028--Microsource 29.6589.790.025110.195810.321.835952--Traditional method 2Microsource 17.2567.91320.15190.5817.8427.38500.30.3Microsource 25.6185.8690.12560.4316.896.2350030.3Bold numbers are the best optimization results.Table 6
Comparison of different algorithms for the computational time (all results were averaged on 30 independent runs).
Time (s)MSAD-FOAFOAPSOGANumber of iterations0436060600.527604954Optimization time (s)02.153.003.003.000.51.353.002.452.70


#### 5.5.3. Comparison of Running Time

It is difficult to design a reasonable experiment to explain the computational complexity or computational time of the algorithms. Many methods have been proposed [34–36]. A general and simple one is adopted in this paper, that is, the running time of the algorithms under the same environmental platform and the same maximum number of iterations. On the basis of comparing the convergence and diversity, the running time of each algorithm is measured simultaneously to fairly demonstrate the computational complexity of the proposed MSAD-FOA algorithm.In this article’s optimization strategy, all algorithms set the maximum number of iterations to 60. In the first optimization, each algorithm will give the same initial value range. The initial value range of the next optimization is determined by the optimal value of the previous optimization, and this strategy is called optimal delivery strategy (ODS). The sampling time of the algorithm is 0.001 seconds. The adaptive strategy proposed in this paper can detect the environment of the algorithm, and the algorithm stops optimization when the detection environment indicators converge. For an algorithm without an adaptive strategy, the objective functionF is used to determine whether the convergence is completed, the optimization is stopped when the convergence is completed, and the optimization is stopped when the maximum number of iterations is reached if the convergence is not completed. The comparison of different algorithms for the computational time is presented in Table 6.It can be seen from Table6 that the optimization strategy proposed in this paper is much shorter than other strategies in terms of optimization time because the strategy proposed in this paper greatly reduces the number of iterations of the algorithm and makes the algorithm converge quickly. In particular, the method of determining the algorithm initial value of this time based on the optimal value of the previous time can significantly reduce the number of iterations. This is because the use of ODS can reduce the range of optimization to a certain extent, and adaptive adjustment will also intensify the convergence of the algorithm, converging rapidly in the optimal direction. Therefore, adaptive regulation strategy plays an important role in online optimization.


## 5.1. Overall Structure of the Droop Control System Based on MASD-FOA

The droop control strategy is similar to the primary frequency regulation of the grid and regulation of the grid voltage and frequency by changes in the inverter output power. Since the inverter output impedance is highly inductive, its resistance can be ignored. The droop control equation is defined as(8)f=f0−mP0−P,E=E0−nQ0−Q,where P0 is the reference active power; Q0 is the reference reactive power; f0 is the reference frequency, generally set as 50 Hz; E0 is the reference voltage; m and n are droop control coefficients of the active and reactive power, respectively; E is the actual voltage; and f is the actual frequency.The overall block diagram of the MASD-FOA applied to droop control is shown in Figure10. The droop control strategy includes voltage and current dual loop closed control, which refers to the decoupling control of the active and reactive power. In the event of a sudden change in the load, the dual closed-loop voltage and current control schemes regulate the inverter to track the load power, control voltage, and current stability. DC voltage source is used to provide electric energy for the load.Figure 10
Overall structure of the improved fruit fly optimization algorithm for optimal droop control.The voltage outer loop refers to the difference in the given reactive power and actual reactive power aftern regulations. The value is compared with the given voltage to obtain the difference and further compared with the value after the outer loop controller to obtain the reference value of the current inner loop control to ensure a stable output voltage. The regulation formula is as follows:(9)idref=Cfkp+kisudref−ud−ωCfud,iqref=Cfkp+kisuqref−uq+ωCfuq,where udref and uqref are the reference voltages and ud and uq are the instantaneous voltages. kp and ki are the proportional and integral parameters of the PI controller, respectively. ω is the grid angular frequency.The current inner loop refers to the difference between the reference value of the current inner loop and feedback current and current internal loop regulation via the internal loop PI controller. The adjustment formula is as follows:(10)usd=kp+kisidref−id−ωLi+ud,usq=kp+kisiqref−id−ωLiq+uq.The basic principle of the online optimization of the dual closed-loop PI parameters for a microgrid drooped control system is to optimize the parameters of the four PI controllers defined in equations (9) and (10) by using the MASD-FOA algorithm: kp,1,ki,1kp,2,ki,2,kp,3,ki,3,kp,4,ki,4.


## 5.2. Determination of the Objective Function

In traditional PI controller optimization, the PI error evaluation performance indexITAE=∫0∞tetdt is often used as the objective function. Considering the droop control, the change in the output power is realized by adjusting the frequency and voltage, and the stability of the frequency and voltage can ensure the stability of the active and reactive power. Therefore, the frequency deviation Δf and the voltage deviation ΔU are introduced in the objective function. Specifically, Δf=f−fref and ΔU=U−Uref, where Δf and ΔU are the system reference values. The objective function matrix is defined as(11)E1t=∫errordt,∫f−frefdt,∫U−Urefdt,θ1=1,1,1T,where error is the error of the PI controller and θ1 is the weight matrix of the droop control.When the microgrid is optimized using equation (11) as the objective function, the microgrid output is expected to be unstable. Figure 11 shows that in the multiple simulation experiments, when the objective function is extremely small, the output power of the microgrid exhibits four characteristics: startup oscillation, small amplitude oscillation, small amplitude rise, and continuous oscillation. These four phenomena are not conducive to the stable operation of microgrids. By changing the number of iterations of the algorithm, resetting the initial parameters and adjusting the step size, these phenomena cannot be effectively suppressed. A several-cause analysis indicates that these four cases correspond to the PI error curve. For example, when the PI error output oscillates, the inverter output power also oscillates. Therefore, while the stability of the PI error is guaranteed, the stable output of the inverter can be ensured. To solve this problem, the absolute value integral term of the PI error derivation is introduced in the objective function in this paper. When the PI error oscillates or deviates, the value of the objective function continuously increases, and the unstable output of the inverter can be avoided in the optimization iteration. The new objective function is shown as follows:(12)Et=∫errordt,∫derrordtdt,∫f−frefdt,∫U−Urefdt,θ=1,1,1,1T.Figure 11
Power oscillations and deviation.


## 5.3. Optimization Ideas and Processes

The core concept of the optimization is to solve for the nonnegative minimum of the objective function. Online optimization is transformed to a mathematical solution problem. The proposed algorithm is applied to microgrid-drooped control, and the optimization process of the algorithm is shown in Figure12. During microgrid operation, when the microgrid topology changes, the control module sends the deviation information to the MASD-FOA module. The process can be summarized as follows: (1) Perform weighted calculation of the deviation information. (2) Calculate the target fitness function and result of the fruit fly concentration. (3) In this paper, the fruit fly population is divided into three regions according to Formula (2), and then the multistrategy model is updated according to the performance of the fruit fly and the environment in which the algorithm is located, and the calculation is iteratively calculated until the end. The MASD-FOA module interacts with the control module in real time, transmitting the parameters to the PI controller of the control module and dual closed-loop controls to regulate the voltage and current, and a sine wave pulse width modulation (SPWM) signal is generated.Figure 12
Flowchart of inverter droop control algorithm for microgrid based on improved fruit fly optimization algorithm optimization.


## 5.4. Microgrid Model

To verify the effectiveness of the proposed control strategy, build Simulink simulation according to the basic principle of Section5.1; set the DC voltage source as 800 V according to the load capacity in the simulation [32]. Other simulation parameters are shown in Table 4. The line impedance is negligible, and off grid operation is considered. Figure 13 shows a frame diagram of multiple microsources in parallel.Table 4
Simulation parameters.
Parameter nameNumerical valueDC side voltage (V)800Filter inductors (H)1.35×10−3Filter capacitor (F)50×10−6Rated frequency (Hz)50Rated voltage (V)311Active power droop factor1e−4Reactive power droop factor3e−4Reference active power (W)3000Reference reactive power (Var)0Figure 13
Online optimization framework of microgrid based on MASD-FOA.Experiment 1.
Optimization results of different objective functions.
Experiment1 verifies that the introduction of the PI error derivative absolute value integral term into the objective function can effectively suppress the oscillation and deviation of the inverter power output. Only microsource 1 runs for 0.2 s (to more clearly display the output waveform at the startup time of the microgrid). MASD-FOA is used to optimize microsource 1; load: 3000 W, 1000 Var. In situations 1 and 2, Formulas (12) and (11) are used as the objective functions for the optimization, respectively. In this case: STS1 and STS3 are closed, and STS1 and STS3 are disconnected.Experiment 2.
Control effects of different strategies.
Experiment2 verifies the performance of the MASD-FOA online optimized PI control strategy. When the topology of the microgrid changes, the MASD-FOA can optimize the PI parameters of the microgrid in time and ensure the stable output of the inverter. At 0 s, microsource DG1 works independently. In this case, STS1 and STS3 are closed, and STS1 and STS3 are disconnected. load: 3000 W, 1000 Var. After 0.5 s, microsources DG1 and DG2 simultaneously operate with loads of 8000 W and 3000 Var. In this case, STS1 to STS4 are all closed. Equation (12) is used as the objective function.
In the experiment, MASD-FOA is compared with FOA, PSO, NSGA, and traditional methods. Among them, the traditional method 1: do not adjust the PI parameters; the traditional method 2: manually adjust the PI parameters;


## 5.5. Comparison and Analysis of Experiments

### 5.5.1. Comparison and Analysis of Experiment1

As shown in Figures14 and 15, in situation 1, the output power of the inverter slowly fluctuates in a small range, and the range of fluctuation is constant. After optimization based on Formula (12), when the system starts, the output power of the inverter considerably fluctuates. In the steady state, the output power continues to oscillate at a high frequency, and the oscillation range is large. With time, the output power exhibits a small deviation. Therefore, the absolute value integral term of the PI error derivation can suppress the oscillation and deviation of the output power.Figure 14
Output of active power.Figure 15
Output of reactive power.


### 5.5.2. Comparison and Analysis of Experiment2

Figures16 and 17 show the frequency and voltage output by the inverter, respectively. The MASD-FOA is adopted to ensure prompt responses of the inverter. In terms of the frequency, the output is stable, and no frequency overshoot occurs. At 0.5 seconds, both the topology and the load have changed (the topology is changed after STS2 is closed, and the load is changed after STS4 is closed), so it is necessary to reoptimize the droop control PI parameters. The increase of the load leads to the increase of the output power because the increase of the output power causes the frequency to decrease slightly. The frequency stability complies with the national standard GB/T15945-1995 [33]: the frequency of the power system is controlled within the range of 50 ± 0.2 Hz. The other four algorithms exhibit frequency oscillations; for example, after NSGA optimization, the frequency of the microgrid greatly fluctuates at the moment of startup, and the overshoot reaches 0.3 Hz. Although PSO stabilizes the frequency output, the difference in the output frequency and reference frequency is large. It can be observed from Figure 16 that the error of inverter output frequency can be reduced by the MASD-FOA algorithm, which is caused by the introduction of the frequency error term in the objective function. In the algorithm optimization, the steady-state frequency with smaller error can be obtained. Both exploitation and exploration capabilities of the proposed algorithm are greatly improved by population partitioning, multistrategy, and adaptive scheme, respectively. Facing the complex nonlinear systems, according to the evolutionary environment where the algorithm is located, the convergence and diversity of the algorithm are adaptively adjusted by the MASD-FOA algorithm, and the best PI parameters can be found. With the increase of dimension of the optimization problem, the remarkable performance of the MASD-FOA algorithm can be still remained, and the small error of the inverter output is guaranteed. In terms of the voltage stability, the MASD-FOA can render the inverter voltage output highly stable, and no fluctuation occurs in a small range, corresponding to the minimum error. In the traditional method 1, because there is no online optimization of PI parameters, causing huge fluctuations in microgrid frequency and voltage, microgrid cannot work properly. In the traditional method 2, the PI parameters are properly adjusted according to human experience. It can be seen that the artificial adjustment accuracy is not high, especially with the increase of microsources, the adjustment difficulty increases, resulting in high-frequency oscillation of inverter output voltage and frequency, and the oscillation amplitude is large.Figure 16
Comparison chart of inverter output frequency.Figure 17
Comparison chart of inverter output voltage.Figure18 shows that the MASD-FOA ensures the rapid response of the inverter when the microsource is started or the topology changes. Almost no overshoot occurs, the inverter can promptly follow the load change, and a precise power output can be guaranteed in the steady state. In contrast, the NSGA algorithm decreases the response speed of the inverter. The standard FOA increases the steady-state error of the inverter and decreases the response speed. The MASD-FOA is compared with the PSO algorithm: the locally magnified view indicates that in the case of the MASD-FOA, the response of the inverter is a smooth rising curve; however, PSO causes the output power of the inverter to oscillate at startup. At 0.5 s, in the case of the MASD-FOA, the steady-state response time of the inverter is extremely small, and no overshoot occurs. In contrast, the steady-state response time of the inverter is extremely large in the case of the PSO. In the traditional method 1, the output of the inverter will oscillate because the PI parameters do not adjust in time when topology changes. The original PI parameters do not enable stable operation of the microgrid. In the traditional method 2, due to the insufficient regulation accuracy, the output power of the inverter fluctuates after 0.5 seconds, and the steady-state error is large.Figure 18
Comparison chart of inverter output power.In order to measure the deviation between the output power of inverter and the required power of load, Formulas (13) and (14) are used to calculate the relative error of the power.(13)Perror=Pi−PloadPload%.(14)Qerror=Qi−QloadQload%,where Pi is the effective value of active power, Qi is the effective value of reactive power, Pload is the required active power of the load, and Qload is the required active reactive power of the load.Table5 shows the comparison of the results under different algorithm optimizations. Microsources 1 and 2 correspond to the statistics of operation for 1 s and 0.5 s, respectively. The overshoot amount is the maximum overshoot that occurs during the entire operation of the microsource. The rise time is the time required for the inverter output to reach the first extreme value at system startup. The steady-state response time is the time at which the system enters the steady state. The performance of the MASD-FOA is summarized in Table 6. The MASD-FOA is slightly inferior to the other algorithms in terms of the overshoot; however, it outperforms the other algorithms in terms of the error and response speed. The performance in terms of the amount of overshoot is not optimal, but the value of overshoot is extremely small and in accordance with microgrid operation requirements. In terms of the stabilization time, the stable state of the system can be induced in 0.005 and 0.008 s after MASD-FOA optimization, almost 40 times faster than other algorithms.Table 5
Comparison of algorithm stability margins.
Comparison algorithmMicrosourceRelative error of active powerRelative error of reactive powerFrequency deviationVoltage deviationPi1 errorPi2 errorOvershootRise timeSteady-state response timeMASD-FOAMicrosource 11.0611.4280.0053520.10630.45540.68711040.0050.005Microsource 20.2170.34638.681e−50.015580.4240.3649330.0080.008FOAMicrosource 110.6210.890.046180.351310.856.53200.2350.235Microsource 27.0677.2540.036280.20776.023.16900.250.25PSOMicrosource 11.1822.7980.16480.37840.63870.856236900.0050.22Microsource 20.34880.62970.080.22510.56320.5424950.0050.2NSGAMicrosource 14.6735.1910.054490.37645.2053.6400.20.2Microsource 23.7363.8480.051120.22472.2411.42100.20.2Traditional method 1Microsource 1312.3641.11.555.45428.3135.053028--Microsource 29.6589.790.025110.195810.321.835952--Traditional method 2Microsource 17.2567.91320.15190.5817.8427.38500.30.3Microsource 25.6185.8690.12560.4316.896.2350030.3Bold numbers are the best optimization results.Table 6
Comparison of different algorithms for the computational time (all results were averaged on 30 independent runs).
Time (s)MSAD-FOAFOAPSOGANumber of iterations0436060600.527604954Optimization time (s)02.153.003.003.000.51.353.002.452.70


### 5.5.3. Comparison of Running Time

It is difficult to design a reasonable experiment to explain the computational complexity or computational time of the algorithms. Many methods have been proposed [34–36]. A general and simple one is adopted in this paper, that is, the running time of the algorithms under the same environmental platform and the same maximum number of iterations. On the basis of comparing the convergence and diversity, the running time of each algorithm is measured simultaneously to fairly demonstrate the computational complexity of the proposed MSAD-FOA algorithm.In this article’s optimization strategy, all algorithms set the maximum number of iterations to 60. In the first optimization, each algorithm will give the same initial value range. The initial value range of the next optimization is determined by the optimal value of the previous optimization, and this strategy is called optimal delivery strategy (ODS). The sampling time of the algorithm is 0.001 seconds. The adaptive strategy proposed in this paper can detect the environment of the algorithm, and the algorithm stops optimization when the detection environment indicators converge. For an algorithm without an adaptive strategy, the objective functionF is used to determine whether the convergence is completed, the optimization is stopped when the convergence is completed, and the optimization is stopped when the maximum number of iterations is reached if the convergence is not completed. The comparison of different algorithms for the computational time is presented in Table 6.It can be seen from Table6 that the optimization strategy proposed in this paper is much shorter than other strategies in terms of optimization time because the strategy proposed in this paper greatly reduces the number of iterations of the algorithm and makes the algorithm converge quickly. In particular, the method of determining the algorithm initial value of this time based on the optimal value of the previous time can significantly reduce the number of iterations. This is because the use of ODS can reduce the range of optimization to a certain extent, and adaptive adjustment will also intensify the convergence of the algorithm, converging rapidly in the optimal direction. Therefore, adaptive regulation strategy plays an important role in online optimization.


## 5.5.1. Comparison and Analysis of Experiment1

As shown in Figures14 and 15, in situation 1, the output power of the inverter slowly fluctuates in a small range, and the range of fluctuation is constant. After optimization based on Formula (12), when the system starts, the output power of the inverter considerably fluctuates. In the steady state, the output power continues to oscillate at a high frequency, and the oscillation range is large. With time, the output power exhibits a small deviation. Therefore, the absolute value integral term of the PI error derivation can suppress the oscillation and deviation of the output power.Figure 14
Output of active power.Figure 15
Output of reactive power.


## 5.5.2. Comparison and Analysis of Experiment2

Figures16 and 17 show the frequency and voltage output by the inverter, respectively. The MASD-FOA is adopted to ensure prompt responses of the inverter. In terms of the frequency, the output is stable, and no frequency overshoot occurs. At 0.5 seconds, both the topology and the load have changed (the topology is changed after STS2 is closed, and the load is changed after STS4 is closed), so it is necessary to reoptimize the droop control PI parameters. The increase of the load leads to the increase of the output power because the increase of the output power causes the frequency to decrease slightly. The frequency stability complies with the national standard GB/T15945-1995 [33]: the frequency of the power system is controlled within the range of 50 ± 0.2 Hz. The other four algorithms exhibit frequency oscillations; for example, after NSGA optimization, the frequency of the microgrid greatly fluctuates at the moment of startup, and the overshoot reaches 0.3 Hz. Although PSO stabilizes the frequency output, the difference in the output frequency and reference frequency is large. It can be observed from Figure 16 that the error of inverter output frequency can be reduced by the MASD-FOA algorithm, which is caused by the introduction of the frequency error term in the objective function. In the algorithm optimization, the steady-state frequency with smaller error can be obtained. Both exploitation and exploration capabilities of the proposed algorithm are greatly improved by population partitioning, multistrategy, and adaptive scheme, respectively. Facing the complex nonlinear systems, according to the evolutionary environment where the algorithm is located, the convergence and diversity of the algorithm are adaptively adjusted by the MASD-FOA algorithm, and the best PI parameters can be found. With the increase of dimension of the optimization problem, the remarkable performance of the MASD-FOA algorithm can be still remained, and the small error of the inverter output is guaranteed. In terms of the voltage stability, the MASD-FOA can render the inverter voltage output highly stable, and no fluctuation occurs in a small range, corresponding to the minimum error. In the traditional method 1, because there is no online optimization of PI parameters, causing huge fluctuations in microgrid frequency and voltage, microgrid cannot work properly. In the traditional method 2, the PI parameters are properly adjusted according to human experience. It can be seen that the artificial adjustment accuracy is not high, especially with the increase of microsources, the adjustment difficulty increases, resulting in high-frequency oscillation of inverter output voltage and frequency, and the oscillation amplitude is large.Figure 16
Comparison chart of inverter output frequency.Figure 17
Comparison chart of inverter output voltage.Figure18 shows that the MASD-FOA ensures the rapid response of the inverter when the microsource is started or the topology changes. Almost no overshoot occurs, the inverter can promptly follow the load change, and a precise power output can be guaranteed in the steady state. In contrast, the NSGA algorithm decreases the response speed of the inverter. The standard FOA increases the steady-state error of the inverter and decreases the response speed. The MASD-FOA is compared with the PSO algorithm: the locally magnified view indicates that in the case of the MASD-FOA, the response of the inverter is a smooth rising curve; however, PSO causes the output power of the inverter to oscillate at startup. At 0.5 s, in the case of the MASD-FOA, the steady-state response time of the inverter is extremely small, and no overshoot occurs. In contrast, the steady-state response time of the inverter is extremely large in the case of the PSO. In the traditional method 1, the output of the inverter will oscillate because the PI parameters do not adjust in time when topology changes. The original PI parameters do not enable stable operation of the microgrid. In the traditional method 2, due to the insufficient regulation accuracy, the output power of the inverter fluctuates after 0.5 seconds, and the steady-state error is large.Figure 18
Comparison chart of inverter output power.In order to measure the deviation between the output power of inverter and the required power of load, Formulas (13) and (14) are used to calculate the relative error of the power.(13)Perror=Pi−PloadPload%.(14)Qerror=Qi−QloadQload%,where Pi is the effective value of active power, Qi is the effective value of reactive power, Pload is the required active power of the load, and Qload is the required active reactive power of the load.Table5 shows the comparison of the results under different algorithm optimizations. Microsources 1 and 2 correspond to the statistics of operation for 1 s and 0.5 s, respectively. The overshoot amount is the maximum overshoot that occurs during the entire operation of the microsource. The rise time is the time required for the inverter output to reach the first extreme value at system startup. The steady-state response time is the time at which the system enters the steady state. The performance of the MASD-FOA is summarized in Table 6. The MASD-FOA is slightly inferior to the other algorithms in terms of the overshoot; however, it outperforms the other algorithms in terms of the error and response speed. The performance in terms of the amount of overshoot is not optimal, but the value of overshoot is extremely small and in accordance with microgrid operation requirements. In terms of the stabilization time, the stable state of the system can be induced in 0.005 and 0.008 s after MASD-FOA optimization, almost 40 times faster than other algorithms.Table 5
Comparison of algorithm stability margins.
Comparison algorithmMicrosourceRelative error of active powerRelative error of reactive powerFrequency deviationVoltage deviationPi1 errorPi2 errorOvershootRise timeSteady-state response timeMASD-FOAMicrosource 11.0611.4280.0053520.10630.45540.68711040.0050.005Microsource 20.2170.34638.681e−50.015580.4240.3649330.0080.008FOAMicrosource 110.6210.890.046180.351310.856.53200.2350.235Microsource 27.0677.2540.036280.20776.023.16900.250.25PSOMicrosource 11.1822.7980.16480.37840.63870.856236900.0050.22Microsource 20.34880.62970.080.22510.56320.5424950.0050.2NSGAMicrosource 14.6735.1910.054490.37645.2053.6400.20.2Microsource 23.7363.8480.051120.22472.2411.42100.20.2Traditional method 1Microsource 1312.3641.11.555.45428.3135.053028--Microsource 29.6589.790.025110.195810.321.835952--Traditional method 2Microsource 17.2567.91320.15190.5817.8427.38500.30.3Microsource 25.6185.8690.12560.4316.896.2350030.3Bold numbers are the best optimization results.Table 6
Comparison of different algorithms for the computational time (all results were averaged on 30 independent runs).
Time (s)MSAD-FOAFOAPSOGANumber of iterations0436060600.527604954Optimization time (s)02.153.003.003.000.51.353.002.452.70


## 5.5.3. Comparison of Running Time

It is difficult to design a reasonable experiment to explain the computational complexity or computational time of the algorithms. Many methods have been proposed [34–36]. A general and simple one is adopted in this paper, that is, the running time of the algorithms under the same environmental platform and the same maximum number of iterations. On the basis of comparing the convergence and diversity, the running time of each algorithm is measured simultaneously to fairly demonstrate the computational complexity of the proposed MSAD-FOA algorithm.In this article’s optimization strategy, all algorithms set the maximum number of iterations to 60. In the first optimization, each algorithm will give the same initial value range. The initial value range of the next optimization is determined by the optimal value of the previous optimization, and this strategy is called optimal delivery strategy (ODS). The sampling time of the algorithm is 0.001 seconds. The adaptive strategy proposed in this paper can detect the environment of the algorithm, and the algorithm stops optimization when the detection environment indicators converge. For an algorithm without an adaptive strategy, the objective functionF is used to determine whether the convergence is completed, the optimization is stopped when the convergence is completed, and the optimization is stopped when the maximum number of iterations is reached if the convergence is not completed. The comparison of different algorithms for the computational time is presented in Table 6.It can be seen from Table6 that the optimization strategy proposed in this paper is much shorter than other strategies in terms of optimization time because the strategy proposed in this paper greatly reduces the number of iterations of the algorithm and makes the algorithm converge quickly. In particular, the method of determining the algorithm initial value of this time based on the optimal value of the previous time can significantly reduce the number of iterations. This is because the use of ODS can reduce the range of optimization to a certain extent, and adaptive adjustment will also intensify the convergence of the algorithm, converging rapidly in the optimal direction. Therefore, adaptive regulation strategy plays an important role in online optimization.


## 6. Conclusion

The response speed, output power oscillation, and voltage and frequency stability of inverters in microgrid droop control are studied, and the following conclusions are derived: (1) when the microgrid topology changes, the proposed three-partition multistrategy adaptive fruit fly optimization algorithm can optimize the PI parameters of the microgrid droop control in real time and enhance the robustness of droop control. Consequently, the inverter exhibits a faster response, a smaller error, and more stable output. (2) Microgrid experiments with different objective functions verify that the PI error derivation absolute value integral term can effectively suppress the oscillation and deviation of the inverter output power. (3) Six test functions are used. Through a comparison with the FOA, PSO, and NSGA algorithms, the effectiveness of the three-partition, multistrategy, and adaptive update mode is verified. This framework can help exploit the development and exploration ability of each fruit fly when solving different problems. Consequently, the MASD-FOA exhibits a high convergence speed and convergence accuracy. (4) In noninitial optimization, the combination of adaptive strategy and ODS greatly reduces the number of iterations of the algorithm, thereby reducing the time for online optimization.The three-partition multistrategy adaptive fruit fly optimization algorithm proposed in this paper can not only solve the problem of optimizing droop control parameters, but the algorithm can be applied to more scenarios in the future. Compared with other algorithms, the advantages of this algorithm are as follows: the algorithm can detect the algorithm environment, adaptively adjust the convergence and diversity of the algorithm, quickly jump out of the local optimum in the development phase, and improve the convergence accuracy during the exploration phase. The multistrategy update mode can maximize the development and exploration capabilities of fruit flies, thereby avoiding invalid calculations.



---

*Source: 2646384-2022-01-31.xml*