Experimental Investigations on Particle Swarm Optimization Based Control Algorithm for Shunt Active Power Filter to Enhance Electric Power Quality

Quality power is a very important factor for the proper functioning of appliances and can be enhanced using shunt active power filters (SAPF). This work demonstrates the hardware implementation of synchronous reference frame (SRF) theory based SAPF. This paper presents the technique of particle swarm optimization (PSO) to tune the gain values of the SAPF PI controller to control the voltage of the DC-link and enhance its dynamic efficiency. The estimation of gain values of PI controllers using conventional methods does not yield the expected outcomes under varying load conditions. The PSO tuned controller provides better results as compared to traditional tuning methods. The switching scheme is implemented using hysteresis controller to control the SAPF. The main objectives of this approach are to extract the compensating currents and cancel out the harmonics produced by balanced, unbalanced and nonlinear loads. The planned scheme is designed and implemented in MATLAB/Simulink and then its performance on a developed laboratory prototype is validated experimentally.


INDEX TERMS
Harmonic mitigation, hysteresis current controller, particle swarm optimization, PI controller, power quality shunt active power filter, synchronous reference frame theory.

I. INTRODUCTION
The distribution systems in this era of advanced power electronics are suffering from the issues related to power quality. The application of power electronics based nonlinear load is increasing which increases the harmonics in the distribution system. The industrial (paper mills, arc furnaces, automotive, metals, cement etc.) and non-commercial (refrigerators, washing machines, televisions etc.) appliances contribute fairly to the harmonics injection into the grid which results in reducing the power factor [1]- [4]. The inferior quality of the power is responsible for power loss, resonance, errors in readings of the instruments, etc. The consumer and the utility are paying heavily for these losses. The power quality issues are of serious concern and require a lot of focus and extensive work to improve [5]. The harmonic voltage compensation purposes have been shown in single-phase APF [6], [7] allowing loads to be supplied by a nearly sinusoidal voltage. Many furnace industries till date are using the passive filters to suppress harmonics, but these filters have disadvantages such as resonance, large size, aging, compensation, and their inability to compensate for unbalanced loads [8]. To mitigate these problems, the shunt active power filter (SAPF) came out as an effective solution. The SAPF can compensate for current-related issues, while the series APF can compensate for voltage-related issues, and the unified power quality conditioner (UPQC) can reduce both voltage and current harmonics [9], [10]. Moreover, they have the capability for load balancing in case of three-phase active filters and reactive power compensation.
The dynamic performance of a SAPF is reliant on how rapidly and precisely the harmonic components are extracted from the load current. The harmonic extraction techniques namely instantaneous reactive power theory (IRPT) also known as the p-q theory [11], [12] and synchronous reference frame (SRF) theory also known as d-q theory are given in [13], [14]. The SRF theory performs excellently for eliminating the harmonics in real-time systems. The dynamic performance of SAPF depends upon the converter topology and DC link voltage regulation [15]. There are different approaches (controllers) to control the DC link voltage like proportional integral derivative (PID) [16], fuzzy logic control (FLC) [17], artificial neural network (ANN) approach and genetic algorithm method (GA) [18] etc. In addition, [19] discusses the different control techniques for SAPF. The adaptive DC-link voltage control for SAPFs was introduced by Juan et al. [20], which minimized switching loss during operation. They used predictive current control and proportional voltage control to maintain the DC-link voltage. Under unbalanced and distorted supply voltage conditions, Xiaohua et al. [21] presented a current reference control approach for SAPF that uses the Kalman filter to extract the harmonic content.
The PSO algorithm is a dominant tool for optimization of nonlinear functions. The method was found through simulation of a simplified social model inspired by the flocking of birds [22], [23] and presently being used in many applications for optimization of nonlinear equations. The selective harmonic elimination method is performed using PSO to calculate the switching angles to eliminate the harmonics [24]. The harmonics alleviation and DC link voltage regulation using PSO have been employed to find out the gains of PI controller in SAPF [25]. In SAPF control strategy, a low pass filter was used to eliminate the ripple content by using wavelet and adaptive filter based control strategy in [26]. PI controller is the most popular industrial controller and is used by 95% of process industries [27]. The major drawback of PI controller is the requirement of having a precise linear mathematical model of the system, which is difficult to obtain under varying parameters and non-linear load disturbances.
Photovoltaic (PV) integrated SAPF mitigates power quality issues in a distribution system while simultaneously lowering reliance on fossil fuels, resulting in enhanced environmental quality. The presented system uses a fuzzy logic proportional integrator derivative multiple complex coefficient filter multiple second-order generalized integrator frequency-locked loop. The maximum power from the PV panel is tracked using the PSO-based perturb and observe technique under changing external environment in the study [28]. PV integrated DSATCOM to resolve the power quality issues caused by nonlinear loads demonstrated in [29] to track the peak power point, an FLC-based maximum power point tracking (MPPT) controller was used. Battery energy storage system and PV with UPQC can be a good distributed generating solution for improving the power quality of today's modern power system [30]. Mukundan et al. [31] demonstrates a grid-connected PV system that uses a binary hybrid multilevel inverter and a damped second-order generalized integral controller. The VOLUME 10, 2022 universal APF system enhances voltage and current quality by combining both shunt and series APF introduced in [32]. To improve power quality, a PV-based SAPF system with a Perturb and Observe MPPT controller and a non-linear load is connected [33]. Fuzzy PSO strategy with a PV fed SAPF to improve power quality and provide clean electricity [34].
To generate pulse width modulation (PWM) signals for driving SAPF, the linear and non-linear control strategies for tracking the harmonic current were presented in [35]. The nonlinear current control technique mainly consists of hysteresis control and predictive control. One of the most appropriate PWM switching methods for producing reference current in SAPF is hysteresis current control. The advantages of hysteresis current control include high stability, speed, and accuracy in dynamic behavior. In linear current control, techniques such as sinusoidal PWM, deadbeat control and ramp comparison control, etc. are used to obtain the PWM signal [36].
The proposed PSO-PI control algorithm is compared with ref. [37] which only considers nonlinear load conditions whereas proposed approach deals with different combinations of balanced, unbalanced and nonlinear load condition. The proposed PSO-PI algorithm is worked out on 30µs sampling time against 52.5ms used in [38], [39] therefore the proposed scheme is fast and offers lesser computational burden and lesser THD.
In this paper, a three-phase SAPF to enhance power quality in the distribution system is proposed. The combination of linear and nonlinear load demands for reactive power and current harmonic compensation. The SRF method always proves to be superior to IRPT strategies for current compensation under non-ideal conditions of voltage.
In this work, time-domain based SRF theory is applied to control the system. A PSO tuned PI controller is incorporated with SRF theory. The hysteresis current control technique is applied for generating the gate pulses of the VSI (SAPF). This control strategy is experimentally implemented as a prototype in the laboratory. This work is executed with microsecond time step on FPGA based computational engine of OPAL-RT. The performance of the SAPF and current control strategies has been evaluated in terms of harmonic mitigation and DC link voltage regulation. The results with classically tuned and PSO tuned controller are presented here.
The key contributions of this article are as follows: • Shunt active power filter is employed to improve the power quality.
• Mathematical modeling of the proposed system is formulated.
• Particle swarm optimization-based control strategy is utilized here which enhances the system performance as compared to classical techniques.
• OPAL-RT which has FPGA based computational engine with microsecond time step size, is applied here as a hardware controller.
• A prototype of the proposed shunt active power filter is developed and tested in the laboratory.
• The developed control algorithm is used to regulate the SAPF and it can improve various elements of power quality including harmonics mitigation and load balancing.
• Costs and benefits of the proposed and traditional control techniques have been compared. This paper is organized as follows. In section 2, the configuration of SAPF is given. In section 3, SRF theory using the PSO/PI controller is described. Experimental results are shown in section 4. Finally, the conclusion is provided in section 5.

