Sie sind auf Seite 1von 4

Self-tuning PID Controller with Variable Parameters Based on Particle

Swarm Optimization

Wang Xin,

Li Ran, Wang Yanghua, Peng Yong, Qin Bin
School of Electrical & Information Engineering, Hunan University of Technology, Zhuzhou, 412008
E-mail: qinbin99p@163.com


Abstract In order to deal with the time-varying, nonlinear,
and large-lagging problems in the auto-chlorination control
process of tap water, a self-tuning PID chlorination controller
with variable parameters based on PSO is proposed in this
paper. By finding the relationship between k
p
, k
i
, k
d
and the
deviation, the s-functions are written to completethe design of
self-tuning PID controller with variable parameters. Then,
particle swarm optimization is used for achieving the
correction coefficient values of deviation which are sent to the
controller so that the control effect of chlorination system is
improved. At the same time, compared with the fuzzy PID
controller, the difficulty of controller rules extraction is solved.
The simulation results of auto-chlorination control system
show that the controller is stable and reliable. Hence, an
effective control for auto-chlorination control system can be
realized.
Keywords- Self-tuning Controller, Variable Parameters PID;
PSO; Chlorination Control System
I. INTRODUCTION
The auto-chlorination system is an important part in tap
water process. Generally, the chlorination process in water
plants is divided into two times. One is prior to the filteration
process, and the other is after it. The dosage of every
chlorine changes in a certain range with the situation of
water quality. This paper proposes a combination of the
particle swarm algorithm with self-tuning PID controller
with variable parameters for the chlorination system of water
plant which could be equivalent to second-order or third-
order plus pure encounter dynamic model. The particle
swarm algorithm can be used for achieving the optimal
parameters of self-tuning PID controller with variable
parameters in the auto-chlorination control system. The
theoretical analysis and the results of simulation show that,
as for the automatic chlorination control system, the self-
tuning PID controller with variable parameters based on the
particle swarm optimization has good control performance.
Because conventional PID controller has simple
structure, and robustness, high reliability, simple for
operation, etc. It is still the most common control mode in
today's industrial control method. However, the controller
parameters adjustment is the key to ensure the control
quality. But some control systems can be approximately
regarded as a second-order or third-order plus pure
encounter model, like the automatic chlorine control system,
which has nonlinear and strong interference characteristics.
It would be difficult to reach the expected control effect
merely depending on a fixed set of PID parameters which is
determined before-handed. Moreover in the time-varying,
nonlinear and uncertain complex system application, a fuzzy
self-tuning PID controller often encounters the problem of
proper application rules extraction to adjust PID parameters
correctly. Therefore, the PID parameters setting method for
the automatic chlorination control system is still a question
which should be explored.
II. THE PRINCIPLE OF THE PID CONTROLLER WITH
VARIABLE PARAMETER
The PID controller with variable parameters (VPPID) is
put forward by Zhong Qingchang
[2]
, etc. Compared to
conventional PID controller parameters setting way that the
three parameters (
p
K
,
i
K
,
d
K
) setting process are
completed according to the object model or dynamic
response curve of chlorination control system, the self-
tuning PID controller with variable parameters is introduced
through the nonlinear function between
p
K
,
i
K
,
d
K
and
deviation e . According to the size of the deviation, the three
parameters are adjusted online and, thereby, the control
performance of chlorination control system is improved.
The following relationship between the three parameters
of a PID controller and deviation e
[3]
has been proved
( ) ( )
2
0
= 1+ 1-exp -100
p
K a a e



(2-1)
And,
( ) ( )
2
1
=1+ 1-exp -100 k a e (2-2)
( )
2
0
exp 100
i
K b b c e

= +

(2-3)
And,
( )
2
2
= +c exp -100 k b e (2-4)
( )
2
0
= 1+ exp -25
d
K c d e



(2-5)
And,
( )
2
3
=1+ exp -25 k d e (2-6)
For the above relations, a
0
, b
0
, c
0
are the parameters of
conventional PID controller. The parameters a , b , c , d are
the correction coefficient of deviation e . In order to design
the self-tuning PID controller with variable parameters of
chlorination control system, the s-function of
1
k ,
2
k ,
2
k are
written respectively and its structure is as shown in figure1:
2013 Third International Conference on Intelligent System Design and Engineering Applications
978-0-7695-4923-1/12 $26.00 2012 IEEE
DOI 10.1109/ISDEA.2012.297
1264

