Open access peer-reviewed chapter

Application of Harmony Search Algorithm in Power Engineering

By H. R. Baghaee, M. Mirsalim and G. B. Gharehpetian

Submitted: July 16th 2012Reviewed: December 13th 2012Published: February 13th 2013

DOI: 10.5772/55509

Downloaded: 2592

1. Introduction

1.1. On the use of harmony search algorithm in optimal placement of FACTS devices to improve power systems

With the increasing electric power demand, power systems can face to stressed conditions, the operation of power system becomes more complex, and power system will become less secure. Moreover, because of restructuring, the problem of power system security has become a matter of concern in deregulated power industry. Better utilization of available power system capacities by Flexible AC Transmission Systems (FACTS) devices has become a major concern in power systems too.

FACTS devices can control power transmission parameters such as series impedance, voltage, and phase angle by their fast control characteristics and continuous compensating capability. They can reduce flow of heavily loaded lines, resulting in low system losses, improved both transient and small signal stability of network, reduced cost of production, and fulfillment of contractual requirement by controlling the power flow in the network. They can enable lines to flow the power near its nominal rating and maintain its voltage at desired level and thus, enhance power system security in contingencies [1-6]. For a meshed network, an optimal allocation of FACTS devices allows to control its power flows and thus, to improve the system loadability and security [1].

The effect of FACTS devices on power system security, reliability and loadability has been studied according to proper control objectives [4-14]. Researchers have tried to find suitable location for FACTS devices to improve power system security and loadability [13-16]. The optimal allocation of these devices in deregulated power systems has been presented in [17-18]. Heuristic approaches and intelligent algorithms to find suitable location of FACTS devices and some other applications have been used in [15-21].

In this chapter, a novel heuristic method is presented based on Harmony Search Algorithm (HSA) to find optimal location of multi-type FACTS devices to enhance power system security and reduce power system losses considering investment cost of these devices. The proposed method is tested on IEEE 30-bus system and then, the results are presented.


2. Model of FACTS devices

2.1. FACTS devices

In this chapter, we select three different FACTS devices to place in the suitable locations to improve security margins of power systems. They are TCSC (Thyristor Controlled Series Capacitor), SVC (Static VAR Compensator), and UPFC (Unified Power Flow Controller) that are shown in Fig. 1.

Power flow through the transmission line i-j namely Pij, depends on the line reactance Xij, the bus voltage magnitudes Vi, and Vj, and phase angle between sending and receiving buses δiand δj, expressed by Eq. 1.


TCSC can change line reactance, and SVC can control the bus voltage. UPFC is the most versatile member of FACTS devices family and controls all power transmission parameters (i.e., line impedance, bus voltage, and phase angles). FACTS devices can control and optimize power flow by changing power system parameters. Therefore, optimal device and allocation of FACTS devices can result in suitable utilization of power systems.

Figure 1.

Models of FACTS Devices (a) TCSC, (b) SVC and (c) UPFC

2.2. Mathematical model of FACTS devices

In this chapter, steady-state model of FACTS devices are developed for power flow studies. TCSC is simply modeled to modify just the reactance of transmission lines. SVC and UPFC are modeled using the power injection models. Therefore, SVC is modeled as shunt element of transmission line, and UPFC as decoupled model. A power flow program has been developed in MATLAB by incorporating the mathematical models of FACTS devices.

2.2.1. TCSC

TCSC compensates the reactance of the transmission line. This changes the line flow due to change in series reactance. In this chapter, TCSC is modeled by changing transmission line reactance as follows:


where, Xlineis the reactance of the transmission line, and rTCSCis the compensation factor of TCSC. The rating of TCSC depends on transmission line. To prevent overcompensation, we choose TCSC reactance between 0.7Xlineto 0.2Xline[26-27].

2.2.2. SVC

SVC can be used for both inductive and capacitive compensation. In this chapter, SVC is modeled as an ideal reactive power injection at bus i:


2.2.3. UPFC

Two types of UPFC models have been studied in the literature; one is the coupled model [28], and the other the decoupled type[29-31]. In the first, UPFC is modeled with series combination of a voltage source and impedance in the transmission line. In the decoupled model, UPFC is modeled with two separated buses. The first model is more complex than the second one because the modification of the Jacobian matrix is inevitable. In conventional power flow algorithms, we can easily implement the decoupled model. In this chapter, the decoupled model has been used to model the UPFC as in Fig. 2.

