Application of Bacterial Foraging Algorithm and Genetic Algorithm for Selective Voltage Harmonic Elimination in PWM Inverter

  • Maheswaran, D. (Dept. of Electrical Engineering, TNPL) ;
  • Rajasekar, N. (School of Electrical Engineering, VIT University) ;
  • Priya, K. (School of Electrical Engineering, VIT University) ;
  • Ashok kumar, L. (Dept. of Electrical and Electronic Engineering, PSG College of Technology)
  • Received : 2014.04.17
  • Accepted : 2014.11.12
  • Published : 2015.05.01


Pulse Width Modulation (PWM) techniques are increasingly employed for PWM inverter fed induction motor drive. Among various popular PWM methods used, Selective Harmonic Elimination PWM (SHEPWM) has been widely accepted for its better harmonic elimination capability. In addition, using SHEPWM, it is also possible to maintain better voltage regulation. Hence, in this paper, an attempt has been made to apply Bacterial Foraging Algorithm (BFA) for solving selective harmonic elimination problem. The problem of voltage harmonic elimination together with output voltage regulation is drafted as an optimization task and the solution is sought through proposed method. For performance comparison of BFA, the results obtained are compared with other techniques such as derivative based Newton-Raphson method, and Genetic Algorithm. From the comparison, it can be observed that BFA based approach yields better results. Further, it provides superior convergence, reduced computational burden, and guaranteed global optima. The simulation results are validated through experimental findings.

1. Introduction

With the recent developments of low cost semi converter devices and high speed digital processors, PWM inverters have become cost effective. PWM Inverters are increasingly employed in wide range of industrial and commercial applications such as Variable speed induction motor drives, Induction heating, Welding machines, UPS systems, Standalone solar Photovoltaic systems. Further, in distributed generation plant, the generated DC power is converted to AC with required voltage and frequency via PWM inverters and Multilevel Inverter [1-3]. The most commonly favored switching schemes for inverter output voltage regulation is Pulse Width Modulation (PWM) method.

Among various PWM methods; Selective Harmonic Elimination PWM (SHEPWM) method has been the main focus of research since it offers several advantages compared to traditional methods which includes acceptable performance with low switching frequency to fundamental frequency ratios, direct control over output waveform harmonics, and the ability to leave triplen harmonics uncontrolled to take advantage of circuit topology in three phase systems [4]. This technique was first examined by [5] and later developed into matured form in [6, 7]. The common characteristic of these methods is the waveform analysis is done in Fourier domain. A set of non-linear, transcendental equations is then derived and the solution is obtained using iterative procedure, mostly by the Newton-Raphson method. This method is derivative dependent and may end in local optima; further, a judicial choice of initial values alone will guarantee convergence [8]. Another approach is the use of Walsh functions [9, 10]. By using Walsh function method, the switching angles are optimized by solving linear equations instead of solving non-linear transcendental equations. Moreover, in [10] it is pointed out that the method fails if there exists a solution that requires two or more angles to vary in the same selected interval. In [11] Walsh function based harmonic elimination method is applied in PWM inverter. The calculation of optimum switching angles for the elimination of selective harmonics imposes heavy computational burden; due to associated nonlinear transcendental equations having multiple solutions. Therefore the methods used must have the capability to handle large solution space with multiple solutions. Hence, an optimization method based on population search is a suitable choice for solving such nonlinear transcendental equations. Further, these methods have the advantage of starting with a random initial guess, converging to the global optimal value and multiple optimal solutions compared to single solution in conventional search.

Genetic Algorithm (GA), inspired by the laws of natural selection and genetics, has been widely discussed in the literature for harmonic elimination problem [12-16]. Genetic Algorithm has simple structure and converges to near optimum solution. However, it has the inherent drawback of slower convergence and convergence to local optima [17]. Very recently, a new evolutionary computation technique, called Bacterial Foraging Algorithm (BFA) has been proposed in [18] and has been successfully applied to various engineering optimization problems [19-23]. This method is based on the foraging (methods for locating, handling, and ingesting food) behavior of E. coli bacteria present in our intestines and the foraging strategy is governed by four processes, namely, chemo taxis, swarming, reproduction, and elimination and dispersal. BFA has been reported to have better performance than GA [18] in terms of convergence to global minimum solution.

Hence, in this paper, a novel algorithm based on BFA is proposed for selective harmonic elimination in PWM inverter. The dual objective of harmonic elimination together with output voltage regulation is suitably framed as an optimization task and the switching instances are identified through the steps of BFA. The performance of BFA is estimated and later compared with calculus based Newton-Raphson method and Genetic Algorithm. Simulation and experimental results are taken for the proposed methods.


