You are on page 1of 11

70

Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

Fuzzy logic Control of Continuous Stirred Tank Reactor

Dr. Duraid Fadhil Ahmed Maha Nazar Esmaeel


Chemical Engineering Department
Tikrit University

Abstract
The mathematical modeling of continuous stirred tank reactor system is developed
based on the mass and energy balances for the reactor and heating system. The system is
studied by introducing step change in concentration, inlet flow, flow of heating fluid,
inlet temperature and heating fluid temperature and measuring the temperature change
in the reactor. In this paper, a fuzzy logic controller has been designed and evaluated.
Through simulation study by using MATLAB, it has been shown that the proposed
fuzzy logic controller has given an excellent tracking and regulation performance
compared to that of the PID control system.
Keywords: Mathematical modeling of continuous stirred tank reactor, MATLAB
simulation, Fuzzy logic, PID controller.



.

.
--
.""
.

, , , :
.--

E: Activation energy, (kJ/kmol). Nomenclature


e(t): Temperature error signal. Concentration of A in the reactor,
: Volumetric flow rate of the inlet (kmole/m3).
stream, (m3/hr). Concentration of A in the inlet
Volumetric flow rate of the jacket, stream, (kmole/m3).
3
(m /hr). : Specific heat capacity of the inlet
: Heat of reaction, (kJ/kmol). stream, (kJ/kg.K).
k1: Reaction rate constant (min-1). : Specific heat capacity of the jacket
Constant of Eq.(1). water, (kJ/kg.K).
KT: Constant of Eq.(1). Specific heat capacity of the reacting
Gains of energy balance in Eq. mixture.
(4&6).
71
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

digital PID controllers (MSaad et al. [6] R: Universal gas constant, (kJ/kmol. K).
and Cameron, Seborg[7]) and gain- S: Laplace transform.
scheduled fuzzy logic controller (Pramit t : Time, (min.).
[8]
). td: Time delay, (min.).
Czeczot [9] applied a balance-based : Temperature of the outlet , (K).
adaptive control methodology and its :Temperature of the jacket, (K).
application to the control of the : Inlet temperature of the jacket, (K).
continuous stirred tank reactor. This U: Overall heat transfer coefficient,
control methodology combines (kw/K.m2).
simplicity and generality, the simulation V: Volume of the reactor, (m3).
results prove very good control Volume of the jacket, (m3).
performance of the balance-based
: Density of the outlet stream, (kg/m3).
adaptive controller in comparison with
Density of the jacket water, (kg/m3).
the classical PI controller. Salehi &
Mohammad [10] applied an adaptive : Time constant, (min.).
fuzzy temperature controller for a class : Concentration time constant, (min.) .
of continuous stirred tank, a fuzzy logic : Thermal time constant, (min.).
system is used to estimate the : Jacket time constant, (min.).
concentration dependent terms and other D: Derivative time constant, (min.).
unknown system parameters in the I: Integral time constant, (min.).
control law, using temperature A: Membership function.
measurements. Prakash & Senthil [11]
applied a nonlinear observer based Introduction
model predictive controller continuous Continuous stirred tank reactor system
stirred tank reactor. The nonlinear state (CSTR) is a typical chemical reactor
estimation is achieved by using fuzzy system with complex nonlinear dynamic
kalman filter and augmented state fuzzy characteristics. There has been
kalman filter. The fuzzy kalman filter is considerable interest in its state
used to estimate the reactor estimation and real time control based on
concentration and reactor temperature mathematical modeling. However, the
whereas the augmented state fuzzy lack of understanding of the dynamics of
kalman filter is used to estimate the the process, the highly sensitive and
reactor concentration, From the nonlinear behavior of the reactor, has
extensive simulation studies on the made difficult to develop a suitable
reactor, they infer that fuzzy kalman control strategy. An efficient control of
filter based nonlinear model predictive the CSTR can be achieved only through
controller was able to achieve an accurate model [1].
satisfactory servo performance. For fuzzy control, the issue for
Soukkou et al. [12]
applied a fuzzy designing robust controller using fuzzy
optimal control methodology to the logic technique has always been the key
design of the feedback loops of an point. In most cases, fuzzy control is
exothermic continuous stirred tank designed based on the use of heuristic
reactor system. Simulations demonstrate information from human experts without
that the proposed robust has successfully using any plant model as a reference
[2]
met the design specifications. Galluzzo .The control of continuous stirred tank
& Cosenza [13] considered a mixed reactor requires the application of
feedbackfeedforward control advanced techniques such as neural
configuration and type-2 fuzzy logic network control ( Nikravesh et al. [3],
Thompson and Kramer [4] and Seborg[5]),
72 Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

