genetic algorithms applied in online autotuning pid parameters of a

19
http://tim.sagepub.com Measurement and Control Transactions of the Institute of DOI: 10.1191/0142331203tm0098oa 2003; 25; 433 Transactions of the Institute of Measurement and Control T. K. Teng, J. S. Shieh and C. S. Chen liquid-level control system Genetic algorithms applied in online autotuning PID parameters of a http://tim.sagepub.com/cgi/content/abstract/25/5/433 The online version of this article can be found at: Published by: http://www.sagepublications.com On behalf of: The Institute of Measurement and Control found at: can be Transactions of the Institute of Measurement and Control Additional services and information for http://tim.sagepub.com/cgi/alerts Email Alerts: http://tim.sagepub.com/subscriptions Subscriptions: http://www.sagepub.com/journalsReprints.nav Reprints: http://www.sagepub.com/journalsPermissions.nav Permissions: © 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.com Downloaded from

Upload: voque

Post on 11-Feb-2017

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Genetic algorithms applied in online autotuning PID parameters of a

http://tim.sagepub.com

Measurement and Control Transactions of the Institute of

DOI: 10.1191/0142331203tm0098oa 2003; 25; 433 Transactions of the Institute of Measurement and Control

T. K. Teng, J. S. Shieh and C. S. Chen liquid-level control system

Genetic algorithms applied in online autotuning PID parameters of a

http://tim.sagepub.com/cgi/content/abstract/25/5/433 The online version of this article can be found at:

Published by:

http://www.sagepublications.com

On behalf of:

The Institute of Measurement and Control

found at:can beTransactions of the Institute of Measurement and Control Additional services and information for

http://tim.sagepub.com/cgi/alerts Email Alerts:

http://tim.sagepub.com/subscriptions Subscriptions:

http://www.sagepub.com/journalsReprints.navReprints:

http://www.sagepub.com/journalsPermissions.navPermissions:

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 2: Genetic algorithms applied in online autotuning PID parameters of a

Transactions of the Institute of Measurement and Control 25,5 (2003) pp. 433–450

Genetic algorithms applied in onlineautotuning PID parameters of aliquid-level control systemT.K. Teng , J.S. Shieh and C.S. ChenDepartment of Mechanical Engineering, Yuan Ze University, 135 Yuan-Tung Rd,Chung-Li, Tao Yuan, 320, Taiwan

In this paper, a simple genetic algorithm (GA) method has been applied in a real-time experi-ment on a liquid-level control system for online autotuning proportional-integral-derivative(PID) parameters. Our proposed method can automatically choose the best PID parametersfor each generation. Then, using the reproduction, crossover and mutation to create the newpopulation for other PID parameters, it can continuously control the liquid-level system untilthe preset iteration number is reached. Finally, the best PID parameters can be obtained. Fur-thermore, two selection methods, roulette wheel and tournament, have been compared in real-time experiments. Real-time experimental results are given to demonstrate the effectivenessand usefulness for online tuning PID parameters via this evolution process.

Key words: crossover; evolution; genetic algorithms; mutation; proportional-integral-derivative(ID) controller; reproduction; roulette wheel selection; tournament selection

1. Introduction

Most industrial processes are controlled by proportional-integral-derivative (PID)controllers. The popularity of PID controllers is due to their simplicity both fromdesign and parameter tuning points of view. Almost all control problems can besolved by these controllers and they are found in large numbers in all processindustries. They have survived many changes in technology, from early controllers

Address for correspondence: Jiann-Shing Shieh, Department of Mechanical Engineering, Yuan ZeUniversity, 135 Yuan-Tung Rd, Chung-Li, Tao Yuan, 320, Taiwan. E-mail: [email protected]

Ó 2003 The Institute of Measurement and Control 10.1191/0142331203tm0098oa © 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution.

at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 3: Genetic algorithms applied in online autotuning PID parameters of a

434 Online autotuning PID parameters

based on relays and pneumatic systems to being lately replaced by electroniccircuits and microprocessors. The PID controllers perform several important func-tions, two very important ones being the elimination of steady-state offset andanticipation of deviation and generation of adequate corrective signals throughthe derivative action. Together with combinational logic, sequential machines andsimple function blocks, these PID controllers are increasingly being used to buildautomation systems for industries.