UPFC controls power flow of the transmission lines. To present UPFC in load flow studies, the variables Pu1, Qu1, Pu2, and Qu2are used. Assuming a lossless UPFC, real power flow from bus ito bus jcan be expressed as follows:


Although UPFC can control the power flow but, it cannot generate the real power. Therefore, we have:


Reactive power output of UPFC, Qu1, and Qu2, can be set to an arbitrary value depending on the rating of UPFC to maintain bus voltage.

Figure 2.

Decoupled model for UPFC


3. Security index

The security index for contingency analysis of power systems can be expressed as in the following [32-33]:


Here we have:

Vi,wias voltage amplitude and associated weighting factor for the ithbus, respectively,Sj,wjas apparent power and associated weighting factor for the jthline, respectively,Vref,ias nominal voltage magnitude, which is assumed to be 1pufor all load buses (i.e., PQ buses), and to be equal to specified value for generation buses (i.e., PV buses), andSj,maxas nominal apparent power of the jthline or transformer.JPis the security index for the even distribution of the total active flow, and JVis the security index for the closeness of bus voltage to the reference voltage. If the number of overloaded lines decreases, the value of JPreduces too. Similarly, when the bus voltage have a value close to the desired level, JVbecomes a small value. Minimization of both JPand JVmeans the maximization of security margins.

4. The proposed algorithm

4.1. Harmony search algorithm

Harmony Search Algorithm (HSA) has recently been developed in an analogy with music improvisation process, where music players improvise the pitches of their instruments to obtain better harmony [34]. The steps in the procedure of harmony search are as follows [35]:

Step 1: Initialize the problem and algorithm parameters

Step 2: Initialize the harmony memory

Step 3: Improvise a new harmony

Step 4: Update the harmony memory

Step 5: Check the stopping criterion

The next following five subsections describe these steps.

  1. Initialize the problem and algorithm parameters

In step 1, the optimization problem is specified as follows:

min{f(x)|xX}subject tog(x)0andh(x)=0

where, f(x)is the objective function, g(x)the inequality constraint function, and h(x)the equality constraint function. xis the set of each decision variable xi, and Xis the set of the possible range of values for each decision variable; that is Xi,minXiXi,maxwhere, Xi,minand Xi,maxare the lower and upper bounds of each decision variable. The HS algorithm parameters are also specified in this step. These are the harmony memory size (HMS), or the number of solution vectors in the harmony memory, harmony memory considering rate (HMCR), pitch adjusting rate (PAR), the number of decision variables (N), and the number of improvisations (NI), or stopping criterion. The harmony memory (HM) is a memory location where all the solution vectors (sets of decision variables) are stored. This HM is similar to the genetic pool in the GA [36]. Here, HMCR and PAR are parameters that are used to improve the solution vector and are defined in step 3.

  1. Initialize the harmony memory

In step 2, the HM matrix is filled with as many randomly generated solution vectors as the HMS in the following:

  1. Improvise a new harmony

A new harmony vector, xi=(x1,x2,...,xN), is generated based on three rules; (1) memory consideration, (2) pitch adjustment, and (3) random selection. Generating a new harmony is called ‘improvisation’ [36]. In the memory consideration, the value of the first decision variable x1for the new vector is chosen from any value in the specified HM range (x11x1HMS). Values of the other decision variables (x2,x3,...,xN), are chosen in the same manner. The HMCR, which varies between zero and one, is the rate of choosing one value from the historical values stored in the HM, while (1-HMCR) is the rate of randomly selecting one value from the possible range of values.


For example, an HMCR of 0.85 indicates that the HS algorithm will choose the decision variable value from historically stored values in the HM with 85% probability or from the entire possible range with (100–85) % probability. Every component obtained by the memory consideration is examined to determine whether it should be pitch-adjusted. This operation uses the PAR parameter, which is the rate of pitch adjustment as follows:


The value of (1-PAR) sets the rate of doing nothing. If the pitch adjustment decision for xiis “Yes”, xiwill be replaced as follows:


where, bwis an arbitrary distance bandwidth and rand () is a random number between 0 and 1.

In step 3, HM consideration, pitch adjustment or random selection in turn is applied to each variable of the new harmony vector.

  1. Update harmony memory