II. SYSTEM CONFIGURATION OF SAPF
The fundamental compensation principle of SAPF is shown in Fig. 1. When SAPF is not active, the source and load currents both carry the same harmonics (i.e., their signatures are same). Once the SAPF is connected at PCC, it injects controlled compensating current to make the supply current free of harmonics irrespective of the load characteristics. The utility voltage is given by eqn.
The instantaneous source currents at PCC are given by eqn. (2) The load current i L with fundamental and harmonics components is represented in eqn. (3) Instantaneous load power can be given as eqn. (4) where, p f (t) is the active power, p r (t) is the reactive power and p h (t) is the harmonic power. Also, From eqn. (6) the source current supplied after compensation, is expressed as in eqn. (7) i where i sm = i 1 cosφ 1 The control law must consider an extra current to the capacitor leakage and converter switching losses. The following compensation current must be provided by the SAPF in eqn. (8): A. DESIGN OF PROPOSED SYSTEM CONFIGURATION The proposed SAPF system is shown in Fig.1. To design a required SAPF, the values of few parameters need to be chosen and are as follows: Three-phase grid voltage (V s ) 58V (L-L), frequency (f) 50Hz, load current (i L ) 5A. The nonlinear load is a combination of three-phase diode rectifier with RL load. The SAPF is designed based on the analysis available in [40], [41] and their parameters are derived as below: In three-phase diode rectifier, the supply current (i s ) is a quasi-square waveform given in eqn. (9) The value of the fundamental component of the quasi-square waveform is expressed as in eqn. (10) The current rating (harmonic current) of SAPF is given in eqn. (11) The power rating of SAPF (S) is given in eqn. (12) The DC-link voltage of SAPF is given by eqn. (13) where 'm i ' is the modulation index and 'V s ' is the phase voltage.
The compensating inductance of SAPF is given in eqn. (14) where '6k' is the overloading factor, f is the switching frequency and I f is the ripple factor. The DC-link capacitor is calculated from change in stored energy and is given by eqn.
The proposed strategy is designed to minimize the THD and improve the power factor.

