Sie sind auf Seite 1von 6

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 10, No. 7, July 2012

Modeling and Control of CSTR using Model based Neural Network Predictive Control

Piyush Shrivastava

Assistant Professor,

Electrical& Electronics EngineeringDepartment, Takshshila Institute of Engineering & Technology, Jabalpur, Madhya Pradesh, India


Abstract—this paper presents a predictive control strategy based on neural network model of the plant is applied to Continuous Stirred Tank Reactor (CSTR). This system is a highly nonlinear process; therefore, a nonlinear predictive method, e.g., neural network predictive control, can be a better match to govern the system dynamics. In the paper, the NN model and the way in which it can be used to predict the behavior of the CSTR process over a certain prediction horizon are described, and some comments about the optimization procedure are made. Predictive control algorithm is applied to control the concentration in a continuous stirred tank reactor (CSTR), whose parameters are optimally determined by solving quadratic performance index using the optimization algorithm. An efficient control of the product concentration in cstr can be achieved only through accurate model. Here an attempt is made to alleviate the modeling difficulties using Artificial Intelligent technique such as Neural Network. Simulation results demonstrate the feasibility and effectiveness of the NNMPC technique.

Keywords-Continuous Stirred Tank Reactor; Neural Network based Predictive Control; Nonlinear Auto Regressive with eXogenous signal.



One of the main aims in industry is to reduce operating costs. This implies improvements in the final product quality, as well as making better use of the energy resources. Advanced control systems are in fact designed to cope with these requirements. Model based predictive control (MBPC) [1,2] is now widely used in industry and a large number of implementation algorithms due to its ability to handle difficult control problems which involve multivariable process interactions, constraints in the system variables, time delays, etc. The most important advantage of the MPC technology comes from the process model itself, which allows the controller to deal with an exact replica of the real process dynamics, implying a much better control quality. The inclusion of the constraints is the feature that most clearly distinguishes MPC from other process control techniques, leading to a tighter control and a more reliable controller.

Another important characteristic, which contributes to the success of the MPC technique, is that the MPC algorithms


consider plant behavior over a future horizon in time. Thus, the effects of both feedforward and feedback disturbances can be anticipated and eliminated, fact which permits the controller to drive the process output more closely to the reference trajectory. The classical MBPC algorithms use linear models of the process to predict the output of the process over a certain horizon, and to evaluate a future sequence of control signals in order to minimize a certain cost function that takes account of the future output prediction errors over a reference trajectory, as well as control efforts. Although industrial processes especially continuous and batch processes in chemical and petrochemical plants usually contain complex nonlinearities, most of the MPC algorithms are based on a linear model of the process and such predictive control algorithms may not give rise to satisfactory control performance [3, 4]. Linear models such as step response and impulse response models are preferred, because they can be identified in a straightforward manner from process test data. In addition, the goal for most of the applications is to maintain the system at a desired steady state, rather than moving rapidly between different operating points, so a precisely identified linear model is sufficiently accurate in the neighborhood of a single operating point. As linear models are reliable from this point of view, they will provide most of the benefits with MPC technology. Even so, if the process is highly nonlinear and subject to large frequent disturbances; a nonlinear model will be necessary to describe the behavior of the process. Also in servo control problems where the operating point is frequently changing, a nonlinear model of the plant is indispensable. In situations like the ones mentioned above, the task of obtaining a high-fidelity model is more difficult to build for nonlinear processes.

In recent years, the use of neural networks for nonlinear system identification has proved to be extremely successful [5- 9]. The aim of this paper is to develop a nonlinear control technique to provide high-quality control in the presence of nonlinearities, as well as a better understanding of the design process when using these emerging technologies, i.e., neural network control algorithm. The combination of neural networks and model-based predictive control seems to be a good choice to achieve good performance in the control. In this paper, we will use an optimization algorithm to minimize the ISSN 1947-5500

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 10, No. 7, July 2012

cost function and obtain the control input. The paper analyses a neural network based nonlinear predictive controller for a Continuous Stirred Tank Reactor (CSTR), which is a highly nonlinear process. The procedure is based on construction of a neural model for the process and the proper use of that in the optimization process.

This paper begins with an introduction about the predictive control and then the description of the nonlinear predictive control and the way in which it is implemented. The neural model and the way in which it can be used to predict the behavior of the CSTR process over a certain prediction horizon are described, and some comments about the optimization procedure are made. Afterwards, the control aims, the steps in the design of the control system, and some simulation results are discussed.


The predictive controller, in summary, is characterized by computing future control actions based on output values predicted by a model, with vast literature and academic and industrial interest (Clarke, 1987; Garcia et all, 1989; Arnaldo, 1998) [4]. This section presents the concepts of predictive control based on NPC, using the usual optimization functions and control laws, applied to the conventional predictive controllers.

