Optimal dispatching of microgrid based on improved moth-flame optimization algorithm based on sine mapping and Gaussian mutation

Because the traditional power generation method has caused certain damage to the environment, the microgrid system composed of renewable energy has been widely developed and applied. This paper studies distributed power sources including photovoltaics, wind turbines, energy storage systems, gas turbines, and fuel cells. Under the conditions of microgrid islands and grid-connected operation, the fuel cost, operation and maintenance cost, and the electricity transaction cost between the microgrid and the distribution network, establish the optimal objective function for the operating cost of the microgrid. At the same time, due to the standard moth-flame optimization algorithm having low optimization accuracy and are easy to fall into local optimal solution, an improved moth-flame optimization algorithm based on Sine mapping and Gaussian mutation is proposed. This algorithm is used to obtain the output of each distributed power source and total operating cost in a dispatch period. Finally, an example is used to verify the effectiveness and economy of the proposed model and the improved algorithm.


Introduction
In recent years, due to the depletion of global traditional energy, environmental pollution, and climate change, the microgrid system composed of renewable energy has been widely used and developed (Liao et al., 2019;Liu et al., 2021b;Qian et al., 2020;Wang et al., 2013;Wang & Tang, 2021;Zhang et al., 2021b). As a small autonomous system for power generation and distribution, microgrid has the characteristics of flexible power supply, short transmission distance, low energy consumption, and low pollution. It can realize self-control and self-management, effectively promote energy saving and emission reduction, and alleviate the energy crisis.
At present, research scholars at home and abroad have conducted a lot of research on the optimization of the economic operation of the microgrid. Literature (Li et al., 2014) comprehensively considered economic costs, environmental benefits, and network losses, established the objective function of microgrid optimization, and used an improved gravitational algorithm for simulation. Although the cost was optimal, the output of photovoltaic power generation and wind power generation in the article lacked randomness. Literature (Kong et al., 2021) established a multi-objective microgrid CONTACT Yu Zhang 17316606@qq.com operation optimization model based on the optimization goals of microgrid economy, reliability, energy efficiency, equivalent load peak-valley difference and volatility. Although the optimal operation plan of the microgrid was obtained, it only considered the island conditions of the microgrid and did not analyse the optimization operation of the microgrid when it is connected to the grid and the power transaction with the distribution network. Literature (Gao & Zou, 2019) used the basic particle swarm optimization algorithm to study the economic optimization dispatch of the microgrid. Although the optimal operating cost of the microgrid system was obtained, the particle swarm optimization algorithm was prone to fall into the local optimal and poor accuracy problems. Literature (Chu, 2019) used the genetic algorithm to distribute the microgrid load in the isolated grid and grid-connected modes, thereby effectively reducing the comprehensive cost of power generation. Although the cost of the microgrid was reduced, the genetic algorithm was easy to fall into the local optimum. Literature (Mirjalili, 2015) proposed the basic moth-flame optimization algorithm. Although excellent results have been achieved in many practical projects such as distribution network fault location and flexible job-shop scheduling, there is insufficient population diversity in the later stage, and the reduction of the number of flames may cause the algorithm to fall into local optimization and other shortcomings. Literature (Zhang et al., 2020a) proposed an improved moth-flame optimization algorithm based on genetic algorithm crossover operator and non-uniform mutation operator for the problem of slow convergence speed and easy to fall into local optimum in the later period of moth algorithm. Although compared with the basic moth-flame optimization algorithm, the improved algorithm had significantly improved convergence speed and optimization accuracy, and at the same time, it could jump out of the local optimal solution with a greater probability in the later stage of the calculation. However, when dealing with some complex functions, it would still fall into the local optimal solution, and the disturbance of the flame would increase the computational complexity and reduce the computational speed. Based on the existing research, this paper takes the microgrid system including photovoltaics, wind turbines, energy storage systems, gas turbines, and fuel cells as the research object. Under the conditions of microgrid islands and grid-connected operation, comprehensively considering the fuel cost, operation and maintenance cost, and the electricity transaction cost between the microgrid and the distribution network, the optimal objective function of the microgrid operating cost is established. At the same time, due to the standard moth-flame optimization algorithm has low optimization accuracy and is easy to fall into local optimal solution, an improved moth-flame optimization algorithm based on Sine mapping and Gaussian mutation is proposed. This algorithm is used to obtain the output of each distributed power source and total operating cost in a dispatch period. Finally, an example is used to verify the effectiveness and economy of the proposed model and the improved algorithm.
The organizational structure of this article is as follows. Section 2 introduces the optimization model of microgrid operation. Section 3 introduces the improved moth-flame optimization algorithm. Section 4 introduces the performance test of the algorithm. Section 5 introduces the calculation example analysis. Section 6 is the conclusion.

