#### Abstract

Microgrid optimal dispatching has become one of the core issues of microgrid energy management and integrated control, which is of great significance to reduce energy consumption and environmental pollution. As a natural heuristic algorithm, the butterfly optimization algorithm (BOA) has the advantages of simple adjustment parameters and fast convergence speed. It is widely used to solve nonlinear programming problems. However, BOA is easy to fall into local optimization and poor convergence accuracy. Therefore, an improved butterfly optimization algorithm (IBOA) based on skew tent chaotic map, Cauchy mutation, and simplex method is proposed, and compared with particle swarm optimization (PSO), whale optimization algorithm (WOA), sparrow search algorithm (SSA), and BOA, the results show that the IBOA has high convergence speed and optimization accuracy. Finally, the IBOA is used to solve the optimization model. The simulation results show that the IBOA can effectively reduce the power consumption cost of the system, promote the effective utilization of renewable energy, and improve the operation stability of the microgrid cluster system.

#### 1. Introduction

Nonrenewable energy plays a crucial role as the main energy in production and life. However, due to the overexploitation of nonrenewable energy, a series of problems caused by the use of nonrenewable energy is gradually expanding, endangering the ecological environment of the natural world, and the development and utilization of renewable energy such as wind energy and solar energy are becoming more and more important. With the development of renewable energy and energy storage batteries, the microgrid cluster system consisting of multiple microgrids can make effective use of renewable energy and has good development prospects [1–4]. The microgrid cluster system is an extension of the microgrid system. Compared with a single microgrid, the interconnected operation of multiple microgrids not only improves the reliability of the power supply but also plays an important role in reducing power economic costs and environmental protection. Microgrid optimal dispatch problem is generally multi-objective optimization. Due to the random fluctuation of distributed energy, the microgrid optimal dispatch problem has become a nonlinear, multi-constrained, multivariable combinatorial optimization problem [5–8]. For traditional algorithms, it is usually hard to find a feasible or optimal solution. In recent years, biomimetic-inspired intelligent optimization algorithms have become increasingly important in solving the optimal dispatch problem of the microgrid [9, 10]. Popular algorithms such as PSO [11, 12], genetic algorithm (GA) [13, 14], and ant colony optimization (ACO) [15] have better global optimization ability and robustness.

At present, many scholars have done a lot of research on the optimal dispatch of the microgrid. Miao et al. [16] proposed a cost-benefit model for analyzing the scale of microgrid energy storage system (ESS), which is solved by the gray wolf optimization (GWO). The superiority of intelligent optimization algorithms in solving microgrid optimal dispatch problems was verified, but the convergence speed of GWO was slow when solving the model. Alireza et al. [17] proposed an off-grid microgrid model consisting of photovoltaics (PV), wind turbine (WT), micro-turbine (MT), ESS, and gas boiler (GB), which took the annual total cost as the objective function and was solved by evolutionary particle swarm optimization (E-PSO). Compared with other intelligent algorithms, the results showed that E-PSO has better searching ability than other algorithms, but it may fall into local optimum when solving high-dimensional nonlinear programming problems. In Reference [18], the optimal size of the ESS in the microgrid was analyzed and solved by PSO, GA, and flower pollination algorithm (FPA). Although the optimal solution was obtained, the initial algorithms are prone to falling into the local optimization problem, and a more accurate value can be obtained by improving the algorithm. In Reference [19], an optimal system configuration model for determining a reliable power supply system was proposed and solved using the grasshopper optimization algorithm (GOA). The results showed that the GOA outperformed the cuckoo search (CS) and PSO in terms of searching ability, but that there is still room for improvement. Abhilipsa et al. [20] proposed a microgrid bidding strategy model in an uncontrolled environment and solved it using an improved whale optimization algorithm (IWOA). Compared with WOA, PSO, and bat algorithm (BA), although the overall economic cost has been optimized, the impact of environmental costs has not been taken into account. Zahraoui et al. [21] determined the optimal generation capacity of distributed power with the objective of the lowest total generation cost and solved it using a memory-based gravitational search algorithm (MBGSA). Compared with GSA, artificial bee colony (ABC), GA, and PSO, the cost of generating electricity has been reduced, but the environmental costs of distributed power sources have not been taken into account. Soheil et al. [22] used the levy-flight moth-flame optimization algorithm (LMFOA) to solve the problem with the objective of minimizing the life cost of internal equipment and the transaction cost of electricity in the microgrid. Compared with MFOA, hybrid genetic algorithm and particle swarm algorithm, and ACO, the superiority of the improved algorithm was verified, but only a single microgrid system was considered, and the microgrid group system composed of multiple microgrids was not considered. Morteza et al. [23] proposed a model to determine the optimal size of the ESS with the lowest total cost as the objective, solved it by convex optimization, and compared it with GA and PSO. The power interaction in grid-connected situations was not considered, although the lowest total cost was obtained.

