Paper 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Al-Khwarizmi

Engineering
Journal
Al-Khwarizmi Engineering Journal, Vol. 9, No. 4, P.P. 46- 53 (2013)


Design of an Adaptive PID Neural Controller for Continuous Stirred
Tank Reactor based on Particle Swarm Optimization

Khulood A. Dagher* Ahmed S. Al-Araji**
* Department of Computer Science / College of Science / University of Baghdad
** Department of Control and Systems Engineering / University of Technology
*Email:[email protected]
*Email:[email protected]

(Received 16 May 2013; accepted 11 November 2013)


Abstract

A particle swarm optimization algorithm and neural network like self-tuning PID controller for CSTR system is
presented. The scheme of the discrete-time PID control structure is based on neural network and tuned the parameters
of the PID controller by using a particle swarm optimization PSO technique as a simple and fast training algorithm. The
proposed method has advantage that it is not necessary to use a combined structure of identification and decision
because it used PSO. Simulation results show the effectiveness of the proposed adaptive PID neural control algorithm
in terms of minimum tracking error and smoothness control signal obtained for non-linear dynamical CSTR system.

Keywords: Particle Swarm Optimization, PID Controller, Neural Network, CSTR.


1. Introduction

In recent years, the adaptive control techniques
in the industry process have made great advances.
Numerous control methods such as adaptive
neural control and adaptive fuzzy control have
been studied. Among them, the best known is the
adaptive proportional-integral-derivative (PID)
controller, which has been widely used in the
industry because of its simple structure and robust
performance in a wide range of operating
conditions [1]. There are many classic tuning
methods for PID parameters such as trial and error
method or Ziegler-Nichols method.
Unfortunately, it has been quite difficult to
tune properly the gains of PID controllers because
many industrial plants are often burdened with
problems such as high order, time delays, and
nonlinearities. It is hard to determine optimal or
near optimal PID parameters with the classic
tuning method. For these reasons, it is highly
desirable to increase the capabilities of PID
controllers by adding new features. Many
artificial intelligence (AI) techniques have been
employed to improve the controller performances
for a wide range of plants while retaining their
basic characteristics [2].
In addition to that, there are many control
methodologies for continuous stirred tank reactor
(CSTR) system that it's strong nonlinear behavior
such as follows.
A PID self adaptive control method based on
on-line optimization of PID controller parameters
by the differential evolution algorithm is stated in
[3].
A practical non-linear PID controller that
utilizes a local model (LM) network, which
combines a set of local models within an artificial
neural network (ANN) structure, to adaptively
characterize the CSTR process nonlinearity is
explained in [2].
The control of CSTR using state feedback gain
using pole placement technique is investigated in
[4]. The state feedback gain parameters are gain
scheduled using Fuzzy Logic Control to provide
the appropriate values for the different regions.
In [5] it is used two strategies for adaptive
control of a nonlinear CSTR process, adaptive
general predict control and model reference
Khulood A. Dagher Al-Khwarizmi Engineering Journal, Vol. 9, No. 4, P.P. 46- 53(2013)
47

adaptive control the polynomial approach
connected with pole-placement method. The
Artificial Neuro-Fuzzy Inference System (ANFIS)
gain scheduled Genetic Algorithm (GA) based
PID is proposed for CSTR as in [6].
Also in [7] is proposed a predictive control
strategy for nonlinear dynamics of a CSTR
process based on a neuro-fuzzy network and L
infinite. Hybrid adaptive inverse control based on
neural fuzzy system is presented and explained in
[8]. It consists of two control loops, inverse
control and PID control. PID control is a
complement for inverse control and is mainly
used to eliminate static error existing in direct
inverse control when the inverse model is
uncertain.
A nonlinear model predictive control (NMPC)
based on Wiener model and Laguerre function is
proposed in [9]. Employing a Wiener model in
NMPC can handle the nonlinearity in the
controlled CSTR plant and retain all important
properties of linear model predictive control
(MPC) with a quadratic function.
The main advantage of the presented approach
is not necessary to use a combined structure of
identification and decision, common in a standard
self-tuning controller because it is used a particle
swarm optimization (PSO) as a simple steps
algorithm and fast tuning the parameters of the
PID controller.
The remainder of this paper is organized as
follows: section two is a description of the
mathematical model of the CSTR. In section
three, the proposed of neural network like self-
tuning PID controller approach and tuning
algorithm are derived. Simulation results of the
proposed adaptive PID neural control algorithm
are presented in section four and the conclusions
are drawn in section five.