Internal structure of microgrid
The internal structure of the microgrid is shown in Figure 1. It mainly includes photovoltaics, wind turbines, energy storage batteries, fuel cells, gas turbines, and loads.

Objective function
The operating cost of the microgrid mainly includes fuel costs, operation and maintenance costs, and electricity transaction costs between the microgrid and the distribution network, therefore the objective function of the single microgrid is where C FC t represents the fuel cost of the microgrid in time t, C OM t represents the operation and maintenance cost of the microgrid during t period, C DN t represents the electricity transaction cost between the microgrid and the distribution network during the t period, T is the scheduling period.

Fuel cost
The fuel cost of the microgrid is shown in Equation (2).
where C FC t represents the fuel cost of the microgrid in time t, C MT is the unit fuel cost of the micro gas turbine of the microgrid, C FC is the unit fuel cost of the fuel cell of the microgrid, P MT t is the output power of the micro gas turbine in the microgrid during t period, P FC t is the output power of the microgrid fuel cell during t period.

Operation and maintenance costs
The operation and maintenance cost of the microgrid is mainly related to the output power of the power generation unit, as shown in Equation (3) (Zhang et al., 2021a).
where C OM t represents the operation and maintenance cost of the microgrid during t period, λ i is the operation and maintenance coefficient of the i-th power generation unit of the microgrid, P i t is the output of the i-th power generation unit of the microgrid in period t.

Transaction costs between microgrid and distribution network
The electricity transaction cost between the microgrid and the distribution network refers to the cost generated when the microgrid and the distribution network interact with electricity, as shown in Equation (4).
where C DN t represents the electricity transaction cost between the microgrid and the distribution network during the t period, C buy t is the cost of purchasing electricity from the distribution network in the time period t, C sell t is the cost of selling electricity from the distribution network to the microgrid in the time period t, C b t is the electricity purchase price of the distribution network during the time period t, C s t is the price of electricity sold in the distribution network during the time period t, P DN t is the interactive power between the microgrid and the distribution network during the period t, and the purchase of electricity is positive and the sale of electricity is negative.
where P i is the total output power of each power generation unit of the microgrid, P B t is the output of the microgrid battery in the period t, charging is positive and discharging is negative, P DN t is the transaction power between the microgrid and the distribution network during the period t, the positive value means electricity purchase, and the negative value means electricity sale. P L t is the load of the microgrid.
(2) Constraints on the output power of distributed power sources.
where P i min is the minimum output of the microgrid distributed power supply, P i max is the maximum output of microgrid distributed power.
(3) Power constraints between microgrid and distribution network.
where P DN min is the minimum value of the interactive power between the microgrid and the distribution network, P DN max is the maximum value of the interactive power between the microgrid and the distribution network.

Basic moth-flame optimization algorithm
The MFO algorithm is a new meta-heuristic algorithm proposed based on moths' fire fighting behaviour. The moths represent search individuals moving in the search space, and the flame represents the current optimal position of the moth. The position of moths is updated repeatedly and iteratively until the optimal solution is obtained (Liu et al., 2021a;Guo et al., 2021;Tan et al., 2021;Gu et al., 2021;Qin et al., 2020;Zeng et al., 2020a;Zeng et al., 2020b). The MFO algorithm is specifically described as follows:

Initialization of moth population
In the MFO algorithm, M is the moth population, O M is the fitness value matrix corresponding to M, F is the flame population, and O F is the fitness value matrix corresponding to F. The specific formula is as follows: where n is the number of moths and the number of initial flames; d is the required variable dimension.

