a new particle swarm optimization based auto-tuning of pid

6
Proceedings of the Seventh International Conference on Machine Learning and Cybernetics,Kunming,12-15 July 2008 978-1-4244-2096-4/08/$25.00©2008 IEEE 1818 A NEW PARTICLE SWARM OPTIMIZATION BASED AUTO-TUNING OF PID CONTROLLER YOU-BO WANG 1 , XIN PENG 2 , BEN-ZHENG WEI 2 1 Institute of Communication, Shandong Normal University, Jinan City, China, 250014 2 Institute of Science and Technology, Shandong University of Traditional Chinese Medicine, Jinan City, China, 250355 E-MAIL:[email protected], [email protected] Abstract: Particle swarm optimization based auto-tuning of Propor- tional-Integral-Derivative (PID) controller is discussed in this paper. Relay feedback experiment is applied to identify the approximate parameters of PID controller first, although the parameters identified is not very accurate. Next we utilize particle swarm optimization algorithm to refining parameters of PID controller. The basic particle swarm optimization based auto-tuning PID algorithm often fall into local optimum. To improve the performance of controller, an improved PSO method is proposed in this paper by dividing the searching process into two steps. First the parameter k d of particles is limited in a small space then enlarged to a larger one. Our experiments confirm the method can improve the perform- ance of PID controller dramatically. Keywords: Particle Swarm Optimization; PID controller; Auto- tuning 1. Introduction Proportional-Integral-Derivative (PID) controller has been used widely for processes and motion control system in industry. Now more than 90% control system is still PID controller. The most critical step in application of PID con- troller is parameters tuning. Today self-tuning PID digital controller provides much convenience in engineering. The parameter settings of a PID controller for optimal control of a plant depend on the plant’s behavior. The tuning method includes online model-free methods. This method tunes the PID controller in loop with the given plant using an optimi- zation algorithm such as steepest descent or Newton’s method to minimize some cost function [1][2]. Yet the above method can not guarantee to find the global optimum and its calculation is also expensive. Beside these methods, genetic algorithm (GA) and particle swarm optimization (PSO) are widely adopted to tuning PID controller in recent years [5] [6]. Since relay feedback approach should not require an op- erator with expert knowledge, the relay feedback method is adopted to design PID controllers. Since a wide range of process plant can be auto-tuning utilizing relay identifica- tion, the approach is used in many devices. By using the method, we can get approximate parameters of PID control- ler. Identification result usually has an error ranging form - 18% to +27%. Obviously control application needs higher accuracy. These parameters derived from the relay feedback ex- periment should include an approximate time scale and the desired amplitude of limit cycle oscillations. It is much necessary to refine the parameters to guarantee the PID controller to achieve a higher performance. It was reported that the PSO algorithm can generally achieve a higher performance than genetic algorithm. An- other reason for us to utilize PSO algorithm is that is no need of gradient information or calculation of gradient [4]. PSO has a unique ability for optimization of non-linearly function and multi-dimensional function. In this paper our research is focused on how to improve the performance of auto-tuning digital PID controller based on PSO algorithm. The remainder of this paper is organized as follows. Section 2 introduces the particle swarm optimi- zation algorithm. Section 3 describes both the auto-tuning PID controller framework and choosing of fitness function. Local optimum problem is discussed in PSO based parame- ters tuning are studied in section 4. Section 5 provides our solution to the problem, and conclusion in section 6. 2. Relay feedback identification The mathematic model of the industrial process plant is usually difficult to derive, and basic Z-N method still re- main unsolved problems, such as possible resulting in in-

Upload: sun-narto

Post on 02-Oct-2014

182 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: A New Particle Swarm Optimization Based Auto-tuning of Pid

Proceedings of the Seventh International Conference on Machine Learning and Cybernetics,Kunming,12-15 July 2008

978-1-4244-2096-4/08/$25.00©2008 IEEE 1818