2. Problem Formulation

The output voltage of single-phase PWM inverter with k pulses per half cycle is shown in Fig. 1. For generality, the output voltage is assumed to have k pulses with switching angles symmetrical with respect to π/2 . The value of k is an odd number and it varies from three, five, seven, nine, etc. The output voltage can be expressed using Fourier series as,

Fig. 1.PWM inverter output voltage waveforms

Where n = 1, 2, 3, 4, 5….

Due to quarter wave symmetry of the output voltage, even harmonics are absent. Further, the coefficients An and a0 are zero. Thus the above equation reduces to,

where n=1, 3, 5,…..

The value of Bn is computed using

The fundamental component is given by

In selective harmonic elimination the problem objective is to find the switching angles such that where refers to the desired fundamental voltage component and the remaining harmonic components are equated to zero. The above objective can be framed as an optimization problem by defining function F(α) satisfying the constraints. The framed optimization problem then mathematically written as


Subject to constraints:

0 ≤ α1 ≤ α2....... ≤ αk-1 ≤ αk ≤ π/2



3. Bacterial Foraging Algorithm

Bacteria Foraging Algorithm (BFA) was proposed by Passino and a new addition to the family of nature-inspired optimization algorithms [18]. The algorithm is based upon the fact that the genes of the fitter species, having successful foraging strategy, are likely to survive and get propagated in the evolution chain. Escherichia coli bacteria present in human intestine also undergo foraging strategy and can be explained by four processes, namely chemotaxis, swarming, reproduction, elimination and dispersion. Application of group foraging strategy of a swarm of E.coli bacteria in multi-optimal function optimization is the key idea of this new algorithm.

The following section explanations the various BFA operations followed by steps involved in the implementation of BFA approach for harmonic elimination in PWM inverter. Various operators of BFA include chemotaxis, swarming, reproduction, elimination and dispersion chromosomes.

Chemotaxis: During chemotaxis a bacterium involves two processes namely swimming and tumbling, both refers to the movement of E. coli cell. It can either swim for a period of time in the same direction or it may tumble, and alternate between these two modes of operation for the entire lifetime. Each bacteria tumbles, a unit length movement in a random direction φ(i) , to find a new direction of movement. The direction of movement after a tumble is represented by


θi ( j , k ,l) represents i-th bacterium at j-th chemotactic, k-th reproductive and l-th elimination-dispersal step. c(i) is the size of the step taken in the random direction specified by the tumble (run length unit). Δ(i) ∈ℜP random number in the range of [-1,1]

The bacteria continued to swim after the tumble if the present direction is rich in nutrients (food), but only up to a maximum number of steps, Ns.

Swarming: During this process, the bacterium that has already followed the optimum path try to attract the other bacteria so that they swarm together to the desired location. The bacteria congregate into groups and, hence, move as groups in concentric patterns with high bacterial density. The mathematical representation for swarming can be represented by

Where, Jcc ( θ, P( j, k, l)) is the objective function value to be added to the actual objective function (to be minimized) to present a time varying objective function. “S” is the total number of bacteria, “P” is the number of variables to be optimized, which are present in each bacterium and dattract , wattract , hrepelent , wrepelent are different coefficients that should be chosen properly.

Reproduction: The least healthy bacteria eventually die while each of the healthier bacteria (those yielding lower value of the objective function) split into two, maintaining the population of bacteria constant.

Elimination and Dispersal: Gradual or sudden changes in the local environment, due to various reasons, may kill a group of bacteria or disperse a group of bacteria into a new location. This process reduces the chance of convergence to local optimum position.

Table 1.Parameters used for BFA

Aforementioned BFA processes of chemotaxis, swarming, reproduction and elimination dispersion are implemented by applying the following steps. The following table shows the parameter values used in this work and these values are initialized at the start.

The following section discusses the chemotaxis loop, swarming, reproduction, and elimination and dispersion of a bacterium. Any ith bacteria at the jth chemotatic, kth reproduction and lth elimination stage is given by θi ( j , k ,l) and its corresponding objective function is J (i, j , k ,l) . In the present work, the value of ith bacteria θi( j , k ,l) refers to set of switching angles (α1, α2, ....., αk). For example, if there are three pulses per half cycle their respective ‘ α ’ values are α1, α2, α3 . These values are denoted by bacteria θi ( j , k ,l) in BFA where each ‘α ’ value is indicated by using variable ‘P’. Hence, a bacterium denotes a potential solution to the problem. Bacteria indicating ‘ α ’ values are evaluated using the objective function J (i, j , k ,l) in BFA. The values of θi ( j , k ,l) and J (i, j , k ,l) are updated using the following steps.