In the early development of automatic control, PID control generated muchinterest, but for a long time, researchers paid very little attention to it. The mainreason behind this was the practical dif�culty in tuning the three parameters bytrial and error. After the widespread application of microprocessors, there hasbeen a resurgence of interest in PID control. Even though these PID controllersare very common and well known, they are often not tuned properly, resultingin poor control quality. Since almost all PID controllers are now implemented insoftware, there is ample scope to incorporate complex algorithms in these control-lers. Autotuning is one such feature now being extensively used in commerciallyavailable PID controllers (Hoopes et al., 1983; Kraus and Myron, 1984). Althoughthe process reaction curve (PRC) method can be used to obtain the �rst-orderplus time-delay model, the adjustable parameters can then be obtained with theusual tuning rules for PID controllers, such as the integral of time-weightedabsolute value of the error, Cohen-Coon and Ziegler–Nichols (Z-N) (1942)methods. Also, the continuous cycling identi�cation method identi�es the ultimategain and frequency, and then the Z-N tuning rule can be used to tune the PIDcontroller. However, the above-mentioned identi�cation methods cannot be donein an online manner and require tedious procedures. Moreover, identi�cation per-formances are poor frequently due to the effects of measurement noises ordisturbances.

Therefore, many online process identi�cation methods for automatic tuning ofthe PID controller have been proposed to overcome these disadvantages (Yuwana,1982; Schei, 1992; Zhuang and Atherton, 1993; Sung et al., 1998; Tan et al., 2001).However, the identi�ed frequency region by previous methods is too narrow com-pared to the wide operating frequency region of the controller, so satisfactorycontrol performances cannot be achieved frequently. Also, too much complicatedmathematics to let them implement to industrial processes is impossible. Toenhance the capabilities of traditional PID tuning techniques and perform theonline process identi�cation without complicated mathematics, several newmethods from an arti�cial intelligent approach, such as genetic algorithms (GAs)(Wang and Kwok, 1994), fuzzy logic controllers (Tzafestas and Papanikolopoulos,1990; Zhao et al., 1993), and hybrid method for a fuzzy-genetic approach (Wu andHuang, 1997; Bandyopadhyay et al., 2001) have been developed recently to tunethe parameters of PID controllers. Since Holland’s work (1975), the applicationsof GAs have expanded into various �elds (Goldberg, 1989a). With the abilitiesfor global optimization and good robustness, and without knowing anythingabout the underlying mathematics, GAs are expected to overcome the weaknessof traditional PID tuning techniques and to be more acceptable for industrial prac-tice. In the work of Wang and Kwok (1994), it has been shown that GAs give abetter performance in tuning the parameters of PID controllers than the Z-N

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 4: Genetic algorithms applied in online autotuning PID parameters of a

Teng et al. 435

method does. However, since the PID parameters generated by GAs are �xed,PID controllers cannot always effectively control systems with changing para-meters. To cope with the above problems, the GAs proposed in this paper are foronline autotuning the parameters of PID controllers. In this method, GAs are usedto search for the optimal PID parameters that will minimize the integral absoluteerror (IAE) value when the process in steady state. Since no human expertise isneeded in the tuning procedure and since the PID parameters are online adaptive,good control performance can be expected in the proposed method. Also, a real-time experiment on a coupled-tank liquid-level control system designed to mimican industrial process is provided to illustrate the applicability of the proposedapproach under realistic practical conditions.

2. Parameter tuning of PID controllers

2.1 PID controllers

In general, a classical PID control system can be depicted as shown in Figure 1,in which the input–output relation of the PID controller is expressed as

u = Kce +1Ti

et0 edt + Tde· (1)

where u is the control signal, e is the error signal, and Kc, Ti and Td denote theproportional gain, the integral gain and derivative gain, respectively.

The basic equation of a PID controller in discrete domain is given by (Porter,1989)

mn = Kc F en +TTiOnk=0

ek +Td

T(en - en-1 ) G + m0 (2)

where m is the manipulated variable, the controller output; e,Kc,Ti and Td are thesame as in Equation (1); T is the sampling time and the suf�xes denote thesampling instants.

At the (n-1)th, Equation (2) is modi�ed as

mn-1 = Kc F en-1 +TTiOn-1

k=0

ek +Td

T(en-1 - en-2) G + m0 (3)

Subtracting Equation (3) from Equation (2), the velocity form algorithm of thePID controller is derived:

Figure 1 Block diagram of a classical PID control system

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 5: Genetic algorithms applied in online autotuning PID parameters of a

436 Online autotuning PID parameters

mn - mn-1 = Kc F (en - en-1 ) +TTi

en +Td

T(en - 2en-1 + en-2 ) G (4)

The right-hand side of Equation (4) is to be evaluated to obtain the new valuesof Kc, Ti and Td. All the quantities in the above equation, except mn, are knownat the (n-1)th sampling instant. If different values of Kc, Ti and Td are chosen,then it is obvious that various responses of the plant will be obtained. Therefore,the parameter tuning problem of a PID controller can be considered by selectingthe three parameters Kc, Ti and Td such that the response of the plant will be asdesired. For online autotuning the PID parameters, a GA method will be intro-duced in the following section.

2.2 GAs