Take the Laplace transform of Eq. (3): controllers they're considered for the
temperature control of a non-isothermal
continuous stirred tank reactor. The
simulation results show that the
... (4) proposed control configuration with

type-2 FLCs can be an effective solution
to a very difficult control problem and an
The energy balance for the jacket
alternative to the use of adaptive
becomes.
controllers.

( ). (5) Mathematical Modeling of the


Continuous Stirred Tank Reactor
Take the Laplace transform of Eq. (5): The dynamic behavior of the continuous
stirred tank reactor has been modeled by
the following set of nonlinear equations
based on the mass and energy balances
(6) for the reactor and heating system. Heat
and mass balance has been developed
Fuzzy Logic Controller and comprehensively validated against
Fuzzy logic control is a methodology the pilot plant. For the hydrolysis of
bridging artificial intelligence and ethyl acetate (A) forming ethanol &
traditional control theory. This acetic acid with NaOH as a catalyst, the
methodology is usually applied in the following differential equations describe
only cases when accuracy is not of high the dynamics of the continuous stirred
necessity or importance. On the other tank reactor [14].
hand, Fuzzy Logic can address complex The mass balance equation of continuous
control problems, such as robotic arm stirred tank reactor becomes.
movement, chemical or manufacturing
process control, automobile transmission
control with more precision and
accuracy, in many cases, than traditional
control techniques . Fuzzy Logic is a
methodology for expressing operational
laws of a system in linguistic terms
instead of mathematical equations.
Wide spread of the fuzzy control and
high effectiveness of its applications in a
great extend is determined by Take the Laplace transform of Eq. (1):
formalization opportunities of necessary
behavior of a controller as a fuzzy
(flexible) representation. This .. (2)

representation usually is formulated in
the form of logical (fuzzy) rules under The energy balance equation of
linguistic variables of a type If A then continuous stirred tank reactor becomes.
B (15).
Fuzzy Set Basic operation
The theory of sets and the concept of a (3)
set itself constitute a foundation of
73
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

In fuzzy set theory, the characteristic modern mathematics. As far as one


function is usually called the considers mathematical and simulation
membership function. models of application problems, on deals
Design of Fuzzy Logic Controller with mathematics and the set theory at
The decision-making activities of a the base of mathematics. The space
process operator in a regulation control which fuzzy sets are working in is called
task are shown in Figure (2); for the the universal set. Then a fuzzy subset
purposes of this work this activity is (A) of universal set (U) is characterized
expressed as a fuzzy relationship or by a membership function (A(u)) which
algorithm, relating significant observed is assigns to each element (U u). This
variables to the control actions. The form function determines if the element of the
of the decision rules employed depends universal set does or does not belong to
on the process under control and the this subset A. Hence the function may
heuristics employed. In the case of single have two values: TRUE or FALSE or in
input-single output regulation tasks numbers, 1 or 0.(16)
which are the subject of this study, the
process operator is assumed to respond
to the system error (E) and its rate of
change (CE), the result of a control {
decision being a change in the control
valve setting (CU). The resulting control
system has a measurement and control The main operations used are defined as
action basis similar to the versatile follow (16):
proportional + integral control system 1-The intersection of the fuzzy subsets
used extensively in the process industry (A) and (B) of the universal with
(17)
. The first step in fuzzy logic is to characteristic function define by:
convert the measured signal x (which
might be the error signal in a control
system) into a set of fuzzy variables.
This is called fuzzy classification or This corresponds to the logical AND
fuzzification. It is done by giving values operation.
(these will be our fuzzy variables) to 2-The union of the fuzzy subsets (A)
each of a set of membership functions. and (B) of the universe set (U) is
The values for each membership dented by:
function are labeled (x), and are with characteristic function define by:
determined by the original measured
signal x and the shapes of the
membership functions. A common fuzzy This corresponds to the logical OR
classifier splits the signal x into five operation.
fuzzy levels as follows: - 3-The complement of a fuzzy subset
a) LP: x is Large Positive (A) of the universe set (U) is denoted
b) SP: x is Small Positive by:
c) Z: x is Zero
d) SN: x is Small Negative
e) LN: x is Large Negative This corresponds to the logical NOT
operation.
We can simply follow these steps in
designing a fuzzy logic control:
74
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

