Genetic Algorithm Based Self Tuning Regulator

7 downloads 5754 Views 627KB Size Report
Traditional Ziegler-Nichols [3] method of tuning PID controllers commands substantial .... Conventional GA uses random function in MATLAB or C library. But, in ...
S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728

Genetic Algorithm Based Self Tuning Regulator S.KANTHALAKSHMI * Department of Instrumentation & Control Systems Engg, PSG College of Technology, Coimbatore, Tamilnadu – 641004, India [email protected]

V.MANIKANDAN Department of Electrical & Electronics Engineering, Coimbatore Institute of Technology, Coimbatore, Tamilnadu – 641004, India [email protected] Abstract : In this paper, Genetic Algorithm is used for two basic tasks of a Self Tuned Regulator (STR) - system identification and PID tuning, providing the controller the ability to automatically tune its parameters while the physical plant dynamic characteristics changes, in an optimal way. The performance of the ball and hoop system, which is difficult to control optimally using a PID controller because of the constantly changing system parameters, is presented. Then, the proposed GA based optimal adaptive controller is designed for the same. Perturbations are applied to the system to check the robustness of the proposed system. The results reflect that proposed scheme improves the performance of the process in terms of time domain specifications, robustness to parametric changes and optimum stability. Also, a comparison with the conventional Ziegler-Nichols method proves the superiority of GA based system. Keywords: Genetic algorithm, Ball and hoop system, Self Tuning Regulator, System identification, PID tuning. Introduction The majority of processes met in industrial practice have stochastic character, i.e. the output at time ‘t’ cannot be exactly determined from input/output data at time ‘t-1’. The reason is, often the plant characteristics (model) are subjected to changes due to internal or external factors. when the plant response deviates from the specified limits, it will result in an unrealistic result, if the controller is not updated according to the new model. So it is needed that, the plant to be stopped for a new identification process followed by a modified controller design. Now the question in front is that, how an automatic control can be established without this interruption. Traditional controllers with fixed parameters are often unsuited to such applications because of their parameters change. One possible solution is an Online PID controller in which, a Recursive Least Squares (RLS) estimator was then created to estimate the system online and design a PID controller based on the current model. But, RLS estimator may converge to the wrong parameter estimates when the system being estimated changes considerably. As an alternative to these methods, evolutionary computation seems to be a very promising approach, because it needs only little knowledge about the problem and it can be easily combined with a number of other techniques from control engineering, machine learning, and artificial intelligence and so on. Genetic algorithms (GAs), one of the global search and optimization technique, have been shown to be capable of locating high performance areas in complex domains without experiencing the difficulties associated with high dimensionality, as may occur with gradient descent techniques or methods that rely on derivative information. Traditional Ziegler-Nichols [3] method of tuning PID controllers commands substantial acceptance in control engineering community but is beset with following drawbacks: (i) it doesn’t guarantee the optimality of tuned parameters. The very concept of optimality needs to be linked with some performance index, which this method misses woefully; and (ii) generally, parameters tuned by it stand improved upon through trial and error. Genetic Algorithm based method, however, doesn’t suffer from above drawbacks. It associates with the tuning process an optimality concept through chosen objective functions, yielding optimal parameters with respect to such function(s). Further, this method is free from the curse of local optimality- the parameters are globally optimal.

*

S.KANTHALAKSHMI, Department of Instrumentation & Control Systems Engineering, PSG College of Technology, Coimbatore, Tamilnadu, India – 641 004. Mobile: 97886 - 10868 † E-mail: [email protected]

ISSN: 0975-5462

7719

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728 GA has been implemented for identification and PID tuning, but, not employed for higher order systems so far. In this paper, GA is effectively used for a Self Tuning Regulator (STR), in which, a Ball and Hoop system of fourth order, which mimics the complex dynamics of liquid slosh, is identified and a PID controller with optimum parameters is designed for the same. Materials and methods Theory The Ball and Hoop System [2] illustrate the dynamics of a steel ball that is free to roll on the inner surface of a rotating circular hoop. There is a groove on the inside edge of the hoop so that a steel ball can roll freely inside the hoop. The hoop is continuously rotated by a motor. When the hoop is rotated, the ball will tend to move in the direction of hoop rotation. At some point, gravity will overcome the frictional forces and the ball will fall back. This process will repeat, causing the ball to have oscillatory motion.

Fig 1: The Ball and Hoop System.

Fig 2 shows how the ball and hoop system mimics the complex dynamics of the oscillations of a liquid in a container when the container is moving and undergoing changes in velocity and direction. This ‘liquid slosh’ is significant because the movement of large quantities of liquid can strongly influence the movement of the container itself, which is usually undesirable and often dangerous.

  1. Cross section through vessel

  Hoop