GAs and searching algorithms imitate some of the processes of natural evolution.The searching process is similar to the natural evolution of biological creatures,in which successive generations of organisms are born and raised until they them-selves are able to breed. Indeed, users are free to utilize those features that areuseful and eliminate aspects that seem unimportant in their applications. In suchalgorithms, the �ttest among a group of arti�cial creatures can survive and forma new generation. The creatures in the new generation are produced through thestructure that includes randomized information or gene exchange. In every newgeneration, the new creatures (offspring) are produced by using bits and piecesof the �ttest of the older generation in terms of some extended performancecriteria. Since normal evolution processes are quite slow, better reproductionbased on an aggressive ‘survival of the �ttest’ philosophy is used to speed up theevaluation process, e.g., tournament selection is computationally more ef�cientthan the other selection methods (Mitchell, 1998). In order to understand moredetails about how to use GAs in our work, a brief description of this method isgiven below.

2.2.1 Encoding: Binary encodings (i.e., bit strings) are the most commonencodings for a number of reasons. In their earlier work, Holland and his studentsconcentrated on such encodings and GAs practice has tended to follow this lead.Much of the existing GA theory is based on the assumption of �xed-length, �xed-order binary encodings. Much of that theory can be extended to apply to nonbi-nary encodings, but such extensions are not as well developed as the originaltheory. In addition, heuristic about appropriate parameter settings (e.g., for cross-over and mutation rates) have generally been developed in the context of binaryencodings. In spite of these advantages, binary encodings are unnatural andunwieldy for many problems (e.g., evolving weights for neural networks), andthey are prone to rather arbitrary orderings. For many applications, it is naturalto use an alphabet of many characters or real numbers to form chromosomes.Several empirical comparisons between binary encodings and multiple-characteror real-valued encodings have shown better performance for the latter (Wright,1991; Yang and Kao, 1996; Bessaou and Siarry, 2001), but the performance depends

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 6: Genetic algorithms applied in online autotuning PID parameters of a

Teng et al. 437

very much on the problem and the details of the GA being used, and at presentthere are no rigorous guidelines for predicting which encodings will work best.

2.2.2 Initialization and population size: The initial population for a GA is a setof solutions to the optimization problem. Good initial populations facilitate a GA’sconvergence to good solutions, whereas poor initial populations can hinder GAconvergence. There are a variety of approaches for generating initial populations.A common method of population generation is random generation. The initialpopulation is �lled with individuals that are generally created at random. Thisapproach is ef�cient and provides a population covering the feasible region, butthe entire initial population may be unfeasible. An alternative approach is to useinformation about the problem structure to arrive at better probability values forbuilding initial populations randomly. Therefore, individuals in the initial popu-lation are the solutions found by some method determined by the problem domainand knowledge. In this case, the scope of the GA is to obtain more accuratesolutions (Hill, 1999; Renner and Ekart, 2003).Although it has been recognized by the GA community that population size

plays an important role in the success of the problem-solving process, there isstill limited understanding of the effects and merits of dynamically adapting thisparameter. In an early paper, DeJong (1975) studied, among other GA aspects,the optimal population size for a set of numerical functions, experimenting withvalues ranging from 50 to 100. Grefenstette (1986) used a meta-level GA to controlthe parameters of another GA, �nding population size values between 30 and 80,but his results were only slightly better than DeJong’s. Goldberg (1989b) statedthat a small initial population size can lead to premature convergence, since thereare few schemata to process in the initial population. On the other hand, a largepopulation results in a long computational time to gain improvements, imposinga large computational cost per generation. Also, Goldberg’s paper suggests thatsmall population sizes should be selected for serial GA implementation and largepopulation sizes for perfectly parallel GA implementations. Recently, a briefsurvey of previous work on population size parameter control is proposed inCosta et al. (1999), covering both static and dynamical methods. The paper resultsindicate that, when no previous information exists, choosing a dynamic randomvariation control strategy for the population size is a reasonable choice.

2.2.3 Fitness function: In GAs, the �tness is the quantity that determines thequality of a chromosome, from which a determination can be made as to whetherit is better or worse than other chromosomes in the gene pool. The �tness isevaluated by a �tness function that must be established for each speci�c problem.The �tness function is chosen so that its maximum value is the desired value ofthe quantity to be optimized. Its importance cannot be overemphasized, becauseit is the only connection between the GA and the problem in the real world. A�tness function must reward the desired behaviour; otherwise the GA may solvethe wrong problem. Fitness functions should be informative and have regularities.However, they need not be low-dimensional, continuous, differentiable orunimodal (Tsoukalas and Uhrig, 1997).

2.2.4 Selection methods: The purpose of selection is to emphasize the �tter indi-

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 7: Genetic algorithms applied in online autotuning PID parameters of a

438 Online autotuning PID parameters