A NEW PARTICLE SWARM OPTIMIZATION BASED AUTO-TUNING OF PID CONTROLLER

YOU-BO WANG1, XIN PENG2, BEN-ZHENG WEI2

1 Institute of Communication, Shandong Normal University, Jinan City, China, 250014 2 Institute of Science and Technology, Shandong University of Traditional Chinese Medicine,

Jinan City, China, 250355 E-MAIL:[email protected], [email protected]

Abstract: Particle swarm optimization based auto-tuning of Propor-

tional-Integral-Derivative (PID) controller is discussed in this paper. Relay feedback experiment is applied to identify the approximate parameters of PID controller first, although the parameters identified is not very accurate. Next we utilize particle swarm optimization algorithm to refining parameters of PID controller. The basic particle swarm optimization based auto-tuning PID algorithm often fall into local optimum. To improve the performance of controller, an improved PSO method is proposed in this paper by dividing the searching process into two steps. First the parameter kd of particles is limited in a small space then enlarged to a larger one. Our experiments confirm the method can improve the perform-ance of PID controller dramatically.

Keywords: Particle Swarm Optimization; PID controller; Auto-

tuning

1. Introduction

Proportional-Integral-Derivative (PID) controller has been used widely for processes and motion control system in industry. Now more than 90% control system is still PID controller. The most critical step in application of PID con-troller is parameters tuning. Today self-tuning PID digital controller provides much convenience in engineering. The parameter settings of a PID controller for optimal control of a plant depend on the plant’s behavior. The tuning method includes online model-free methods. This method tunes the PID controller in loop with the given plant using an optimi-zation algorithm such as steepest descent or Newton’s method to minimize some cost function [1][2]. Yet the above method can not guarantee to find the global optimum and its calculation is also expensive. Beside these methods, genetic algorithm (GA) and particle swarm optimization

(PSO) are widely adopted to tuning PID controller in recent years [5] [6].

Since relay feedback approach should not require an op-erator with expert knowledge, the relay feedback method is adopted to design PID controllers. Since a wide range of process plant can be auto-tuning utilizing relay identifica-tion, the approach is used in many devices. By using the method, we can get approximate parameters of PID control-ler. Identification result usually has an error ranging form -18% to +27%. Obviously control application needs higher accuracy.

These parameters derived from the relay feedback ex-periment should include an approximate time scale and the desired amplitude of limit cycle oscillations. It is much necessary to refine the parameters to guarantee the PID controller to achieve a higher performance.

It was reported that the PSO algorithm can generally achieve a higher performance than genetic algorithm. An-other reason for us to utilize PSO algorithm is that is no need of gradient information or calculation of gradient [4]. PSO has a unique ability for optimization of non-linearly function and multi-dimensional function.

In this paper our research is focused on how to improve the performance of auto-tuning digital PID controller based on PSO algorithm. The remainder of this paper is organized as follows. Section 2 introduces the particle swarm optimi-zation algorithm. Section 3 describes both the auto-tuning PID controller framework and choosing of fitness function. Local optimum problem is discussed in PSO based parame-ters tuning are studied in section 4. Section 5 provides our solution to the problem, and conclusion in section 6.

2. Relay feedback identification

The mathematic model of the industrial process plant is usually difficult to derive, and basic Z-N method still re-main unsolved problems, such as possible resulting in in-

Page 2: A New Particle Swarm Optimization Based Auto-tuning of Pid

Proceedings of the Seventh International Conference on Machine Learning and Cybernetics,Kunming,12-15 July 2008

1819

creased amplitude oscillation, consuming more time on parameters tuning. To overcome these problems, K.J. As-trom introduces valuable relay feedback identification method. Such a procedure is based on the idea of using a relay controller in feedback loop, whose dynamic behavior meet with characteristic of relay [8].

Consider the system depicted in Figure 1. Assuming there is a limit cycle with period Tu, so the relay output is a periodically symmetric square wave. If the amplitude of relay output is h, a simple Fourier series expansion of the relay output with no hysteresis gives a first harmonic with amplitude 4h

