Research on capacity optimization of micro-grid hybrid energy storage system based on simulated annealing artificial fish swarm algorithm with memory function

. The intermittence and uncertainty of wind power and photovoltaic power have hindered the large-scale development of both. Therefore, it is very necessary to properly configure energy storage devices in the wind-solar complementary power grid. For the hybrid energy storage system composed of storage battery and supercapacitor, the optimization model of hybrid energy storage capacity is established with the minimum comprehensive cost as the objective function and the energy saving and charging state as the constraints. A simulated annealing artificial fish school algorithm with memory function is proposed to solve the model. The results show that the hybrid energy storage system can greatly save costs and improve system economy.


Introduction
In recent years, wind power and photovoltaic power generation have developed rapidly, and the installed capacity has increased year by year. However, the intermittent and extremely unstable wind energy and solar energy connected to the power grid will have an impact on the power system and seriously endanger the safe operation of the power grid [1] . In order to make wind energy and solar energy a continuous and stable energy source, and finally become an alternative energy source that can compete with conventional energy sources, certain energy storage devices must be configured in the wind-solar complementary power grid, which can effectively suppress the fluctuation of wind-solar output power [2] .
It is difficult for a single energy storage to have the advantages of high efficiency, high energy density, high power density, and long life at the same time, which is not conducive to the safe and reliable operation of the system [3] . This shortcoming greatly limits the development of energy storage technology. The proposed hybrid energy storage technology overcomes this shortcoming and promotes the development of energy storage technology.
Battery energy storage has the advantages of large energy density and easy operation and maintenance. Super capacitors have the advantages of large power density, long life, fast response speed and high efficiency [4] . The two are complementary in technical performance. They can be mixed and used through reasonable connection. The system has the advantages of high energy density of the battery and high power density of the super capacitor, and can optimize the working environment of the battery. The application of the hybrid energy storage system of super capacitors and accumulators improves the power supply quality of the microgrid, and improves the operation stability and economy of the microgrid. In order to make the effect of suppressing power fluctuation better, the capacity of the hybrid energy storage system is usually large. But as the capacity of the hybrid energy storage system increases, so does its cost [5] . The cost of a hybrid energy storage system contradicts its leveling effect. Therefore, it is very necessary to economically and rationally configure the capacity of the hybrid energy storage system.

Structure of wind-solar storage power generation system
The schematic diagram of the wind and solar storage system is shown in Figure 1. The system includes a hybrid energy storage system composed of a wind power generation system, a photovoltaic power generation system, a storage battery and a super capacitor, and a power conversion device. Photovoltaic cells and wind turbines are connected to the grid through inverters, and supercapacitors and batteries are connected to the grid through bidirectional DC/DC converters and DC/AC converters. On the premise of ensuring the stability effect and stability, the capacity of the energy storage device is optimized to reduce its overall cost and improve the economics of the system. For this, the capacity is optimized with the goal of minimizing the overall cost of the hybrid energy storage system.

Objective function
The objective function of this system is that the comprehensive cost of the hybrid energy storage system is the smallest under the premise of satisfying the stability of the power system. The comprehensive cost of the hybrid energy storage system mainly considers the purchase cost, operation and maintenance cost, and disposal cost.
(1) Purchase cost Purchase cost is the total investment expenditure that the hybrid energy storage system consumes during the construction process. Mainly includes installation investment expenditures, equipment investment expenditures, and other investment expenditures. The purchase cost of the hybrid energy storage system is mainly related to its own capacity, and the calculation formula is as follows: In the formula:K 1 is the construction cost of the hybrid energy storage system; α S is the unit power unit price of the supercapacitor; β S is the unit capacity unit price of the supercapacitor; α B is the unit power unit price of the battery; β B is the unit power unit price of the battery; P S is the power of the supercapacitor ; Q S is the capacity of the super capacitor; P B is the power of the battery; Q B is the capacity of the battery.
(2) Operation and maintenance costs Operation and maintenance cost refers to the cost of testing, installation, loss and labor, and maintenance cost refers to the cost of maintenance and maintenance during the operation of the system. The whole process from the beginning of the system to the scrapping of the system requires maintenance costs. Calculated as follows: In the formula: is the operation and maintenance cost coefficient of the supercapacitor; is the operation and maintenance cost coefficient of the battery (3) Disposal cost Disposal cost refers to the cost of scrapping and residual value after the equipment is damaged. (3) In the formula: is the disposal cost coefficient of the supercapacitor; is the disposal cost coefficient of the storage battery.
In summary, the objective function of the system is:

Restrictions
While considering the annual comprehensive cost of the hybrid energy storage system, it is also necessary to consider some constraints during operation. It mainly includes energy conservation constraints, state-of-charge constraints, power constraints, and grid-connected power fluctuation constraints.
(1) Energy conservation constraint When the hybrid energy storage system is in operation, its output should be equal to the difference between the output power of the photovoltaic system and the wind power generation system and the input power of the grid.
In the formula: P HESS is the power of the hybrid energy storage system; P PV is the output power of the photovoltaic power generation system; P W is the output power of the wind power generation system; P O is the grid-connected power; P S is the output power of the supercapacitor; P B is the output power of the battery.
(2) State-of-charge constraints During operation, the state of charge of the supercapacitor and battery cannot be infinite, and should be within the specified range: In the formula: SOC S-min is the minimum state of charge of the supercapacitor; SOC S-max is the maximum state of charge of the supercapacitor; SOC S (t) is the supercapacitor at time t State of charge; SOC B-min is the minimum value of the battery state of charge; SOC B-max is the maximum value of the battery state of charge; SOC B (t) Is the state of charge of the battery at time t.
(3) Power constraint During operation, the output power of the supercapacitor and battery should be within the rated power range at any time.
In the formula: P S (t) is the output power of the supercapacitor at time t; P B (t) is the output power of the battery at time t.
(4) Constraints on grid-connected power fluctuations After smoothing the grid fluctuations through the hybrid energy storage system, the power fluctuations after the grid connection of wind power and photovoltaic power generation must meet the corresponding national standards.
In the formula: σ is the output power fluctuation of the system; σ max is the maximum power fluctuation allowed by the system.