viduals in the population in hopes that their offspring will in turn have evenhigher �tness. Selection has to be balanced with variation from crossover andmutation: too strong a selection means that suboptimal highly �t individuals willtake over the population, reducing the diversity needed for further change andprogress; too weak a selection will result in too slow an evolution. The two mostcommon methods are proportional selection (i.e., the roulette wheel) and rank-based selection. In proportional selection, the number of times the gene can bereproduced is proportional to its �tness function. This technique, which was usedby Holland, involves selecting the top performers and allowing multiple repro-ductions of the best performers. A sampling algorithm is usually used to allocatethe number of reproductions to the various genes. The proportional method some-times tends to give undue emphasis to superior performing chromosomes whose�tness functions may be 10 times the average �tness function. If such a superchromosome is reproduced 10 times in a pool of 50 genes, it would clearly distortthe gene pool. In the rank-based selection process, each gene is typically repro-duced only once, although there are variations of this algorithm that allow mul-tiple reproduction of a single gene. Rank-based selection tends to converge slowlywith less premature convergence and better diversity of the gene pool. However,the proportional method requires the computation of the mean �tness and theexpected value of each individual through the population at each generation. Rankscaling requires sorting the entire population by rank. Hence, these two methodshave a potentially time-consuming procedure. Tournament selection is similar torank selection in terms of selection pressure, but it is computationally moreef�cient and more amenable to parallel implementation. Two individuals arechosen at random from the population. A random number r is then chosenbetween 0 and 1. If r < k (where k is a parameter, for example 0.75), the �tter ofthe two individuals is selected to be a parent; otherwise the less �t individual isselected. The two are then returned to the original population and can be selectedagain. For more technical comparisons of different selection methods, see Mitchell(1998) and Osyczka et al. (1999). Recently, several papers to modify the tourna-ment selection method have been proposed to improve the population diversity(Matsui, 1999) and optimize the multicriteria problems (Osyczka and Krenich,2000).

2.2.5 Genetic operators: In each generation, the genetic operators are appliedto selected individuals from the current population in order to create a newpopulation. Generally, the three main genetic operators of reproduction, crossoverand mutation are employed. By using different probabilities for applying theseoperators, the speed of convergence can be controlled. Crossover and mutationoperators must be carefully designed, since their choice highly contributes to theperformance of the whole genetic algorithm.

1) Reproduction: A part of the new population can be created by simply copyingwithout change selected individuals from the present population. This givesthe possibility of survival for already developed �t solutions.

2) Crossover: New individuals are generally created as offspring of two parents(i.e., crossover being a binary operator). One or more so-called crossover points

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 8: Genetic algorithms applied in online autotuning PID parameters of a

Teng et al. 439

are selected (usually at random) within the chromosome of each parent, atthe same place in each. The parts delimited by the crossover points are theninterchanged between the parents. The individuals resulting in this way arethe offspring. Beyond one point and multiple point crossover, there exist somecrossover types. The so-called arithmetic crossover generates an offspring as acomponent-wise linear combination of the parents (Yalcinoz, 2002; Lee andMohamed, 2002; Mondal and Maiti, 2002). In later phases of evolution it ismore desirable to keep �t individuals intact, so it is a good idea to use anadaptively changing crossover rate: higher rates in early phases and a lowerrate at the end of the GA (Dagli and Schierholt, 1997). Sometimes it is alsohelpful to use several different types of crossover at different stages of evol-ution (Hong and Wang, 1998).

3) Mutation: A new individual is created by making modi�cations to one selectedindividual. The modi�cations can consist of changing one or more values inthe representation or adding/deleting parts of the representation. In GAs,mutation is a source of variability and too great a mutation rate results in lessef�cient evolution, except in the case of particularly simple problems. Hence,mutation should be used sparingly because it is a random search operator;otherwise, with high mutation rates, the algorithm will become little more thana random search (Lin and Lee, 1999). Moreover, at different stages, one may usedifferent mutation operators. At the beginning, mutation operators resulting inbigger jumps in the search space might be preferred. Later on, when thesolution is close by, a mutation operator leading to slighter shifts in the searchspace could be favoured (Smith and Fogarty, 1996).

3. A liquid-level control system

A laboratory-scale coupled-tank system, developed by the authors, is used as atest bed for the proposed method. It consists of two tower-type tanks with aninternal pipe in between, as shown in Figure 2. Water from a reservoir �ows intothe second tank via the �rst tank through an internal pipe and subsequently backto the reservoir through a drainage pipe. To measure the level of the liquid inthe second tank, it relies on the change of liquid’s level which makes �oating ballpop up and down. When the �oating ball changes its position, the belt whichascends or descends will rotate the sensor (i.e., potentiometer) to generate 0–5voltage. The whole system is connected to a PC via an AD and DA card (i.e.,PCL-8125PG made in Advantech Co., Taiwan). Therefore, the continuous data ofthe liquid level (i.e., 0–5 voltage) will be sampled by AD card and turned intodiscrete signals that will be dealt with by computer. After digital signal processing,the computer can send an analogue signal (i.e., 0–10 voltage) to control the pumpvia DA card. The control objective is to control the water level in the second tankto a prespeci�ed level. The simple block diagram of a closed-loop digital controlsystem is shown in Figure 3.

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 9: Genetic algorithms applied in online autotuning PID parameters of a