Figure 1. Self-tuning PID controller with variable parameters structure of
chlorination control system diagram
The following is one source code of M document of the
s-function:
function [sys,x0,str,ts] = fun(t, x, u, flag, a)
switch flag,
case 0
[sys, x0, str, ts]=mdlInitializeSizes;
case 3
sys=mdlOutputs (t, x, u, a);
case { 1, 2, 4, 9 }
sys=[];
otherwise
DAStudio.error('Simulink:blocks:unhandledFlag',
num2str(flag));
end
function [sys,x0,str,ts] = mdlInitializeSizes()
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0;
sizes.NumOutputs =1;
sizes.NumInputs = 1;
sizes.DirFeedthrough = 1;
sizes.NumSampleTimes = 1;
sys = simsizes(sizes);
str = [];
x0 = [];
ts = [-1 0];
function sys = mdlOutputs (t, x, u, a)
sys =1+a*(1-exp(-100*u*u));
The rest of the two can be so on.
III. THE SELF-TUNING PID CONTROLLER WITH VARIABLE
PARAMETERS BASED ON PARTICLE SWARM OPTIMIZATION
A. The Particle Swarm Optimization(PSO)
The particle swarm optimization algorithm (particle
swarm optimization, PSO) is derived from the research of
the birds predation activity, which is a kind of optimization
algorithm based on swarm intelligence and was put forward
by the Kennedy and Eberhart in 1995
[4]
.
The mathematical description of the particle swarm
algorithm is as follows: in a D-dimensional target search
space, each particle is seen as a point in a space .and a group
of N particle composition. If the particle swarm contains N ,
and each particle coordinate position vector is represented
as
1 2
( , , , , , )
i i i id iD
x x x x x = " " , The velocity vector is
represented as
1 2
( , , , , , )
i i i id iD
v v v v v = " " , the optimal
position of particles searched so far (individual optimum
value) is denoted as
1 2
( , , , , , )
i i i id iD
p p p p p = " " .
The whole optimal position of particle swarm searched
so far (group optimal value) is denoted
as
1 2
( , , , , , )
g g g gd gD
p p p p p = " " .Groups optimal value
is the best value of the individual optimal value.
Speed iterative formula
[5]
:
( ) ( )
1
1 1 2 2
k k k k
id id id id gd id
c r p x c r p x
+
= + + v v
(3-1)
Position iterative formula:
1 1 k k k
id id id
+ +
= + x x v
(3-2)
1, 2, , d D = " , D is the dimension of the particle; k
is the number of iterations. The parameters
1
r ,
2
r is the
random number between 0 and 1. The parameters
1
c ,
2
c is the
Learning factor, which is also known as the acceleration
factor.
The parameter is inertia weight, which can be used to
change the particle's search range and speed. With the
increasing number of iteration, the value of would be
reduced self-adaptively and would therefore help to strike a
balance between the search capability of the particle and
convergence speed of the algorithm. The value of could
be updated according to:
( ) ( )
max max min max
/ k k k =
(3-3)
k
is for the k -th iteration inertia weight.
max
is the
initial weight ,
min
for the final weight. k is the current
iteration number,
max
k is the maximum number of iterations.
Generally speaking, algorithm performance is comparatively
good. When inertia weight
max
0.9 = ,
min
0.4 = . The
maximum speed for particle is for
max
v , the minimum speed
is
min
v . The speed for particle should not be too fast or too
low. Inadequate search of searching space would occur if the
speed is too low. Conversely, particle would miss the best
value if the speed is overly fast. Therefore, it would be wise
to take 0.1-0.2 times of the particle variation range. The
value scope of the position is
min max
x x .
The second item of speed iterative formula is the
"cognitive" part, which represents the particle's own learning
ability. The third one is "social" section, which represents
the mutual cooperation during the population of particles.
Speed iterative formula is the equation in which particle
could update its speed according to last iteration speed,
current position and the distance between the own best
experience and that of the group.
The Particle Swarm Optimization algorithm flowchart is
as follows:
1265

Figure 2. The flowchart of the particle swarm optimization algorithm
B. The Particle Swarm Algorithm To Optimize Parameters
of Self-tuning PID controller with Variable parameters
In the control process of the self-tuning VPPID
controller, the parameters a , b , c , d still have an important
influence on control performance of automatic chlorination
control system besides the parameters a
0
, b
0
, c
0
. Finding a
group of optimal combination is very difficult owing to
thousands of combination of them. The better control effect
of the chlorination system can be obtained by using the
particle swarm optimization method for the four parameters.
As for the optimization problems of self-tuning PID
controller with variable parameters, it is necessary to set up
the objective function for a comprehensive evaluation of the
performance index. Here choosing ITAE index, namely
[6]
:
( )
0
= d J t e t t

(3-4)
Particle swarm optimization for the self-tuning PID
controller with variable parameters flowchart is as follows:

Figure 3. The flowchart of PSO optimizing VPPID
a , b , c , d are the variable quantity and a
0
, b
0
, c
0
are for
the conventional PID controller parameters.
IV. APPLICATION OF THE SELF-TUNING VPPID
CONTROLLER
A. The Dynamic Model Of Chlorination Control System
For convenience of the study, this paper sets chlorination
control system model as:
( )
-
2
25
=
+8 +25
s
e
G s
s s
(4-1)
B. The Simulation Of chlorination System based on
particle Swarm Optimization Self-tuning VPPID
The whole optimization process is composed of three
parts, the first part includes m file for the particle swarm
optimization program, the second part is to connect the
particle swarm optimization program and the simulation
model program, and the third part is the simulation model
diagram.
During the first part, the function handle of simulation
model is called by using feval function in the particle swarm
optimization program. Then, the optimization results of the
four parameters are sent to PSO_PID file, and the specific
function call program is as follows:
ObjFun = @PSO_PID % Handle to the function
fSwarm(j,:)=feval (ObjFun, Swarm(j,:))
The second part : PSO_PID.m file functions
function z=PSO_PID(x)
assignin('base','a',x(1));
assignin('base','b',x(2));
assignin('base','c',x(3));
assignin('base',d',x(4));
[t,x,y_out]=sim('lr',[0,200]);
z=y_out(end,1);
The program above is mainly about to establish the
relationship between the simulation model of chlorination
control system and the particle swarm. In the PSO_PID file,
The particle swarm optimization parameters results will be
assigned to the simulation model by the assignin function,
then the simulation will be started by the use of sim function.
The final simulink simulation results, namely the fitness
function value, will be returned to the particle swarm
application fitness value: fSwarm .The program will be
cycled until it meets the criterion of the iterative number.
The third part, the simulation graph of the chlorination
control system is as follows:

Figure 4. The simulation model of chlorination control system
1266
In order to compare the effect of chlorination with
conventional PID controller, the self-tuning PID controller
with variable parameters based on particle swarm
optimization is operated.
30 particles and 50 iterations are used in this paper. The
particles and optimized parameters are random generation
through the rand function and the linear weights particle
swarm (LDIW - PSO) algorithm is used.
When a
0
=0.3, b
0
=1.2, c
0
=009, the simulation result of
conventional PID controller is as follows:

Figure 5. The simulation result of chlorination control system based on
the conventional PID
The simulation diagram of PSO_VPPID controller
parameters:

Figure 6. The simulation result of PSO-VPPID controller parameters
By using the system step response, the simulation result
graph of chlorination control system based on PSO-VPPID
controller is as follows:

Figure 7. The simulation results graph of chlorination control system
based on PSO-VPPID
The results of particle swarm optimization parameters is
as follows: a =0, b =0.4305, c =0, d =1.3104.
The simulation curve of the chlorination control system
shows that compared to the conventional PID controller, the
self-tuning PID controller with variable parameters based on
the particle swarm optimization overshoot is smaller.
Moreover, the response time and the time to reach balance
state is shorter, the steady state error is also smaller and the
control quality is higher comparatively.
V. CONCLUSION
The simulation model is established which could be used
for simulating the chlorination system by the self-tuning PID
controller with variable parameters. Then, the particle swarm
algorithm is used for optimizing the self-tuning VPPID
controller parameters, and the simulation results show that
the self-tuning PID controller with variable parameters based
on particle swarm optimization has strong adaptability and
robustness. To some extent, the difficulty of fuzzy controller
rules extraction is solved and it is of great significance for
improving the control performance of the chlorination
system.
ACKNOWLEDGEMENTS
This work was supported by National Natural Science
Foundation of China under Grant 61074067, 21106036,
61203136 and part supported by Scientific Research Fund of
Hunan Provincial Edu-cation Department(09A023,11B038)
REFERENCES
[1] Wang dingshun, The research and realization of the modern water
plant automatic control system [master's degree thesis].Hunan:
Hunan university,2007.(in Chinese)
[2] Zhong qingchang, Xie jianying, Li hui, Variable parameter PID
controller. Intromation and Controller. 1999.28(4):273-277. (in
Chinese)
[3] Zhou yingyu, Shu hua, Guo chen, Using Matlab S function to realize
nonlinear PID contol, Automation and Instrumentation 2001.94(2).
(in Chinese)
[4] Wang xiaochuan, Yu lei, Li yang. Matlab neural network 30 case
analysis.BeiJing: aerospace press.2010.4. (in Chinese)
[5] Li shiyong, Fuzzy Control, Neural Control and Intelligent Control
Theory. Harbin: Harbin Institute of Techno- logy Press, 1996. (in
Chinese)
[6] Shen guojian, Sun youxian, Relay Auto-Tuning Control Technique
of PID Based on IAE for a General System with Large Time-Varying
Time Delay. Journal of China's paper, 2010. (in Chinese)
1267

Das könnte Ihnen auch gefallen