#### Abstract

Conventional mathematical modeling-based approaches are incompetent to solve the electrical power quality problems, as the power system network represents highly nonlinear, nonstationary, complex system that involves large number of inequality constraints. In order to overcome the various difficulties encountered in power system such as harmonic current, unbalanced source current, reactive power burden, active power filter (APF) emerged as a potential solution. This paper proposes the implementation of particle swarm optimization (PSO) and bacterial foraging optimization (BFO) algorithms which are intended for optimal harmonic compensation by minimizing the undesirable losses occurring inside the APF itself. The efficiency and effectiveness of the implementation of two approaches are compared for two different conditions of supply. The total harmonic distortion (THD) in the source current which is a measure of APF performance is reduced drastically to nearly 1% by employing BFO. The results demonstrate that BFO outperforms the conventional and PSO-based approaches by ensuring excellent functionality of APF and quick prevail over harmonics in the source current even under unbalanced supply.

#### 1. Introduction

Introduced by Kennedy and Eberhart in the year 1995 [1], particle swarm optimization (PSO) has emerged as a proficient stochastic approach of evolutionary computation. Since then it has been employed in various fields of applications and research and is successful in yielding an optimized solution. This algorithm mimics the social behavior executed by the individuals in a bird flock or fish school while searching for the best food location (global optima). The PSO algorithm neither depends upon the initial condition nor on the gradient information. Since it depends only on the value of objective function, it makes the algorithm computationally less expensive and much simple to implement. The low CPU and memory requirement is another advantage. However, some experimental results show that the local search ability around the optima is very poor though the global search ability of PSO is quite good [2–4]. This results in premature convergence in problems where multiple optima exist and; hence, the performance is degraded.

The bacterial foraging optimization (BFO) proposed by Passino in the year 2002 [5] is based on natural selection that tends to eliminate animals with poor foraging strategies. After many generations, poor foraging strategies are eliminated while only the individuals with good foraging strategy survive signifying survival of the fittest. BFO formulates the foraging behavior exhibited by *E. coli *bacteria as an optimization problem. Over certain real-world optimization problems, BFO has been reported to outperform many powerful optimization algorithms in terms of convergence speed and final accuracy [6–8].

The power system is continuously being subjected to huge disturbances due to the proliferation of large number of nonlinear loads such as power electronic converters, arc furnaces, fluorescent lights, motor drives, saturated transformers, switched mode power supplies, computers, and other domestic and industrial electronic loads. Though the active power filter (APF) is efficient enough to compensate for these disturbances, optimal load compensation by the APF is always desirable.

This paper exploits conventional, PSO, and BFO approaches to optimize the shunt APF performance for optimal load compensation, and the results demonstrate that the APF that implements BFO converges to global optimum solution faster compared to APFs employing conventional method and PSO.

#### 2. Particle Swarm Optimization

The mechanism of PSO is initialized with a group of randomly dispersed particles assigned with some arbitrary velocities. The particles fly in the -dimensional problem space, cluster together, and finally converge to a global optimum area. The movement of particles in the search space is in accordance with the flying experience of the individual and its neighboring particles in the swarm population (swarm intelligence). Let the th particle in the swarm be at moving with a velocity . Then, the position and velocity of the particle at next iteration will be and , respectively, which is illustrated in Figure 1 and can be given mathematically as

In the above expression, parameter is known as inertia constant that maintains a balance between the local and global search. and are acceleration constants. and are two independently generated random numbers which are uniformly distributed in the interval . represents coordinates of the best location discovered as yet by the th particle (local optima), whereas the coordinates of best location discovered thus far by the entire swarm (global optima) are stored in (Figure 2).

The exploration of new search space depends upon the value of inertia constant . Therefore, Eberhart and Shi proposed a modified that decreases linearly with the successive iterations [9], which can be given as Here is the generation index representing the current number of evolutionary generations, is the predefined value of maximum number of generations, and and are the maximal and minimal weights. Initially the value of is 0.9 in order to allow the particles to find the global optimum neighborhood faster. The value of is set to 0.4 upon finding out the optima so that the search is shifted from exploratory mode to exploitative mode. The search process terminates when there is no further improvement in the global optimum solution or the number of iterations executed becomes equal to its maximum predefined value. The entire process of PSO is represented as a flowchart in Figure 3.

