# Optimal Modeling for Dynamic Response of Energy Storage Systems
## 3 Introduction to Key Parameter Identification and Optimization Algorithm
### Improved Particle Swarm Optimization  
The improved particle swarm optimization (IPSO) improves the traditional particle swarm optimization (PSO). The problems of too fast convergence, easy falling into the local optimal solution, and the problems derived when the search position exceeds the preset range are fixed, so the global optimal solution can be found more efficiently [18; 19; 20; 21].  
The PSO is an algorithm based on group relations. According to the observation on animals with social structures in nature, the individuals of a group share the received information with each other, where the information sharing brings advantages to the  
Figure 10: The OAT sensitivity analysis flowchart.  
development and evolution of the group. The theoretical diagram of a mathematical model is shown in Figure 11.  
The direction of the next step of the particles in the group of traditional PSO is influenced by their experience, and the shared information of the group is expressed as Equations (1) and (2):  
\[v_{ij}^{(t+1)}=\omega\cdot v_{ij}^{(t)}+c_{1}R\times\left(\textit{pbest}-x_{ij} ^{(t)}\right)+c_{2}R\times\left(\textit{gbest}-x_{ij}^{(t)}\right) \tag{1}\]  
\[x_{ij}^{(t+1)}=x_{ij}^{(t)}+v_{ij}^{(t+1)} \tag{2}\]  
\(v_{ij}^{t}:\) Velocity of \(x_{ij}\) at time \(t\)  
\(v_{ij}^{(t+1)}:\) Velocity of \(x_{ij}\) at time \(t+1\)  
\(x_{ij}^{(t)}:\) Position of \(x_{ij}\) at time \(t+1\)  
\(\omega:\) Inertia weight of \(x_{ij}\)  
\(c_{1}\), \(c_{2}:\) Acceleration constant  
\(R:\) Random number between 0 and 1  
\(\textit{pbest}:\) Personal best value  
\(\textit{gbest}:\) Global best value  
To enhance the global search capability of the optimal solution, the improved PSO modifies the generation method of three variables of the weighting factors, \(\omega\), \(c_{1}\), and \(c_{2}\) in (1), expressed as Equations (3)-(5). his method enhances the dependence of particles on their optimal experience at the initial stage of iteration and lays emphasis on the group experience at the late stage of iteration.  
\[\omega=\omega_{max}-(\omega_{max}-\omega_{min})\times\left(\frac{j}{N}\right) ^{2} \tag{3}\]  
\[c_{1}=(c_{max}-c_{min})\times\frac{N-j}{N}+c_{min} \tag{4}\]  
\[c_{2}=(c_{min}-c_{max})\times\frac{N-j}{N}+c_{max} \tag{5}\]  
\(\omega_{max}:\) Maximum value of \(\omega\)  
\(\omega_{min}\): Minimum value of \(\omega\)  
\(c_{max}\): Maximum value of \(c_{1}\), \(c_{2}\)  
\(c_{min}\): Minimum value of \(c_{1}\), \(c_{2}\)  
\(j\): The iteration of this time  
\(N\): Number of total iteration  
Figure 11: Schematic diagram of a mathematical model of PSO.  
Additionally, the IPSO modifies the particle position exceeding the boundary. This was set as the coordinates exceeding the boundary dimensions in the past. To enhance the search diversity, Ref. [19] proposed the method of Equation (6)  
\[v_{ij_{max}}^{(t+1)}=-\frac{d}{D}\cdot v_{ij}^{(t+1)} \tag{6}\]  
\(d\): The distance between the particle and its violation boundary  
\(D\): The variant range  
In addition, Ref. [19] proposed a method to improve a genetic algorithm that excessively falls into the local optimal solution, a certain perturbation is provided for a global optimal solution to enlarge the search area, and the magnitude of perturbation is determined according to the current number of iterations. The specific method is expressed as Equations (7) and (8).  
\[p_{g}(\tau)=p_{g}(\tau)+e_{d}p_{g}(\tau) \tag{7}\]  
\[e_{d}=1-(1+r_{d})e^{(1-\frac{\tau}{\tau})} \tag{8}\]  
\(p_{g}\): The best global solution  
\(e_{d}\): The extrapolation coefficient  
\(r_{d}\): The uniform distributed number between 0 and  
\(\tau\): The iteration of this time  
\(T\): Number of total iteration  
The flowchart of the IPSO is shown in Figure 12.