440 Online autotuning PID parameters

Figure 2 A liquid-level control system

Figure 3 Block diagram of a digital control system

3.1. The transfer function of the system

The transfer function of this liquid-level system was obtained from the most popu-lar of the empirical tuning methods, known as the PCR method, developed byCohen-Coon (Stephanopoulos, 1984). Cohen-Coon observed that the response ofmost processing units to an input change had a sigmoid shape, which can beadequately approximated by the response of a �rst-order system with dead time:

G(s) =Ke-tds

ts + 1(5)

where K is the process static gain, td is the process dead time and t is the processtime constant.

From the approximate response of the reaction curve in the liquid-level system,it is easy to estimate the values of these three parameters and the transfer functionof this system can be obtained as shown:

G(s) =0.68e-4s

118s + 1(6)

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 10: Genetic algorithms applied in online autotuning PID parameters of a

Teng et al. 441

Then, according to the Cohen-Coon method, it is easy to obtain the three PIDcontroller parameters (i.e., Kc = 5.82, Ti = 9.7 s, and Td = 1.5 s) in Equation (1).

3.2 Genetic tuning methodology

In this method, the GAs is used to search for the optimal PID parameters thatwill minimize the IAE value when the process is in steady state. Therefore, theparameter tuning problem of a PID controller using GAs can be considered byselecting the three parameters Kc,Ti and Td such that the response of the plant willbe as desired as shown in Figure 4. The details of the GAs used in this paper aregiven in the following. The encoding used real numbers to form chromosomes.The population size used here is eight tribes. The tribe is composed of three PIDparameters, which used to describe the liquid-level control system. Because wedo not know what PID value is the best value for the system, we gave the systemmany tribes, composed of random PID values around the values obtained fromthe Cohen-Coon method in the beginning. The �tness function is calculated fromthe IAE, which will minimize the IAE value when the process is in steady stateas shown:

Fitness function = et0ueudt (7)

The selection method chosen has been the roulette wheel and tournament selectionmethods, in order to compare the speed of search and the controller performance.Regarding the genetic operators, there are 20% of the �ttest individuals unalteredinto the next generation to ensure that the best organism will not disappear ineach generation. The crossover operation conducts the most creative kind ofsearch, which is why we use it to produce around 76% of the offspring in eachgeneration. Finally, about 4% of the mutation rate in this case undergoes mutation,in the hope that a random modi�cation of the relatively �t individuals will leadto improvement (Koza et al., 2003).

Therefore, the GAs work in this paper as follows (i.e., also shown in Figure 5):

1) The eight initial population tribes are �lled with individuals that are generallycreated at random. Sometimes, the individuals in the initial population are thesolutions found by some method determined by the problem domain. In this

Figure 4 Block diagram of the proposed GA method forparameter tuning of PID controllers

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 11: Genetic algorithms applied in online autotuning PID parameters of a

442 Online autotuning PID parameters

Figure 5 Flowchart of the GAs in a liquid-level control system

paper, we gave random values to these initial populations but limited theirranges around the values obtained from the Cohen-Coon method because PIDparameters too large or too small result in a long search time. Although theranges of PID values are rationally chosen by arbitrary and it is true that thelimitation will in�uence the results of the GA search, it is intended to obtainmore stable, ef�cient and accurate solutions.

2) Every generation is applied in liquid-level control system, which was describedby PID parameters and produced a group of errors that calculated the IAEvalue from transient to steady state.

3) Each individual in the current population is evaluated using the �tnessfunction.

4) If the termination criterion [i.e., the generation number > preset number (20or 40)] is met, the best solution (i.e., PID parameters) is returned.

5) From the current population, individuals are selected based on the previouslycomputed �tness values. A new population is formed by applying the geneticoperators (i.e., reproduction, crossover, and mutation) to these individuals.

6) Actions starting from step (2) are repeated until the termination criterion issatis�ed. An iteration is called a generation.

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 12: Genetic algorithms applied in online autotuning PID parameters of a

Teng et al. 443

4. Real-time experimental results

The proposed GA method has been applied in the real-time experiment on aliquid-level control system for online autotuning PID parameters. In each real-time experiment, we make the liquid-level control system run for 150 s for a groupof PID parameters. There are eight tribes in every generation and every tribe has150 s (from the bottom to a set level of the liquid control system) to accumulatetheir errors. Better PID parameters obtain smaller IAE values. Hence, our pro-posed method can automatically choose the best PID parameters for each gener-ation. Then, using the GAs to create the new population for another eight tribesof PID parameters, it can continuously control the liquid-level system until thepreset iteration number reached. Finally, the best PID parameters can be obtained.