Location update mechanism
(1) Update of moth position. The moth uses a logarithmic spiral to update its position. The specific formula is as follows: where D i is the distance between the moth and the flame, b is a constant parameter related to the shape of the logarithmic spiral, t is a random number, and t ∈ [−1, 1], when t = −1, the distance between the moth and the flame is the shortest, when t = 1, the distance between the moth and the flame is the farthest.
(2) Update of flame position. In the iterative process, the number of flames is adaptively reduced until the last optimal flame is retained. The specific formula is as follows: where n is the total number of moth populations, f round is the rounding function, T is the maximum number of iterations, l is the current number of iterations.

Chaos initialization
Chaotic variables have randomness, ergodicity, and regularity, which is conducive to the algorithm to jump out of the local optimum. The chaotic map used in this paper is the Sine equation (Yu et al., 2018;Zhu et al., 2019). The Sine chaotic model is a model with an unlimited number of mapping folds, and the Sine mapping is obtained by deforming the sine trigonometric function. Because of its simple structure, it is widely used in chaotic image encryption. The specific formula is as follows: where a ∈ (0, 4], z ∈ (0, 1), a = 4, z 0 = 0.152.

Gaussian variation
Gaussian variation comes from Gaussian distribution, which specifically refers to replacing the original parameter value with a random number conforming to a normal distribution with a mean value of μ and a variance of σ 2 when making mutations (Lv et al., 2021;Pan & Xu, 2016). According to the characteristics of normal distribution, the Gaussian mutation can perform key search in a certain area near the previous generation of individuals, thereby enhancing the local search ability without reducing the convergence speed and search accuracy. The variation formula is where x is the original parameter value, N(0, 1) represents a normally distributed random number with an expectation of 0 and a standard deviation of 1, mutation(x) is the value after Gaussian mutation.

Analysis of algorithm complexity
The MFO algorithm includes two parts: sorting and position update, where n is the number of moths, d is the number of variables, and T is the maximum number of iterations. Therefore, the computational complexity of sorting is O(n 2 ), and the computational complexity of position updating is O(n * d). The total computational complexity of the MFO algorithm is O(T(n 2 + nd)). The IMFO algorithm adds chaos mapping and Gaussian mutation based on the MFO algorithm. Among them, the computational complexity of chaos initialization is O(n * d) and the computational complexity of Gaussian mutation is O(n * d), therefore the total computational complexity of the IMFO algorithm is O (T(n 2 + 3nd)). The IMFO algorithm and the MFO algorithm have the same computational complexity, however the IMFO algorithm is better than the MFO algorithm in solving accuracy and avoiding falling into the local optimum.

The steps of the algorithm
The steps of the improved moth algorithm combining Sin chaotic map and Gaussian mutation are shown in Figure 2 below.
(1) Initialize the parameters, and initialize the moth population using Equation (15)

Experimental design and benchmark function
In order to verify the feasibility and superiority of the improved moth-flame optimization algorithm, simulation experiments are carried out based on 10 different types of benchmark functions. Benchmark test functions are shown in Table 1. Among them, F1-F5 are unimodal functions and F6-F10 are multimodal functions. Through different types of benchmark functions, the optimization ability of the proposed improved moth-flame optimization algorithm can be fully investigated.
In the experiment, the population size is N = 50, the maximum number of iterations is T = 500, and the dimension is 30. The parameters of each algorithm are shown in Table 2. The choice of parameters was based on parameters widely used by other researchers or parameters used by the original author in previous articles. In order to avoid the contingency of the optimization results and prove the stability of the improved mothflame optimization algorithm, the experimental results of each benchmark function independently running 50 times are selected as the experimental data. For 10 benchmark functions, the optimal value, worst value, average value, and standard deviation of each algorithm are used as the final evaluation indicators, as shown in Table 3. It can be obtained from Table 3 that for the unimodal function F1-F5 and the multimodal function F6-F10, the solution ability of the IMFO algorithm is better than that of the GA, LSO, and MFO algorithms. Among them, when solving F1, F2, F4, F6, F7, F10, the IMFO algorithm finds the theoretical optimal value, when solving F3, F5, F8, F9, GA, LSO, MFO, IMFO algorithm did not find the theoretical optimal solution, however, its convergence effect and convergence accuracy is better than those of GA, LSO, and MFO algorithms.