In summary, most of the research on optimal dispatch of microgrids still stays at the level of a single microgrid. The microgrid cluster system composed of multiple microgrids can make up for the insufficiencies of fluctuation, indirectness, and randomness of distributed power supply, effectively improve the stability of the system, and reduce the rate of light and wind abandonment, so the optimal dispatch research on microgrid cluster is particularly important. In this study, a microgrid cluster system model composed of three microgrids is constructed, which considers the generation cost, equipment operation and maintenance cost, ESS operation cost, energy transaction cost, and environmental cost of the power generation unit, and uses IBOA to simulate and solve the model. To improve the searchability of the algorithm, a skew tent chaotic map is used to improve population diversity, and then, the Cauchy mutation is used in the search process to change the location information of butterflies, expand the search space, and finally use the simplex method to improve the poor individuals in the location update process. As a result, the microgrid cluster's optimum dispatch may be solved more efficiently.

#### 2. Economic Dispatching Model of Microgrid Cluster

##### 2.1. Microgrid Cluster System Structure

The microgrid cluster is composed of several microgrids, each of which is an individual, including PV, WT, diesel generator (DG), MT, ESS, and load. The interaction between the microgrid cluster and the distribution network is carried out through the information interaction center, as shown in Figure 1.

##### 2.2. Objective Function

The objective function is to minimize the operating cost and environmental cost of the microgrid cluster. The operating cost includes the generation cost of controllable distributed generating units, the operation and maintenance cost of generating equipment, the operation cost of ESS, and the transaction cost of electricity. The environmental cost is the penalty cost for pollutant gases (CO_{2}, SO_{2}, and NO_{x}), and the objective function is to maximize the overall benefits of the microgrid cluster. The specific objective functions can be represented as follows:where *C*_{k} is the cost factor for handling *K*-type pollutants, and there are three main pollutants (CO_{2}, SO_{2}, and NO_{x}).

###### 2.2.1. Cost of Diesel Generator

The cost of DG is related to fuel consumption and can be expressed as follows:where *α*, *β*, and *γ* are the fuel consumption cost factors of the DG. Typically, *α* *=* 0.001, *β* *=* 0.18, and *γ* *=* 6 [24].

###### 2.2.2. Cost of Micro-Turbine