B. DYNAMIC SAPF MODEL
According to Fig.1, one can develop the dynamic model of three-phase SAPF. According to circuit theory and KVL, VOLUME 10, 2022 we can obtain where L c and R c are respectively SAPF inductance and resistance.
The V MN is the voltage that is expressed as in eqn. between M and N in eqn. (19) A switching function g n denotes the switch's ON / OFF state and is given in eqn. (20).

III. SYNCHRONOUS REFERENCE FRAME THEORY PSO BASED PI CONTROLLER
The synchronous reference frame (SRF) theory is applied to control the harmonic compensation system in real-time. The functional diagram of SRF based control method is shown in Fig. 2. The load currents (i La , i Lb , i Lc ) are detected as feedback signals and are transferred into d-q axis by Park transformation as given below in eqn. (35): These signals are synchronized with point of common coupling (PCC) using phase locked loop (PLL). The PLL is required to extract the phase information of a periodic and physical control. Generally, the physical control has unpredictable variations and it has to dynamically ensure the accuracy of phase information extracted. Pure sine and cosine waves need to be generated that are synchronized to the grid voltage to perform the abc to d − q and the d − q to abc transformations. The components are cleared through a LPF to remove the DC segments of i d and i q in eqn. (36), (36). The d-axis and q-axis currents consist of fundamental and harmonic segments as follows: The d − q to abc transformation is carried out to get three phase reference compensating currents i * sa , i * sb , i * sc . The expressions of these currents are given in eqn. (38), (39), (40): and

A. PARTICLE SWARM OPTIMIZATION
As compared to classical tuning techniques, particle swarm optimization method can handle a multiple governing equations with constraints and yields an optimal solution for the targeted problem. PSO is an evolutionary computation method, which is inspired from social behavior movement and intelligent thought process of swarms through which they reach to an optimal location. Initialization of PSO is done by population of random solutions and random velocity is assigned to each solution. Random position values are used to initialize each particle. A repetitive process is employed to obtain the optimal values of PI controller parameters [42]- [43]. PSO involves identification of two premier feature movements of particles; 1) global particle-to-particle best outcome and 2) local particle's iteration-to-iteration for best solution. Iteration-to-iteration data denotes the 'pbest' the best solution it has reached upto this point. Particle-to-particle data brings about putting away the best outcomes reached by any particle, and is called 'gbest'. The 'pbest' and 'gbest' factors are called intellectual and social segments individually. After each iteration, 'pbest' and 'gbest' are refreshed for every particle, for reaching better solution and more dominating solution is found. 'pbest' and 'gbest' are iterated constantly till the point either the wanted outcomes are obtained or no promising solutions can be obtained in the given search space. Particle's velocity determines the direction and amount of movement.
The PSO defines every particle in D-dimensional space as X i = (x i1 , x i2 , . . . , x iD ), where the subscript 'i' represents the number of particle and the second subscript represents the dimension, the number of parameters defining the solution. The previous best position is represented as P i = (p i1 , p i2 , . . . , p iD ) which is stored in the memory and the velocity for each dimension is independently established After each iteration, the velocity term is updated, and the particle is moved with some randomness in the direction of its own best position, pbest, and the global best position, gbest. Velocity is updated as given by eqn.
The position is updated using this velocity V (t+1) id and given as eqn. (42). (42) where U [0,1] samples a uniform random distribution, t is a relative time index, ψ 1 and ψ 2 are weighted trade off and impacts of the local best and global best solutions' on the particle's total velocity. Table 1 shows the PSO parameters.
The undesirable losses such as overshoot, settling time, transient response and steady state error are minimized by using PI controller by maintaining a DC-link voltage. It is difficult to model a power system network using conventional mathematical approaches since it is complex, non-linear and non-stationary along with many inequality constraints. Therefore, by using various optimization techniques to optimize the PI controller coefficients; there can be further improvement in the compensation capability of SAPF. The proposed PSO algorithm flow chart of the PI controller is shown in Fig. 3.
In this paper, the PSO scheme has been used for the optimization of PI controller parameters K p and K i . The integral square error (ISE) performance index presented in eqn. (43) is used to optimize the objective function 'j' as follows: The coefficient K p and K i optimized at a different load condition such as balanced/unbalanced and nonlinear load conditions provide satisfactory performance for all conditions in the experimental system. The voltage of the DC-link capacitor is detected and compared to a reference voltage. As shown in Fig. 2, the error 'e = V dc , ref − V dc ' is minimized using PI controller, which provides output as an active current that corresponds to power flow needed to maintain DC-link voltage.