Two selection methods have been compared in this paper. The �rst one wasusing the roulette wheel selection. In every generation, we compare every �tnessvalue, and better �tness values included in larger sector of a circle can be obtainedthan worse ones. The area of the sector equals to the percentage of opportunitythat is chosen for crossover. In other words, the better �tness values get the largerchance to ‘survive’. As described before, we determine the best PID parametersby the smallest errors (i.e., IAE), which generate the PID control formula andapplied these parameters in the liquid control system. Figure 6 demonstrates theerrors compared at different numbers of generations. In Figure 7, we can observethe response of the liquid-level control system. The upper curve is the responseof plant (i.e., the height of the liquid level) and the lower curve is the output of

Figure 6 Twenty generations of accumulated errors (i.e., IAEvalues) from the roulette wheel selection method [the abscissaindicates the number of generation and each generation has eighttribes (i.e., eight groups of PID)]

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 13: Genetic algorithms applied in online autotuning PID parameters of a

444 Online autotuning PID parameters

Figure 7 The best PID parameters to control the liquid-levelsystem from 20 generations using the roulette wheel selectionmethod (the dotted line indicates the set point level; controlleroutput is the voltage of pump’s output and the control height isthe liquid level; the Kc,Ti and Td are the three PID parameters)

the controller (i.e., the pump output). The dotted line is the set-point level.Obviously, when the system is in a steady-state response, the upper curve is notreally good at following the set-point level.

The second method is the tournament selection, which is very different fromthe roulette wheel selection in that it can �lter out the worse �tness values directlyand keep the better ones. Because tournament selection has this kind of propertyit can avoid sophisticated algebraic calculation. The speed of the search is muchfaster than in roulette wheel selection. Figure 8 describes the errors compared atdifferent numbers of generations just like Figure 6. For ease of comparison, theconditions (i.e., generation number) of these two experiments are the same. It isobvious that the errors decrease faster and more smoothly than that in roulettewheel selection. Figure 9, the same as Figure 7, shows the response of the liquid-level control system. The upper curve is a little bit better than Figure 7 in followingthe set-point level and the lower curve is more stable than Figure 7 from a control-ler output point of view. This result shows that tournament selection can searchfor optimal PID parameters more rapidly than that of roulette wheel selection.

However, good PID parameters should have a short rising time and smallersteady-state errors. Proportional gain, integral time constant and derivative timeconstant can affect the liquid-level control system separately. These three para-meters are a group of PID parameters and should operate in co-ordination. Hence,we need more generations of evolution. In previous experiments, we just ran 20generations. In order to obtain more accurate parameters, we prolong the gener-ation; in other words, we increase the generations of the evolution. Figure 10 is

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 14: Genetic algorithms applied in online autotuning PID parameters of a

Teng et al. 445

Figure 8 Twenty generations of accumulated errors (i.e., IAEvalues) from the tournament selection method (the notation in the�gure is the same as in Figure 6)

Figure 9 The best PID parameters to control the liquid-levelsystem from the 20-generation tournament selection method (thenotation in the �gure is the same as in Figure 7)

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 15: Genetic algorithms applied in online autotuning PID parameters of a

446 Online autotuning PID parameters

Figure 10 Forty generations of accumulated errors (i.e., IAEvalues) from the roulette wheel selection method (the notation inthe �gure is the same as in Figure 6)

an experiment that has 40 generations. Obviously, the accumulated errors aremuch smaller than the experiments with 20 generations. According to Figure 10,we know that GAs can obtain more accurate results by more evolutions. This isjust like Darwinian principles of evolution and natural selection. Figure 11 is theresponse of the liquid-level control system and shows a better response than doFigures 7 and 9. We also performed the experiment using tournament selectionwith 40 generations in comparison with roulette wheel selection. In Figure 12, theaccumulated errors as before decrease faster and more smoothly than in roulettewheel selection. Also, in Figure 13 we can �nd that the rising time is shorter thanin roulette wheel selection and the static error is also smaller. Rising time deter-mines the transient response and a short rising time makes a small accumulatederror. Furthermore, the oscillation of the steady-state response is smaller anddemonstrates that it is a stable liquid-level control system. This result proves thatmore generations produce better offspring.

5. Conclusions and future work

In this paper, a simple GA method has been applied in the real-time experiment ofa liquid-level control system for online autotuning PID parameters. Our proposedmethod can automatically choose the best PID parameters for each generation,and we use a real liquid-level control system to evaluate the chromosomes(individual of the population) by measuring the error signal. This means that eachevaluation of a chromosome needs a trial run of the liquid-level control system.

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 16: Genetic algorithms applied in online autotuning PID parameters of a

Teng et al. 447

Figure 11 The best PID parameters to control the liquid-levelsystem from 40 generations using the roulette wheel selectionmethod (the notation in the �gure is the same as in Figure 7)

