The purpose of electric spring(ES)can effectively alleviate the intermittent problems caused by new energy generation and provide stable power quality for critical loads(CL)by realizing the variance of electricity consumption with the change of power generation. However
ES adopts with the traditional proportional-integral(PI)control method and can not effectively stabilize the CL voltage under non-ideal grid voltages(voltage imbalance and low-order harmonics coexist). To solve this problem
the active power filter(APF)based on fourth-order generalized integrator(FOGI)is firstly developed
which can filter out the harmonics in the grid and compensate for the unbalanced current of the CL bus. The proposed method can meet the requirements of the CL voltage and current harmonics and can balance the output current in the inverter. Furthermore
the improved particle swarm optimization(PSO)algorithm is used to detect the unbalanced voltage information of CL two ends in real time
and optimize the pulse width modulation(PWM)control signal of ES voltage in series with non-critical load(NCL)to make the voltage across the CL stable and meet the requirements of the power quality
which would eliminate the impact of imbalance and fluctuations of grid voltage. Finally
the proposed algorithm is verified by simulating different load conditions.