##### 2.1. Iterative Algorithm for PSO

*Step 1. *Initialize the size of swarm, dimension of search space, maximum number of iterations, and the PSO constants , , and . Define the random numbers and . Find out the current fitness of each particle in the population.

*Step 2. *Assign the particles with some random initial positions and velocities . Set the counter for iteration to zero. For the initial population, local best fitness of each particle is its own fitness value, and local best position of each particle is its own current position, that is,

*Step 3. *The global best fitness value is calculated by
The position corresponding to global best fitness is the global best position .

*Step 4. *Update the particle velocity and particle position for next iteration by (1) and (2).

*Step 5. *By setting , increment the iteration counter.

Find out the current fitness of each particle.

If current fitness < local best fitness, set

*Step 6. *After calculating the local best fitness of each particle, the current global best fitness for the *k*th iteration is determined by
If current global best fitness < global best fitness, then
The position corresponding to global best fitness is assigned to .

*Step 7. *Repeat Steps 5 and 6 until is equal to the maximum number of iterations defined in Step 1 or there is no improvement in the global best fitness value.

*Step 8. *Terminate the iterative algorithm, when there cannot be any further execution of iterations.

#### 3. Bacterial Foraging Optimization

The BFO is a nongradient optimization problem which is inspired by the foraging strategy used by *E. coli* bacteria such that it maximizes their energy intake per unit time spent in foraging. The four principal mechanisms observed in bacteria are chemotaxis, swarming, reproduction, and elimination-dispersal.

The flowchart of BFO algorithm which mimics the above four mechanisms is presented in Figure 4.

##### 3.1. Chemotaxis

The movement of *E. coli* bacteria in the human intestine in search of nutrient-rich location away from noxious environment is accomplished with the help of the locomotory organelles known as flagella by chemotactic movement in either of the ways, that is, swimming (in the same direction as the previous step) or tumbling (in an absolutely different direction from the previous one). Suppose represents the th bacterium at th chemotactic, th reproductive, and th elimination-dispersal step. Then chemotactic movement of the bacterium may be mathematically represented by (10). In the expression, is the size of the unit step taken in the random direction, and indicates a vector in the arbitrary direction whose elements lie in as follows:

##### 3.2. Swarming

This group behavior is seen in several motile species of bacteria, where the cells, when stimulated by a high level of *succinate*, release an attractant *aspertate*. This helps them propagate collectively as concentric patterns of swarms with high bacterial density while moving up in the nutrient gradient. The cell-to-cell signaling in bacterial swarm via attractant and repellant may be modeled as per (11), where specifies the objective function value to be added to the actual objective function that needs to be optimized, to present a time varying objective function, indicates the total number of bacteria in the population, is the number of variables to be optimized, and is a point in the -dimensional search domain. The coefficients , , , and are the measure of quantity and diffusion rate of the attractant signal and the repellant effect magnitude, respectively,

##### 3.3. Reproduction

The fitness value for th bacterium after travelling chemotactic steps can be evaluated by the following equation: Here represents the health of th bacterium. The least healthy bacteria constituting half of the bacterial population are eventually eliminated while each of the healthier bacteria asexually split into two, which are then placed in the same location. Hence, ultimately the population remains constant.

##### 3.4. Elimination and Dispersal

The BFO algorithm makes some bacteria to get eliminated and dispersed with probability after number of reproductive events to ensure that the bacteria do not get trapped into a local optimum instead of the global optima.

#### 4. Active Power Filter

The shunt APF is intended to be used not merely for compensation of current harmonics but also for unbalance in the source current generated due to nonlinear loads. It injects filter-generated current harmonics of equal magnitude and opposite phase as the load current harmonics at the point of common coupling (PCC) between the source and the load as illustrated in Figure 5. The APF comprising a three-phase pulse-width modulation-(PWM-) based voltage source inverter (VSI) employing various control schemes has gained well recognition [10]. For proper functioning of APF, it is crucial to design an appropriate control scheme. In the conventional instantaneous active and reactive power method, the entire reactive power and oscillating component of active power are used for generation of reference compensation currents [11]. The multiplication of instantaneous load currents and voltages while calculating the instantaneous powers caused amplification of harmonic content leading to imprecise harmonic compensation. Later, the instantaneous active and reactive current component method is proposed to replace the method as it brings down the total harmonic distortion (THD) in supply current below 5% so as to satisfy the IEEE-519 standards even under nonideal supply voltage [12, 13].