If the new harmony vector xi=(x1,x2,...,xN)is better than the worst harmony in the HM, judged in terms of the objective function value, the new harmony is included in the HM, and the existing worst harmony is excluded from the HM.

  1. Check stopping criterion

If the stopping criterion (maximum number of improvisations) is satisfied, the computation terminates. Otherwise, steps 3, and 4 are repeated.

4.2. Cost of FACTS devices

Using database of [32], cost function for SVC, TCSC, and UPFC shown in Fig. 3 are modeled as follows:



For SVC:




Here, sis the operating range of the FACTS devices in MVAR, and CTCSC, CSVC, and CUPFCare in $US/kVAR.

Figure 3.

Cost Function of the FACTS devices: SVC, TCSC, and UPFC

4.3. Objective function

The goal of the optimization algorithm is to place FACTS devices in order to enhance power system security-level considering cost function of FACTS devices. These devices should be placed to prevent congestion in transmission lines and transformers, and to maintain bus voltages close to their reference values. Security index introduced in section III has been used in objective function considering cost function of FACTS devices and power system losses. Fitness function FFis expressed by the following equation:


The coefficient a1to a4have been selected by trial and error, which are 0.2665, 0.5714, 0.1421, and 0.02, respectively. These values a1to a4give better optimization results for different runs of the algorithm. In the equation above, the third term is sum of cost functions of TCSC, UPFC and SVC, described in equations (12) to (14). In addition, the forth term is total active power loss of the power system.


5. Simulation results

Simulation studies are carried out for different scenarios in the IEEE 30-bus power system. Five different cases have been considered:

  • Case 1: power system normal operation (without installation of FACTS devices),

  • Case 2: one TCSC is installed,

  • Case 3: one SVC is installed,

  • Case 4: one UPFC is installed, and

  • Case 5: Multi-type (TCSC, SVC, and UPFC) FACTS devices are installed.

The first case is the normal operation of network without using any FACTS device. In the second, third, and fourth cases, installation of only one device has been considered. Each device is placed in an optimal location obtained by HSA. Multi-type FACTS devices installation is considered in the 5th scenario. In this case, three different kinds of FACTS devices have been considered to be placed in optimal locations to enhance power system security.

The performance index evolutions of implemented methods are shown in Fig.4, and Fig.5. The average, and maximum performance indices are shown in Fig.4. Tables 1, and 2 show optimal locations of devices for different cases. These results illustrate that the installation of one device in the network could not lead to improved security of power system and reduction in power system losses simultaneously, and that multi-type FACTS devices should be placed in optimal locations to improve security margins and reduce losses in the network.

Size/LocationSize(MVA)Location(Bus No-Bus No)Size(MVA)Location(Bus No-Bus No)Size(MVA)Location(Bus No.)

Table 1.

The results for FACTS allocations and sizes

ScenarioJPJV($) CostLosses (MVA)

Table 2.

Simulation results for different cases

Figure 4.

Performance index evolution (average of fitnesses in every iteration)

Figure 5.

Performance index evolution (maximum of fitnesses in every iteration)


6. Harmonic optimization in multi-level inverters using harmony search algorithm

6.1. Introduction

Nowadays, dc-to-ac inverters are widely used in industry. All applications are mainly divided into two general groups; 1- Electric drives for all ac motors when dc supply is used, and 2- in systems including high voltage direct current (HVDC) transmission systems, custom power and flexible ac transmission systems (FACTS) devices, flexible distributed generation (FDG), and interconnection of distributed generation (DG) units to a grid. Several switching algorithm such as pulse width modulation (PWM), sinusoidal pulse width modulation (SPWM), space-vector modulation (SVM), selective harmonic eliminated pulse width modulation (SHEPWM), or programmed-waveform pulse width modulation (PWPWM) are applied extensively to control and determine switching angles to achieve the desired output voltage. In the recent decade, a new kind of inverter named multi-level inverter has been introduced. In various publications, this inverter has been used in place of the common inverters to indicate its advantages in different applications. Being multi-level, it can be used in high-power and high-voltage applications. In order to reach the desired fundamental component of voltage, all of various switching methods produce harmonics and hence, it is of interest to select the best method to achieve minimum harmonics and total harmonic distortion (THD). It is suggested to use optimized harmonic stepped waveform (OHSW) to eliminate low order harmonics by determining proper angles, and then removing the rest of the harmonics via filters. In addition, this technique lowers switching frequency down to the fundamental frequency and consequently, power losses and cost are reduced.