2. CSTR Mathematical Modeling

Consider standard two-state (CSTR) with an
exothermic irreversible first-order reaction
B A take place, the heat of reaction is removed
by a coolant medium that flows through a jacket
around the reactor as shown in Figure (1) [10 and
11]. The dynamics of system can be described by
the following two nonlinear ordinary differential
equations [10, 11, 12 and 13]:
)) ( ( 1 ) (
) ( ) (
)) ( (
) (
) ( )) ( (
) (
) (
) (
) (
t T T e t q
Vol C
C
e
C
t C K H
t T T
Vol
q
t
t T
e t C K t C C
Vol
q
t
t C
cf
C t q
h
c
c c
c c
t RT
E
a o
f
t RT
E
a o a af
a
c c c
a


+ =

(1)




















Fig .1. CSTR with Cooling Jacket.


The nominal CSTR operating conditions can
be shown in Table (1).























q
c
(t) , T
cf


Coolant

C
af
, q , T
f


Reactant
q
c
(t) , T
c
(t)
C
a
(t) , q ,
T(t)

Product

Khulood A. Dagher Al-Khwarizmi Engineering Journal, Vol. 9, No. 4, P.P. 46- 53(2013)
48

Table ,
Nominal CSTR Operating Conditions.

Parameter Description Nominal Value
q Process flow-rate 100 lmin
-1
C
af
Intel feed
concentration
1 mol l
-1
T
f
Feed temperature 350K
T
cf
Inlet coolant
temperature
350K
Vol
Reactor volume 100 l
h
a
Heat transfer
coefficient
7*10
10
cal min
-
1
.K
-1
k
o
Reaction rate
constant
7.2*10
10
Min
-1
R
E
Activation energy 9.95*10
3
K
H Heat of reaction 2*10
5
cal mol
-1
c
, Liquid densities 1000 g l
-1
C
p
C
pc
Specific heats 1 cal g
-1
. K
-1
q
c
Coolant flow-rate 103.41 l.min
-1
T
Reactor temperature 440.2K
C
a

Product
concentration
8.36*10
-2
mol l
-
1








3. PID Neural Controller Approach

The approach used to control the nonlinear
system depends on the information available
about the system and the control objectives;
therefore, the general structure of the PID neural
controller is shown in Figure (2).
The feedback PID neural controller is very
important because it is necessary to stabilize the
tracking error of the system when the output of
the system is drifted from the reference point.
The self-tuning PID neural controller is shown
in figure (3). It is based on a conventional PID
controller, which consists of three terms:
proportional, integral and derivative. The standard
form of a PID controller is given in the s-domain
as in equation (2) [15].
s K
s
K
K D I P s Gc
d
i
p
+ + = + + = ) (
(2)
where K
p
, K
i
and K
d
are called the proportional
gain, the integral gain and the derivative gain
respectively.
The aim of adaptive self-tuning technique is to
adjust the parameters of the PID neural controller
by using particle swarm optimization algorithm
technique.
The proposed self-tuning PID neural control
scheme is like neural network PID controller
structure as the discrete-time equation (3) [16].
) ( )] 1 ( ) ( [ ) 1 ( ) ( k Kie k e k e Kp k u k u + + =

)] 2 ( ) 1 ( 2 ) ( [ + + k e k e k e Kd .(3)
Therefore, the self-tuning PID input vector
consists of e(k), e(k-1), e(k-2) and u(k-1), where
e(k) and u(k-1) denote the input error signals and
the self-tuning PID output respectively.



























CSTR
System

PID Controller
Particle Swarm
Optimization
Algorithm
Kp Ki Kd
Ca
ref
(k+1)
e(k)
u(k)
Ca
out
(k+1)
+


Fig. 2. The Proposed Block Diagram of Neural Network Like Self Tuning PID Controller.


u(k-1)

-

Khulood A. Dagher Al-Khwarizmi Engineering Journal, Vol. 9, No. 4, P.P. 46- 53(2013)
49


Fig. 3. The Neural Network Like Self Tuning PID
Controller Architecture.


3.1. Learning Algorithm

Particle Swarm optimization is a kind of
algorithm to search for the best solution by
simulating the movement and flocking of birds.
PSO algorithms use a population of individual
(called particles) flies over the solution space to
search for the optimal solution.
Each particle has its own position and velocity
to move around the search space. The particles are
evaluated using a fitness function to see how close
they are to the optimal solution [17, 18 and 19].
The previous best value is called as pbest.
Thus, pbest is related only to a particular particle.
It also has another value called gbest, which is the
best value of all the particles pbest in the swarm.
The neural network like self-tuning PID
controller with three weights parameters of the
PID controller matrix is rewritten as an array to
form a particle. Particles are then initialized
randomly and updated afterwards according to
equations (4, 5, 6, 7, 8 and 9) [17, 18 and 19] in
order to tune the PID parameters:
) ( ) (
2 2 1 1
1 k
m
k k
m
k
m
k
m
k
m
Kp gbest r c Kp pbest r c Kp Kp + + =
+
(4)
1 1 + +
+ =
k
m
k
m
k
m
Kp Kp Kp
(5)
) ( ) (
2 2 1 1
1 k
m
k k
m
k
m
k
m
k
m
Ki gbest r c Ki pbest r c Ki Ki + + =
+
(6)
1 1 + +
+ =
k
m
k
m
k
m
Ki Ki Ki
(7)
) ( ) (
2 2 1 1
1 k
m
k k
m
k
m
k
m
k
m
Kd gbest r c Kd pbest r c Kd Kd + + =
+
(8)
1 1 + +
+ =
k
m
k
m
k
m
Kd Kd Kd
( 9 )
pop m ,..... 3 , 2 , 1 =
where
pop is number of particles.
k
m
Kpid is the weight of particle m at k iteration.
c
1
and c
2
are the acceleration constants with
positive values equal to 2.
r
1
and r
2
are random numbers between 0 and 1.
m
pbest is best previous weight of m
th
particle.
gbest
is best particle among all the particle in the
population.
The number of dimension in particle swarm
optimization is equal to three because there are
only three parameters of the PID controller.
The mean square error function is chosen as
criterion for estimating the model performance as
equation (10):
2
1
) ) 1 ( ) 1 ( (
2
1

=
+ + =
pop
j
j
out
j
ref
k Ca k Ca E
(10)
The steps of PSO for neural network like self-
tuning PID controller can be described as follows:

Step1 Initial searching points
0
1
Kp ,
0
1
Ki ,
0
1
Kd ,
0
1
Kp ,
0
1
Ki and
0
1
Kd of
each particle are usually generated randomly
within the allowable range. Note that the
dimension of search space is consists of all the
parameters used in the neural network like PID
controller as shown in Figure (3). The current
searching point is set to pbest for each particle.
The best-evaluated value of pbest is set to
gbest and the particle number with the best
value is stored.
Step2 The objective function value is
calculated for each particle by using equation
(10). If the value is better than the current
pbest of the particle, the pbest value is
replaced by the current value. If the best value
of pbest is better than the current gbest, gbest
is replaced by the best value and the particle
number with the best value is stored.
Step3 The current searching point of each
particle is update by using equations (4, 5, 6, 7,
8 and 9).
Step4 If the current iteration number reaches
the predetermined maximum iteration number,
then exit. Otherwise, go to step 2.


4. Simulation Results

The dynamic model of the CSTR described in
section 2 is used where the objective is to control
the Ca(t), which can be done by introducing a
coolant flow rate qc(t) as the manipulated
variable, also the temperature can be varied too.
To study the dynamic behavior of the CSTR

Kp
+
+
+
+

) (k u

+
+
+
+
Ki

Kd

) (k e

) 1 ( k e

) 2 ( k e

) 1 ( k u

1
-1
1
1
-2


1
1

Khulood A. Dagher Al-Khwarizmi Engineering Journal, Vol. 9, No. 4, P.P. 46- 53(2013)
50

model, the open loop output response of the
CSTR for step changes in the coolant flow-rate is
shown in figures (4-a & b) respectively by using
the fourth order RK method [20] with sampling
time of 0.1 minute through the Matlab/Simulink
computer simulation.

0 20 40 60 80 100 120 140 160 180 200
0.06
0.065
0.07
0.075
0.08
0.085
0.09
0.095
0.1
0.105
Sample
C
S
T
R

o
u
t
p
u
t

C
a

(
m
o
l
/
l
)


Fig. 4-a. The Open Loop Respose of the CSTR.
0 20 40 60 80 100 120 140 160 180 200
94
96
98
100
102
104
106
108
110
Sample
C
o
o
l
a
n
t

f
l
o
w
-
r
a
t
e

(
l
/
m
i
n
)


Fig. 4-b. The Step Changes in the Coolant Flow-
Rate.


As shown in Figure (4), both the damping and
the steady-state gain of the system varies
considerably, depending on the set point, which
gives an indication of the highly nonlinear
dynamic behavior of the system.
The proposed neural network like self-tuning
PID controller scheme as in Figure (2) is applied
to the CSTR model and it is used the proposed
learning algorithm steps of PSO for tuning PID
controller's parameters. The PSO algorithm is set
to the following parameters:
Population of particle is equal to 20 and
number of iteration is equal to 300.Number of in
each particle is 3 because there are three
parameters of PID.
It is very necessary to normalize the input
signals of Figure (4-a) and the coolant flow-rate
as the manipulated variable of Figure (4-b)
between (-1 to +1). The signals entering to or
emitted from the network have been normalized to
lie within (-1 to +1) in order to overcome
numerical problems that is involved within real
values. Scaling functions have to be added at the
neural network terminals to convert the scaled
values to actual values and vice versa.
After training, it can be observed that the
actual output of the CSTR plant is following the
desired input that is shown the Figure (5) while
the feedback control action is shown in Figure (6)
that has small spike in the transit state and fix
output at steady-state.

0 50 100 150 200 250 300
0.075
0.08
0.085
0.09
0.095
0.1
Sample
C
S
T
R
o
u
t
p
u
t
C
a

m
o
l
/
l


Desired Input
Actual Output


Fig. 5. Response of the CSTR Plant Output & the
Desired Input.

0 50 100 150 200 250 300
80
85
90
95
100
105
110
115
120
Sampl e
C
o
o
l
a
n
t
f
l
o
w
-
r
a
t
e


Fig. 6. The Feedback PID Control Signal.



The error between the desired input and the
actual output of the plant is very small as shown
in Figure (7).
Khulood A. Dagher Al-Khwarizmi Engineering Journal, Vol. 9, No. 4, P.P. 46- 53(2013)
51

0 50 100 150 200 250 300
-8
-6
-4
-2
0
2
4
6
8
10
x 10
-3
Sample
E
r
r
o
r


Fig. 7. Output Error between the Set Point Desired
& the Actual Output.


The gains of the PID self-tuning neural
controller as scale function is shown in Figure (8).

0 50 100 150 200 250 300
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
Sample
P
I
D
P
a
r
a
m
e
t
e
r
s


Kp gain
Ki gain
Kd gain


Fig. 8. The PID Controller's Parameters.


5. Conclusion

In this paper, the structure of the neural
network like self tuning PID controller with
particle swarm optimization algorithm technique
learned as the proposed structure of controller and
successfully simulated to nonlinear dynamic
CSTR system. Using PID feedback controller
with self-tuning technique to adjust the
parameters (Kp, Ki, Kd) of the controller. So that,
the output of the plant follows the desired input
and PSO algorithm is used to tune the PID
controller with minimum time and more stability
of the controller and no oscillation with best
parameters of the controller. The proposed
control structure has shown the ability to
minimize the tracking error in the transient state
less than 0.01 between the desired input and the
actual output of the CSTR plant and in the steady
state, the tracking error is equal to zero, as well as
to reduce the spike control action with a simple
and fast training algorithm.


Acknowledgment

The authors would like to express their
appreciation to Automation and Robotics
Research Unit (ARRU) at Control and Systems
Engineering Dept. in the University of
Technology for providing them the requirements
of this research.


6. References

[1] T. Wonghong and S. Engell, Real-time PI
Controller Tuning via Unfalsified Control,
The Proceedings of IEEE International
Symposium on Intelligent Control (ISIC),
Part of 2011 IEEE Multi-Conference on
Systems and Control Denver, CO, USA.
September 28-30, 2011, pp. 1008-1013.
[2] R. Gao, A. Odywer and E. Coyle, A Non-
linear PID Controller for CSTR Using Local
Model Networks, Proceedings of the 4th
World Congress on Intelligent Control and
Automation June 10-14, 2002, Shanghai,
P.R.China., pp. 3278-3282.
[3] X. Zhicheng, The Application in Adaptive
Control for Differential Evolution Algorithm,
Proceedings of the International Conference
on System Science, Engineering Design and
Manufacturing Information, 2011, pp. 206-
209.
[4] U. Sabura and G. Uma, Fuzzy Gain
Scheduled Pole Placement Based State
Feedback Control of CSTR, IET-UK
International Conference on Information and
Communication Technology in Electrical
Sciences (ICTES 2007), Dr. M.G.R.
University, Chennai, Tamil Nadu, India. Dec.
20-22, 2007. pp.63-68.
[5] M. Delbari, K. Salahshoor and B. Moshiri,
Adaptive Generalized Predictive Control and
Model Reference Adaptive Control for CSTR
Reactor, International Conference on
Intelligent Control and Information
Processing August 13-15, 2010 - Dalian,
China, pp. 165-169.
[6] U. Sabura and G. Uma, ANFIS Gain
Scheduled CSTR with Genetic Algorithm
Khulood A. Dagher Al-Khwarizmi Engineering Journal, Vol. 9, No. 4, P.P. 46- 53(2013)
52

Based PID Minimizing Integral Square Error,
IET-UK International Conference on
Information and Communication Technology
in Electrical Sciences (ICTES 2007), Dr.
M.G.R. University, Chennai, Tamil Nadu,
India. Dec. 20-22, 2007, pp. 57-62.
[7] Q. Wu, Y.J. Wang, Q.M. Zhu and K.
Warwick, Neurofuzzy model based L


predictive control of nonlinear CSTR system,
Proceedings of the 2002 IEEE international
Conference on Control Applications
September 18-20, 2002, Glasgow, Scotland,
U.K. pp. 59-64.
[8] J. Li and Y. Jinshou, Nonlinear Hybrid
Adaptive Inverse Control Using Neural
Fuzzy System and Its Application To CSTR
Systems, Proceedings of the 4th World
Congress on Intelligent Control and
Automation June 10-14, 2002, Shanghai,
P.R.China, pp. 1896-1900.
[9] A. Harudeen and D. Banjerpongchai,
Nonlinear Model Predictive Control with
Wiener Model and Laguerre Function for
CSTR Process. The Proceedings of 8th
Electrical Engineering! Electronics,
Computer, Telecommunications and
Information Technology (ECTI) Association
of Thailand - Conference 2011, pp. 577-580.
[10] L.S. Saoud, F. Rahmoune, V. Tourtchine
and K. Baddari, An Inexpensive embedded
electronic continuous stirred tank reactor
(CSTR) based on neural networks,
Proceeding of the International Conference
on Multimedia Technology (ICMT2011),
pp. 6233-6237, 2011.
[11] M. Delbari, K. Salahshoor and B. Moshiri,
Adaptive generalized predictive control and
model reference adaptive control for CSTR
reactor, Proceedings of the International
Conference on Intelligent Control and
Information, Dalian, China, August 13-15,
pp. 165-169, 2010.
[12] P. Guo, nonlinear predictive functional
control based on hopfield network and its
application in CSTR, Proceedings of the
5th International Conference on Machine
Learning and Cybernetics, Dalian, August
13-16, pp. 3036-3039, 2006.
[13] B.C. Juricek, D.E. Seborg and W.E.
Larimore, Process control applications of
subspace and regression-based
identification and monitoring methods,
2005 American Control Conference,
Portland, OR, USA, June 8-10, pp. 2341-
2346, 2005.
[14] E.P. Nahas, M.A. Henson and D.E. Seborg,
Nonlinear internal model control strategy
for neural network models, Computers
Chem. Eng., Vol. 16, no. 12, pp. 1039-
1057, 1992.
[15] Q. Zhong, "Robust Control of Time-delay
Systems", Springer Verlag London
Limited 2006
[16] S. Omatu, M. Khalid, and R. Yusof, Neuro-
Control and its Applications. London:
Springer-Velag, 1995.
[17] J. Derrac, S. Garc, D. Molina and F.
Herrera ,A practical tutorial on the use of
nonparametric statistical tests as a
methodology for comparing evolutionary
and swarm intelligence algorithms, Journal
of Swarm and Evolutionary Computation,
Vol.1,pp. 318, 2011.
[18] J. Zhou, Z. Duan, Y. Li, J. Deng and D. Yu,
PSO-based neural network optimization
and its utilization in a boring machine,
Journal of Materials Processing
Technology, Vol.178, pp.1923, 2006.
[19] Y.S. Lee, S.M. Shamsuddin, and H.N.
Hamed, Bounded PSO Vmax Function in
Neural Network Learning, Proceedings of
the Eighth International Conference on
Intelligent Systems Design and
Applications, pp.474-479, 2008.
[20] K. Ogata, Modern Control Engineering. 4th
Edition, by Addison- Wesley Publishing
Company, Inc. 2003.







9 4 53-46 ) 2013 (

53



) PID (



*

**

* / /
** /
[email protected] : *
[email protected] : **




) PID (
.
) PID ( ) PID (
. .
) PID (
.

You might also like