The cost of MT is related to gas consumption and can be represented as follows:where *C*_{nl} is the price of natural gas, *L* is the low calorific value of natural gas, is the power of MT, and is the power generation efficiency of MT [25]. Typically, *C*_{nl} = 2.5 CNY/*m*^{3} and *L* *=* 9.7KWh/m^{3}.

###### 2.2.3. Maintenance Cost of Power Generation Equipment

The power generation equipment will cause some loss during operation, which can be expressed as follows:

###### 2.2.4. Operation Cost of Energy Storage System

Due to the randomness and fluctuation of distributed power supply, the ESS discharges when the power generation is insufficient, charges when the power generation is sufficient, and produces a certain loss when charging and discharging, which can be expressed as follows:

###### 2.2.5. Transaction Cost of Electricity

There are costs incurred when the microgrid trades with the microgrid and the microgrid trades with the distribution network, which can be expressed as follows:where and are positive when purchasing electricity and negative when selling electricity.

##### 2.3. Constraints

When optimizing the microgrid cluster system, the following constraints need to be considered.

###### 2.3.1. Power Balance Constraint

This constraint is for the total power of the microgrid cluster system and plays an important role in optimal dispatch, which can be expressed as follows:

###### 2.3.2. Power Generation Equipment Constraints

This restriction is mainly derived from the physical constraints of the power generation equipment and can be expressed as follows:

###### 2.3.3. Energy Storage System Constraints

The energy storage systems can improve the stability of microgrid cluster, and the constraints can be expressed as follows:(1)Charge state constraint(2)Power constraints for charging and discharging

#### 3. Proposed Enhancements for Butterfly Optimization Algorithm

##### 3.1. Butterfly Optimization Algorithm

The BOA is a natural heuristic algorithm proposed for the feeding behavior of butterflies. In BOA, all butterflies attract each other by emitting some fragrance. Each butterfly moves randomly or toward the best butterflies and emits more fragrance [26]. The size of the butterfly aroma is a function of the physical intensity of the stimulus, and the formula can be expressed as follows:where *f* is the aroma size of butterflies, *c* is the sensory modality, *I* is the stimulation intensity, and *α* is the power exponent with a range of [0,1].

The location update formula for the global search phase can be expressed as follows:where is the position vector of the *i*th butterfly in the *t*th iteration, *r* is the random number between [0,1], is the current optimal solution, and *f*_{i} is the aroma size of the *i*th butterfly.

The location update formula for the local search phase can be expressed as follows:where and refer to the position vectors of the *j*th and *k*th individuals randomly selected from within the population in the *t*th iteration, respectively.

Global and local searches occur when a butterfly is searching for food and are determined by setting the switch probability *p*.

##### 3.2. Improved Butterfly Optimization Algorithm

###### 3.2.1. Chaotic Map Initialization Population

Chaotic sequences generated by chaotic mapping have the advantages of randomness, traversal, non-repeatability, etc. In the optimization field, they are often used to generate the initial position of the population, which can effectively improve the diversity of the population. Here, the skew tent chaotic mapping is used to initialize butterfly population, and its definition can be expressed as follows:where *α* is a random number from 0 to 1.

###### 3.2.2. Cauchy Variation

The Cauchy density function is similar to the Gauss density function, but the Cauchy distribution has a higher two-wing probability characteristic, a wider distribution range than the random numbers generated by the Gauss distribution, which effectively improves the global searchability of the algorithm and makes it easy to jump out of the local optimum [27]. The Cauchy distribution function can be expressed as follows:where *t* is a proportional function and has a positive value.

The Cauchy operator is introduced in the global search and local search to mutate individual locations, which makes it easier for the algorithm to jump out of the local optimal value and improve the accuracy of the algorithm.

The location of the global search phase is updated as follows:

The location of the local search phase is updated as follows:

###### 3.2.3. Simplex Method

The advantages of the simplex method include a simple principle, small computation, quick convergence, and strong local searchability. It can effectively improve the local development ability and search accuracy of BOA. The simplex method entails creating *n* + 1 vertex polyhedrons in *n*-dimensional space, calculating and comparing the fitness values of each vertex, and determining the best, second best, and worst points. By reflection, expansion, contraction, and other strategies, a better advantage is obtained, and a new polyhedron is formed, iterating and approaching the optimal point gradually. The steps can be expressed as follows: Step 1: calculate the fitness values of all vertices, rank the individual fitness values, and determine the optimal point *x*_{1}, the secondary advantage *x*_{2}, and the worst point *x*_{3}. Step 2: calculates the center point of the optimal point *x*_{1} and the secondary advantage *x*_{2}, which is counted as *x*_{4}. Step 3: reflect the worst point *x*_{3} to get the reflection point, which is recorded as *x*_{5} and can be expressed as follows: where *α* is the reflection coefficient in the formula and the value is 1. Step 4: if *f*(*x*_{5}) < *f*(*x*_{1}), the reflection direction is correct, the expansion operation is performed, and the expansion point is obtained, which is recorded as *x*_{6} and can be expressed as follows: where *β* is the expansion factor and the value is 1.5. If *f*(*x*_{6}) < *f*(*x*_{1}), the worst point *x*_{3} is replaced by the expansion point *x*_{6}; otherwise, the worst point *x*_{3} is replaced by the reflection point *x*_{5}. Step 5: if *f*(*x*_{5})>*f*(*x*_{1}), the reflection direction is incorrect. Compression is performed to get the compression point, which is recorded as *x*_{7} and can be expressed as follows: where *γ* is the compression factor and the value is 0.5. If *f*(*x*_{7}) < *f*(*x*_{3}), the worst point *x*_{3} is replaced by the compression point *x*_{7}. Step 6: if *f*(*x*_{1}) <*f*(*x*_{5}) < *f*(*x*_{3}), a contraction operation is performed to get the contraction point, which is recorded as *x*_{8} and can be expressed as follows:where *ε* is the shrinkage factor and the value is 0.5.

If *f*(*x*_{8}) < *f*(*x*_{3}), the worst point *x*_{3} is replaced by the shrinking point *x*_{8}. Otherwise, the worst point *x*_{3} is replaced by the reflection point *x*_{5}.

###### 3.2.4. IBOA Steps

In summary, the IBOA steps presented in this study can be expressed as follows: Step 1: initialize parameters, using skew tent chaotic map to set population location; Step 2: calculate the fitness value and record the initial extreme value; Step 3: calculate the individual aroma size of each butterfly; Step 4: perform global and local searches using formulas (19) and 20); Step 5: improve the poor individuals by the simplex method; Step 6: update the individual and global optimal solution of the butterfly; Step 7: determine whether the algorithm has reached the maximum number of iterations and whether it has reached the end of the algorithm; otherwise, return to Step 3.

#### 4. Test Function and Analysis

##### 4.1. Parameter Settings

The 14 test functions are compared among PSO, WOA, SSA, BOA, and IBOA. The initial population size of all algorithms is set to 100, the number of iterations is 1000, each algorithm runs independently 30 times, and all simulations are completed on MATLAB 2019b. The algorithm parameter settings are shown in Table 1.

##### 4.2. Test Function

The 14 benchmark test functions are selected for simulation analysis. The test function information is described in Table 2:

##### 4.3. Algorithmic Test and Performance Comparison

The test results are described in Table 3.

The convergence curve is shown in Figure 2.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

**(g)**

**(h)**

**(i)**

**(j)**

**(k)**

**(l)**

**(m)**

**(n)**

From the above results, IBOA is better than other algorithms in search accuracy and convergence speed, among which IBOA performs well in single-mode test functions *f*_{1}∼*f*_{5}, can directly find the optimal value in *f*_{1}∼*f*_{4} test functions, and has the highest search accuracy in *f*_{5} test functions compared with other algorithms. In the multimodal test functions *f*_{6}∼*f*_{11}, IBOA still has a high optimization ability, in which the optimal values can be directly found in the test functions *f*_{7} and *f*_{9}, and the convergence speed is faster than other algorithms. IBOA, BOA, and SSA search capabilities are almost the same in *f*_{8} test functions, but IBOA has the advantage of faster convergence. In *f*_{10} and *f*_{11} test functions, IBOA has the highest accuracy and stability. In the fixed dimension test function *f*_{12}∼*f*_{14}, each algorithm has excellent performance. In *f*_{12} and *f*_{14} test functions, all algorithms can quickly find the optimal value. In *f*_{13}, the optimization accuracy of IBOA and SSA is higher than that of other algorithms, and the convergence speed is faster. Through comparative experiments, IBOA solves the problem that BOA is easy to fall into local optimum and has poor convergence accuracy.

#### 5. Simulation Results and Discussion

Three interconnected microgrids (MG1, MG2, and MG3) are selected for simulation analysis, in which a single microgrid is mainly composed of the PV, WT, DG, MT, ESS, and load. When dealing with microgrids, the multipower supplier preferentially supplies power to the one with more power shortages to improve overall economic benefits, and the calculation period is one day.

##### 5.1. Case Parameters

Figure 3 shows the power generation of PV and MT and the load diagram required by the microgrid. Table 4 shows the power generation unit parameter, Table 5 demonstrates the environmental pollution parameter, Table 6 is the time-sharing electricity price table, and Table 7 illustrates the ESS parameter.

**(a)**

**(b)**

**(c)**

##### 5.2. Result Analysis

Figure 4 shows the power output diagram of each power generation device based on the minimum total cost of the microgrid cluster under the island model. Figure 5 shows the power output diagram of each power generation device under the condition of grid connection. ESS discharge is preferred when PV and WT power generation is insufficient. When ESS reaches the lower discharge limit, the other power generation equipment with lower total cost takes precedence. The positive output value of ESS indicates discharge, while the negative output value indicates charge. The positive output values for the microgrid and the distribution network indicate the purchase of electricity, while the negative output values indicate the sale of electricity.

**(a)**

**(b)**

**(c)**

**(a)**

**(b)**

**(c)**

###### 5.2.1. Economic Dispatch in the Island Model

Since the microgrid cluster is not connected to the distribution network in the island model, DG is used as the emergency power supply to provide the amount of electricity needed and remove the power constraint of DG to meet the power balance of the microgrid. The output of specific power generation equipment is shown in Figure 4.

Microgrid 3 is taken as an example, in 00:00–01:00, 05:00–08:00, and 20:00–24:00 time periods, the power generation is insufficient, and the amount of electricity lacking is first compensated by ESS, and after reaching the upper limit of ESS discharge, it is supplied by emergency power DG. In 02:00–04:00 and 09:00–19:00 periods, the power generation is sufficient and is charged to ESS, and after reaching the charge limit, the remaining electricity is sold to the power-deficit microgrid. Surplus power is sold to microgrid 2 in 03:00–04:00 time frame and microgrid 1 in 12:00–19:00 time frame. The microgrid cluster in the island model does not have the support of the distribution network, and DG is a high demand for itself as an emergency power supply.

###### 5.2.2. Economic Dispatch in the Grid-Connected Model

The device output of the microgrid cluster in the grid-connected model is shown in Figure 5.

Microgrid 3 is taken as an example, in 00:00–01:00, 05:00–09:00, and 19:00–24:00 periods, the power generation is insufficient, and ESS discharge is given priority. When ESS discharge reaches the upper limit, power purchase is made to the microgrid and distribution network. Since there is no excess power within the microgrid group in this period, power purchase is made to the distribution network to fill the shortage. In 02:00–04:00 and 10:00–18:00 periods, the power generation is sufficient, the excess power is charged to ESS, and then the remaining power is sold after reaching the maximum charge limit. Surplus power is sold to microgrid 2 in 03:00–04:00 time frame and microgrid 1 in 12:00–18:00 time frame. The power generation cost of MT is slightly lower than that of DG, and the power generation process can bring some heat, which can meet the resident's need for hot water and obtain additional benefits.

##### 5.3. Analysis of Optimization Results

The result is shown in Figure 6. PSO, WOA, SSA, BOA, and IBOA are used to optimize the model, where Figure 6(a) is the economic cost in the island model and Figure 6(b) is the economic cost in the grid-connected model. In the grid-connected model, PSO cost is 4338.14 CNY, WOA cost is 4165.94 CNY, SSA cost is 4046.61 CNY, BOA cost is 4105.38 CNY, and IBOA cost is 3957.49 CNY. Among the costs of IBOA, the economic cost is 3343.39 CNY, and the environmental pollution cost is 614.11 CNY, and the economic cost includes the DG cost of 466.51 CNY, the MT cost of 557.18 CNY, the maintenance cost of PV and MT of 1421.20 CNY, the electric energy transaction cost of 538.07 CNY, and the ESS maintenance cost of 360.43 CNY. From the graph, IBOA is better than other algorithms in convergence speed and searchability.

**(a)**

**(b)**

#### 6. Conclusions

This research constructs a microgrid cluster system model consisting of three single microgrids to solve the economic optimization dispatch problem. The information exchange center facilitates information sharing between single microgrids and between the microgrid cluster and the distribution network, and the model is simulated and solved by IBOA. To solve the problems of BOA falls into a local optimum easily and poor convergence accuracy, the skew tent chaotic map is used to initialize butterfly population, the Cauchy mutation is used to expand the search space, and the simplex method is used to improve the performance of the algorithm for poor individuals. The results of a comparison of 14 test functions with PSO, WOA, SSA, and BOA show that IBOA has significant advantages in terms of convergence speed and optimization accuracy. Finally, the proposed model is solved by simulation. Compared with other algorithms, IBOA has the highest economic benefit. By optimizing the microgrid cluster, the total operating cost is decreased, the dependence of the microgrid cluster on the distribution network is reduced effectively, and the development and utilization of renewable energy are promoted.

#### List of Symbols and Abbreviations

PV: | Photovoltaics |

WT: | Wind turbine |

MT: | Micro-turbine |

ESS: | Energy storage system |

DG: | Diesel generator |

ET: | Electricity transaction |

EM: | Equipment maintenance |

C1: | The operating cost |

C2: | The environmental pollution cost |

and : | Generation cost of DG and MT |

: | Operation and maintenance cost of PV and WT inside microgrid |

: | Operation cost of ESS |

: | Electricity transaction cost |

, , and : | Discharge factors of the K-type pollutants produced by DG, MT, and grid |

, , , , and : | Generated power of WT, PV, DG, MT, and ESS |

, , , and : | Maintenance cost factors of WT, PV, DG, and MT |

: | Total investment cost of ESS |

: | Rated power of ESS |

T: | Annual running hours of ESS |

d_{i}: | Depreciation rate of ESS |

l_{i}: | Service life of ESS |

: | Power for power trading between microgrids |

: | Power for power trading between the microgrids and the distribution network |

: | Power price of microgrid |

: | Power price of the distribution networks |

: | Load size of the microgrid cluster system |

, : | Up and down climb speed of DG |

and : | Up and down climb speed of MT |

and : | Minimum and maximum charges of the ESS |

: | Charge power of ESS |

: | Discharge power of ESS. |

#### Data Availability

The data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This work was supported by the Open Research Fund of Guangxi Key Laboratory of Building New Energy and Energy Conservation (Gui Keneng 17-J-21-4).