A. Optimization functions The optimization function, usually represented by the index J, represents the function that the control action tries to minimize. In an intuitive way, the error between the plant output and the desired value is the simplest example of an optimization function, and it is expressed by:

example of an optimization function, and it is expressed by: (1) Where: y ( k )



y(k) represent the plant output

y k ref ( )represent the desired response e(k) represent the estimation error

k is the sample time

One of the most usual optimization functions is based on the square error and it is represented as:


But the optimization index can take forms of more complex functions. For predictive controllers, whose models are capable to predict N steps ahead, the simple application of the square error approach can present satisfactory results. This case admits that the optimization function is not limited to an only point, but an entire vector of N predicted errors. It seeks to optimize the whole trajectory of the future control actions in a horizon of N steps ahead.

the future control actions in a horizon of N steps ahead. (3) More complex optimization functions
the future control actions in a horizon of N steps ahead. (3) More complex optimization functions


More complex optimization functions can consider the control effort. It is the specific case of GPC (Generalized Predictive Control), where the optimization index J can be expressed as:

where the optimization index J can be expressed as: (4) where: y ( k ) -



y(k ) - is the output plant estimation at instant = k Δu - is the control action increment. N1 - is the minimum horizon of prediction. NU - is the control horizon. NY - is the maximum horizon of prediction.

The objective of the control problem is to minimize the index J, with respect to the control actions, looking for the points where the first order differential is null.


By the knowledge of the identified neural model of the nonlinear plant which is capable of doing multi step ahead predictions, Predictive control algorithm is applied to control nonlinear process. The idea of predictive control is to minimize cost function, J at each sampling point:

JtUk( ,

( )) =






rk( +i) yˆ (k+i)






ρ Δuk( +−i 1)





With respect to the N u future controls,





= uk



and subject to constraints:








uk +−N


1)] T



Using the predictive control strategy with identified NARX model (NNMPC) it is possible to calculate the optimal control sequence for nonlinear plant. Here, term r(k+i) is the required reference plant output, yˆ (k+i) is predicted NN model output, Δuk( + i 1) is the control increment, N 1 and N 2 are the minimum and maximum prediction (or cost) horizons, Nu is the control horizon, and ρ is the control penalty factor[4]. The predictive control approach is also termed as a receding horizon strategy, as it solves the above-defined optimization problem [5] for a finite future, at a current time and implements the first optimal control input as the current control input. The vector u = [Δu(k),Δu(k+1),…Δu(k + Nu-1)] is calculated by minimizing cost function, J at each sample k for selected values of the control parameters {N 1 , N 2 , Nu, ρ}.

39 ISSN 1947-5500

Th ese control

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 10, No. 7, July 2012

parameters de fines the pr edictive cont rol

The purpos e of our neur al network m odel is to do

per formance. N 1 i s usually set t o a value 1 th at
per formance. N 1 i s usually set t o a value 1 th at is equal to
tim e delay, and N 2 is set to defin e the predictio n horizon i.e.
time s eries predictio n of the plant
output. Give n a series of
signals u% an d past data
it is desired t o predict the
nu mber of time-s teps in the futu re for which t he plant respo nse
is r ecursively pre dicted.
plant o utput series y N .The network
is trained to
do one step
ahead prediction[9],
i.e. to predict the plant outp ut y t+1 given
the cur rent control s ignal u t and p lant output
. The neural
networ k will implem ent the functio n
y ˆ
u ,
t + 1
As it
is discussed
y t
inform ation for this p rediction to be
has to conta in sufficient
possible.It is assumed that
Figure 1: NNM PC principle app lied to CSTR c hemical process
y t is m ultivariable. O ne problem is that this meth od will cause

J in NNMPCi s an optimizati on

pro blem minimi zed iterative ly. Similar t o NN traini ng stra tegies, iterati ve search met hods are appl ied to determ ine

Th e minimization

of criterion,

the minimum.

specif ies

(i) is the sea rch direction a nd

size. Variou s types of a lgorithms ex ist,

cha racterized by the way in w hich search d irection and s tep

Newton bas ed

Le venberg–Marq uardt (LM) a lgorithm is im plemented. T he

sea rch direction a pplied in LM algorithm is:

the current iterate










( )









(number ‘i’),


wher e,




siz e are selecte d. In the p resent work


(H [U (t)] +λ I)d





= -G[U (t)]


with Gradien t vector and H essian matrix as:


G[U (t)] =

= −










(t)]E(t)+2 ρ
















J(t, U(t)) |


H[ U (t)] =


U(t )




Ut ()




Y(t) E(t)


() t



U %




U %

( t ) ( )



t )



Ut =U






Ut =U










inverse Hess ian