B. HYSTERESIS CURRENT CONTROL
The hysteresis current control method has been adopted to fire the IGBT of the SAPF. The significance of this control method is because of its fast current controllability, simple usage and stability in all conditions. The hysteresis comparator compares the current injected by the inverter with the reference current in order to provide switching gate pulses. These gate pulses are responsible to decide the turning on and off of the IGBTs.

IV. SIMULATION RESULTS AND DISCUSSION
Sim Power System toolbox in MATLAB/Simulink is used to simulate the proposed system under various load conditions. Table 2 lists all of the simulation parameters that were considered.

A. PERFORMANCE OF SYSTEM UNDER SUDDEN DISTURBANCE IN THE GRID VOLTAGE
The rapid disturbance in grid voltage is depicted in the Fig. 4. The grid voltages are perturbed for 0.2 seconds which results in grid current disturbances. Despite the fact that source currents had overshot by 40% it gets settle down in just three cycles which shows the effectiveness of the proposed method.     nonlinear load is applied. The harmonic spectrum of source current and load current is shown in Figs. 9 and 10, respectively. The THD has been decreased from 18.76% to 5.57%.

V. EXPERIMENTAL RESULTS AND ANALYSIS
The experimental setup of the proposed system is shown in Fig.11. Here, the PSO tuned PI controller is employed to control the SAPF for harmonic reduction. The lab prototype SAPF consists of Semikron IGBT module and three interfacing inductors of the desired value. The algorithms are implemented through the OPAL-RT 4510 system. The OPAL-RT 4510 has kintex-7 FPGA based high performance processor and advanced features such as higher number of I/O pins and in built analog to digital converter (ADC). The grid voltage signals are sensed by a potential transformer, the source & load currents are sensed by a current transformer and DC capacitor voltage is sensed by LV20P-LEM Hall Effect sensors. These sensed signals are applied to the ADC of the OPAL-RT through a signal-conditioning card. The entire control strategy is firstly simulated in MATLAB and then a Simulink model is created using RT library to comply with the RT lab. The RT lab is used to implement the proposed control algorithm on the host computer in the realtime system. This control algorithm finally controls the entire system on the actual hardware as shown in Fig.11. Table 3 lists all of the simulation parameters that were considered. The performance of SAPF for various cases is given below. Fig.12 shows the results without compensation i.e., when SAPF is not activated. It is expected that the actual source current and load current are the same without compensation, and that the THD is the same 23.90%. The DC-link voltage (V dc ) is 75V, source voltage (V s ) is 33V and actual source current (i s ) is 2.18A. The reference source current (i * s ) is approximately same as actual source current. It is observed that the source current is distorted without compensation. Fig.13 shows the waveforms when SAPF is activated and controlled using the classically tuned PI controller. The DC-link voltage is regulated to 95.4V. The source current is now almost harmonics-free & thus validates the capabil-

