Application of Harmony Search Algorithm in Power Engineering

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.


Introduction 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][2][3][4][5][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].
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.

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 P ij , depends on the line reactance X ij , the bus voltage magnitudes V i , and V j , and phase angle between sending and receiving buses δ i and δ j , expressed by Eq. 1.

sin(
) 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.

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.

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, X line is the reactance of the transmission line, and r TCSC is the compensation factor of TCSC.The rating of TCSC depends on transmission line.To prevent overcompensation, we choose TCSC reactance between − 0.7X line to 0.2X line [26][27].

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:

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][30][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 P u1 , Q u1 , P u2 , and Q u2 are used.Assuming a lossless UPFC, real power flow from bus i to bus j can 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, Q u1 , and Q u2 , can be set to an arbitrary value depending on the rating of UPFC to maintain bus voltage.

Security index
The security index for contingency analysis of power systems can be expressed as in the following [32][33]: Search Algorithms for Engineering Optimization 2 , ( ) Here we have: V i , w i as voltage amplitude and associated weighting factor for the i th bus, respectively, S j , w j as apparent power and associated weighting factor for the j th line, respectively,V ref ,i as nominal voltage magnitude, which is assumed to be 1pu for all load buses (i.e., PQ buses), and to be equal to specified value for generation buses (i.e., PV buses), andS j,max as nominal apparent power of the j th line or transformer.J P is the security index for the even distribution of the total active flow, and J V is the security index for the closeness of bus volt- age to the reference voltage.If the number of overloaded lines decreases, the value of J P reduces too.Similarly, when the bus voltage have a value close to the desired level, J V be- comes a small value.Minimization of both J P and J V means the maximization of security margins.

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.

a. Initialize the problem and algorithm parameters
In step 1, the optimization problem is specified as follows: where, f(x) is the objective function, g(x) the inequality constraint function, and h(x) the equality constraint function.x is the set of each decision variable x i , and X is the set of the possible range of values for each decision variable; that is X i,min ≤ X i ≤ X i,max where, X i,min and X i,max are 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.

b. 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: c. Improvise a new harmony A new harmony vector, , 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 x ′ 1 for the new vector is chosen from any value in the specified HM range (x 1 1 − x 1 HMS ).Values of the other decision variables (x ′ 2 , x ′ 3 , ..., x ′ N ), 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:

Yes with probability PAR
No with probability PAR The value of (1-PAR) sets the rate of doing nothing.If the pitch adjustment decision for x ′ i is "Yes", x ′ i will be replaced as follows: where, b w is 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.

d. Update harmony memory
If the new harmony vector 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.

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

Cost of FACTS devices
Using database of [32], cost function for SVC, TCSC, and UPFC shown in Fig. 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 FF is expressed by the following equation: . .
The coefficient a 1 to a 4 have been selected by trial and error, which are 0.2665, 0.5714, 0.1421, and 0.02, respectively.These values a 1 to a 4 give better optimization results for different runs of the algorithm.In the equation above, the third term is sum of cost functions of TCSC, UPFC Search Algorithms for Engineering Optimization and SVC, described in equations ( 12) to (14).In addition, the forth term is total active power loss of the power system.

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 5 th 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.

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), spacevector 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 highvoltage 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 nonequal 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.

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 13level 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.
Each full-bridge inverter produces a three level waveform +V dc , − V dc and 0, and each angle θ i is related to the i th inverter i = 1, 2, ..., S. S is 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 Considering equal amplitude of all dc sources, the Fourier series expansion of the output voltage waveform is as follows: ( ) ( ) where, V n is 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, V n will 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).

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 o strings (.i.e.chromosomes) with improved fitness is produced using genetic operators (i.e.selection, crossover and mutation).M q q q q q q q q q = + + + Here, M is the modulation index and defined as: ( ) It is necessary to determine six switching angles, namely θ 1 , θ 2 ,…and θ 6 so that equation set (18) is satisfied.These equations are nonlinear and different methods can be applied to solve them.

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).

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

c. 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.

d. 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.

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].

Simulation Results
Harmony Search algorithm has been used to solve the optimization problem.The objective function has been chosen as follows: where, * 1 V 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: 4.73% THD  , and 4.8 8 f e   .
Simulation has also been performed by GA and results obtained as: 7.11% THD  , and 0.05 f  . It is obvious that the harmony search algorithm performed much better than GA approach.

Simulation results
Harmony Search algorithm has been used to solve the optimization problem.The objective function has been chosen as follows: where, V 1 * is the desired fundamental harmonic, h 1 =1, h 2 =5 … and h 6 =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 b w =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.8e − 8. 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.

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.

Table 1 .
The results for FACTS allocations and sizes

Table 2 .
Simulation results for different cases

Table 3
. A typical chromosome a.Chromosome's structure Chromosome structure of a GA is shown in table 1 that involves i  as parameter of the inverter.b.Selection a

Table 3 .
A typical chromosome a.Chromosome's structure Chromosome structure of a GA is shown in table 1 that involves θ i as parameter of the inverter.