= min. (E(u), CE(u)) 1- Choose a suitable scaled universe


5-The fuzzy decision rules are of set (U) of;
developed linguistically to do a
particular control task and are L (Ei) L
implemented as a set of fuzzy
conditional statements of the form: -L (CEi) L

IF E is PB AND CE is NB THEN PS Where L and L represent the positive


Action and negative ends respectively of this
universe which is quantified into equally
This form can be translated with the help spaced levels in between those two ends.
of fuzzy sets definition into a new Ei and CEi represent the error and its rate
statement; of change for the same instant (i). The
calculation of the error and its rate of
IF PEB AND NCB THEN PUS change, from the fuzzy logic control
point of view the calculations of error
The derivation of the fuzzy rules can be (E) and its rate of change (CE) are as
obtained directly from the phase-plane of below:
error and its rate of change. Table (1) Ei = (Measured value)i Set value
shows the fuzzy rules conclusions. The CEi = Instant error Previous error
five fuzzy sets definition generates (25) The error definition here is the opposite
rules fuzzy controller. of that used in other control theory and
7- Choice of the defuzzification the cause is just to keep the linguistic
procedure. The defuzzification goal in that the fuzzy rules have already built
Mamdani type fuzzy controllers is to on.
produce a crisp output taking the fuzzy 2-Both Ei, CEi and u are multiplied by a
output obtained after rules processing. scale factor of the universe of set to
The center of gravity (COG) method is ensure mapping their values into suitable
used. intervals that belong to each one, also
8- Fuzzy Controller program: The fuzzy this scale factor helps to simplify
controller can be programmed in C, handling the numerical values of all
Fortran, Basic, MATLAB, or virtually variable.
any other programming language. 3-Choose a membership function,
Suppose that we let the computer such as number of classes to describe
variable (er) denote E(t), which we call all the values of the linguistic
the first input, and (de) denote CE(t), variable on the universe, the position
which we will call the second input. of different membership functions on
Using these definitions, consider the the universe of discourse, the width
program for a fuzzy controller output of the membership functions and the
given its two inputs: shape of a particular membership
For i=1 t0 200 function.
Multiplying e (i) and der (i) by a 4-Calculate the applicability degree.
suitable scale factor to get er(i) At this the degree to which the whole
and de (i). (inputs of fuzzy condition part (all the inputs)
controller). satisfies the rule is calculated. This
Compute 1 and 2. (Find the degree is called the degree of
values of all membership applicability of the condition part. It
is denoted as :
75
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

blades. The stirrer operates with range of functions given the values for
(0-250) rpm. (er) and (de).
Three glass rectangular vessels of Compute = min(1,2). (Find
two liters were used as feeding tanks. the values for the premise
These were fitted at the top of reactor membership functions for a given
and transfer of liquids by gravity to the (er) and (de).using the minimum
reactor. All the transport tubes of the operation).
system to the reactor are 12 mm inside Compute "du"
diameter and are made of stainless steel Let w (no. of rule)=0, du(no. of
to prevent any chemical corrosion. Flow rule).=0
rates were measured by independently
calibrated rotameters. The range of flow After applying these six steps on
of each rotameter is (0 40 L/hr.) of our 25 rules, then calculate COG
water at 200 C. num.= sum [du* ]/sum []
The reactor was heated by hot water, Output u crisp=u(i)+ COG*
which flows through the jacket around suitable scale factor for FLC
the reactor by using a small pump. The output
pump was capable of handling about (40 T(i+1) = T(i+1) + u
L/hr.) water and was heated by an
external electrical heater. The electrical Simulation of Control Methods
heater was provided with a digital screen The simulation technique is based on
to view the temperature. the software tool MATLAB to solve the
Thermocouple (3B37-T-03) was ordinary differential equations which
installed to measure reactor temperature, represent the system behavior. During
the input range of this thermocouple (- the digital simulation of the two methods
1000 C to +4000 C) and the output ranges of control, the controlled variable (T) is
(0 10 mV), this signals were converted calculated and from the response of this
through transmitter and then fed to the variable we find the best condition of the
computer through Analog digital control system.
interface. The open loop responses to step
change in ( are calculated
Results and Discussion from MATLAB program. The closed
Open Loop System loop response for Fuzzy Logic controller
In order to obtain a model for each is calculated by applying the steps in the
process, the input and output data of the simulation section, and software tool
open loop system are needed for the MATLAB to obtain the closed loop
evaluation purpose. The data is obtained response to a step change in the
from experiments done on the real mentioned variables.
process plant. The experimental results
of the open loop responses in the reactor Experimental Work
temperature for a step change in step The experiments were carried out in a
change in ( are shown in laboratory scale continuous stirred tank
the figures (3) to (6). reactor. The laboratory plant consists of
The mathematical model equations of 1 liter glass reactor with constant volume
continuous stirred tank reactor were byproduct overflow out of the vessel.
solved using MATLAB software. The Surrounded by a glass jacket as shown in
results values for model parameters are figure (1), it also equipped with the
as follows: stirrer of stainless steel which has two-
76
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

controlling the continuous stirred tank =12.8min, =3.53min, = ,


reactor system using fuzzy logic by =0.028, = 0.033, =0.08 and
shorting the time requires for reaching
the set point and eliminating the The transfer function of the reactor
oscillation in the response. can represent as the following equation
and Table (2) gives the value of these
Conclusions parameters:
From the present study, the following 21.69e 0.36s
conclusions are drawn regarding the G( s) .............................(7)
12.8s 1
control of continuous stirred tank
reactor.The process identification
Simulation was also used to calculate
procedure using process reaction curve
the controller parameters. These
methods showed that the system was
parameters were determined using
described as first-order lag system with
Cohen-Coon method. The simulated
dead time. The results have shown
reactor temperature responses are also
priority of the fuzzy logic controller
shown in the same figures for
compared with the classical controller
comparison. The Mean Square Error
(PID). The comparison between the
between the simulated and experimental
experimental data and simulation results
results are (0.077), (0.0743), (0.0595) &
gave a little deviation. It was considered
(0.0936) respectively. This deviation
that the differences were due to some
between the actual and simulated
reasons like the unisolated system and
response arises from the linearization
the non- linearity of the system
inherent in the transfer function model.
However, the responses with simulated
References and experimental are not significantly
1. Suja Malar & Thyagarajan,"
different.
Modelling of Continuous Stirred
Fuzzy Logic Controller
Tank Reactor Using Artificial
The fuzzy controller presented is
Intelligence Techniques",
applied for the continuous stirred tank
Department of Electrical and
reactor system. In order to certain the
Electronics Engineering, PET
advantages offered by the fuzzy control
Engineering College of India, Vol.3,
strategy, simulation results are also
pp. 145-155, (2009).
presented for PID controller. A
2. Passino K.M. and Yurkovich S,
simulation study was carried out to
"Fuzzy control", Menlo Park,
establish the effectiveness of the
California Addison Wesley Longman
proposed methods in controlling the
Inc.134, pp. 243-253 (1998).
reactor temperature and to predict the
3. Nikravesh M. , Farell A.E., Stanford
dynamic process behavior with tuning
T.G.," Control of Nonisothermal
the parameters of the controllers.
CSTR With Time Varying
The results obtained for the control
Parameters Via Dynamic Neural
system are shown in the figures (7) to
Network Control", Chemical
(10). The results obtained with the fuzzy
Engineering Journal,vol.76, pp. 1
controller were much better than
16, (2000).
conventional method. The fuzzy
4. Thompson M., and Kramer M.,
controller gave good control at all
"Modeling chemical processes using
operating points with a rapid response
prior knowledge and neural
and small amount of overshoot. These
responses show the improvement in
77
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

Predictive Controller For a networks", AIChE Journal 40 (8)


Continuous Stirred Tank Reactor", (1994) 1328-1340
Journal of Process Control, Vol.18, 5. Seborg, D.E. "Experience with
pp. 504514, (2008). nonlinear control and identification
12. Soukkou A., Khellaf A., Leulmi S. strategies", Control'. (1994) 94, 879-
and Boudeghdegh K.," Optimal 886.
Control of a CSTR Process", 6. MSaad M., Bouslimani M. and
Brazilian Journal of Chemical Latifi M. A.," PID Adaptive Control
Engineering, pp. 799 812, (2008). of Exothermic Stirred Tank
13. Galluzzo M., and Cosenza M.," Reactors", Conference on Control
Control of a Non-Isothermal Applications, Vancouver, pp. 113-
Continuous Stirred Tank Reactor By 117, (1993).
a FeedbackFeedforward Structure 7. Cameron F., and Seborg D.E., "A
Using Type-2 Fuzzy Logic self-tuning controller with a PID
Controllers", Information structure", International Journal of
Sciences,Vol.32, pp. 35353550, Control 38 (2) (1983) 401 - 417.)
(2011). 8. Sarma P.," Multivariable Gain-
14. Stephanopoulos G., "Notes on Scheduled Fuzzy Logic Control of an
Chemical Process Control And Exothermic Reactor", Engineering
Chemical Modeling", Prentice/Hall Applications of Artificial
International, Inc, pp. 81-120, Intelligence, Vol.14, pp. 457471,
(1986). (2001).
15. Grigorie T. L.," Fuzzy Controllers, 9. Czeczot J., "Balance-Based Adaptive
Theory and Applications", InTech Control Methodology and Its
web organization, p. 17-20, (2011). Application to the Non-Isothermal
16. Passino, M. K. and Stephen, Y., CSTR", Chemical Engineering and
Fuzzy Control, Addison-Wesley Processing, Vol.45, pp. 359371,
Longman, Inc., California, (1998). (2006).
17. King, P. S. and Mamdani, E. H., 10. Salehia S., Mohammad Shahrokhi,"
The Application of Fuzzy Control Adaptive Fuzzy Approach For H
Systems to Industrial Processes, Temperature Tracking Control of
Automatica, Vol. 13, pp. 235-242, Continuous Stirred Tank Reactors",
(1977). Control Engineering Practice,
Vol.16, pp. 11011108, (2008).
11. Prakash J. and Senthil R.," Design
of Observer Based Nonlinear Model
78
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

Figure (1): Schematic Diagram of the Experimental CSTR


Process.

Figure (2) Block Diagram of the Fuzzy Control System

307 301
306 300
305 Simulation
299
Temperature (k)

304 Experimental
Temperature (K)

Simulation
303 298
302 Experimental
297
301
296
300
299 295
0 20 40 0 10 20 30 40
Time (min.) Time (min.)
Figure (3): Comparison between the Figure (4): Comparison between the
open-loop simulated and experimental open-loop simulated and experimental
temperature responses to step change in temperature responses to step change in
jacket flow rate from 10 to 30 L/hr. jacket temperature from 313 to 323 K.
79
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

306 310

Temperature
305 308
304 306
Temperature (K)

303 Simulation 304 Fuzzy

(K)
302 PID
302 Experimental
300 - - - Setpoint
301
298
300
296
299
0 100 200 300
0 20 40
Time (min.) Time (sec.)
Figure (4): Comparison between the open-loop Figure (7) Comparison between
simulated and experimental temperature conventional control and fuzzy logic
responses to step change in jacket temperature control to a step change in jacket flow
from 313 to 323 K. from 10 to 30 L/hr
301 312
300 310
Simulation
299 308
Temperature (K)
Temperature (K)

Experimental
306 Fuzzy
298
304 PID
297 - - -Setpoint
302
296
300
295 298
0 10 20 30 40 0 100 200 300
Time (min.)
Time (sec.)
Figure (5): Comparison between the open-loop
simulated and experimental temperature Figure (8) Comparison between
responses to step change in feed flow rate conventional control and fuzzy logic
from 4.5 to 9 L/hr. control to a step change in feed
temperature from 285 to 293K
304

303
Temperature (K)

Simulation
302
Experimental
301

300

299
0 10 20 30 40
Time ( min.)
Figure (6): Comparison between the open-loop
simulated and experimental temperature responses
to step change in feed temperature from 285 to 293 K.
80
Tikrit Journal of Engineering Sciences/Vol.20/No.2/March 2013, (70-80)

Table (1): Fuzzy logic controller rules for CSTR


E
PEB PES ZE NES NEB
CE
PCB NUB NUB NUB NUS ZU
PCS NUB NUS NUS ZU PUS
ZC NUB NUS ZU PUS PUB
NCS NUS ZU PUS PUS PUB
NCB ZU PUS PUB PUB PUB

Table (2): Comparison between theoretical and experimental parameters of


transfer function of CSTR.
parameters Theoretical Experimental Error
KP, K.m3 /kmol 21.69 21.54 0.15
td , (min) 0.36 0.5 0.15
, (min) 12.8 18.92 6.12

You might also like