Comparative analysis of algorithm convergence curves
The benchmark test function curve can intuitively reflect the convergence speed and accuracy of each algorithm, and it can also clearly show the ability of the algorithm to jump out of local space. Therefore, to better show the dynamic convergence characteristics of the improved moth-flame optimization algorithm, Figure 2 shows the convergence curves of 10 test functions under four optimization algorithms. It can be seen from the figure that the IMFO algorithm continues to optimize as the number of iterations increases, and its convergence speed and accuracy are better than GA, LSO, and MFO algorithms, and it has faster convergence speed and higher convergence accuracy. Among them, the abscissa of Figure 3 is the number of iterations, and the ordinate is the log value of fitness.

Basic data
The microgrid system in the calculation example in this chapter includes photovoltaics, wind turbines, micro-gas turbines, fuel cells, and batteries. The calculation example uses 24 h a day as the dispatch cycle. Figure 4 shows the photovoltaic, wind turbine, and load curves of the microgrid. Table 4 shows the time-of-use electricity price. Table 5 shows the parameters of each micro source. The maximum state of charge of the energy storage battery is 0.9, and the minimum state of charge is 0.2. The unit fuel cost of the micro gas turbine of the microgrid is 0.6 yuan/kW, and the unit fuel cost of the fuel cell of the microgrid is 0.6 yuan/kW.

In the case of islands
In the island operation state, there is no electric energy transaction between the microgrid and the distribution network, and the load of the microgrid is supplied by internal micro sources. Figure 5 is the output curve of each micro source after optimization, and Figure 6 is the operating cost curve of the microgrid system. It can be seen from Figure 6 that the IMFO algorithm basically stabilizes after 200 iterations, converging to 1072.5 yuan, and is better than the GA, LSO, and MFO algorithms.

In the case of grid connection
In the state of grid-connected operation, the microgrid and the distribution network carry out energy trading. When the microgrid meets its own load demand while there is electricity surplus, it sells the excess electricity to the distribution network. Figure 7 is the output curve   of each micro source after optimization. Figure 8 is the operating cost curve of the microgrid system. It can be seen from Figure 7 that during the period of 00:00-06:00, because the micro-source output of the microgrid system cannot meet the load demand, it is necessary to purchase electric energy from the power distribution network to meet the power shortage of the system. During the period of 08:00-12:00, because the micro-grid system can meet the load demand with micro-source output, and there is still electricity surplus, the excess electricity is sold to the power distribution network to gain revenue and reduce  operating costs. It can be seen from Figure 8 that the IMFO algorithm basically stabilizes after 90 iterations, converging to 833.7 yuan, and is better than the GA, LSO, and MFO algorithms.

Conclusion
This paper establishes an optimized operation model of the microgrid with the lowest fuel cost, operation and maintenance cost, and the electricity transaction cost between the microgrid and the distribution network. At the same time, an improved moth-flame optimization algorithm based on Sine mapping and Gaussian mutation is proposed. Through this algorithm, the microgrid system is simulated and solved, and the output of each micro source and the optimized operating cost are obtained.
(1) This paper considers the optimal scheduling of microgrid operation under the two modes of islanding and grid-connected. When the microgrid and the distribution network conduct electricity trading, the cost of the microgrid dropped from 1072.5 to 833.7 yuan, a drop of 238.8 yuan, effectively reducing the operating cost of the microgrid. (2) This paper proposes an improved moth-flame optimization algorithm based on Sine mapping and Gaussian mutation. Numerical experiments are carried out based on 10 benchmark test functions and compared with GA, LSO, and MFO algorithms. The test results and statistical analysis show that the proposed algorithm has higher accuracy and stability, and verify the effectiveness of the improvement. (3) The IMFO algorithm proposed in this paper will still fall into a local optimum when facing some complex functions. Therefore, in future work, we can further study methods to avoid local optimal solutions. At the same time, the algorithm can be applied to other fields, such as image segmentation, face recognition, and so on.

Disclosure statement
No potential conflict of interest was reported by the author(s).

Funding
This work was supported by the Natural Science Foundation of Guangxi [grant number 2017GXN SFAA198161].

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