Figure 12 Forty generations of accumulated errors (i.e., IAEvalues) from the tournament selection method (the notation in the�gure is the same as in Figure 6)

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 17: Genetic algorithms applied in online autotuning PID parameters of a

448 Online autotuning PID parameters

Figure 13 The best PID parameters to control the liquid-levelsystem from the 40-generation tournament selection method (thenotation in the �gure is the same as in Figure 7)

However, if we apply the proposed PID-parameter tuning method to control ofa real process, those random PID parameters (in the GA’s initial stage) may causethe system to become unstable. Hence, in this paper, the initial parameters of thePID (i.e., Kc = 58.2, Ti = 9.7 s and Td = 1.5 s) were derived from the Cohen-Coonmethod (not from random values) in order to make sure that the real system canconverge in the stable condition. Moreover, the �nal best PID parameters (i.e., Kc

= 17.3, Ti = 6.8 s and Td = 1.7 s) in Figure 13 are not very far away from the initialparameters. This means that the individuals in the initial population found bysome method determined by the problem domain and knowledge are easy andcan obtain more accurate solutions faster and more easily. However, according tothe GAs, the size of the tribes, rate of crossover and rate of mutation could affectthe result of GAs’ searching and may cause the system to become divergent.Hence, in the next stage, the simulation in the plant model is needed to test thedifferent GA parameters combination in order to obtain the best PID parameters.Then, such parameters can be initialized as the initial population to ensure thatsuch trial runs of a real process are stable and convergent.

Fuzzy logic, neural networks and GAs are three popular arti�cial intelligencetechniques widely used in many applications. Because of their distinct propertiesand advantages, they are currently being investigated and integrated to formmodels or strategies in areas of system control. In control engineering, the fusionof fuzzy logic, neural networks and GAs is steadily growing (Wu and Huang,1997; Lian et al., 1998; Bandyopadhyay et al., 2001; Koza et al., 2003). Therefore,using the hybrid intelligent approach for autotuning a PID controller may providemore suitable PID parameters.

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 18: Genetic algorithms applied in online autotuning PID parameters of a

Teng et al. 449

Acknowledgements

The authors wish to thank the National Science Council (NSC) in Taiwan (GrantNumber: NSC90-2212-E-155-002) for supporting this research.

References

Bandyopadhyay, R., Chakraborty, U.K. andPatranabis, D. 2001: Autotuning a PIDcontroller: A fuzzy-genetic approach. Journalof Systems Architecture 47, 663–73.

Bessaou, M. and Siarry, P. 2001: A geneticalgorithm with real-value coding to optimizemultimodal continuous functions. Structureand Multidisciplinary Optimization 23, 63–74.

Costa, J.C., Tavares, R. and Rosa, A. 1999: Anexperimental study on dynamic randomvariation of population size. Proceedings ofIEEE SMC’99 Conference on Systems, Man, andCybernetics, Vol. 1, Tokyo, Japan, 607–12.

Dagli, C.H. and Schierholt, K. 1997: Evaluat-ing the performance of the genetic neuroscheduler using constant as well as changingcrossover and mutation rates. Computers inIndustry and Engineering 33, 253–56.

DeJong, K.A. 1975: An analysis of the behaviorof a class of genetic adaptive systems. PhDthesis, University of Michigan, Ann Arbor,Michigan.

Goldberg, D.E. 1989a: Genetic algorithms insearch, optimization and machine learning.Reading, Massachusetts: Addison-Wesley,122–24.

Goldberg, D.E. 1989b: Sizing populations forserial and parallel genetic algorithms. Pro-ceedings of the Third International Conference onGenetic Algorithms and Their Applications. SanMateo, California, Morgan Kaufmann, 70–79.

Grefenstette, J.J. 1986: Optimization of controlparameters for genetic algorithms, IEEETransactions on Systems, Man and Cybernetics,SMC-16, 122–28.

Hill, R.R. 1999: A Monte Carlo study of gen-etic algorithm initial population generationmethods. Proceedings of the 1999 WinterSimulation Conference, Vol. 1, Phoenix,Arizona, 543–47.

Holland, J. 1975: Adaptation in natural andarti�cial systems. Ann Arbor, Michigan:University of Michigan Press.

Hong, T.P. and Wang, H.S. 1998: Auto-matically adjusting crossover ratios of mul-

tiple crossover operators. Journal of Infor-mation Science and Engineering 14, 369–90.

Hoopes, H.S., Hawk, W.M. and Lewis Jr, R.C.1983: A self-tuning controller. ISA Trans-actions 22, 49–58.

Koza, J.R., Keane, M.A. and Streeter , M.J.2003: Evolving inventions. Scienti�c Amer-ican, 40–47.

Kraus, T.W. and Myron, T.J. 1984: Self-tuningPID controller uses pattern recognitionapproach. Control Engineering. 106–11.