In this paper, the performance of APF with conventional control is improved by means of PSO and BFO algorithms since the conventional approach becomes complex to implement as the power system represents a highly nonlinear and nonstationary system. Moreover, the conventional control yields inadequate result at every operating point except the one at which it is designed to be operated [14, 15].

##### 4.1. Shunt APF System Configuration

The system configuration of a 3-phase 3-wire shunt APF is depicted in Figure 5. The filter performance is studied under ideal and unbalanced supply conditions. Here the nonlinear load is consisting of diode rectifier with load on the dc side. The APF is comprised of a VSI with hysteresis PWM current control. Controller for the APF is designed using control scheme. Inputs to the controller are the three-phase load currents and the dc-link capacitor voltage of the inverter. The gains of the PI controller used for dc-link voltage regulation are optimized using conventional, PSO and BFO techniques. Output of the controller is reference compensation current template. The actual filter currents and the reference compensation currents are compared in a hysteresis comparator giving away the current pulses for switching actions to be carried out in the switching devices (IGBTs) of the VSI. Finally the filter-generated compensating current is injected into the power system at PCC to assure that sinusoidal and compensated current is drawn from the utility.

##### 4.2. Optimization Problem for dc-Link Voltage Regulation

While operating under steady-state condition of the shunt APF, the VSI should neither absorb nor deliver active power. So the main concern lies in getting an optimally tuned PI controller which satisfies the conditions of dynamics and stability together in order to make the dynamics of inverter dc-link voltage sufficiently low. In various conventional PI controller-tuning methods such as Ziegler-Nichols method, the recommended settings are empirical in nature and require extensive experimentation. Hence, there is always scope for improving the tuning of PI controller that yields suitable values of proportional gain and integral gain for which it gives better settling time within tolerable limits of maximum overshoot. This purpose can be accomplished by implementing PSO and BFO to minimize the deviation of from its reference value. Maximum overshoot , rise time , and steady-state error are the constraints that imply the optimality of PI controller. The objective here is to reduce dc-link voltage deviation which can be given by

The performance criteria chosen in this paper are integral square error (ISE), and the objective function to be optimized is estimated using (14) which represents a nonconstrained optimization problem. In the expression, and symbolize weighing factors, is the starting time, and is the settling time of transient: The significance of weighing factors is that, is used to overcome the steady-state voltage error and decides the values of and . Large value of results in less overshoot, whereas smaller value of results in reduced settling time.

##### 4.3. Reference Compensation Current Extraction

The PI controller output signal represents the total active current required to maintain the dc-link voltage at a constant level and to compensate the losses in the APF due to the presence of inductances and semiconductor switches. The three-phase load currents are tracked by the use of current sensors, upon which Park’s transformation is performed in order to find out the corresponding axis current components and with the help of

According to control strategy, the load should only draw the average value of direct-axis component of load current from the supply. Here and indicate the fundamental frequency component of the currents and , respectively. The oscillating components of the currents and , that is, and , respectively, are filtered out by using Butterworth’s low-pass filter with cut-off frequency of ( fundamental supply frequency). The currents and along with are utilized to generate the reference compensation current template and in coordinates, followed by inverse Park’s transformation giving away the three-phase compensating currents , , and in reference frame as described in (16). The zero-sequence current is brought into play in order to make the transformation matrix a square one as follows:

In Figure 6, the entire scheme of reference current generation for shunt APF using method has been illustrated. This scheme does not require a phase-locked loop (PLL) as only current quantities are involved; hence, synchronization between phase currents and voltages is not needed.

The reference signals, thus, obtained are compared with the actual compensating filter currents in a hysteresis comparator as shown in Figure 5, where the actual current is forced to follow the reference. Hysteresis band current controller is intended to be used for instantaneous compensation by the APF on account of its easy implementation and quick prevail over fast current transitions. This consequently provides switching signals to trigger the IGBTs inside the inverter. Ultimately, the filter provides necessary compensation for harmonics in the source current and reactive power unbalance in the system.