π.

ProcessRelay-+

Figure 1. The architecture of relay feedback tuning system

Initially, the plant oscillates without a definite pattern around the nominal output value until a definite and re-peated output response can be easily identified. When we reach this closed-loop plant response pattern the oscillation period (Pu) and the amplitude (A) of the plant response can be measured and used for PID controller tuning. In fact, the ultimate gain can be computed as:

4u

hKAπ

= (1)

Having determined the ultimate gain Ku and the oscilla-tion period Pu the PID controller tuning parameters can be obtained from the following table according to Z-N method:

Ku τI τD P 0.5Ku PI 0.45Ku Pu/1.2 PID 0.6Ku Pu/2 Pu/8

This method has only one parameter that must be speci-fied in advance, namely the amplitude of the relay output. A feedback loop from measurement of amplitude of the oscillation to the relay amplitude can be used to ensure that the output is within reasonable bounds during oscillation. Although the relay feedback method can utilized in a wide range of process plant, parameters from the tuning proce-dure are not accurate enough. Since the method brings us approximate PID parameters, to achieve a better control performance, it is much necessary to refine the parameters using other optimization tuning method, such particle swarm optimization.

3. PSO Algorithm

PSO is a method for optimizing hard numerical func-tions on metaphor of social behavior of flocks of birds and schools of fish. The original PSO algorithm is discovered through simplified social model simulation. It was first de-signed to simulate birds seeking food which is defined as a cornfield vector. The bird would find food through social cooperation with other birds around it (within its neighbor-hood). It was then expanded to multidimensional search.

In PSO each particle in swarm represents a solution to the problem and it is defined with its position and velocity. In D-dimensional search space, the position of the ith parti-cle can be represented by a D-dimensional vector, xi = (xi1,…, xid, …, xiD). The velocity of the particle vi can be represented by another D-dimensional vector vi = (vi1,…, vid, …, viD). The best position previously visited by the ith particle is denoted as pi=(pi1,…,pid,…,piD), and pg as the index of the particle visited the best position in the swarm, then pg becomes the best solution found so far, and the velocity of the particle and its new position will be determined according to the following two equations, which a inertia weight w is added to [3]:

vid = wvid + c1r (pid-xid) + c2 R (pgd-xid) (2) xid = xid + vid (3)

Where c1 and c2 are positive constants, and r and R are random functions in the range [0,1]; xi = (xi1, xi2,… , xiD) represents location of the ith particle; pi =(pi1, pi2, …, piD) represents the best previous position (the position giving the best fitness value) of the ith particle; the symbol g represents the index of the best particle among all the parti-cles in the population; vi = (vi1, vi2, … , viD) represents the rate of the position change (velocity) for the ith particle [7].

The parameter w in formula (2) is inertia weight that in-creases the overall performance of PSO. It is reported that a larger value of w can favor higher ability for global search while lower value of w implies a higher ability for local research. To achieve a higher performance, we linearly decrease the value of inertia weight w over the generations to favor global research in initial generations and local re-search in the later generations. The linearly deceased value of inertia is according the following formula.

max minmax

max

w ww w iteriter

−= − ⋅ (4)

Where itermax is the maximum of iteration in evolution process, wmax is maximum value of inertia weight, wmin is the minimum value of inertia weight, and iter is current value of iteration.

Page 3: A New Particle Swarm Optimization Based Auto-tuning of Pid

Proceedings of the Seventh International Conference on Machine Learning and Cybernetics,Kunming,12-15 July 2008

1820

The process of optimization utilizing PSO is depicted as following:

1. Initialize a population of particles with random posi-tions and velocities on D-dimensions in the problem space.

2. For each particle, evaluate the desired optimization fitness function in D variables.

3. Compare particle's fitness evaluation with its pbest. If current value is better than pbest, then set pbest equal to the current value, and pi equals to the current location xi in D-dimensional space.