Step 1: Step Elimination-dispersal loop l =l +1 Step 2: Reproduction loop k = k +1 Step 3: Chemotaxis loop j = j +1

A) For each bacterium, i =1, 2, 3 ,......., S compute objective function J (i, j , k ,l) .

a. LetJsw(i, j, k, l)=J(i, j, k, l)+Jcc( θi( j, k, l),P( j, k, l)) Where, Jcc( θ, P( j, k, l)) is the objective function value to be added to the actual objective function (to be minimized) to present a time varying objective function. b. Let Jlast= Jsw(i, j, k, l), to save this value since the objective is a minimization function. c. End of the loop

B) Tumble and swim:

a. Let m = 0 (counter length for swim) b. While m < NS i. Let m=m+1 Generate a random vector Δ(i) ∈ℜP with each element being a random number in the range of [-1,1]. c. Move: To generate new ‘α ’ values each bacteria is allowed to move fixed step length of C(i) with random tumble direction defined by φ(i) . The newly computed ‘α ’ values is represented by is given by

θi (j +1, k ,l)=θi ( j , k ,l)+C(i)φ(i)


C) Compute J (i, j +1, k ,l) and then let Jsw(i, j+1, k, l)= J(i, j+1, k, l)+Jcc(θi(j+1, k, l), P(j+1, k, l)) ii. If Jsw(i, j +1, k, l ) < Jlast then Jlast = Jsw(i, j +1, k, l ) θi (j +1, k ,l)=θi ( j , k ,l)+C(i)φ(i) and use the above θi (j +1, k ,l) to compute new J (i, j +1, k ,l) iii. Else m = NS

D) Go to next bacterium (i +1) till all the bacteria undergoes chemotaxis.

Step 4: If j < Nc , (go to step 3). In this case, continue chemotaxis since the life of the bacteria is not over. Step 5: Reproduction: a. For the given k and l, for each i =1, 2, 3,.............., S , let be the health of i th bacterium and sort Jhealth in ascending order b. The bacteria with the highest Jhealth values die and those with minimum values split and the copies that are made already, now placed at the same location as their parent. Step 6: If k < Nre , go to step 2. In this case, we have not reached the number of specified reproduction steps, so we start the next generation in the chemotactic loop. Step 7: Elimination-dispersal: for i=1, 2, 3,.............., S , a random number is generated and if it is less than or equal to Ped , then that bacterium is dispersed to a new random location else it remains at its original location. Step 8: If l < Ned , then go to step 1; otherwise end. The flowchart corresponding to the implementation steps is given in Fig. 2.

Fig. 2.Flowchart for bacterial foraging algorithm


4. Simulation Results

A dedicated software program is developed in MATLAB for application of BFA for voltage harmonic elimination problem in PWM inverter. The efficacy of the BFA methods relies on selection of parameters; since the speed of convergence and convergence to global minimum are greatly affected by the parameter selection. The parameters are selected via a trial and error process to achieve best solution set. The program is made to run for different voltage conversion ratios and with different number of pulses per half cycle. The convergence characteristics of proposed algorithm with different pulses per half cycle under certain run are plotted and it is shown in Fig. 3. From the graph; one important observation is that, the fitness function starts with a lowest value of 0.25 and converges steadily towards global optimum value of 0.003845 at 100th iteration irrespective of the number of pulses per half. The behavior of the proposed methods is studied and it remains same for different run. The proposed algorithm is stable and the objective function continues to converge to the global optimum even with different initial values.

Fig. 3.Convergence characteristics of proposed BFA method

Further, to demonstrate the effectiveness of the proposed approach, the results obtained with BFA are compared with Newton-Raphson and GA method; since both methods are extensively employed in literature for harmonic elimination problem [11-15]. The convergence characteristics of all methods are plotted in Fig. 4. When NR method is applied for harmonic elimination problem it is found that the convergence strongly depends on the initial value selected and it fails to converge with random initial guess.

Fig. 4.Comparative convergence characteristics of BFA, GA, NR method