#### 5. Simulation Results

The shunt APF load compensation capability is demonstrated by means of its (a) measure of harmonic compensation in the source current and (b) dynamic performance under ideal and unbalanced supply conditions. The active filter performance is analyzed with the error between dc-link voltage and its reference value being regulated by the conventional PI controller followed by PSO- and BFO-based optimally tuned PI controllers. A diode rectifier load with dc-side resistance , dc-side inductance , ac-side resistance , and ac-side inductance has been considered as shown in Figure 5. The nature of dc-link voltage transient (maximum overshoot, settling time, etc.) is also observed. The simulation is performed taking parameter values as given in Table 1.

The THD of source current is a measure of the effective value of harmonic distortion and can be calculated as per (17) in which is the RMS value of fundamental frequency component of current and represents the RMS value of th order harmonic component of current as follows:

When the APF is not being operated, the load current is exactly reflected in the source current. The FFT (Fast Fourier transform) analysis of the source current before compensation shows the THD to be equal to 20.61%. The load current (or source current before compensation) along with its FFT analysis has been shown in Figure 7.

##### 5.1. Compensation of Harmonics in the Source Current

The simulation for ideal supply is carried out with the source voltage of 230 V (RMS) which is perfectly balanced and sinusoidal as depicted in Figure 8. The compensation currents produced by APF employing conventional, PSO, and BFO techniques under ideal supply are shown in Figure 9. This current is added to the load current at PCC so that the resulting source current becomes sinusoidal after compensation. The corresponding source currents are also shown in the figure. For the source current obtained with each of the APF controllers, FFT analysis is done and the results show that THD obtained with APF employing BFO is much lower than conventional and PSO-based APFs.

Though the supply voltage is always desired to be ideal, sometimes unbalanced supply condition is produced in the power system which may be due to the generators in the system, presence of unequal single phase loads, blown fuses in one of the phases of a three-phase capacitor bank, or single phasing conditions. For simulation with unbalanced supply condition, voltage in one of the three phases is taken 230 V (RMS), while in rest of the phases it is 200 V (RMS). The unbalanced supply voltage simulation waveform is clearly presented in Figure 10. From Figure 11, the comparison of source current THDs obtained with simulation under unbalanced supply reveals that BFO is a better alternative compared to the other two in terms of current harmonic compensation by lowering down the THD.

##### 5.2. Dynamic Performance of APF

Convergence characteristics of voltage for both the supply conditions and all the methods of APF control are shown in Figures 12 and 13. It is observed that the APF employing BFO for PI controller tuning makes to reach its reference value of 800 V faster compared to other alternatives. As a result BFO provides speedy recovery for active filter losses and, hence, exhibits quick prevail over current harmonics. The indices for performance measurement of APF, that is, settling time (), maximum overshoot (), and the source current THD values are listed in Tables 2 and 3 for ideal and unbalanced supply, respectively. It shows that though BFO provides faster convergence to reach global optimum solution, there is no compromise over maximum overshoot of which is within the permissible value. A comparison of the THDs of source current for both ideal and unbalanced supply conditions without and with compensation by conventional, PSO- and BFO-based APFs is presented in Figure 14. Under ideal supply there is not much difference in the source current distortion obtained after compensation using the APFs with any of the PI controller tuning methods. But under unbalanced supply, BFO has better command over the dc-link voltage, and, hence, ultimately the distortion in source current is lowered down drastically.

#### 6. Conclusion

The conventional methods used to find the coefficients of PI controller are usually based on a linearized model, which may not give satisfactory result under transient conditions. Advanced computational-intelligence-based optimization algorithms, PSO and BFO, have been implemented to tune the coefficients of PI controller to enhance the performance of power system under balanced and unbalanced source voltage conditions. Simulation results were compared with conventional PI controller tuning. The dc-link voltage settles approximately within one cycle, and also the excursion in voltage is less compared to the conventional PI controller. Further the THDs of the source current have improved significantly, which indicates the elimination of harmonics and verified superior functionality of PSO and BFO algorithms. Out of the three approaches, the BFO-PI based APF validates excellent functionality, superior harmonic compensation capability, and robustness.