# Optimal Modeling for Dynamic Response of Energy Storage Systems
## 4 Optimization Parameter Search and Analysis
### Comparison of Abilities of Algorithms  
This study used traditional PSO, traditional GA, IPSO, and improved GA as candidate methods of a parameter optimization search. The convergence speeds and optimal solutions of various algorithms in the global optimal solution search were compared by the Rastrigin function. The Rastrigin function is expressed as Equation (16), and the global optimal solution of the function is always the origin. \[f(x)=\sum\limits_{i=1}^{K}\left[x_{1}^{2}-10\cos(2\pi x_{i})+10\right],\quad x _{i}\in\left[x_{i,min},x_{i,max}\right] \tag{16}\]  
This study used the Rastrigin functions of two variables and 30 variables as the testing targets, with the former being applicable to 3D mapping and is easy for the users to identify. The latter one increases the number of variables to increase the problem's complexity to verify which algorithm can search out the optimal solution under more complex conditions. When the Rastrigin function with two variables was used for verification, the four algorithms could achieve a global optimal solution, as shown in Figure 15a. The initial values of the four algorithms were random, but could converge at the global optimal solution eventually. When employing the Rastrigin function with a two variable optimization  
Figure 14: The flowchart for building the ESS WECC model. solving problem for testing, the PSO could converge at a global optimal solution rapidly, and there were merely eight iterations. This means that the method had excellent performance in the case of low problem complexity and a small number of solved variables. The IGA needed 17 iterations to solve optimization problems and was a little slower than PSO, but it could reach a global optimal solution with a small number of iterations. The IPSO algorithm converged at a global optimal solution after 45 iterations. As the algorithm aims to maintain the diversity of variables when the IPSO search exceeds the boundary, and it is likely to fall into the local optimal solution, the IPSO loses convergence speed but enhances the capability of the global search in comparison to PSO. When the problem complexity and the number of variables increased, the algorithm still had a better performance than PSO. The algorithm that converged last was GA, which needed about 181 iterations before converging at a global optimal solution. When the optimization problem complexity was increased, as the dimension of the optimization problem was too large, it could not be displayed graphically. Only the convergence speed and fitness values were marked, and the performances of various methods in searching for a global optimal solution were compared. The subsequent result is shown in Figure 15b. According to the figure, the method of PSO type excessively depends on the optimum position of individuals and the optimum position of groups and lacks effective mutability, so it is likely to fall into local optimal solutions. The condition of PSO is more severe than IPSO; the IPSO provides the possible direction of the new optimum position of groups by global optimal solution perturbation, but it is difficult to converge at the position of a global optimal solution in general. In terms of the GA type methods, the traditional GA spends more time on exploring global optimal solutions due to mutability when solving low complexity problems, but the search process will not fall into local optimal solutions. Aside from the existing mutability, the improved GA is provided with the idea of the survival of the fittest of the evolution, the offspring generation form is changed, and the diversity of the gene bank is increased, so the abundance of offspring genes obtained by the crossover operation is better than that of the traditional method, the global search capability is enhanced greatly. The subsequent optimization algorithm will select two different types of algorithms for comparison. According to the test results in this section, the IGA had good performance in the capability of global search regardless of the problem complexity.