C. PERFORMANCE OF SAPF UNDER BALANCED & NONLINEAR LOAD USING PSO-PI TECHNIQUE
In this approach, the controller is tuned with PSO. Fig.15 the response of SAPF when nonlinear and balanced load is applied. The value of DC-link voltage (V dc ) is 99.2V, source voltage (V s ) is 33V, source current (i s ) is 2.20A and the value of reference source current (i * s ) is approximately same as actual source current. Fig.16 and Fig.17 show the harmonic spectrum of load and source currents under balanced & nonlinear load without PSO. The THD is reduced to 4.88 %. Fig.18 represents the harmonic spectrum of source current using unbalanced load condition without PSO. The THD in this case is 5.72%, which is more than the balanced load case.        21 shows the harmonic spectrum of source current under unbalanced load using PSO-PI technique. Fig. 22 represents the THD profile; (i) using MAT-LAB Simulation for balanced and non-linear lad conditions, (ii) Using MATLAB Simulation for unbalanced and non-linear load conditions, (iii) for experimental validation using conventional PI control for balanced and non-linear load conditions, (iv) for experimental validation using conventional PI control for unbalanced and non-linear load conditions, (v) for experimental validation using PSO-PI control for balanced and non-linear load conditions and (vi) for VOLUME 10, 2022   experimental validation using PSO-PI control for unbalanced and non-linear load conditions. It is inferred that the THD profile of the experimental study has a similar feature to that of the simulation results. From the experimental results, it is seen that PSO-PI controller beats the performance of PI controller and offers lesser error, reduced overshoot (constant DClink voltage) and lesser THD. Tables 4 and 5 show the indices for measuring SAPF efficiency, such as settling time (t s ), maximum overshoot (V dc max), and source current THD values for balanced/unbalanced and nonlinear load condition.

E. COST BENEFIT ANALYSIS OF HARMONIC REDUCTION
The harmonics are responsible for power losses and their compensation leads to improved power quality and recovering in revenue saving. SAPF eliminates the harmonics but the deciding factor is their feasibility and cost. Various producers are looking for cost-effective ways to decrease harmonics inside electronic equipment. This section details the financial feasibility of SAPFs which is inspired from Key TS et al. [30]. To calculate the energy-loss incurred because of harmonics, a wiring model was developed [44]. The PCC can be selected in a building/industrial plant/ electrical distribution system to minimize the harmonics [45], [46]. Depending on the levels of harmonics, energy savings vary from 1 to 15%.
The comparison in terms of losses and savings for both compensated systems and non-compensated systems with different control techniques has been provided in Table 5. The analysis carried out for an SAPF of 0.405 kVA rating (lab proptotype) with a load of 1.155kW. The commercial cost of energy (in India) is considered at Rs. 8/kWh and the loading period is assumed to be 12 Hrs. The THD for compensated system (simulation) with balanced and nonlinear load condition using; PI is 5.20%, and PSO-PI is 4.85% whereas with unbalanced and nonlinear load condition using PI is 5.8%, and PSO-PI is 5.57%. The THD for compensated system (experimental) with balanced and nonlinear load  condition using PSO-PI controller is 4.01% whereas with unbalanced and nonlinear load condition, THD is 5.39%. The comparison of savings in revenue loss is depicted in Table 5. It has been concluded that PSO-PI based control strategy delivers minimum losses and maximum savings. These savings are at very low power applications and will be amounting to a huge sum if applies to high power/inductry applications.
Thus, SAPF; enhances power quality, minimizes harmonics induced energy losses, stabilizes voltage conditions, eradicates power factor penalties, advances system performance and productivity. In the above analysis, outstanding financial benefits may arise due to increased business productivity and improved product quality.
Based on this analysis, it can be inferred that the cost of SAPF can be recovered within two years. The results obtained from the proposed design are encouraging and may be of interest to industries as well as commercial applications such as aviation, textile, pharmaceutical, telecommunications and metal, etc.

VI. CONCLUSION
In this work, hardware implementation of SRF theory based SAPF is demonstrated. The proposed system is tuned using PSO technique to get high degree of performance. The proposed SAPF performs satisfactorily in harmonic elimination, load balancing, and voltage regulation without any frequency deviation at PCC under balanced/unbalanced nonlinear loads. The control approach mitigates the harmonics and maintains SAPF DC-link voltage. The proposed laboratory prototype is controlled using OPAL-RT FPGA based computational engine that has much less execution time. The THD of source current is 23.90% in case of without compensation, which is reduced to 4.01% and 5.39% respectively in case of balanced & unbalanced and nonlinear loads using proposed control strategy on hardware. Thus, based on the experimental investigation, this paper confirms the feasibility of PSO tuned control strategies for practical applications in power quality improvements.