4. Identify the particle in the neighborhood with the best success so far, and assign its index to the variable g.

5. Change the velocity and position of the particle ac-cording to Equation (2) and (3).

6. Loop to step 2) until a criterion is met, usually a suffi-ciently good fitness or a maximum number of iterations.

4. Auto-Tuning of PID Controller

The framework of online parameter self-tuning system is depicted as Figure 2. In this framework the PSO optimi-zation module complete the self-tuning of PID parameters with a microprocessor that achieves the optimum of PID parameters. These parameters are used to retune the PID controller in PID controller module.

PSO Microprocessor

PID Controller

Process

Relaye(t)

u(t)y(t)

Figure 2. The framework of online self-tuning system

parameters Kp, Ki, Kd values in the transfer function of PID controller are state as

( ) ( )( )

ip d

U s kG s k k sE s s

= = + +

Where Kp is proportional, gain, Ki is integral gain and Kd is derivative gain. U(s) and E(s) are separately the Laplace transform of input and output of controller. The optimiza-tion of PID parameters can be viewed as particle evolution in 3-dimensional space as respect to fitness function. That is tuning of PID controller parameters is to search optimiza-tion value in Kp, Ki, Kd, the three dimensions search spaces as shown in formula (5).

0 1 21 1 10 1 22 2 2

0 1 23 3 3

... ... ...

K K KK K K

X

K K K

⎡ ⎤⎢ ⎥⎢ ⎥=⎢ ⎥⎢ ⎥⎢ ⎥⎣ ⎦

(5)

There are two necessary problems to be tackled in the PSO parameters optimization: one is particle coding, namely particle expression, the other is fitness function choosing. Since the original PSO algorithm is designed for real-value problem, PID parameters optimize problem is easily solved. As for fitness function choosing, there are several fitness function has been widely used in parameters optimization of PID controller. Suitable fitness function can be chosen according to the demand of the project and for-mula (6) is often used as optimizing criterion.

( )1 30 sJ w e t dt w t∞⎡ ⎤= +⎣ ⎦∫ (6)

If only considering time integration of error in fitness function, it seems simpler and is not easily to achieve high performance. Considering the influence of settle time on performance, we add another term w3ts in the formula. Where e(t) is system error, Where ts is settling time of step response of process, Using this item can decrease the set-tling time of response, and coefficient w3 is also important for the smooth of the response curve.

To avoid overshoot of response, punishment of over-shoot approach is adopted. the punishment item is added to the fitness function.

( ) ( )

( ) ( ) ( )1 30

1 4 30

0

0

s

s

w e t dt w t e tJ

w e t w e t dt w t e t

⎧ ⎡ ⎤ + <⎣ ⎦⎪= ⎨⎡ ⎤⎪ + + >⎣ ⎦⎩

∫∫

(7)

where w4 is much larger than w1 (w4>>w1), the parameters choosing of w1, w3, w4 is very important for the perform-ance of optimization. Our experiment shows that carefully choosing w3 and w4 is very importing in simulation ex-periments.

The auto-tuning method described in this paper has been implemented in MATLAB to confirm the validity of the method. To simulate the tuning of PID controller, the follow process model is chosen as below:

( ) ( )( )60

2 5G s

s s=

+ +

We assume that the selected process is controlled by the PID controller, and the process is simulated in Matlab.

Page 4: A New Particle Swarm Optimization Based Auto-tuning of Pid

Proceedings of the Seventh International Conference on Machine Learning and Cybernetics,Kunming,12-15 July 2008

1821

Auto-tuning PID parameters using the PSO algorithm need suitable solution space to be initialized first. The range of search space in PSO algorithm will influence the performance of optimization, such as the convergence speed. The smaller search space is, the less time the evolu-tionary process consumed. We always expect to determine a search space as small as possible. If no prior knowledge about the parameters of PID controller is provided, a large range must assign to search space to ensure the range will cover the optimum. Yet the large search space will inevita-ble lead to a slow convergence and large overshoot in step response, and this is not permitted firmly in some conroll engineering. We define the search space of kp, ki, and kd as

