Issue 
Sci. Tech. Energ. Transition
Volume 79, 2024
Emerging Advances in Hybrid Renewable Energy Systems and Integration



Article Number  81  
Number of page(s)  12  
DOI  https://doi.org/10.2516/stet/2024070  
Published online  15 October 2024 
Regular Article
Analysis of optimal configuration of energy storage in windsolar microgrid based on improved gray wolf optimization
^{1}
School of Electronics and Information Engineering, Chongqing Three Gorges University, Chongqing, China
^{2}
School of Electrical Engineering, Southeast University, Nanjing, China
^{*} Corresponding author: 20150011@sanxiau.edu.cn
Received:
16
July
2024
Accepted:
21
August
2024
To make full use of the electric power system based on energy storage in a windsolar microgrid, it is necessary to optimize the configuration of energy storage to ensure the stability of a multienergy system. This paper analyses the structure and function of the microgrid system, establishes the mathematical model, and analyzes the output characteristics. A doublelayer optimization model of energy storage system capacity configuration and windsolar storage microgrid system operation is established to realize PV, wind power, and load variation configuration and regulate energy storage economic operation. The mathematical model of the improved gray wolf optimization is constructed, and the typical landscape resource data of a residential district. Comparing the difference between energy storage without an installation and energy storage with improved algorithm, it is shown that the energy storage configuration of the improved gray wolf optimization improves the economy, efficient energy use, and revenue of the whole system.
Key words: Microgrid / Improved Gray Wolf Optimization (IGWO) / Optimize operation / Doublelayer optimization model / Energy storage capacity configuration
© The Author(s), published by EDP Sciences, 2024
This is an Open Access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
1 Introduction
Against the background of the Double carbon target, distributed generation is more in line with the current concept of green and environmentally friendly power generation, which can effectively absorb and utilize renewable energy sources, reducing environmental pollution. Because renewable distributed energy sources such as solar and wind power are uncontrollable, which power output characteristics exhibit intermittency and volatility due to uncertain factors like temperature, sunlight, and climate, posing significant challenges to the power system [1, 2]. Microgrid can effectively reduce the impact of intermittent power supply on the operation and control of the power grid [3], which is a typical power generation and distribution system consisting of various types of distributed energy sources, energy storage systems, PCS conversion systems, loads, and protection systems. Acting as a bridge between distributed power sources and the main grid, which provides a controllable power supply and distribution system for the main grid, minimizing the impact of distributed power source failures on the main grid, improving power quality, and enhancing power reliability [4, 5]. Power systems based on windsolar microgrids have broad adaptability and flexible construction. However, it is crucial to optimize energy storage configuration and enhance operational stability to enable the practical application of multienergy complementary systems.
Energy storage technology is divided into mechanical energy storage [6], electromagnetic energy storage [7], and electrochemical energy storage [8]. At present, the optimal landscape storage capacity allocation scheme is obtained by taking the lowest Levelized Cost of Energy (LCOE) as the optimization objective in the landscape storage model [9]. However, it only operates under the island model and does not consider the influence of energy storage capacity configuration on system stability. A capacity optimal allocation method based on continuous motion is proposed, which can effectively utilize distributed electric energy and improve electric energy efficiency [10]. A multiobjective function with annual average comprehensive cost and selfbalance function as the main indexes, based on the NSGAII algorithm, the area average comprehensive cost of different selfequilibrium ratios is calculated. The life cycle cost compound model of energy storage for the economic operation of microgrid is established, and the integrated configuration method of planning and operation is proposed. These methods take into account the minimum of the average annual cost of energy storage and the maximum of integrated benefits but do not consider the size of energy storage power distribution and economic costs.
The output and load of the system will affect the running state of the system, and the change of the running state will affect the economic benefit, thus presenting uncertainty. It is necessary to enhance the optimal allocation of energy storage and improve the operation stability in order to make the multienergy complementary system able to be applied in practical engineering. In view of these problems, from the point of view of the actual application demand of landscape storage microgrid. This paper considers the cooperation of energy storage capacity and the operation of windsolar storage based on a doublelayer optimization model. An Improved Gray Wolf Optimization is used to solve the multiobjective optimization of energy storage capacity and get the optimized configuration operation plan. Therefore, it can improve the utilization ratio of energy, reduce the source load deviation rate and improve the system stability, provide the decisionmaking basis for the development, application, and popularization of the microgrid.
2 Principle analysis and methodology
2.1 Structure of energy storage in windsolar microgrid
The microgrid can flexibly regulate and control the energy, improve the absorption rate of the new energy, and ensure the safe and stable operation of the power grid. According to Operation Mode, it is divided into independent microgrid and gridconnected microgrid. The gridconnected microgrid is connected to the large grid [11], focusing on the local integration of energy and improving the reliability of the power supply. In this paper, the gridconnected microgrid is the research object. The microgrid topology is mainly composed of a power generation system, energy storage system, load, converter, and power grid. The schematic diagram of the microgrid structure is shown in Figure 1.
Figure 1 Schematic diagram of microgrid structure. 
2.2 Optimization model of energy storage in windsolar microgrid
2.2.1 Photovoltaic system model
The photovoltaic power generation system is composed of series and parallel solar cells, the actual output power of the PV system is also changing with the different operating characteristics of the PV module under different environmental factors [12]. The photovoltaic output power (P_{PV}) is given by equation (1):$${P}_{\mathrm{PV}}={G}_{\mathrm{PV}}{P}_{\mathrm{STC}}\frac{{Q}_{\mathrm{C}}}{{Q}_{\mathrm{STC}}}\left[1+\mu \left({T}_{\mathrm{C}}{T}_{\mathrm{STC}}\right)\right],$$(1)where G_{PV} represents the number of PV modules, P_{STC} represents the rated power of photovoltaic power generation, Q_{C} represents the actual light intensity, Q_{STC} represents the standard light intensity, and μ represents the Power temperature coefficient.
2.2.2 Wind power generation model
According to the principle of Betz, The whole operation process of wind power generation is related to wind speed, The mathematical expression for a wind turbine (P_{wt}) is represented by the following equation (2):$${P}_{\mathrm{wt}}=\frac{1}{2}\rho \pi {R}^{2}{v}^{3}{C}_{P},$$(2)where ρ represents the air density, R represents the blade radius, v represents the wind speed, C_{p} represents the coefficient of wind energy utilization.
Wind Turbine (WT) between output power and wind speed is defined as follows:$${P}_{\mathrm{wt}}=\{\begin{array}{cc}\begin{array}{c}0\\ {P}_{e}\cdot \frac{v{v}_{\mathrm{ci}}}{{v}_{e}{v}_{\mathrm{ci}}}\\ \begin{array}{c}{P}_{e}\\ 0\end{array}\end{array}& \begin{array}{c}0\le v<{v}_{\mathrm{ci}}\\ {v}_{\mathrm{ci}}\le v<{v}_{e}\\ \begin{array}{c}{v}_{e}\le v<{v}_{\mathrm{co}}\\ {v}_{\mathrm{co}}\le v\end{array}\end{array}\end{array},$$(3)where P_{e} represents the rated power of wind turbine, v_{ci} represents the cut into wind speed, v_{e} represents the actual wind speed, v_{co} represents the cutoff wind speed.
The output power of wind speed has three stages, the relationship between wind speed and power is illustrated in Figure 2.
Figure 2 Wind speedpower characteristic curve. 
2.2.3 Energy storage system model
Energy storage technology can adjust peak and fill valleys, improve power quality, and effectively reduce network loss. In many kinds of energy storage, battery energy storage has the advantages of low cost, fast response speed, and many applicable scenarios. The energy storage battery used in this paper is a lithium iron phosphate battery, which is widely used in the field of energy storage because of its high cycle life, good charge and discharge performance [13]. The equivalent circuit model is shown in Figure 3.
Figure 3 Equivalent circuit model of lithium battery. 
The expression for the circuit relationship is:$$\{\begin{array}{c}{U}_{3}={U}_{0}{R}_{2}{I}_{3}{U}_{1}\\ {I}_{3}={C}_{1}\frac{\mathrm{d}{U}_{1}}{\mathrm{d}t}+\frac{{U}_{1}}{{R}_{1}}\end{array},$$(4)where U_{0} represents the opencircuit voltage, U_{1} is the terminal voltage of capacitor C_{1}, U_{3} and I_{3} represents the battery voltage and discharge current.
2.3 Capacity optimization configuration model of energy storage in windsolar microgrid
There are two problems to be considered in the configuration of energy storage systems, one is how to optimize the configuration of energy storage capacity, and the other is how to operate the microgrid economically after configuration. Therefore, a doublelayer optimization model is proposed. The upper layer is under the microgrid system of wind and solar energy storage, with the lowest total cost of energy storage configuration as the target. In order to maximize the operation benefit of the windsolar storage system, the realtime output optimization model of each generation unit in the windsolar storage system is established in the lower layer.
The doublelayer optimization model is composed of the objective functions and constraints of the upper and lower levels [14]. The upperlevel model has the right to make decisions in advance and feed those decisions back to the lowerlevel optimization model. The lowerlevel model utilizes the optimized results from the upper level as initial conditions. Combining the objective function and constraints, it adjusts and solves for the lowerlevel optimization results. These optimized results are then passed back to the upper level, ultimately leading to the determination of the optimal solution. The framework of the doublelayer optimization model is shown in Figure 4.
Figure 4 The framework of twolevel optimization model. 
The objective functions and constraints of the upper and lower models are shown in the formula (5):$$\{\begin{array}{cc}\underset{x}{\mathrm{min}}F=F\left(x,y\right)& \mathrm{s}.G\left(x,y\right)\le 0\\ \underset{y}{\mathrm{min}}f=f\left(x,y\right)& \mathrm{s}.g\left(x,y\right)\le 0\end{array},$$(5)where x and y represents the upper and lower decision variables, F(x, y) and f(x, y) represents the upper and lower objective functions, G(x, y) and g(x, y) represents the Upper and lower constraints.
2.3.1 Upper optimization model
The upper layer aims at the lowest total cost (C_{all}) of energy storage configuration, including purchase cost, Operation Cost and battery replacement cost. The objective function (f_{1}) is given by equation (6):$${f}_{1}=\mathrm{min}\left({C}_{\mathrm{all}}\right),$$(6) C_{all} is governed by the following equation (7):$${C}_{\mathrm{all}}={C}_{1}+{C}_{2}+{C}_{3},$$(7)where C_{1} represents the cost of purchase, C_{2} represents the cost of operation and maintenance, C_{3} represents the cost of battery replacement.
(1) Energy storage battery charge and discharge power constraints
The charging power of the energy storage battery at ttime (P_{c}(t)) and the discharging power of the energy storage battery at ttime (P_{f}(t)) are represented by the following equation (8):$$\{\begin{array}{c}{P}_{C\mathrm{min}}\left(t\right)\le {P}_{C}\left(t\right)\le {P}_{C\mathrm{max}}\left(t\right)\\ {P}_{f\mathrm{min}}\left(t\right)\le {P}_{f}\left(t\right)\le {P}_{f\mathrm{max}}\left(t\right)\end{array},$$(8)where P_{cmin} (t) and P_{cmax} (t) represents the minimum and maximum charge power. Where P_{fmin} (t) and P_{fmax} (t) represents the minimum and maximum discharge power.
(2) Energy storage rated power (P_{e}) and capacity (E_{e}) constraints$$\{\begin{array}{c}{P}_{e}\le {P}_{M}\\ {E}_{e}\le {E}_{M}\end{array},$$(9)where P_{M} and E_{M} represents the maximum power of energy storage and the maximum capacity of energy storage.
2.3.2 Lowerlevel optimization model
The lower level is to maximize the economic benefits of the operation of the energy storage system (f_{2}). The decision variable is the output characteristic of each generation unit, f_{2} is given by equation (10):$$\mathrm{max}{f}_{2}=\sum _{t=1}^{24}\mathrm{}\left({C}_{4}+{C}_{5}+{C}_{6}\right),$$(10)where C_{4} represents the revenue from purchasing and selling electricity on the grid, C_{5} represents the revenue from energy storage charge and discharge, C_{6} represents the revenue from photovoltaic and wind power generation.
(1) Revenue from purchasing and selling electricity on the grid
The electric charge obtained by the system in selling to the user at different times, C_{4} is represented by the following equation (11):$${C}_{4}={C}_{\mathrm{buy}}{C}_{\mathrm{sell}}.$$(11)
C_{buy} and C_{sell} are governed by the following integral equation (12):$$\{\begin{array}{c}{C}_{\mathrm{buy}}={\int}_{0}^{T}\mathrm{}{h}_{\mathrm{buy}}\cdot {P}_{\mathrm{buy}}\left(t\right)\mathrm{d}t\\ {C}_{\mathrm{sell}}={\int}_{0}^{T}\mathrm{}{h}_{\mathrm{sell}}\cdot {P}_{\mathrm{sell}}\left(t\right)\mathrm{d}t\end{array},$$(12)where h_{buy} and h_{sell} are the unit price of purchasing electricity from the grid and selling electricity respectively, P_{buy}(t) and P_{sell}(t) represents the amount of electricity purchased and sold from the grid.
(2) Energy storage charge and discharge income
The charging and discharging income of the energy storage system refers to the price income of the system at peak and valley can be formulated as follows:$$\{\begin{array}{c}{C}_{c}=\sum _{i=1}^{N}\mathrm{}\sum _{i=1}^{T}\mathrm{}({m}_{t}\cdot {P}_{t,c}\cdot \Delta t)\\ {C}_{f}=\sum _{i=1}^{N}\mathrm{}\sum _{i=1}^{T}\mathrm{}({m}_{t}\cdot {P}_{t,f}\cdot \Delta t)\end{array},$$(13)Where C_{c} and C_{f} are charge cost and discharge income respectively, _{N} represents the number of energy storage systems, T represents the energy storage scheduling cycle.
(3) Revenue from photovoltaic and wind power generation
C_{6} associated with government subsidies for electricity generation, the expression is defined as follows:$${C}_{6}={k}_{1}{P}_{\mathrm{pv}}+{k}_{2}{P}_{\mathrm{wt}},$$(14)where k_{1} and k_{2} are the subsidy prices of photovoltaic and wind turbines respectively.
(4) Power balance constraint$${P}_{\mathrm{pv}}\left(t\right)+{P}_{\mathrm{wt}}\left(t\right)+{P}_{\mathrm{cf}}\left(t\right)+{P}_{\mathrm{grid}}\left(t\right)={P}_{\mathrm{load}}\left(t\right).$$(15)
Installed capacity and power constraints:$$\{\begin{array}{c}0\le {S}_{\mathrm{PV}}\le {S}_{\mathrm{PV},\mathrm{max}}\\ 0\le {S}_{\mathrm{WT}}\le {S}_{\mathrm{WT},\mathrm{max}}\end{array}.$$(16)
Tieline power transmission capacity constraints:$${P}_{\mathrm{grid},\mathrm{min}}\left(t\right)\le {P}_{\mathrm{grid}}\left(t\right)\le {P}_{\mathrm{grid},\mathrm{max}}\left(t\right).$$(17)
Here, P_{pv}(t) and P_{wt}(t) describes the the power output of PV and wind power respectively, P_{cv}(t), P_{grid}(t), P_{load}(t) represents power in different places, S_{pv} and S_{wmax} represents the maximum value of the resource capacity constraint.
2.4 Improved gray wolf optimization model
The Grey Wolf Optimizer (GWO) is a swarm intelligence optimization algorithm inspired by the cooperative hunting behavior of the gray wolves in nature [15]. In the gray wolf population, there is a strict hierarchical system. During cooperative hunting, different ranks of wolves have distinct roles, each wolf completes its assigned task until the prey is captured. This hierarchical structure enables the algorithm to perform both local optimization and global search, making it simple and easy to implement. The distribution of the gray wolf population system is shown in Figure 5.
Figure 5 Distribution of gray wolf population system. 
The α wolf is the first level, which is the leader of the population, and has the strongest coordination management and leadership ability, the wolf’s overall action is ordered by the wolf, as the optimal solution in the optimization algorithm. The β wolf is the second layer of rank, obeying α wolf, playing the role of assisting α wolf, being the liaison between α wolf and lower rank, it belongs to the suboptimal solution in the optimization algorithm. The δ wolf is the third level, are subordinate to both the α wolf and the β wolf. Their responsibility is to relay information between the α wolf and β wolf, ensuring the safety of the pack and caring for young wolves. The ω wolf is the lowest level of the hierarchy, obligated to obey all other ranks. Their primary role is to execute the hunting tasks for capturing prey.
The key problem of optimal allocation of energy storage capacity is to optimize the output power and load power distribution of photovoltaic and wind power generation systems. In the GWO algorithm, the ω wolf is guided by the α wolf, the β wolf, and the δ wolf, and approaches the target gradually until the final capture target [16]. According to the natural theory of gray wolf population, there is a class relationship among α wolf, β wolf and δ wolf, and there must be a strong or weak guiding ability among them. If the gap of guiding ability is not specified, the update times of GWO algorithm will increase, and it will fall into the local optimal solution. Therefore, based on the original GWO algorithm, an Improved Gray Wolf Optimization (IGWO) algorithm is proposed to allocate of fitness values to the three wolves.
The IGWO algorithm is a swarm intelligence optimization algorithm [17], the dynamic mechanism based on weighted allocation determines the hierarchical positions of the α wolf, β wolf and δ wolf. The higher the weight coefficient of a wolf, the higher its rank, indicating a greater leadership role, stronger guidance over other wolves, and accelerated pursuit of the target, ultimately leading to the discovery of better solutions. The IGWO algorithm can speed up the search iteration rate, improve the search accuracy, and effectively avoid the algorithm falling into the global extremum.
2.4.1 Dynamic weight proportional mechanism
α wolf, β wolf and δ wolf according to their own and prey position issue movement instructions, the movement direction and step size of ω wolf can be expressed as follows:$${X}_{1}={X}_{\alpha}{A}_{1}\cdot {D}_{\alpha},$$(18) $${X}_{2}={X}_{\beta}{A}_{2}\cdot {D}_{\beta},$$(19) $${X}_{3}={X}_{\delta}{A}_{3}\cdot {D}_{\delta},$$(20) $$X\left(t+1\right)=\frac{{X}_{1}+{X}_{2}+{X}_{3}}{3},$$(21)where X_{α}, X_{β}, X_{δ} represents the position of α wolf, β wolf and δ wolf, D_{α}, D_{β}, D_{δ} represents the position ω wolf to α wolf, β wolf and δ wolf, A_{1}, A_{2}, A_{3} represents the random numbers.
The dynamic weighting mechanism are:$${\omega}_{1}=\frac{\left{X}_{1}\right}{\left{X}_{1}+{X}_{2}+{X}_{3}\right},$$(22) $${\omega}_{2}=\frac{\left{X}_{2}\right}{\left{X}_{1}+{X}_{2}+{X}_{3}\right},$$(23) $${\omega}_{3}=\frac{\left{X}_{3}\right}{\left{X}_{1}+{X}_{2}+{X}_{3}\right},$$(24)where ω_{1,} ω_{2,} ω_{3} represents the proportion of learning weights for α wolf, β wolf and δ wolf, So the updated location of ω wolf is given by equation (25):$$X\left(t+1\right)=\frac{\left({\omega}_{1}{X}_{1}+{\omega}_{2}{X}_{2}+{\omega}_{3}{X}_{3}\right)}{3}.$$(25)
The algorithm flow is depicted in Figure 6.
Figure 6 Algorithm flow chart. 
Select three functions of the test are shown in Table 1, using MATLAB R2019b software, the IGWO and GWO algorithms are simulated and verified.
Functions of test.
The population size N of IGWO and GWO is set to 100, the maximum number of iterations is 1000, and the maximum convergence factor a is 2. The optimal values, mean values, and standard deviations of different test functions are obtained and analyzed. The test results are shown in Table 2.
Test results.
Comparing the results of the three test functions, compared with the GWO algorithm, the IGWO algorithm has a better ability to seek the optimal solution. In the tests of functions f_{1}, f_{2}, and f_{3}, the optimal values, mean values, and standard deviations obtained by the IGWO algorithm are the minimum values and the closest to the theoretical values.
The convergence comparison diagram of the function shown in Figure 7. Compared with GWO algorithm, IGWO algorithm has the fastest convergence speed in the test functions of f_{1,} f_{2}, and f_{3}.
Figure 7 (a) Test the convergence of function f_{1}. (b) Test the convergence of function f_{2}. (c) Test the convergence of function f_{3}. 
2.4.2 Solve the model
The improved gray wolf algorithm is used to solve the doublelayer optimization model. First, through the upper model to do the scheme, the scheme will be passed to the lower model. According to the scheme, combining the objective function and the constraint condition, the lower model feeds back the optimal scheme to the upper model, and then calculates the objective function of the upper model. Finally, the global optimal solution of the doublelayer optimization model is obtained.
The solution flow is shown in Figure 8.
Figure 8 Solution flow. 
The detailed process is as follows:

Input the basic data of the windsolar storage system, such as photovoltaic system output, wind power system, output and load demand power;

The parameters of the improved gray wolf algorithm are set, the population size n of the gray wolf in the upper model is initialized. The maximum number of iterations and optimization variables are set, and the dimension t of each gray wolf is set to 24 h running period. In other words, gray wolf individuals are randomly generated to meet the constraints of the upperlevel optimization model, where each individual represents a configuration scheme of energy storage system.

In the previous step, the capacity of the upper layer energy storage battery is transferred to the lower layer model. The power configuration at each time of energy storage is taken as the gray wolf individual, and the solution model is calculated. If there is a solution, the optimal operation scheme satisfying the lowerlevel constraints is obtained and fed back to the upperlevel model, no solution to return to the previous step.

The optimal operation scheme of the lowerlevel system is transferred to the upperlevel configuration model. The upperlevel objective function and the optimal configuration scheme of the energy storage system are updated.

If the convergence condition is satisfied, then the optimal solution α wolf is output, and the process of solving the model is finished. Otherwise the population is renewed, the location and parameters of ω wolf are updated according to the location of α wolf, the β wolf and the δ wolf.
3 Results and discussion
3.1 Study subjects and data
Taking a residential district as the research object [18], where the annual average wind speed is about 4 m/s, the average annual light intensity is about 0.14 kw/m^{2}, the average daily load power is about 1300 kW.
Distributed power equipment includes photovoltaic system, wind turbine, battery system. PV, wind turbine cost parameters was tabulated as Table 3.
PV, wind turbine cost parameters.
The battery cost parameters are shown in Table 4.
Battery cost parameters.
The range of SOC of lithium battery is [0.2, 1], the specific parameters of the algorithm are: population size N = 20, maximum iteration number t_{max} = 100, a_{max} = 100, T is 24 h running cycle, and the simulation environment is MATLAB2019b.
According to the current electricity price policy, peak and valley electricity prices are applied in the residential quarter. 07:00–12:00 and 18:00–22:00 are peak prices, 00:00–07:00 and 22:00–00:00 are valley price, as shown in Table 5.
Peak and valley electricity prices.
3.2 Analysis of raw data
3.2.1 Grid configuration
The maximum daily load of the residential district is 450 kW, and the minimum daily load is 70 kW. The installed capacity of the PV system is 550 kW, and the installed capacity of the wind power system is 500 kW [19]. Solar and wind output data on a typical day are shown below.
As shown in Figure 9, photovoltaic power output is mainly concentrated between 8:00 AM and 5:00 PM. Photovoltaic power output is nearly zero from 6:00 PM to 7:00 AM the next day. From 8:00 AM, the power output trend gradually climbs, reaching its peak between 12:00 PM and 1:00 PM, and then gradually declines.The trend of photovoltaic output characteristics is symmetrical, the output characteristics are relatively stable. The output of wind power fluctuates greatly and is unstable, the overall trend is characterized by large output at night and small output during the day, and the overall trend between the photovoltaic and wind power is complementary.
Figure 9 Photovoltaic and wind power output curve. 
3.2.2 Typical daily operation
The maximum transmission power between the power grid and residential district is set to 500 kW. The distribution of energy and electricity purchase and sale is shown in Figure 10.
Figure 10 Distribution of energy and electricity. 
When the power grid is not equipped with energy storage, the statistics of the data indicators are shown in Table 6.
Data indicators of no energy storage configuration.
When the residential district is not equipped with energy storage, the user can only meet the electricity demand through photovoltaic, wind power or purchase electricity from the grid. At 0–7o’ clock, when the photovoltaic output is zero, the wind power generate electricity to temporarily maintain the load demand. Because the combined solar and wind power still cannot meet the load demand, and can only buy electricity from the grid to maintain the stability of the entire residential district of the operation, at this time the price of electricity for the valley price. At 7–10 o’clock, the load demand is still too large, and photovoltaic, wind power are too small, can only spend a higher cost to buy electricity from the grid, increase the peak power grid pressure. At 10–15 o’clock, the load demand is reduced, the power generated by photovoltaic and wind power exceeds the load demand and can sell excess electricity to the grid. At 15–21 o’clock, the demand for load increases gradually, and photovoltaic, wind power output gradually weakened the need to buy electricity at peak prices. At 21–24 o’clock, load demand drops sharply, and wind turbines generate more electricity, which sell to the grid for a small profit.
3.2.3 Deficiencies and problems
When the residential district is not equipped with energy storage, lack economy and flexibility, the main deficiencies and problems are as follows:
(1) Insufficient power selfbalance
In the absence of a microgrid system with energy storage, users can only meet their electricity needs through photovoltaic and wind power generation or by purchasing electricity from the grid. The power exchange is shown in Figure 11.
Figure 11 Power exchange. 
As can be seen from Figure 11, the power exchange between the power grid and the main power grid is very large, up to 250%. The power balance of the power grid mainly depends on the main power grid, and cannot reach the current microgrid power selfbalance of 80% of the requirements.
(2) The microgrid has poor regulation ability
First of all, photovoltaic and wind power output are influenced by the uncontrollability of solar and wind energy, and the regulation of the power grid is limited. Secondly, when the peak period of power consumption, the shortage of photovoltaic and wind power resources, coupled with the lack of energy storage system. In order to meet consumer demand, one can only buy electricity from the grid, and increase the peak power grid pressure.
(3) The cost of buying electricity is high
During the two peak periods of power consumption, 831.28 kWh and 926.45 kWh were purchased from the power grid respectively, indicating that in the case of distributed generation, the demand for electricity is high and the dependence on the power grid is large, and the total amount of electricity purchased during the whole day is 2045.12 kWh, the total cost of purchasing electricity is 1011.35 yuan.
(4) The energy returns is Low
Only in the 10–14o’clock, the most adequate energy reserves. In order to meet their own load under the premise of the remaining electricity sold to the grid at a lower price, according to Table 6, the daily revenue of 543.76 yuan.
3.2.4 Simulation analysis of improved algorithm
An improved gray wolf optimization is used to optimize the allocation of energy storage capacity, and the optimal solution of energy storage capacity allocation is obtained. The distribution of energy and electricity sales using the improved algorithm is shown in the diagram.
After the energy storage is configured by the improved gray wolf optimization, the data indexes are shown in the Table 7.
Various data indicators.
As shown in Figure 12 and Table 7, an improved gray wolf algorithm is used to configure the energy storage capacity. At 9–14 o’clock, the load demand is reduced, photovoltaic, wind power output more, and energy storage systems can be precharged to sell surplus power to the grid, increasing revenue. At the same time at 22–24o’clock, more abundant resources, but also to the grid selling electricity, two time periods have increased the day’s revenue from electricity sales. In terms of the amount of electricity purchased, the total cost of purchasing electricity for one day is 476.22 yuan, which is 535.13 yuan less than the system without energy storage configuration.
Figure 12 Distribution of energy and electricity. 
Energy storage charge and discharge power and state of charge are shown in Figure 13.
Figure 13 Charge and discharge power and state of charge. 
As shown in Figure 13, the energy storage system still discharges when the load demand is high and recharges during the day when the scenery resources are sufficient. But at 21–24o’clock, with low load requirements and low energy storage and charging power, the wind resource can meet some of the storage and charging needs, while selling a small amount of electricity to the grid, adding additional revenue.
The analysis of the example is divided into two different scenarios, one is no energy storage device, and the other is an energy storage device based on an improved gray wolf algorithm. The comparison and analysis of the two optimal configuration schemes of energy storage capacity are shown in Table 8.
The comparison and analysis of the two optimal configuration schemes of energy storage capacity.
When there is no energy storage configuration, the total amount of electricity purchased during the day was 2045.12 kWh, with a total cost of 1011.35 yuan. The total amount of electricity sold was 1445.27 kWh, with a revenue of 543.76 yuan and the cost of purchasing and selling electricity is −467.59 yuan. However, there are some problems such as poor selfbalance of power, poor regulation ability of microgrid, low energy income, and high cost of power purchase. Under this configuration mode, the whole microgrid system has poor economy and flexibility and depends heavily on the power grid. Using the improved gray wolf algorithm to configure the energy storage capacity, the total amount of electricity purchased during the day was 918.23 kWh, with a total cost of 476.22 yuan. The total amount of electricity sold was 417.45 kWh, with a revenue of 164.38 yuan and the cost of purchasing and selling electricity is −253.07 yuan. Compared with no energy storage configuration, the total cost of purchasing and selling electricity is reduced, and in an optimal output state, the economic benefit of the whole system is improved.
4 Conclusion
With the increase of gridconnected capacity of new energy sources such as wind power and solar power, considering the stability and security of microgrid operation, In this paper, the optimal allocation of energy storage capacity of windsolar microgrid is studied, the mathematical models of photovoltaic power generation, wind power generation and energy storage system is established, the output characteristics of each module is analyzed.
A doublelayer optimization model of energy storage system capacity allocation and operating output of windsolar storage system is established. An optimal configuration method based on an improved gray wolf algorithm is proposed. Finally, an example of a residential district is analyzed, an improved algorithm is used to optimize the allocation of energy storage capacity, and the optimal solution of energy storage capacity is obtained. At the same time, the sales revenue of the energy storage system has been improved, which verifies that the scheme of energy storage system configuration capacity proposed in this paper is reasonable and effective. Contributes to the economic and stable operation of residential microgrid, can improve the efficient energy use rate, accelerate the convergence rate, increase the benefit of electricity sales, and efficiently seek the optimal solution of energy storage capacity allocation.
In this paper, the simulation data is selected for the study of a typical residential district. In future research, we can further consider different scenarios of microgrid system energy storage optimization configuration, such as office buildings, parks, and so on. In addition, we can further study the influence of microgrid system with hydrogen energy as storage and hot and cold power as load on the optimal capacity allocation.
Acknowledgments
The authors acknowledge the natural science foundation of Chongqing (Grant: cstc2021jcyjmsxmX0301, 2022NSCQMSX4086), the Science and Technology Research Program of Chongqing Municipal Education Commission(Grant: KJZDK202201203) and Wanzhou Science and Technology Fund (Grant: wzst2023,wzstc20220113, wzstc20230108).
Conflicts of interest
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Data availability statement
The datasets used and/or analyzed during the current study are available from the corresponding author upon reasonable request.
References
 Spichartz B., Günther K., Sourkounis C. (2022) New stability concept for primary controlled variable speed wind turbines considering wind fluctuations and power smoothing, IEEE Trans. Ind. Appl. 58, 2, 2378–2388. [CrossRef] [Google Scholar]
 Jia X., Zhang Y., Tan R.R., Li Z.W., Wang S.Q., Wang F., Fang K. (2022) Multiobjective energy planning for China’s dual carbon goals, Sustain. Prod. Consum. 34, 552–564. [CrossRef] [Google Scholar]
 Wei X., Xiangning X., Pengwei C. (2018) Overview of key microgrid technologies, Int. Trans. Electr. Energy Syst. 28, 7, 2566. [Google Scholar]
 Hafez O., Bhattacharya K. (2021) Optimal planning and design of a renewable energy based supply for microgrids, Renew. Energy 165, 127. [CrossRef] [Google Scholar]
 Cheng H., Hu X., Wang L., Liu Y., Yu Q. (2019) Review on research of regional integrated energy system planning, Autom. Electr. Power Syst. 43, 7, 2–13 [Google Scholar]
 Gautam K.R., Andresen G.B., Victoria M. (2022) Review and technoeconomic analysis of emerging thermomechanical energy storage technologies, Energies 15, 17, 6328. [CrossRef] [Google Scholar]
 Xu P., Wang G.C., Cai X., Shen H.Y., Jiang W.X. (2022) Design and optimization of highefficiency metadevices based on the equivalent circuit model and theory of electromagnetic power energy storage, J. Phys. D Appl. Phys. 55, 19, 195303. [CrossRef] [Google Scholar]
 Mathis T.S., Kurra N., Wang X., Pinto D., Simon P., Gogotsi Y. (2019) Energy storage data reporting in perspective – guidelines for interpreting the performance of electrochemical energy storage system, Adv. Energy Mater. 9, 39, 1902007. [CrossRef] [Google Scholar]
 Qingcheng Y.A.O., Xiaoling Y. (2020) Optimal configuration of independent microgrid based on Monte Carlo processing of source and load uncertainty, Energy Storage Sci. Technol. 9, 1, 186. [Google Scholar]
 Xin L., Yu H., Jing Z., Jia L. (2024) Optimal allocation of hybrid energy storage capacity based on ISSAoptimized VMD parameters. Electronics 13, 13, 2597. [CrossRef] [Google Scholar]
 Silva D.P., Salles J.L.F., Fardin J.F., Pereira M.R., Ottz V.C., Silva F.B., Pignaton E.G. (2021) Measured and forecasted weather and power dataset for management of an island and gridconnected microgrid, Data Brief 39, 107513. [CrossRef] [PubMed] [Google Scholar]
 Barbon A., Ayuso P.F., Bayon L., Silva C.A. (2021) A comparative study between racking systems for photovoltaic power systems, Renew. Energy 180, 424–437. [CrossRef] [Google Scholar]
 Blomgren G.E. (2016) The development and future of lithium ion batteries, J. Electrochem. Soc. 164, 1, 5010–5019. [Google Scholar]
 Rahman M.M., Oni A.O., Gemechu E., Kumar A. (2020) Assessment of energy storage technologies: A review, Energy Convers. Manage. 223, 113295. [CrossRef] [Google Scholar]
 Niu P., Niu S., Chang L. (2019) The defect of the Grey Wolf optimization algorithm and its verification method. Knowl. Based Syst. 171, 37–43. [CrossRef] [Google Scholar]
 Igiri C.P., Singh Y., Poonia R.C. (2020) A review study of modified swarm intelligence: particle swarm optimization, firefly, bat and gray wolf optimizer algorithms, Recent Adv. Comput. Sci. Commun. 13, 1, 5–12. [CrossRef] [Google Scholar]
 Teng Z., Lv J., Guo L. (2019) An improved hybrid grey wolf optimization algorithm, Soft Comput. 23, 6617–6631. [CrossRef] [Google Scholar]
 Zhang Y., Li Z., Han Z.Y. (2024) Optimal configuration of energy storage capacity of microgrid with wind and solar energy based on NSWOA, Electric. Technol. 6, 36–40. [Google Scholar]
 Li Z.W., Fan D.F., Zeng C., He L. (2024) Study on optimal configuration and Operation Strategy of energy storage system considering wind and solar absorption. Sci. Technol. Energy Storage, 1–13. https://doi.org/10.19799/j.cnki.20954239.2024.0165 [Google Scholar]
All Tables
The comparison and analysis of the two optimal configuration schemes of energy storage capacity.
All Figures
Figure 1 Schematic diagram of microgrid structure. 

In the text 
Figure 2 Wind speedpower characteristic curve. 

In the text 
Figure 3 Equivalent circuit model of lithium battery. 

In the text 
Figure 4 The framework of twolevel optimization model. 

In the text 
Figure 5 Distribution of gray wolf population system. 

In the text 
Figure 6 Algorithm flow chart. 

In the text 
Figure 7 (a) Test the convergence of function f_{1}. (b) Test the convergence of function f_{2}. (c) Test the convergence of function f_{3}. 

In the text 
Figure 8 Solution flow. 

In the text 
Figure 9 Photovoltaic and wind power output curve. 

In the text 
Figure 10 Distribution of energy and electricity. 

In the text 
Figure 11 Power exchange. 

In the text 
Figure 12 Distribution of energy and electricity. 

In the text 
Figure 13 Charge and discharge power and state of charge. 

In the text 
Current usage metrics show cumulative count of Article Views (fulltext article views including HTML views, PDF and ePub downloads, according to the available data) and Abstracts Views on Vision4Press platform.
Data correspond to usage on the plateform after 2015. The current usage metrics is available 4896 hours after online publication and is updated daily on week days.
Initial download of the metrics may take a while.