Fig 2: Illustration of Liquid Analogy.

A. The Ball and Hoop system model Fig 1 shows Ball and hoop schematic, in which the key system variables are, The hoop radius: R The ball radius: r. The Ball mass: m The hoop angle:   The ball angles with vertical (slop or slosh angle):   The ball position on the hoop:  The input torque to the hoop:    ( ) The Ball and Hoop dynamic is quite complicated to derive using the normal approach. The hoop is mounted on the shaft of a motor, and the motor is assumed to be a pure source of torque . So, the dynamical behavior of the system would be completely represented by the equations of motion of the angular position of the hoop, and the position y of the ball on the inner periphery of the hoop. For this reason, in this paper, these

ISSN: 0975-5462

7720

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728 variables are used as the generalized coordinates for Lagrange’s equations. However equations (1) to (3) relate the generalized coordinates to the other variables in the system. ⁄

(1) (2) ⁄

(3)

The Lagrangian system is made up entirely from the kinetic energies, associated with the rotation of the hoop, the rotation of the ball and the translation of the ball’s centre of mass So, the dynamical behavior of the system would be completely represented by the motion equation of the hoop angular position (2), and the ball position on the inner periphery of the hoop (3).



  ⁄

[ ⁄

 

 

  

= ⁄



 =

(4)



 

(5)

 

and are the moment of inertia of the hoop and ball respectively, where coefficient of the motor, and   is the friction coefficient of the ball.

is the rotational friction

B. Special features of the ball and hoop The ball and hoop system is very rich and complex in its dynamic because it has an oscillating and always changing behaviour. Two special features are the ability to demonstrate ‘zeros of transmission’ and to show ‘non-minimum phase behavior’ 1) Zeros of transmission The equations of the model after the approximation and linearization can be rewritten as follow: ⁄



+ (g/R

        

(6)

which can be represented by the following transfer function: ⁄ ⁄

/

(7)

This transfer function presents purely imaginary zeros at       /  . This means that if the hoop angle θ, is under feedback control and a sine wave of frequency equal to / in radians/sec is applied to θ, then there will be exact zero response for the ball position output . In physical terms this corresponds to the case where the ball oscillates inside the hoop at exactly the same frequency as the hoop. Thus, to an observer standing on the hoop, the ball appears to be stationary because the ball and hoop are moving in exact synchronism. 2) Non-minimum phase behavior and shifting zeros The outputs of the ball and hoop system are θ(s) and  . It is possible to construct the signal  ) by subtracting scaled measurements of θ(s) and   . Scaling is required to take account the amplification and possible sign inversion introduced by the angle sensors. Generally, the output signal given by: (8) where  is a scalar gain factor. When this gain is equal to 1, is the variable  / , and this corresponds to a scaled version of the ball position on the periphery of the hoop. The equation (8) is the combination of the two system output signals; such that the input has two paths to the output . By varying the gain , a root locus of the transfer function zeros can be plotted and part of the root locus is in the right hand plane. This means that non-minimum phase behavior occurs in the system. C. State variable form of Ball and Hoop System The Ball and hoop system can be represented in state space form as:   

=

State Variables: Input = ( ). Output    Where,

ISSN: 0975-5462

+

(9)

              

7721

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728 ⁄  



0

   

0 ⁄ ⁄ ⁄



1 0