kp∈ [Kp(1-30%), KP(1+30%)] ki ∈[KI(1-30%), KI(1+30%)] kd∈[KD(1-30%), KD(1+30%)],

Where KI, KP, KD is approximate parameters of PID control-ler getting from the relay feedback tuning experiment de-scribed in section 2. This attempt is to decrease the search space. Other parameters used in PSO algorithm are initial-ized as follow. The group size of particles swarm is set to 20, and each particle in swarm is 3-dimensional that repre-sented parameters kp, ki, and kd. The maximum generation iteration number is set to 100. The inertia weight w is de-creased linearly, and the maximum of inertia weight is 1.4 and the minimum is 0.1. In the following section we will discuss the various feature of optimization with different particle initialized.

5. PSO based Optimization Experiments

Though PSO algorithm has a fast convergence to opti-mum, it often traps at certain local optimum and have no ability to exploit the global optimum. Fitness function for-mula (7) also has lots of local optimum and inevitably it brings much difficult to PID parameters optimization. We illustrated this phenomenon in the following Figure 3 based on our hundreds times of experiment, and almost 70 per-cent of results are fitted to this case. To display the figure in a more intuitional manner, we did not display the figure in 3 dimensional space but display a single particle (kp, ki, kd) in two figures. The first figure shows the particle posi-tion of (kp and ki), and the other figure shows the particle position of (ki and kd), the typical situation is shown in Figure 3. In the first sub-figure of Figure 3, the particles fly to the right in the figure and can not fly back again, and this is obviously local optimum, not the global optimum. It is noticeable that once parameter kd evolve to a large value, it is hard to fly back though the fitness function has not

reached its minimum value. Obviously optimization is trap in a certain local optimum, and the basic PSO algorithm has no ability to make the particle get away from the local op-timum.

Figure 3. Position of particles when trap in local optimal

When the particles are trapped in local optimum, the step response of the PID controller is simulated in MAT-LAB and depicted in curve A in Figure 6. From the figure we can see that is not the optimal response curve we ex-pected. So it is necessary to seek an improved method to achieve the optimal performance.

To overcome the problem, attempt was made to guaran-tee the PSO algorithm to find the global optimum. We re-sort to the trial and error method in PID tuning which is widely used in control engineering. The method provides us an idea of tuning kp first, then ki, and kd in the end. Now our strategy divides the original PSO optimizing process into two steps to prevent parameter kd from trapping into large value at the very beginning. Now the parameter of kd is first limited in a relative small range of [0, 0.3], while remain the other parameter never changed range of [7,9], [1,3]. The PSO algorithm searches the optimal value inside the limited space in first 10 evolutionary iterations. Then the space of kp, ki, kd parameters are rearranged into the range of [7,9],[1,3],[0, 1], and the next 90 iterations finish the entire evolutionary process. The two-phase evolution arrangement of searching space KD is illustrated in Figure 4.

0

0.3

0.6

1.0 1.0

0.6

0.3

0

Figure 4. Two-step assignment of kd search space

Page 5: A New Particle Swarm Optimization Based Auto-tuning of Pid

Proceedings of the Seventh International Conference on Machine Learning and Cybernetics,Kunming,12-15 July 2008

1822

Using this two-step space assignment approach, we simulate the auto-tuning of PID controller with the im-proved method again. The result comparison with the clas-sical PSO algorithm is illustrated in Figure 5. There are 20 experimental results shown in the figure and the merit of the improved experiment result is obvious. The improved algorithm can dramatically improve the chance of achiev-ing the global optimum. The most exciting advantage of our approach is that every simulation experiment can achieve the optimum close to the approximate global opti-mum, though there maybe is a little error between the ac-tual global optimum and experimental result. In Figure 5 the curve 2 depicts the result of the improved method, and curve 1 depicts using classic method. The improved method can get a better result and the mean value is smaller than the former one.

