The operation flow of particle swarm optimization (PSO) is presented, at the same time the PSO algorithm and GA algorith m are used to find the optimal value of the standard function, simu lation results show that the PSO algorith m has better global search performance and faster search efficiency. The inertia weight decreasing strategy of PSO algorith m is studied, the simulation results show that the concave function decreasing strategy can accelerate the convergence rate of the algorithm. The stability control of the DC-side voltage is very important for the static var generator (SVG) co mpensation, but the disadvantages of the traditional PI control are fixed parameters and poor adaptability of dynamic response, PSO algorith m is introduced to the optimizat ion of PI parameters, so online PSO-PI control and off-line PSO-PI control are obtained, the SVG voltage loop transfer function is used as the controlled object. The simulat ion results show that the PSO-PI control can satisfy the time varying system of the controlled object with strong adaptability.