However, the above shortcoming is absent with GA and BFA since both the methods share the basic property of population based methods. It is interesting to compare the convergence characteristics of both methods. Both the methods start with a random initial guess and tries to converge to optimum value. In BFA, global optimum is guaranteed because during the elimination and dispersion it kill a group of bacteria or disperse a group of bacteria into a new location. However, in GA no such process exists. When both the algorithm were executed on 2.4GHz Intel i3 processor BFA and GA takes 0.3 sec and 0.25 sec respectively. Further, with iteration limit, BFA converges to optimum value of 0.00324 at 62nd iteration whereas GA converges to 0.09 at 200th iteration.

To validate the guaranteed global optima with BFA, harmonic spectra are computed for different operating point and compared with GA. The computed harmonic spectra taken for k = 3, 5, 7, 9 pulses per half cycles are shown in Fig. 5. In the computation, stress is given to alleviate the possible harmonics by suitably defining hc . For instance, with 3 pulses per half cycle 2 harmonic are eliminated and hc is written as hc = |B3| + |B5| and with 5 pulses per half cycle hc is modified to hc = |B3| + |B5| + |B7| + |B9| and so on. From the spectra, it is evident that BFA works successfully for the present problem by completely eliminating the desired voltage harmonics by selectively choosing ‘ α ’ values. The algorithm works even with higher switching pulses per half cycles with less computation time.

Fig. 5.Simulated harmonic spectra with (a) k=3 pulses per half cycle (b) k=5 pulses per half cycle (c) k=7 pulses per half cycle (d) k=9 pulses per half cycle


5. Experimental Results

In order to validate the theoretical findings a hardware prototype was fabricated in the laboratory and the same was used to drive a 220V; 55 Watts, 1250 rpm capacitor run induction motor driving a domestic fan load. Aurdino processor was used to generate switching pulses to the IGBTs; the switching angles are shown in Table 2. The switching angles were calculated off-line for different operating points of the inverter and are subsequently stored in the processor. Experiments were carried out for different voltage conversion ratios and for different values of switching pulses per half cycle. The measured harmonic spectra are shown in Fig. 6, it is apparent from the figure that, there is good agreement between the computed harmonic spectra and measured values. The small discrepancies could be attributed to the fact that while simulation results are obtained for 50Hz, the same frequency could not be maintained in the hardware implementation to avoid switching dead times. The inverter was supplied a constant dc source of 200V. The measured motor temrinal voltage waveform is taken for 3 pulses per half cycle and Vdc = 200V, Vo*=145V is presented in Fig. 7. In order to vaildate output voltage regulation, the BFA and GA are switched different switching angle at the output voltage of Vo*=165V for 7 pulses per half cycle and Vo*=135V for 9 pulse per half cycles for variable speed purpose. It is evident from the expermental figure 6.c and 6.d the BFA method is achieved perfect output voltage together with harmonics elimination.

Table 2.Firing Angle for BFA and GA

Fig. 6.Experimental harmonic spectra with (a) k = 3 pulses per half cycle (b) k =5 pulses per half cycle (c) k =7 pulses per half cycle (d) k =9 pulses per half cycle.

Fig. 7.Experimental Motor terminal voltage waveform for k = 3 and Vdc=200V, Vo*=145V


6. Conclusion

