## 4 Parameter Configuration of Reactive Power Compensation System
### Improved Particle Swarm Optimization  
At present, most scholars use random initialization to operate the particle position when using particle swarm optimization, but this will directly lead to the problem of the particle distribution becoming more and more uneven in the iterative process [30; 31; 32]. The chaotic motion has the characteristics of going through all states without repetition according to its laws within a certain range. Therefore, using chaos theory to initialize the particles in the algorithm can further enhance the diversity of the population, and fundamentally prevent the solution set from falling into a local optimum situation, which generates the corresponding chaotic sequence, as shown in Equation (6):  
\[\left\{\begin{array}{c}y(h+1)=4y(h)^{3}-3y(h)\\ -1\leq y(h)\leq 1,\ h=0,1,2,\ldots\end{array}\right. \tag{6}\]  
For particle \(i\) in W-dimensional space, the first step is to generate a W-dimensional vector \(y_{i}\)(1), and each component must be in the range of \((-1,1)\). Then, each dimension of the vector is entered into the above formula, and \(H_{\text{set}}\)-1 iterations are performed. After the iteration, the generated \(H_{\text{set}}\)-1 chaotic sequences enter the search space of the corresponding particle swarm.  
It can be obtained from the above that \(q^{t}_{\text{best}}\) represents the optimal position of the particle after one iteration; for the \(q^{t}_{\text{best}}\) generated after each iteration process, it is given a relatively reasonable weight: \(s_{t}\) (\(0<s_{t}<1\), \(\Sigma_{t}=1\)). In order to further weigh all the particles in the algorithm, the following can be obtained: \(\overline{q}_{\text{best}}=\sum\limits_{t=1}^{h}s_{t}q^{t}_{\text{best}}\). The speed update formula of the basic algorithm is replaced by \(\overline{q}_{\text{best}}\), in which \(q^{t}_{\text{best}}\_iw\) is replaced. Thus, after the improvement, the new particle speed update formula is as follows:  
\[v^{t+1}_{iw}=s_{t}v^{t}_{iw}+g_{1}f_{1}(\overline{q}_{\text{best}}-x^{t}_{iw} )+g_{2}f_{2}(d^{t}_{\text{best}\_w}-x^{t}_{dw}) \tag{7}\]  
\[x^{t+1}_{iw}=x^{t}_{iw}+v^{t+1}_{iw} \tag{8}\]  
In order to further ensure the diversity of the population, to avoid local optima at the beginning of iterative evolution, and to ensure the stability of the population and improve the ability of local searches at the later stage of iterative evolution, this paper adopts a strategy to improve the particle initialization by adaptive operators. This strategy updates the particle positions variably during the iterative evolution of the algorithm by setting the variation probability, using a relatively large variation size at the beginning of the iteration, and causing it to gradually decrease during the evolution process.  
\[\left\{\begin{array}{c}\eta(x)=1-a^{(1-\frac{x}{\text{analog}})^{b}},U(0,1)> p_{x}\\ x^{t+1}=x^{t}+\eta\cdot x^{t}\cdot U(0,1),r\geqslant 0.5\\ x^{t+1}=x^{t}-\eta\cdot x^{t}\cdot U(0,1),r\leqslant 0.5\end{array}\right. \tag{9}\]  
In this formula, \(P_{x}\): represents the probability of occurrence of mutation, which is 0.5, and the random number is \(U\)(0,1). If the value is greater than \(P_{x}\), the corresponding population particle will mutate. If the value is smaller than \(P_{x}\), the corresponding population will not mutate. Additionally, \(\eta(x)\in[0,1]\) is the variation scale of the population in the iterative evolution process; \(a\in(0,1)\); max \(gen\) is the total number of evolutionary iterations; the value of \(b\) is 2, and \(r\) is a random value.