Simulated annealing artificial fish swarm optimization algorithm based on memory function
In order to seek the optimal solution, many scholars at home and abroad have proposed a variety of algorithms, mainly including: genetic algorithm, artificial fish swarm algorithm, simulated annealing algorithm, mountain climbing algorithm, particle swarm algorithm, ant colony algorithm, etc [6] . . These algorithms have their own scope of application, with different advantages and disadvantages. When using a single algorithm, it is often impossible to find the optimal solution because of the limitations of the algorithm. Therefore, it is necessary to mix the algorithms, aim at specific problems, merge the advantages of each algorithm, and overcome its shortcomings, so as to make the solution more optimized.
Simulated annealing algorithm (Simulated Annealing, SA) was first proposed by N. Metropolis and others in 1953. Later it was widely used in the field of combinatorial optimization [7] . The SA algorithm is generated by the principle of solid annealing. First, the solid is heated, and the particles inside the solid will chaotically and disorderly move as the temperature rises, and the energy inside the solid will increase accordingly. After heating to a sufficiently high temperature, the solid is cooled, and the particles with disordered movement inside the solid become ordered as the temperature decreases, and reach a new equilibrium state at any temperature. When the temperature decreases to normal temperature, the solid returns to the ground state , The internal energy is reduced to the minimum state.
SA algorithm has strong local search ability, simple calculation process, general purpose, strong robustness, suitable for parallel processing, and can be used to solve complex nonlinear optimization problems. But its convergence speed is slow, the execution time is long, the algorithm performance is related to the initial value, and the parameters are more sensitive. During the execution of the algorithm, when △t≦0 is not satisfied, the algorithm accepts the new solution with a certain probability according to the Metropolis criterion. The probability link will lead to the loss of the optimal solution in the current state, so that the solution of the objective function not only has no Going in a better direction, but getting worse solutions. In order to avoid this situation, a storage link can be added to store the optimal solution obtained during the execution and compare it with the current solution, and select the better solution as the current optimal solution. The specific steps of introducing the simulated annealing algorithm (MSA) of the memory function are as follows: Step 1: Set the initial temperature T and the number of iterations L for each temperature; Step 2: Randomly generate an initial solution S, and calculate the objective function f (S); Step 3: Introduce the memory variable S0, let S0=S, f(S 0 )=f(S); Step 4: Disturbance generates a new solution S`, calculate f(S`), and calculate the value of △t=f(S`)-f(S).
Step 5: If △t≤0, accept the new solution S` as the current optimal solution. If △ t>0, accept the new solution with the probability of exp(-△t/T), otherwise the current solution returns to the solution at the previous iteration; Step 6: Compare the current solution with the solution of the memory variable. If the current solution is better than the solution of the memory variable, write the current solution into the memory variable. Otherwise, save the solution of the memory variable; Step 7: Reduce the temperature, return to Step 4, and end the iteration when the termination condition is met; Step 8: After the execution is completed, the optimal solution is output.
The simulated annealing algorithm (MSA) based on memory function introduces memory variables S 0 and f(S 0 ), and makes S 0 and f(S 0 ) equal to the initial solution and the initial objective function value, respectively. Each time a current optimal solution is generated, f(S 0 ) and f(S) are compared, and the optimal value of the two is taken as the new current optimal solution. If f(S) is better than f(S 0 ), Then replace S0 and f(S 0 ) with S and f(S). Avoid losing the current optimal solution when accepting new solutions by Metropolis criterion.
The Artificial Fish Swarms Algorithm (AF) algorithm was first proposed by Li Xiaolei and others in 2002. Since the algorithm was proposed, it has attracted extensive attention from scholars at home and abroad, and is used in the field of optimization. The algorithm is generated by simulating various behaviors of fish school. In a water area, the place where a large number of fish gather is usually the area with the highest food concentration in the water area. Based on this idea, artificial fish school algorithm can simulate the behavior of fish school such as foraging, rear-end, clustering, evaluation, etc., and seek the optimal solution in a certain area [8] .
The AF algorithm has low initial value requirements, strong robustness, parallel processing capability, good global optimization ability, and can quickly jump out of the local best. Although the artificial fish school algorithm has many advantages, it also has some problems. Parameters such as step size and visual field limit the optimization effect of artificial fish schools.
In summary, the AF algorithm has low initial value requirements and strong global optimization ability, and the obtained result is an approximate value of the optimal solution. The SA algorithm parameters are more sensitive but the local optimization ability is strong. Aiming at the advantages and disadvantages of the two algorithms, the two algorithms are mixed and applied to the combined optimization problem. The two algorithms take advantage of each other's strengths and weaknesses, and the optimization ability is more superior. The mixing of the two algorithms is also very simple. Just use the AF algorithm to optimize the optimization problem first, and use the global optimization ability of the AF algorithm to find the artificial fish with the highest physical concentration and perform the MSA algorithm to perform local optimization to obtain the optimal value.
The flowchart of the simulated annealing artificial fish school algorithm (MSAAF) with memory function is shown in Figure 2. Specific steps are as follows: Step 1: Initialize the algorithm parameters, set the total number of fishes M, the maximum number of iterations MAX, the field of view V, the step size S, the crowding factor , the initial temperature T, the number of iterations of each temperature L, the cooling coefficient ; Step 2: Construct the objective function and constraint model; Step 3: Randomly generate m fish as the initial fish school; Step 4: Calculate the food concentration of each fish and put the optimal value on the bulletin board; Step 5: Perform behaviors such as foraging, gathering, and rear-end, update your status and compare it with the value of the bulletin board.
Step 6: Perform the MSA algorithm on the artificial fish with the highest food concentration, compare the result with the value on the bulletin board, and replace it if it is better; Step 7: Determine whether the termination condition is satisfied, and end if satisfied, and output the optimal solution. Otherwise, return to step 5.  It can be seen from the algorithm flow that the MSAAF algorithm combines the global optimization of the artificial fish school algorithm and the local optimization of the simulated annealing algorithm. The MSAAF algorithm can improve the accuracy of optimization and does not require high initial values, which greatly improves the optimization effect.

Example analysis
The proposed simulated annealing artificial fish swarm algorithm with memory function is adopted to solve the objective function. The relevant parameters in the objective function and constraints are set as shown in Table 1.  According to relevant regulations, set the power fluctuation value allowed by the grid connection to 2%.
The relevant parameters of the MSAAF algorithm are set as follows: the total number of fish M is 60; the number of try-number is 10; the visual field is 5; the step size is 3; the crowding factor is 0.618; the initial temperature T is 50; each temperature The number of iterations L is 20; the cooling coefficient is 0.95. Using Matlab software for simulation, the AF algorithm and the MSAAF algorithm were used for 200 iterations respectively, and the comprehensive cost chart of the hybrid energy storage system was obtained as follows: It can be seen from the figure that after using the AF algorithm and the MSAAF algorithm after 200 iterations, the MSAAF algorithm is superior to the AF algorithm in both the number of iterations and the overall cost. The AF algorithm tends to be stable when iterating to 105 times, the MSAAF algorithm tends to be stable when iterating to 73 times, and the optimization accuracy of the MSAAF algorithm is better than that of the AF algorithm. Its capacity optimization results are shown in Table 2. In order to verify that the economic efficiency of the hybrid energy storage system is better than that of a single energy storage system, only the battery is used to solve the model, and its capacity optimization results are shown in Table 3 below. It can be seen from Table 2 and Table 3 that only the storage battery is used as the energy storage device, and the overall cost of the system is 970.971 million yuan. Using a hybrid energy storage system composed of storage batteries and supercapacitors, the overall cost of the system is RMB 5.559976 million, a decrease of 42.7%, and the economic benefit is better. Therefore, a hybrid energy storage system is more economical than a single energy storage system.

Conclusion
Aiming at the capacity optimization problem of hybrid energy storage system in wind-solar complementary microgrid, this paper takes the minimum comprehensive cost of the system as the objective function, takes energy conservation and state of charge as constraints, introduces the memory function on the basis of simulated annealing algorithm and it is combined with artificial fish school algorithm to optimize the capacity of the hybrid energy storage device. Simulation results show that the algorithm can effectively reduce the cost of hybrid energy storage devices and improve the economics of the system.