Genetic Algorithm (GA) Genetic Algorithm (GA) [8], [9] is a stochastic global search method that mimics the process of natural evolution. It is a class of probabilistic optimization algorithms using concepts of “Natural Selection” and “Genetic Inheritance” and was originally developed by John Holland (1975). It is particularly well suited for hard problems where a little is known about the underlying search space. Genetic algorithm starts with no knowledge of the correct solution and depends entirely on responses from its environment and evolution operators (i.e. reproduction, crossover and mutation) to arrive at the best solution. A genetic algorithm is typically initialized with a random population consisting of 20-100 individuals. This population (mating pool) is usually represented by a real-valued number or a binary string called a chromosome. How well an individual performs a task is measured and is assessed by an objective function. The objective function assigns each individual a corresponding number called its fitness. The fitness of each chromosome is assessed and a survival of the fittest strategy is applied. A. Initialization of GA Parameters To start with GA, population size, bit length of chromosome, number of iterations, selection, crossover and mutation methods etc. need to be defined. Selection of these parameters decides, to a great extent, the ability of the designed controller. Higher the population size higher diversity and thus better convergence. But this needs more execution time; therefore a population size of 100 is used in simulation. Chromosome length selection also is a compromise between accuracy and simulation time. Conventional GA uses random function in MATLAB or C library. But, in this paper, a modified random function is employed for better performance. it is a hybrid random generator, making use of linear congruential operator on a standard Cauchy distribution, in which, the first number is get from Cauchy distribution method given by,  tan  0.5 (10)        , ,   is the random value between 0 and 1,    is the parameter, specifying the peak location of distribution, and is the scale parameter which specifies the half width at half maximum. In this paper,    and are set as random values from 0 to 1,so that, the probability density function always changes ,whenever the GA routine is called for. The output of Cauchy distribution is given to the linear congruential generator, which is based on the recurrence relation as, mod m                             (11)        0 ; ,0 ;0 ;0 , This hybrid random number generator mimics the diversity in biological population in a better way. B. Genetic operations Normalized geometric selection is the primary selection process used in this paper. A uniform mutation is employed for the sake of simplicity. The Arithmetic crossover procedure is specifically used for floating point numbers and is the ideal crossover option for use in this paper. During the initial stages, it is expected that   is larger, in order to optimize whole population effectively; whereas, in the later crossover probability stages, a smaller    value is better to avoid destroying the optimizing performance. Based on this, the  is designed: adaptive crossover probability function .               1 / (12) Where  describes the crossover probability of   individual,  is the constant crossover probability and N is the population size. When the individual fitness is larger, the crossover probability is smaller. C. Objective Function and Fitness value

ISSN: 0975-5462

7722

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728 The most crucial step in applying GA is to choose the objective functions that are used to evaluate fitness of each chromosome. The performance indices frequently used are Integral of Time multiplied by Absolute Error (ITAE), Integral of Absolute Magnitude of the Error (IAE), Integral of the Square of the Error (ISE), and Mean of the Square of the Error (MSE). GA is used to minimize the value of these performance indices and because of the fact that the smaller the value of performance indices of a chromosome, the fitter the chromosome will be, and vice versa, fitness of the chromosomes may be defined as,                                                 =1⁄ (13) D. Termination Criterion The termination criterion is set as the maximum number of generations equal to 300, simply by trial and error method based on the convergence of process and PID parameters.

GA Based System Identification In general, system identification consists of two tasks. The first task is structural identification of the equations and the second one is an estimation of the model’s parameters. Several techniques have been used to minimize the approximation error, and most are based on stochastic or gradient descent methods. In this paper, the error minimization is accomplished by GA, of which the advantages are that it require less knowledge of the system properties and statistical properties of input and output signals, is a global search technique, and avoids the problem of dimensionality. The estimation of the plant parameters by using GA uses the principle scheme depicted in Figure 1.The ‘Plant’ has the unknown parameters, which are to be found in the genetic search. ‘Model’ has adjustable parameters, which are transmitted from GA in the evaluation step. By comparing the y(t) and ymi(t) outputs, a measure of the performance Ji is obtained, on base of which the individual i has assigned the Fitnessi function. The output of a given plant to a step input signal is compared with the output of the model having adjustable parameters, at equidistant time moments, belonging to the interval [0, ], where  is the maximum simulation time. When the system response simulated by the GA is close enough to the measured response signal, the parameters of that generation are sufficient to correctly represent the plant model.

u (t)

Adjustable Parameters (From GA)

P L A N T