Traditionally, there are two states for DC sources in multi-level inverters: 1- Equal DC sources, 2- Non-equal DC sources. Several algorithms have been suggested for the above purposes. In [37] Newton-Raphson method has been used to solve equations. Newton-Raphson method is fast and exact for those modulation indices (M) that can satisfy equations, but it cannot obtain the best answer for other indices. Also, [38] has used the mathematical theory of resultants to find the switching angles such that all corresponding low-order harmonics are completely canceled out sequentially for both equal and non-equal DC sources separately. However, by increasing levels of multi-level converters, equation set tends to a high-order polynomial, which narrows its feasible solution space. In addition, this method cannot suggest any answer to minimize harmonics of some particular modulation indices where there is no acceptable solution for the equation set. Genetic algorithm (GA) method has been presented in [39] to solve the same problem with any number of levels for both eliminating and minimizing the harmonics, but it is not fast and exact enough. This method has also been used in [40] to eliminate the mentioned harmonics for non-equal DC sources. Moreover, all optimal solutions have used main equations in fitness function. This means that the fundamental component cannot be satisfied exactly.

Here, a harmony search (HS) algorithm approach will be presented that can solve the problem with a simpler formulation and with any number of levels without extensive derivation of analytical expressions. It is also faster and more precise than GA.


7. Cascade H-bridges

The cascaded multi-level inverter is one of the several multi-level configurations. It is formed by connecting several single-phase, H-bridge converters in series as shown in Fig. 1a for a 13-level inverter. Each converter generates a square-wave voltage waveform with different duty ratios. Together, these form the output voltage waveform, as shown in Fig. 1b. A three-phase configuration can be obtained by connecting three of these converters in Y, or Δ. For harmonic optimization, the switching angles θ1, θ2,… and θ6(for a 13-level inverter) shown in Fig. 1b have to be selected, so that certain order harmonics are eliminated.


8. Problem statement

Fig. 6b shows a 13-level inverter, where θ1, θ2,…and θ6are variables and should be determined. Each full-bridge inverter produces a three level waveform +Vdc, Vdcand 0, and each angle θiis related to the ith inverter i=1,2,...,S. Sis the number of DC sources that is equal to the number of switching angles (in this study S=6). The number of levels L, is calculated as L=2S+1. Considering equal amplitude of all dc sources, the Fourier series expansion of the output voltage waveform is as follows:


where, Vnis the amplitude of harmonics. The angles are limited between 0 and 90 (0<θi<π/2). Because of odd quarter-wave symmetric characteristic, the harmonics with even orders become zero. Consequently, Vnwill be as follows:


There are two approaches to adjust the switching angles:

  1. Minimizing the THD that is not common, because some low order harmonics may remain.

  2. Canceling the lower order harmonics and removing the remained harmonics with a filter.

The second approach is preferred. For motor drive applications, it is necessary to eliminate low order harmonics from 5 to 17. Hence, in this section, a 13-level inverter is chosen to eliminate low-order harmonics from 5 to 17. It is not needed to delete triple harmonics because they will be eliminated in three-phase circuits. Thus, for a 13-level inverter, Eq. (17) changes into (18).

Figure 6.

a) Multi-Level Inverter b) Multi-Level waveform generation


Here, Mis the modulation index and defined as:


It is necessary to determine six switching angles, namely θ1, θ2,…and θ6so that equation set (18) is satisfied. These equations are nonlinear and different methods can be applied to solve them.


9. Genetic algorithm

In order to optimize the THD, genetic algorithm (GA) that is based on natural evolution and population is implemented. This algorithm is usually applied to reach a near global optimum solution. In each iteration of GA (referred as generation), a new set of strings (i.e. chromosomes) with improved fitness is produced using genetic operators (i.e. selection, crossover and mutation).


Table 3.

A typical chromosome

  1. Chromosome’s structure

Chromosome structure of a GA is shown in table 1 that involves θias parameter of the inverter.

  1. Selection

The method of tournament selection is used for selections in a GA [41-42]. This method chooses each parent by choosing nt(Tournament size) players randomly, and choosing the best individual out of that set to be a parent. In this section, ntis chosen as 4.

  1. Cross Over