con trol inputs. T he most popul ar formula kn own as Broyd en-

Fle tcher-Goldfarb -Shanno (BF GS) algorithm

the inverse Hessi an is used he re[8]. The pro posed scheme im plementing the NNMPC is sh own in Figure 2.


wh ere B (i) specifi es the approx imation of the


G[U (i) (t)] is

the gradient

of the J wit h respect to

to approxim ate

Tim e Series Pred iction with Ne ural Networks



rapid ly increasing

divergence due

to accumulat ion of errors.


there fore puts high demands on

accuracy of th e model. The

better t he model mat ches the actu al plant the le ss significant

the acc umulated erro r. A sampling time as large

to reduce th e error accum ulation as it

for a given

time h orizon. The ne ural network t rained to do o ne step ahead

effectiv ely reduces t he number of

an effe ctive method

as possible is

steps needed

predict ion will mode l the plant. Th e acquisition

is also referred to as

System Identif ication.

of this model





The thr ee steps invol ved in the AN N model devel opment are

A. Ge neration of Inp ut-Output dat a

The da ta generated t o train the net work should c ontain all the


input w as given to t he convention al model of th e CSTR and

relevan t information

about the dy namics of the

from t he conventio nal model, th e input and

output were

sample d for 0.02 sa mpling instant s and the requ ired sampled

data ar e obtained to t rain the netwo rk.

ired sampled data ar e obtained to t r ain the netwo rk. Figur e 2:

Figure 2: Input-Outp ut Sequence

B. Ne ural Network A rchitecture

The fe ed forward ne twork with sig moidal activa tion function

was ch osen based o n the trials w ith different multila yer perceptron .

structures of ISSN 1947-5500

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 10, No. 7, July 2012

Science and Information Security, Vol. 10, No. 7, July 2012 Fig ure 3: ANN m o

Fig ure 3: ANN m odel of the CS TR

7 neurons in the hidden lay er. architecture of ANN. The A NN


neu rons in the hi dden layer and one neuron in the output lay er.

sel ected here co nsists of 4 n eurons in th e input layer,

Th e lowest error corresponds to He nce it is select ed as optimal

Th e ANN archit ecture used in the present w ork is shown


Fig ure 3. The trai ning algorithm

used in the C STR modeling


bac k propagatio n algorithm.

Before train ing the proc ess

we ights are initia lized to small random numb ers. The weig hts

all training se ts.

Wh en the error fo r the entire se t is acceptably low, the traini ng is s topped.

error gets m inimized for


adjusted till

Ta ble 2 shows t he parameters mo del for the CS TR

used in deve loping the A NN

Parame ters

Va lues

Input ne urons



Output N eurons



Hidden layer



Neuro ns


No. of hidd en layer



Activation function

Sig moidal

Training al gorithm

Levenber g-Marquardt

Iterati on



Archite cture

Feed forward

Initial w eights



Table 2: ANN Parameters f or CSTR mode ling

C. Model Valida tion

Th e final step in

mo del [11]. Vali dation is perfo rmed by eval uating the mo del

per formance usin g trained dat a and test dat a. The input a nd

network and t he network w as

tar get were pres ented to the

developing t he model is


validation of

trai ned using Lev enberg-Marqu ardt algorithm .

Va lidation tests on training s et:

ardt algorithm . Va lidation tests on training s et: Fi gure 4: (a) On e

Fi gure 4: (a) On e step ahead p rediction of m odel, (b) Predi ction error bet ween model o utput and pred icted output

Val idation tests o n test set:

and pred i cted outpu t Val idation tests o n test set: Figur e 5

Figur e 5 :(a) one st ep ahead predi ction of model (validation

set), ( b) Prediction e rror between

model output a nd predicted

o utput (validati on set)




Figure 6.This CSTR



Stirred Tank

Reactor [6]

is shown in

model in used as the nonlinea r system.

The i mage part with relationship ID rId50 was not found in the file.

The i mage part with relationship ID rId50 was not found in the file.

Figure 6: C ontinuous Stir red Tank Reac tor


equations w hich shows t he dynamic

system is

model of the

41 ISSN 1947-5500

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 10, No. 7, July 2012

Science and Information Security, Vol. 10, No. 7, July 2012 (14) (15) prod uct con centration


and Information Security, Vol. 10, No. 7, July 2012 (14) (15) prod uct con centration at


prod uct

con centration at t he output of th e process, w 1 ( t) is the flow r ate

of the concentrat ed feed C b1 an d w 2 (t) is the

dil uted feed C b2


flow rate of the

.The input co ncentration ar e set to C b1 =2 4.9


C b2 =







C b (t)




0.1.T he



w ith



con sumption are


1 =k 2 =1.

The objective