y(t) ymi(

M O D E L

Comparng outputs and calculating Performance index (Ji) Establishing Fitness Function

Fitne To GA

Fig 3: GA based Identification

In the problems of parameters estimation, it is not sufficient to use the system’s response relative to a unique input signal. A number Ne of test vectors are to be used, corresponding to a number Ne of input-output experiments. A test vector associates a plant input signal to an output signal, having the form ( ), where is a given input signal and , is the corresponding output signal, where j = 1 ... Ne. are applied to both plant and model successively, the outputs and By this way, the input signals are compared and the performance index is calculated, which is given by, =

(14)

In the case the input signals amplitude are very different, weighting coefficients can be used in order to compensate these amplitude differences, as presented in relation (14)

ISSN: 0975-5462

7723

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728 = where the coefficients plant.

(15) are chosen by using prior knowledge, based in the previous analysis performed on the real

As smaller is, as better the parameters estimation is. This step is repeated for each individual in each generation of the algorithm. Fitness function defined by the relation (12). In each of the iteration, GA finds the individual of maximum fitness, and the objective function tends closer to the global minimum, where the response curve of the model completely overlaps the plant output . curve GA Based PID Tuning Once the process or system model is identified by the first GA, the optimal value of the PID controller and is to be found using the cascaded GA. All possible sets of controller parameter values parameters are represented as chromosomes, whose values are adjusted to minimize the objective function, which is the Integral Square Error (ISE) criterion. Each chromosome consists of three separate strings constituting a P, I and D term, as defined by the 3-row ‘bounds’ declaration when creating the population. When the chromosome enters the evaluation function, it is split up into three terms, corresponding to P, I and D gains. Plant model parameters given by the best chromosomes obtained by the GA for system identification, are used for this. The PID is tuned when the sum of the square error between the reference input test signal and the simulated system response inside the GA for PID tuning is close to zero. i.e., Objective Function to be formed , for step input, where is the internal GA simulation response of the system. as: Additional code is added to ensure that the genetic algorithm converges to a controller that produces a stable system. If the poles of the controlled system are found to be in the right half of the s-plane, the error is assigned an extremely large value to make sure that the particular chromosome is not reselected. Proposed Methodology In the proposed methodology, a Self Tuned Regulator (STR) scheme is adopted, in which, the system identification and PID tuning is accomplished by employing two sequential Genetic algorithms, as shown in Fig 2. The first one is used identifying the ball and hoop system and the second one for tuning PID controller, based on the identified model. The final objective is to use GA for optimum adaptive control. As the plant model is identified periodically, the changes in its dynamic characteristics can be observed. If the settling time or the overshoot becomes too large, another process of identification and PID tuning is fired. Every time a controller tuning is requested, GA will re-identify the plant model and then tune the controller based on the modified model. This is a great advantage over controller tuning systems that always use the plant model previously known, implying in an adaptation capability to plant changes.

Fig 4: Proposed Methodology

Results and Discussion The simulation is carried out in MATLAB environment, utilizing the Genetic Algorithm Optimization Toolbox (GAOT).The complete system identification and PID tuning processes is simulated Ball and Hoop system. The GA parameters selected are listed in Table 1. TABLE I: GA PARAMETERS

ISSN: 0975-5462

7724

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728 Population size Crossover rate Crossover function Crossover points Mutation rate Mutation function Selection method

100 60% Arithmetic 1 0.1% Uniform Norm Geometric

For obtaining the original Plant response, a state space form of the Ball and Hoop system derived theoretically, as given below, is employed.

With state vector Input motor torque ( ) Output The friction coefficient of hoop The friction coefficient for ball Hoop radius, Ball radius Mass of the ball Moment of inertia of Hoop Moment of inertia of Ball

A=

= = ; ; ;

0 0 1 0 0 0 0 1 -4.79 59.36 -60.18 -0.687 7.045 -88.88 -3.407 -0.5652

B= [0

0

621.8 31.27 ]T

C= I (4) D= [0]. Any one of the state variables can be controlled, while the most relevant variable that has crucial effect on the system performance is the ball position from datum point, . (It is analogous to the liquid slosh, which, when exceeds beyond limit, can be dangerous, and hence needs to be controlled).So, the output matrix C in this case is set as 1 0 0]. The Ball and Hoop system identified through GA is given by, 0 0 A=

0 0

-5.95

1 0

0 1

68.13 -68.37 -0.491

10.029 -81.79 -3.718 -0.7617 B= [0

0

567.9 28.19]T

C= [0 1 0 0] D= [0]. Fig. 5 shows the closed loop step responses of theoretical and identified system, revealing the high oscillatory nature of the ball and hoop system. Closed loop response of identified system is a little more oscillatory and having a small offset error with respect to the theoretical one, since the objective function is converged to an extremely small value, not exactly to zero. This offset could have been still reduced, by increasing the population size, which, unfortunately, will further increase the simulation time.

ISSN: 0975-5462

7725

Ball postion

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728

Theoretical Identified

Fig 5: Theoretical and identified closed loop system responses

By applying GA, the PID tuning parameters are obtained as: = 99.0181; = 33.6052; = 1.82630. Fig. 6 shows the convergence of the PID parameters through generations as GA process iterates. It claims the sufficiency of the selected GA population parameters.

Fig 6: convergence of the PID parameters through generations

Ball position

Fig 7 is a comparison of system responses (ball position) to step input with Zeigler Nichols tuned PID controller with GA tuned PID controller, which points out to the superiority of GA over the later. The dynamic characteristics are far better with minimal percentage overshoot, and settling time, as shown in table 2, providing an optimum response. The response physically means that the ball is first oscillating, and then settles at a distance of one unit from the datum point.GA speeds up this settling and reduces the large oscillations of the ball.

Fig 7: GA and ZN responses before dynamic change.