Lee, K.Y. and Mohamed, P.S. 2002: A real-coded genetic algorithm involving a hybridcrossover method for power plant controlsystem design. Proceedings of the 2002Congress on Evolutionary Computation, Vol. 2,1069–74.

Lian, S.T., Marzuki, K. and Rubiyah, Y. 1998:Tuning of a neuro-fuzzy controller bygenetic algorithms with an application to acouple-tank liquid-level control system.Engineering Applications of Arti�cial Intelli-gence, 11, 517–29.

Lin, C.T. and Lee, C.S.G. 1999: Neural fuzzysystems – a neuro-fuzzy synergism to intelligentsystems. Singapore: Prentice Hall Inter-national.

Matsui, K. 1999: New selection method toimprove the population diversity in geneticalgorithms. IEEE International Conference onSystems, Man, and Cybernetics 1, 625–30.

Mitchell, M. 1998: An introduction to geneticalgorithms. Cambridge, Massachusetts. TheMIT Press.

Mondal, S. and Maiti, M. 2002: Multi-itemfuzzy EOQ models using genetic algorithm.Computers & Industrial Engineering 44, 105–17.

Osyczka, A. and Krenich, S. 2000: A newconstraint tournament selection method formulticriteria optimization using geneticalgorithm. Proceedings of the 2000 Congress onEvolutionary Computation, California, 501–08.

Osyczka, A., Krenich, S. and Kundu, S. 1999:Proportional and tournament selections forconstrained optimization problems using

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from

Page 19: Genetic algorithms applied in online autotuning PID parameters of a

450 Online autotuning PID parameters

genetic algorithms. Evolutionary Optimization1, 89–92.

Porter, B. 1989: Issues in the design of intelli-gent control systems. IEEE Control SystemsMagazine, 97–99.

Renner, G. and Ekart, A. 2003: Genetic algor-ithms in computer aided design. Computer-aided Design 35, 709–26.

Schei, T.S. 1992: A method for closed loopautomatic tuning of PID controllers. Auto-matica 28, 587–91.

Smith, J. and Fogarty, T.C. 1996: Selfadaptation of mutation rates in a steady stategenetic algorithm. Proceedings of the IEEEConference Evolutionary Computation, Nagoya,Japan, 318–23.

Stephanopoulos, G. 1984: Chemical processcontrol – an introduction to theory andpractice. Englewood Cliffs, New Jersey:Prentice-Hall.

Sung, S.W., Lee, I.B. and Lee, J. 1998: Newprocess identi�cation method for automaticdesign of PID controllers. Automatica 34,513–20.

Tan, K.K., Lee, T.H. and Jiang, X. 2001: On-line relay identi�cation, assessment andtuning of PID controller. Journal of ProcessControl 11, 483–96.

Tsoukalas, L.H. and Uhrig, R.E. 1997: Fuzzyand neural approaches in engineering. NewYork: John Wiley & Sons.

Tzafestas, S. and Papanikolopoulos, N.P.1990: Incremental fuzzy expert PID control.IEEE Transactions on Industrial Electronics 37,365–71.

Wang, P. and Kwok, D.P. 1994: Optimaldesign of PID process controllers basedon genetic algorithms. Control EngineeringPractice 2, 641–48.

Wright, A.H. 1991: Genetic algorithm forreal parameter optimization. Proceedings ofFoundations of Genetic Algorithms’91. SanMateo, California: Morgan Kaufman, 205–18.

Wu, C.J. and Huang, C.H. 1997: A hybridmethod for parameter tuning of PID control-lers. Journal of the Franklin Institute 334B,547–62.

Yalcinoz, Y. and Altun, H. 2002: Environ-mentally constrained economic dispatchvia a genetic algorithm with arithmeticcrossover. IEEE AFRICON Conference, Vol.2, 923–28.

Yang, J.M. and Kao, C.Y. 1996: A combinedevolutionary algorithm for real parametersoptimization. In: Proceedings of IEEE Inter-national Conference on Evolutionary Compu-tation, Nagoya, Japan, 732–37.

Yuwana, S. 1982: A new method for on-linecontroller tuning. AIChE Journal 28, 434–40.

Zhao, Z.Y., Tomizuka, M. and Isaka, S. 1993:Fuzzy gain scheduling of PID controllers.IEEE Transactions on Systems, Man, and Cyber-netics 23, 1392–98.

Zhuang, M. and Atherton, D.P. 1993: Auto-matic tuning of optimum PID controllers.IEE Proceedings Part D 140, 216–24.

Ziegler, J.G. and Nichols, N.B. 1942: Optimumsettings for automatic controllers. Trans-actions of the ASME 65, 433–44.

© 2003 SAGE Publications. All rights reserved. Not for commercial use or unauthorized distribution. at PENNSYLVANIA STATE UNIV on April 17, 2008 http://tim.sagepub.comDownloaded from