of the contro ller is to mai ntain the prod uct

con centration by adjusting the f ow w 1 (t), w 2 (t) =0.1.The le vel

The designed controller use s a

neu ral network

of the tank h is n ot controlled.


pot ential control signals. The tr aining data we re obtained fr om

the nonlinear mod el of CSTR.

model to pred ict future CS TR responses




govern theCS TR

dy namics to forc e the system c oncentration t o track a cert ain

set -points. In this system, the in put is the cool ant flow rate a nd


ide ntifier is train ed and initial ized before th e control acti on

sta rts. The input vector of the i dentifier inclu des coolant fl ow

rat es at different t ime steps (the sampling time

Th e performance of the propose d controller is shown in Fig ure

7. Evidently, the concentration values of the plant could tra ck

the set-point valu es excellent. I t is to be note d that to impro ve

larger predicti on

tim e. It is rem arkable to n ote that bec ause of hig hly

no nlinearity natu re of CSTR p rocess, using the conventio nal

con trol technique

see n in figure 7 t hat controller output is track ing the referen ce sig nal.


output is th e concentrati on of the pr ocess [12]. T he

Th e objective of

the control s trategy is to

is 20sec).

transient resp onse, one ma y consider a

could not re ach the contro l task. It can be

y consider a could not re ach the contro l task. It can be Figure 8:
y consider a could not re ach the contro l task. It can be Figure 8:

Figure 8:

control signal by the controll er



p aper

modelin g



has been

implem ented using


neu ral


The neural

model has been train ed using data set obtained f rom dynamic equatio ns. Feed for ward neural n etwork has b een used to


the CSTR. T he neural mod el has been d esigned as a


box model. T he simulation

results from


model and the neural model were c ompared for th e given input

variatio ns and the re sults have be en found sati sfactory. The simula tion shows tha t implementat ion of the Ne ural Network based a dvanced contr ollers for the s et-point tracki ng case were

able to

target values

smooth ly and within reasonable rise

force proces s output varia bles to their

and settling t imes.





some new res ults,Industrial

Engine ering Chemica l Process ”. D ev. 21, 308--3 23.

L.G. Lightb ody and G. W . Irwin, “Neu ral networks

“in Proc. I FAC Symp.

Algorit hms Architec tures Real-Ti me Control, B angor, U.K. pp. 1–1 3, 1992.



Autom atica, Vol.23, no.2, pp: 137 - 148, 1987.


control : past, presen t and future, Engine ering, 23, 667 -682.


control based on Ham merstein mod els”, in. Proc. International

Sympo sium on Proce ss System Eng ineering, Seo ul, Korea, pp. 995–10 00, 1994.


reactor” Proc eedings 23rd

Europe an Conferenc e on Modellin g and Simulat ion ©ECMS

Javier Otamendi, An drzej Bargiela, 2006.


A. Mel lichamp, “An adaptive nonli near predictiv e controller,” in Pro c. Amer. C ontrol Confer ence., vol. 2 ,,pp. 1614– 1619,1 990.


deviate d power of a n identified N NARX mode l of a hydro

“Nonlinear p redictive con trol to track

Vasičkanino va and M. B akošova, “Ne ural network

predict ive control o f a chemical

X. Zhu, D. E. Seborg, “N onlinear mod el predictive

D. W. Cl arke, C. Mo htadi and P . S. Tuffs,

“Gener alized Predic tive Control

for no nlinear adap tive control,

Garcia C. E . and Morari , M. 1982. In ternal model

control -I. “A unifyin g review and



Morari, M.

and Lee, J.

H. 1999. Mod el predictive Computers a nd Chemical

J. D. Morni ngred, B. E. P aden, D. E. Se borg, and D.



Fig ure 7: Respon se graph with and without co ntroller


Expert Syst ems with Ap plications 35,




Tan, Y. and Cauwenbergh e, A. “Non-li near one step


control using

neural netw orks: control

strategy and

42 ISSN 1947-5500

(IJCSIS) International Journal of Computer Science and Information Security, Vol. 10, No. 7, July 2012

stability design”, Automatica, vol 32, no. 12, 1701-1706,


[10] Dan, W.P., 1996. Artificial Neural Networks- Theory and Applications. Prentice Hall, Upper Saddle River, New Jersey, USA. [11] S.A.Billings, and W.S.F. Voon, “Correlation based model validity tests for nonlinear models. International Journal of Control, 44, 235–244.1986.


Author is presently working as Assistant Professor in Electrical and Electronics Department of Takshshila Institute of Engineering and Technology. He received the Masters degree in Electrical Engineering with specialization in Control Systems Engineering from Jabalpur Engineering College. His area of specialization is in Neural Networks, Control Systems, Fuzzy Logic.

43 ISSN 1947-5500