IMPLEMENTATION AND ANALYSIS OF GENETIC ALGORITHMS (GA) TO THE OPTIMAL POWER FLOW (OPF) PROBLEM M. EL-SHIMY A.R. ABU EL-WAFA Electrical Power &Machine Department Faculty of Engineering Ain Shams University, Cairo, Egypt ABSTRACT Recently, there is an increasing need for Optimal Power Flow (OPF) to solve problems of today’s deregulated power systems and the unsolved problems in the vertically integrated power systems. The most important aspects related to OPF are the solution methodologies, and the application areas. This work is an implementation and analysis of an optimization method based on Meta- Heuristics in the form of Genetic Algorithms (GA) for solving the OPF problem (GA-OPF) considering transformer tap, and shunt VAR compensation settings. The effects of the parameters of the presented GA on the performance the OPF problem solution is analyzed in details. Moreover, the GA-OPF solutions are compared to solution obtained from classical optimization techniques presented in MATPOWER program. The effectiveness of the presented GA-OPF technique is demonstrated on the IEEE 9-bus system and the IEEE 14-bus system. صخلم ل انك ااثيدحلا اياسلا تلا اايلر نلا هكاالا قاا لنااكم لاحل لاامحلأل لثملأا نايرسلا ىلإ اثيدح جايتحلاا دزا لاامحلأل لاثملأا نايراسلل اايلرتلا تلاااتمك لاحلا ارار رالتعت .اايديلاتلا ايلر نلا هكالا قا تلانكم لحل لااااامحلأل لاااثملأا نايراااسلا اللااااسم لاااحل لااايلحتك اااايلرت لاااامعلا ا اااا قدااااي .اااااحكررملا ةياااماكملا قاااا نااام ال االاعل رايةلا فرداالا تاامكعم ك تلاكاحملا تااالم تلاداعم قيام اخ ةام اي يتلا تايمزراكخلا قادختسال اكااااخ ريثلااااتل لياااا ات لاااايلحتك اااااسرا د قاااات ل اااان .ايلااااامإ قاااانحت ترا اااايةتمن ااااايلر نلا تانلااااكلا نالاااامم اااا راام قاات اال ىااالإ الاااملإال .لااامحلأل لاااثملأا نايرااسلا اللااسم لاااح ا ااات اال قدااااملا اا يتلا قزراكااخلا . ل ال اايديلاتلا ارارلا امدختاسم لاامحلأل لاثملأا نايراسلا اللاسم لحل فري كلا امرا للا دح ا ات ةم ا ات لا 1 11 9 - راخخك نالامم- قااا نيياسايم نيمااا ال ايلرتلاال اامداملا ااايررلا ايحلا ضرا عتسا قت امن .بيمم INTRODUCTION During the last decade, the literature on Optimal Power flow (OPF) has seen a dramatic rise, with the focus on two aspects – first, the solution methodologies, and second, the application areas. This is because of the increasing need for OPF to solve problems of today’s deregulated power systems and the unsolved problems in the vertically integrated power systems [1, 2]. Recent challenges to, and extended applications of OPF are well discussed in [2]. Several papers dealing with the optimization of real and reactive generation have been published. From historical point of view, the first rigorous formulation was introduced in [3] however, the necessary conditions for economic dispatch by means of the Kuhn-Tucker theorem were stated in [4]. However, because the OPF is a large, non-linear optimization problem, it has taken decades to develop efficient algorithms for its solution. Several mathematical programming techniques used for OPF solution [5], the majority of these methods are: the Lagrange-multipliers method [6], Gradient method [7], Dual Linear Programming (DLP) method [8], Newton’s method [9], Newton’s method with a gradient approach [10], Linear programming method [11], Interior point method [12]. Primal-dual-logarithmic barrier method [13]. The common disadvantages of most classical optimization techniques for OPF problem solution are the constrains placed on the shape of the generator’s cost curves and the flexibility to incorporate control devices such as tap-changing transformers and static VAR compensators. Recently, natural processes have been emulated through a variety of techniques including Genetic Algorithms (GA), Particle Swarm Optimization (PSO)…etc as computational models for optimization [14]. These optimization techniques that based on Meta-Heuristics have received increasing attention in recent years for their interesting characteristics and for their success in solving problems in a number of realms. Meta-heuristics based optimization techniques found several applications to power system stability, operation and control such as [15-21]. OPERATION OF GENETIC ALGORITHMS The first design issue in applying genetic algorithms is to select an adequate coding scheme to represent potential solutions in the search space in the form of chromosomes. The second issue is to decide the number of generations and population size (the number of solutions per generation), these 2 GA parameters are a tradeoff between solution quality and computation cost. Large population size will maintain higher genetic diversity and therefore higher probability of locating global optimum, however, higher computation cost. Then the operation of the basic genetic algorithms is outlined as follows [14, 22]: STEP 1 INITIALIZATION Each bit of all N chromosomes in the population is randomly set to 0 or 1. This operation in effect spreads chromosomes randomly into the problem domains. Whenever possible, it is suggested to incorporate any a priori knowledge of the search space into the initialization process to endow the genetic algorithm with a better starting point. STEP 2 EVALUATION Each chromosome is decoded and evaluated according to the given object function (or a fitness function). The fitness value reflects the degree of success a chromosome c can achieve in its environment. i STEP 3 SELECTION Chromosomes are stochastically picked to form the population for the next generation based on their fitness values. As a result, better chromosomes will have more copies in the new population. STEP 4 CROSSOVER Pairs of chromosomes in the newly generated population are subject to a crossover operation. The crossover operator generates new chromosomes by exchanging genetic material of pair of chromosomes across randomly selected sites. Similar to the process of natural breeding, the newly generated chromosomes can be better or worse than their parents. They will be tested in the subsequent selection process, and only those which are an improvement will thrive. STEP 5 MUTATION After the crossover operation, each bit of all chromosomes is subjected to mutation. Mutation flips bit values and introduces new genetic material into the gene pool. This operation is essential to avoid the entire population converging to a single instance of a chromosome, since crossover becomes ineffective in such situations. STEP 6 TERMINATION CHECKING Genetic algorithms repeat Step 2 to Step 5 until a given termination criterion is met, such as pre-defined number of generations or quality improvement has failed to have progressed for a given number of generations. Once terminated, the algorithm reports the best chromosome (or solution) it found. Fig. 1 shows a flow chart of the basic genetic algorithms operation. 3 Although the operation of genetic algorithms is quite simple, it does have some important characteristics providing robustness: 1. They search from a population of points rather than a single point. 2. They use the object function directly i.e. not its derivatives. 3. They use probabilistic transition rules, not deterministic ones, to guide the search toward promising region. In effect, genetic algorithms maintain a population of candidate solutions and conduct stochastic searches via information selection and exchange. It is well recognized that, with genetic algorithms, near-optimal solutions can be obtained within justified computation cost. However, it is difficult for genetic algorithms to pin point the global optimum. PROBLEM FORMULATION The primary goal of a generic OPF is to minimize the costs of meeting the load demand for a power system while maintaining the security of the system [23]. The costs associated with the power system may depend on the situation, but in general they can be attributed to the cost of generating power (megawatts) at each generator. From the viewpoint of an OPF, the maintenance of system security requires keeping each device in the power system within its desired operation range at steady state. This will include maximum and minimum outputs for generators, maximum MVA flows on transmission lines and transformers, as well as keeping system bus voltages within specified ranges. The OPF problem can be formulated as follows: Minimize J(x,u) (The objective function) (1) Subject to: h(x, u) 0 ( Equality constraints) ( 2) g(x, u) 0 (Inequality constraints) ( 3) Where: x The vector of dependent variables consisting of slack bus power P , load bus voltage vector V , generator reactive power output g1 L Q , and transmission line loading vector S. g l u The vector of independent variables consisting of generators voltage magnitude vector Vg, generator real power output vector P except slack bus real power output P , transformer tap g g1 settings vector T, and settings of the shunt VAR compensation vector Q . c 1 Hence, xt [P V Q S ] and ut [V P TQ ] (4) g1 L g l g g c The equality constraints h(x, u) represent typical load flow equations [24, 25]. The inequality constraints g(x, u) represent the system operating constraints which can be arranged as follows: 1. Generator maximum and minimum real and reactive powers: Pmin P Pmax (5) g g g Qmin Q Qmax (6) g g g 2. Maximum and minimum tap ratio of under-load tap changing transformers (ULTC) Tmin TTmax (7) 3. Maximum and minimum limits of shunt VAR compensators Qmin Q Qmax (8) c c c 4. Maximum and minimum of bus voltage magnitudes and line flows to maintain the quality of electrical service and system security: Vmin V Vmax (10) L L L Vmin V Vmax (5) g g g |S |2 |Smax |2 0 (11) l l THE GA CONSTRUCTION AND PARAMETERS A Fitness function value can be defined as the quality of any particular solution. Consider the following fitness function f for the OPF problem: 5 1 f (12) 1C Penalty T Where C and Penalty are the total generation cost and the penalty placed on T violation of any of the system variables respectively. Let , , be the i i i coefficient of generator i cost function in $, $/MW, and $/MW2 respectively. N g , M be the system’s number of generators and system’s number of variables. Then, Ng C C (P ) (13) T i gi i1 C (P ) P P2 (14) i gi i i gi i gi M Penalty (15) i i i1 min if min i i i i (16) i max if max i i i i where are the penalty weights of the penalty function, are the error i i associated with each variable in the system. is a general system variable with i maximum and minimum limits Φmax and Φmin respectively. i i Based on (15) and (16), if a variable is within its allowable limits then its contribution to the penalty of errors is zero. Hence, the fitness equals to zero if either the cost or penalty is infinite. The fitness equals to one if both the cost and penalty equals to zero. Therefore, the objective of the GA-OPF is to maximize the fitness function. The genetic algorithm uses some genetic operators. A genetic operator is a set of rules for extracting new solutions from older ones. Four types of rules at each step are used: 1. SELECTION RULES in which chromosomes are stochastically picked to from the population for the next generation based on their fitness values. The selection is done by roulette wheel selection with replacement [14, 26, 27] as following: 6 f P (c ) i (17) r i Nc f j1 j where P (c) is the probability that chromosome c number i be selected. N is the r i c total number of chromosomes. 2. CROSSOVER RULES combine two parents to form children for the next generation. The crossover operator randomly selects the portion of the parents it will alter. Two crossover operators are used, single-point crossover and two-point crossover [14, 26, 27]. 3. MUTATION RULES apply random changes to individual parents to form children and are used to avoid premature convergence. Both uniform and non-uniform mutations are used. In uniform mutation, the new value is allowed to be any legal value. In non-uniform mutation, the new value is taken from a smaller neighborhood of the original value. 4. ELITISM by which the best chromosome found is retained in the next generation to ensure its genetic material remains in the gene pool. The seeding of the initial GA population is taken as the base-case load flow solution of the system. APPLICATIONS The presented GA-OPF method is applied to two systems, IEEE 9-bus system shown in Fig. 2 and IEEE 14-bus system shown in Fig. 3. The data of the 9-bus system are listed in Table 1 through Table 5, the data of the 14-bus system can be found in [28]. Analysis of the application of the presented GA-OPF on the IEEE 9-bus system is carried out with out considering neither transformer tap changes nor shunt VAR compensators changes; which are considered later. This is to be able to compare the results with MATPOWER power system simulation package [29], which uses MINOS for solving the OPF problem based on Linear Programming (LP). Neither changes in transformer tap settings or shunt VAR compensator changes are considered in MATPOWER. The effect of GA-generations number on the total system cost is shown in Fig. 4. The GA-OPF results are obtained with equal penalty weights of 1000 and population size of 20. The result show that while all constraints are satisfied, with low number of generations the quality of GA-OPF solution is very poor 7 and the resulting is nearly equals the system operating cost calculated at base- case load flow (5438.2 $/hr) also the result is very large compared to MATPOWER solution (5296.69 $/hr). However, while increasing the GA- generations number, the performance of the GA-OPF algorithm becomes excellent and the system operating cost reaches 5161.2 $/hr, with all system constraints satisfied, which is lower than MATPOWER solution by about 2.6%. It is shown in Fig. 4 that increasing the GA-generations number above 20 generations becomes almost ineffective on the performance of the GA-OPF algorithm, because that the global minimum is reached. The effect of GA-population size with different number of GA- generations on the total system cost is shown in Fig. 5. It is shown that small population size with small number of GA-generations results in very poor results of the GA-OPF. The performances of the GA-OPF can either improved increasing the number of GA-generation or the population size. Perfect solution can be obtained with large GA-generations number and population size as this gives higher possibility of locating global optimum. Actually there is a tradeoff between solution quality and computation cost. The effect of penalty weights on the total system cost keeping fixed number of generations of 20 and fixed population size of 20 is shown in Fig. 6. The result show that as the penalty weights increased above certain value (1000) the performance of the GA-OPF becomes highly degraded. That is because at very high penalty weights value, a solution will be considered illegal even if it is slightly out of the limiting constraints as the fitness value then will be close to zero. Hence, fitness values will not give the GA-OPF a good way of selecting good chromosomes. However, based on (12) very low penalty weights will cause the GA-OPF to neglect the constraints. Since the GA-OPF is based on meta-heuristics, different solutions can be obtained even if the GA parameters are kept unchanged. This is illustrated in Fig. 7 to Fig. 9. Keeping a number of GA-generations of 20, a population size of 20, and penalty weights of 100, Fig. 7 shows the effect of different runs on the total system cost compared with MATPOWER solution, the results show that GA-OPF results are not fixed for a fixed GA-parameters (min 5129.8 $/hr, max 5267.6, and average of 5213.9). However, all the solutions obtained with the GA-OPF are of good quality compared with MATPOWER solution. It should be noted that in all the solutions obtained with GA-OPF method, all the system constraints are satisfied this illustrated by a sample results of the variations of bus voltage magnitudes and generators real power allocation with various runs in Fig. 8 and Fig. 9 respectively. 8 Now, transformer taps changes, and shunt VAR compensators (with [-0.5 – 0.5] limits) are considered in the GA-OPF method. Changes in transformer taps are modeled by adjusting the system’s Y [24, 25] and a load flow is BUS carried out in the GA-OPF program for changes in transformer tap settings or shunt VAR compensators output changes that exceeds 0.01 for checking of violations in any of the system’s variables constraints. The total cost is then 5140 $/hr, the resulting generator real power allocations, generators bus voltage magnitudes, transformer tap settings, and shunt VAR compensators outputs are listed in Table 6. Actually, one of the advantages of GA-OPF is its flexibility to incorporate additional control variables to the basic control variables (generator’s real power outputs, and generator’s bus voltage magnitudes). To show the effectiveness of the presented GA-OPF, it is also applied to the IEEE 14-bus power system shown in Fig. 3, with number of GA-generations of 20, population size of 20, and penalty weights of 1000. Fig. 10 shows a comparison of the bus voltage profile obtained with GA-OPF and MATPOWER solutions of the OPF problem, it is clear that GA-OPF keeps all bus voltage magnitudes within its limits [0.94 : 1.06]. The generator’s allocations, and transformer tap settings are Listed in Table 7 for GA-OPF and MATPOWER solutions. Note: transformer tap settings in MATPOWER solution is the base case values, as it is not optimized through MATPOWER solution environment. CONCLUSION This paper presents an efficient way of implementation of Genetic Algorithms to the solution of OPF problem considering transformer taps settings and shunt VAR compensators as additional control variables. Detailed analysis and discussions on the effect of the presented GA parameters on the performance of the GA-OPF solution method are given. The most advantage of the GA-OPF is its flexibility to accommodate various control variables that could be used in the OPF problem formulation. The main disadvantage of the GA-OPF method is its slow execution time due to the large number of mathematical operation. The execution time may be reduced by either skilled computer programming or by improvements in the GA-OPF structure and termination criterion. The comparison of the OPF solutions obtained from GA- OPF and MATPOWER shows the effectiveness of the presented GA-OPF method for solving OPF with excellent quality of solution with no limitations on the control variables selected. REFERENCES [1] Kankar Bhattacharya, Math H.J. Bollen, Jaap E. Daalder, “Operation of Restructured Power Systems”, Kluwer Academic Publishers, 2001. [2] J.A. Momoh, et. al., “Challenges to Optimal Power Flow”, 1996 IEEE/PES 9 Winter Meeting, Jan. 21 – 25, 1996, Baltimore, MD. [3] R. B. Squires, “Economic Dispatch of Generation Directly From Power System Voltages and Admittances”, AIEE Trans. Vol. 79, 1960, pp. 1235 - 1245 [4] J. Carpienter, “Contribution á Pétude du Dispatching Économique,” Bull. Soc. Franç. Elec., Ser. 8, Vol. 3, Aug. 1962. [5] M. Huneault and F. D. Galiana, “A Survey of the Optimal Power Flow Literature,” IEEE Trans. on Power Systems, Vol. 6, No. 2, May 1991, pp. 762-770. [6] Ahemed H. EL-Abiad, Fernando J. Jaimes, “A Method for Optimum Scheduling of Power and Voltage magnitudes”, IEEE Trans., Vol. PAS-88, No. 4, April 1969. [7] H. W. Dommel and W. F. Tinney, “Optimal Power Flow Solutions,” IEEE Trans., Vol. PAS-87, October 1968, pp.1866-1876. [8] C. M. Shen, et al, “Power System Load Scheduling with Security Constraints using Dual Linear Programming”, Proc. IEE, Vol. 117, No. 11, Nov. 1970, pp. 2117 - 2127 [9] D. I. Sun, B. Ashley, B. Brewer, A. Hughes and W. F. Tinney, “Optimal Power Flow by Newton Approach,” IEEE Trans., Vol. PAS-103, Oct. 1984, pp. 2864-2880. [10] J. Velghe, N.M. Peterson, “Optimal Control of Real and Reactive Power Flow under Constraints”, Power System Computation Conference, GRENOBLE, Sept. 11 – 16, 1972. [11] O. Alsac, J. Bright, M. Prais and B. Stott, “Further Developments in LP- Based Optimal Power Flow,” IEEE Trans. on Power Systems, Vol. 5, No. 3, Aug. 1990, pp. 697-711. [12] Y. Wu, A. S. Debs and R. E. Marsten, “Direct Nonlinear Predictor- Corrector Primal-Dual Interior Point Algorithm for Optimal Power Flows,” 1993 IEEE Power Industry Computer Applications Conference, pp. 138-145. [13] A. Vanusa, et al, “Modified Barrier Method for Optimal Power Flow Problem”, IEEE general Meeting, 6 – 10 June 2004, Denver, Colorado USA. [14] Adrian A. Hopgood, “Intelligent Systems for Engineers & Scientists – 2nd Edition”, CRC Press, 2001. [15] K. Y. Lee, Y. M. Park, and J. L. Ortiz, “A United Approach to Optimal Real and Reactive Power Dispatch,” IEEE Trans., Vol. PAS-104, No. 5, May 1985, pp. 1147–1153 [16] L. L. Lai and J. T. Ma, “Application of Evolutionary Programming to Reactive Power Planning—Comparison with Nonlinear Programming Approach,” IEEE Trans. on Power Systems, Vol. 12, No. 1, Feb. 1997, pp. 198–206. [17] K. P. Wong and Y. W. Wong, “Combined Genetic Algorithm / Simulated Annealing / Fuzzy Set Approach to Short-term Generation Scheduling with Takeor-pay Fuel Contract,” IEEE Trans. on Power Systems, Vol. 11, No. 1, Feb. 1996, pp. 128–136 [18] A. Bakirtzis, V. Petridis, and S. Kazarlis, “Genetic Algorithm Solution to the Economic Dispatch Problem,” Proc. IEE on Gen., Trans., and Distr., Vol. 141, No. 4, July 1994, pp. 377–382 11