The problem of harmonic elimination in PWM inverter is drafted as an optimization task and the same is solved using Bacterial Foraging Algorithm and the results are presented in this paper. From the results, it is observed that Bacterial Foraging Algorithm works efficiently well for output voltage regulation together with harmonic elimination. The proposed algorithm completely eliminates desired harmonics together voltage regulation. To test the feasibility and quality of the solution, a mat lab program is developed and successfully implemented for different operating conditions. A hardware prototype of single phase inverter is also built to compare and validate the computed results. It is observed that, the simulated results agree well with experimental values.


  1. Reza-Salehi, Behrooz-Vahidi, Naeem-Farokhnia and Mehrdad-Abedi, “Harmonic Elimination and Optimization of Stepped Voltage of Multilevel Inverter by Bacterial Foraging Algorithm”, Journal of Electrical Engineering & Technology. Vol. 5, No. 4, pp. 545-551, 2010.
  2. R. N. Ray, D. chatterjee, S. K. Goswamie, “A Modified Reference Approach for Harmonic Elimination in Pulse-width Modulation Inverter Suitable for Distributed Generations”, Electric Power Components and Systems, Vol. 36, Issue 8, June 2008, pp. 815-827.
  3. Salim, C., & Toufik, B. M. “Simplified Control Scheme of Unified Power Quality Conditioner based on Three-phase Three-level (NPC) inverter to Mitigate Current Source Harmonics and Compensate All Voltage Disturbances”, Journal of Electrical Engineering & Technology. Vol. 8, No. 3, pp. 544-558, 2013.
  4. H. Patel and R. Hoft, “Generalized techniques of harmonic elimination and voltage control in thyristor inverters: part 2-Voltage control techniques,” in IEEE Trans.on Industry Applications, vol. IA-10, pp. 666-673, Sept/Oct. 1974.
  5. Holmes DG, Lipo TA. Pulse width modulation for power converters principles and practice. New York: IEEE; 2003.
  6. F. G. Turnbull, “Selected harmonic reduction in static dc-ac inverters,” IEEE Trans. Commun. Electron., vol. 83, pp. 374-378, 1964.
  7. H. Patel and R. Hoft, “Generalized techniques of harmonic elimination and voltage control in thyristor inverters: part 1-Harmonic elimination,” in IEEE Trans. Industry Applications, Vol. IA-9, pp. 310-317, May/June 1973.
  8. Sundareswaran K, Chandra M. Evolutionary approach for line current harmonic reduction in AC/DC converters. IEEE Trans Ind. Electron 2002; 49(1) : 716-9.
  9. J.A. Asumadu and R.G. Hoft, “Microprocessor based sinusoidal waveform synthesis using Walsh and related orthogonal functions,” in IEEE Trans.on Power Electronics., vol. 4, no. 2, pp. 234-241, April 1989.
  10. Fred Swift and Adam Kamberis, “A New Walsh Domain Technique of Harmonic Elimination and voltage control in Pulse-Width Modulated Inverters,” in IEEE Trans.on Power Electronics., vol. 8, no. 2, April 1993.
  11. Tsorng-Juu Lang, Robert M.O’Connell and Richard G.Hoft, “Inverter Harmonic Reduction Using Walsh Function Harmonic Elimination Method,” in IEEE Trans.on Power Electronics., vol. 12, no. 6, November 1997.
  12. Sundareswaran K, Kumar AP. Voltage harmonic elimination in PWM A.C. Chopper using genetic algorithm. IEE Proc-Electron Power Appl 2004; 151 (1): 26-31.
  13. Khaled El-Naggar, Tamer H. Abdelhamid, “Selective harmonic elimination of new family of multilevel inverters using genetic algorithms,” in Energy conversion Management, Vol. 49, Issue 1, pp. 89-95, January 2008.
  14. Shen, W., & Maswood, A. I., “A novel current source PWM drive topology with specific harmonic elimination switching”, In: Proceedings of the Canadian conference on electrical and computer engineering, Halifax, Canada, pp. 53-55, 2000.
  15. Shi, K. L., & Li, H. (2005). Optimized PWM strategy based on genetic algorithms. IEEE Transactions on Industrial Electronics, Vol. 52, pp. 1458-1461, 2005.
  16. A.I. Maswood, S. Wei, M.A. Rahman, A flexible way to generate PWM-SHE switching patterns using genetic algorithm, in: Proc. IEEE Appl. Power Electron. Conf., pp. 1130-1134. 2001.
  17. M. A. Abido, “Optimal design of power-system stabilizers using particle swarm optimization,” IEEE Trans. Energy Convers., vol. 17, no. 3, pp. 406-413, Sep. 2002.
  18. K. M. Passino, “Biomimicry of bacterial foraging for distributed optimization and control”, IEEE. Control Syst. Mag., pp. 52-67, Jun. 2002.
  19. S. Mishra, “A hybrid least square-fuzzy bacterial foraging strategy for harmonic estimation”, IEEE Trans. Evolutionary Computation, vol. 9, pp. 61-73. 2005.
  20. S. Mishra, and C. N. Bhende “Bacterial Foraging Technique-Based Optimized Active Power Filter for Load Compensation,” IEEE Transactions on power delivery, vol. 22, no. 1, pp. 457- 465, January 2007.
  21. Morteza Eslamian, Seyed Hossein Hosseinian, and Behrooz Vahidi, Bacterial Foraging-based Solution to the Unit-Commitment Problem, IEEE Transactions on power systems, vol. 24, no. 3, August 2009.
  22. Rajasekar N,Neeraja KK, Rini V,” Bacterialforaging algorithm based solar PV parameter estimation”, Solar Energy, Vol. 97, 255-265, 2013.
  23. Belwin Edward. J, Rajasekar. N, Sathiyasekar. K, Senthilnathan. N, Sarjila. R, “An enhanced bacterial foraging algorithm approach for optimal power flow problem including FACTS devices considering system loadability”, ISA Trans., Vol. 52, 622-628, 2013.