Now, the system dynamics is changed, by altering the values of frictional coefficient of ball and hoop and a new identification and controller tuning is fired. (In liquid slosh problem, it is possible to have a varying liquid quantity and frictional coefficient due to surface property change) Fig 8 shows the step responses after plant

ISSN: 0975-5462

7726

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728

Ball position

dynamic changes for GA and Z-N based controller. Next, a disturbance is added to the plant input (output of the controller) in the form of the motor torque (can be an actuator fault) and once more the system is re-identified and tuned (Fig 9). These results prove the robustness of the proposed GA based adaptive tune against both the system characteristic change and external disturbances.

Time (sec)

Ball position

Fig 8: GA and ZN responses after dynamic change.

Time (sec) Fig 9: GA and ZN responses under disturbance. TABLE II: PERFORMANCE SPECIFICATIONS

Specification

ZN1

GA1

ZN2

GA2

Settling time(sec)

6

3

15

2

Peak overshoot (%)

27

14

45

30

TABLE III: COMPARISON OF PID GAINS

Parameter

ZN 8.144

GA 1 99.0181

GA2 31.2414

43.4649

33.6052

28.3720

0.3815

1.82630

5.3321

Note: Suffix 1 and 2 represent the plant before and after dynamics change respectively Conclusion By using Genetic Algorithm, a state space model of a Ball and Hoop system with adequate accuracy was identified and PID controller was tuned for the same, resulting in an optimal closed loop system response. The proposed scheme was tested against parametric changes in the ball and hoop system and external disturbances such as torque input to the system. The results proved that this cascaded BA based system is capable of successfully adapting the controller to physical plant dynamic characteristic changes. It proved to be robust to the disturbances, assuring a parameter-insensitive operation of the process. In comparison with conventional Ziegler-Nichols method, GA based method settled fast with minimum overshoot, even under disturbance and parametric variation. The only drawback was the longer execution time, which further increased with the population size and chromosome length. A medium population size of 100 and

ISSN: 0975-5462

7727

S. Kanthalakshmi et al. / International Journal of Engineering Science and Technology Vol. 2 (12), 2010, 7719-7728 chromosome length of 80 resulted in an adequate convergence characteristics and accuracy of parameter consuming only reasonable execution time. References [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

Dionisio S. Pereira, João O. P. Pinto,”Genetic algorithm based system identification and PID tuning for an optimum adaptive control”,Proceedings of 2005 IEEE/ASME, International Conference on Advanced Intelligent Mechatronics Monterey, California, USA, 24-28 July, 2005. Ball and Hoop White Paper, URL: http://www.control-systemsprinciples.co.uk K. J. Astrom and K. J. Hagglund, “PID Controllers: Theory, Design and Tuning”, 2nd ed., Research Triangle Park, NC: ISA, 1995. T. S. Schei, “Automatic tuning of PID controllers based on transfer function estimation,” Automatica, vol. 30, no. 12, pp. 1983-1989, 1994. A. A. Voda and I. D. Landau, “A method for the auto-calibration of PID controllers,” Automatica, vol. 31, no. 1, pp. 41-53, 1995. F. G. Shinskey, “Process Control System: Application, Design and Tuning”, McGraw-Hill, 4th ed, 1996. K. J. Astrom and B. Wittenmark, “Adaptive Control”, Addison Wesley, 2nd., 1995. K. S. Tang, K. F. Man, S. Kwong and Q. He, “Genetic Algorithms and their Applications,” IEEE Signal Processing Magazine, Nov. 1996, pp; 22-37. K. F. Man, K. S. Tang and S. Kwong, “Genetic Algorithms: Concepts and Applications,” IEEE Trans. Ind. Electron., vol. 43, no. 5, Oct. 1996, pp. 519-534. J. H. Holland, “Outline for a logical theory of adaptive systems,” J. ACM, vol. 3, pp. 297-314, July 1962; also in A. W. Burks, Ed., Essays on Cellular Automata, Univ. Illinois Press, 1970, pp. 297-319. J. H. Holland, “Adaptation in Natural and Artificial Systems”, Ann. Arbor, MI: Univ. Mich. Press, 1975. D. E. Goldberg, “Genetic Algorithms is Search, Optimization, and Machine Learning”, Reading MA: Addison-Wesley, 1989. K. Kristinsson and G. A. Dumont, “System Identification and Control Using Genetic Algorithms,” IEEE Trans. System, Man and Cybernetics, vol. 22, no. 5, Sept-Oct. 1992, pp. 1033-1046. S. Lu and T. Basar, “Genetic algorithms-based identification,” IEEE Inter. Conf. System, Man and Cybernetics, vol. 1, pp. 22-25, Oct. 1995.

ISSN: 0975-5462

7728

Suggest Documents