Crossover allows the genes from different parents to be combined in children by exchanging materials between two parents. Crossover function randomly selects a gene at the same coordinate from one of the two parents and assigns it to the child. For each chromosome, a random number is selected. If this number is between 0.01 and 0.3 [42], the two parents are combined; else chromosome is transferred with no crossover.

  1. Mutation

GA creates mutation-children by randomly changing the genes of individual parents. In this section, GA adds a random vector from a Gaussian distribution to the parents. For each chromosome, random number is selected. If this number is between 0.01 and 0.1 [42], mutation process is applied; else chromosome is transferred with no mutation.


10. Harmony search algorithm

Harmony Search Algorithm (HSA) has been implemented based on the algorithm described in section 4 of the first part of this chapter [34-35].

Figure 7.

a) output voltage waveform b) harmonic spectrum

11. Simulation results

Harmony Search algorithm has been used to solve the optimization problem. The objective function has been chosen as follows:


where, V1*is the desired fundamental harmonic, h1=1,h2=5… and h6=17, are orders of the first six viable harmonics at the output of a three-phase multi-level inverter, respectively. The parameters of the harmony search algorithm have been chosen as: HMS=10, HMCR=0.9, PAR=0.6, and bw=0.01. The optimal solution vector is obtained after 1000 iterations as: [10.757, 16.35, 26.973, 39.068, 59.409, 59.409]. With these switching angles, the output voltage waveform and its spectrum will be obtained as shown in Fig. 2. The values of the objective function and the total harmonic distortion (THD) has been obtained as: THD=4.73%, and f=4.8e8. Simulation has also been performed by GA and results obtained as: THD=7.11%, and f=0.05. It is obvious that the harmony search algorithm performed much better than GA approach.

12. Conclusion

In the first part of the presented chapter, we presented a novel approach for optimal placement of multi-type FACTS devices based on harmony search algorithm. Simulations of IEEE 30-bus test system for different scenarios demonstrate that the placement of multi-type FACTS devices leads to improvement in security, and reduction in losses of power systems.

In the second part, the harmony search algorithm was proposed for harmonic optimization in multi-level inverters. Harmony search algorithm has more flexibility than conventional methods. This method can obtain optimum switching angles for a wide range of modulation indices. This advantage is of importance, especially when the number of switching angles goes up, where equation set may not have any solution, or when it is solvable only for a short range of modulation indices. Moreover, the implementation of the harmony search algorithm is very straightforward compared to the conventional methods like Newton-Raphson, where it is necessary to calculate the Jacobean matrix. In addition, one of the most attractive features of intelligent algorithms is their independency from case studies. Actually, intelligent algorithm can be imposed to a variety of different problems without any need for extensive manipulations. For example, the harmony search algorithm and GA algorithms are able to find optimum switching angles in order to cancel out low-order harmonics, and if it is not possible to completely remove them, they can suggest optimum switching angles so that, low-order harmonics will be reduced as much as possible. Furthermore, with a little manipulation in the defined objective function, one can use HSA and GA as a tool for THD optimization. Also, the results indicate that, harmony search algorithm has many benefits over GA such as simplicity in the implementation, precision, and speed in global convergence.

© 2013 The Author(s). Licensee IntechOpen. This chapter is distributed under the terms of the Creative Commons Attribution 3.0 License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

How to cite and reference

Link to this chapter Copy to clipboard

Cite this chapter Copy to clipboard

H. R. Baghaee, M. Mirsalim and G. B. Gharehpetian (February 13th 2013). Application of Harmony Search Algorithm in Power Engineering, Search Algorithms for Engineering Optimization, Taufik Abrão, IntechOpen, DOI: 10.5772/55509. Available from:

chapter statistics

2592total chapter downloads

1Crossref citations

More statistics for editors and authors

Login to your personal dashboard for more detailed statistics on your publications.

Access personal reporting

Related Content

This Book

Next chapter

Heuristic Search Applied to Fuzzy Cognitive Maps Learning

By Bruno Augusto Angélico, Márcio Mendonça, Lúcia Valéria R. de Arruda and Taufik Abrão

Related Book

First chapter

Multi-Agent Based Distributed Manufacturing

By J. Li, J.Y. H. Fuh, Y.F. Zhang and A.Y.C. Nee

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

More About Us