2 4 6 8 10 12 14 16 18 20120

140

160

180

200

220

240

260

280

Simulation times

Fitn

ess

1 ,mean=215.88502, mean=159.7607

Figure 5. Results comparison of the improved PSO and the basic PSO auto-tuning

Then the PID controller is configured with the auto-tuned parameters kp, ki, and kd, the time step transient re-sponse of close-loop system is illustrated in curve (B) in Figure 6. From the curve we can learn that the improved method can get a better response than the curve (A) getting from basic PSO algorithm. Note that the simulation condi-tion is no different except the different range assignment of the kd.

Another noticeable fact is that the linear inertia weight is utilized in our simulation. Yet we should have the ideas that the parameters optimization is not a linear process. Notably, adapting inertia weight in PSO algorithm should be utilized, our future research work will go further step to discovery the adapting inertia in auto-tuning of PID con-troller, and we will study the method to speed the conver-gence to the optimum.

0 0.1 0.2 0.3 0.4 0.5 0.60

0.2

0.4

0.6

0.8

1

time

yout

Curve ACurve B

Figure 6. Comparing step response of process

6. Conclusions

Utilizing basic particle swarm optimization algorithm to seek optimal parameters of PID controller may not defi-nitely achieve the precise optimum. Because of the exis-tence of local optimal, searching often fail to locate at the global optimum. Our endeavor on auto-tuning of PID con-troller is first estimating the approximate parameters of PID controller with relay feedback experiment, and then using an improved particle swarm optimization algorithm to get the global optimum. We adopt the two-step assigned search space of kd to prevent particles from trapping into the local optimum, which first assigns the search space in a small range and then in an enlarged one. Our experiments show this improved method can contribute much to the perform-ance of PID controller compared with the basic particle swarm optimization.

Acknowledgements

This work was partially supported by Scientific Re-search Development Project of Shandong Provincial Edu-cation Department, China (J06N06).

References

[1] H.Hjalmarsson and T.Birkeland. Iterative feedback tuning of linear time-invariant mimo systems. In 37th IEEE Conference on Decision and Control, pages 3893–3898, 1998.

[2] M.A.Johnson and M. H. Moradi. PID Control. Springer Science+Business Media, 2005.

[3] ZHANG Li-ping, YU Huan-jun, HU Shang-xu. Opti-mal choice of parameters for particle swarm optimiza-tion. Journal of Zhejiang University SCIENCE 2005 6A(6):530 528-534

Page 6: A New Particle Swarm Optimization Based Auto-tuning of Pid

Proceedings of the Seventh International Conference on Machine Learning and Cybernetics,Kunming,12-15 July 2008

1823

[4] J. Kennedy and R.Eberhart. Particle swarm optimiza-tion. In Proceedings of the Fourth IEEE International Conference on Neural Networks. IEEE Press, 1995.

[5] Myung-Hyun Yoon, Chang-Hoon Shin. Design of online auto-tuning PID controller for power plant process control in: SICE '97. Proceedings of the 36th SICE Annual Conference. International Session Pa-pers Publication Date: 29-31 Jul 1997 On page(s): 1221-1224

[6] Aggarwal, V.Meng Mao O'Reilly, U.-M.A Self-Tuning Analog Proportional-Integral-Derivative (PID)

Controller in: Adaptive Hardware and Systems, 2006. AHS 2006. On page(s): 12-19

[7] Clerc M, Kennedy J. The Particle Swarm: Explosion, Stability, and Convergence in Multi-Dimension Com-plex Space[J]. IEEE Transactions on Evolutionary Computation, 2002, 16(1): 58-73

[8] Ma Ming-da, Zhu Xin-ian. Performance Assessment and Controller Design Based on Modified Relay Feedback. Ind Eng Chem Res, 2005,44(10):3538-3546