Combining First Principles Models and Neural Networks for Generic Model Control Janos Abonyi, Janos Madar and Ferenc Szeifert University of Veszprém, Department of Process Engineering, H-8201, Veszprém, P.O.Box 158, Hungary, www.fmt.vein.hu/softcomp,
[email protected]
$EVWUDFW
Generic Model Control (GMC) is a control algorithm capable of using non-linear process model directly. In GMC, mostly, first-principles models derived from dynamic mass, energy and momentum balances are used. When the process is not perfectly known, the unknown parts of first principles models can be represented by black-box models, e.g. by neural networks. This paper is devoted to the application of such hybrid models in GMC. It is shown that the first principles part of the hybrid model determines the dominant structure of the controller, while the black-box elements are used as state and/or disturbance estimators. The sensitivity approach is used for the identification of the neural network elements of the control-relevant hybrid model. The underlying framework is illustrated by the temperature control of a continuous stirred tank reactor (CSTR) where a neural network is used to model the heat released by an exothermic chemical reaction.
1 Introduction The need for improved process control has become evident in recent years. Since 1987, there has been growing interest in the use of Generic Model Control (GMC), which has been shown to have certainrobustness for a wide range of process nonlinearity against process/model mismatches [1]. In a case study, Lee and Newel have demonstrated that the performance of GMC is superior over both PI control and Dynamic Matrix Control strategies for a forced evaporator [2]. To make GMC more practical to be applied intoprocess industry, strategies to handle constraints [3],deadtime, and time-varying systems have been workedout. GMC incorporates a nonlinear state-space model of the process directly within the control algorithm. Therefore, it has advantages over other model-based controllers in [4]: • • • •
Models derived from dynamic mass, energy and momentum balances can be directly used in the controller. Nonlinear, multivariable, time-dependent models comprise the dominant structure of the controller. Controller tuning is straightforward and easy to understand.
•
The control is satisfactory, even in the presence of mild process/model mismatch and the techniques for the analysis of the stability of controllers are available.
In any model based controller, including GMC, the control performance depends on the accuracy of the available model. The usage of the nonlinear statespace model requires the measurement of all state-variables and the availability of a detailed first principles model that is based on mass and energy balances of the controlled process. Hence, the critical step of the design of GMC is the development of a suitable control-relevant model. This difficulty stems from a lack of prior information about the process to be controlled due to the complexity of the system. To solve this modeling problem, there is a tendency to blend information of different nature. The semi-mechanistic, also called hybrid modeling approach is based on a first principles model and includes black-box elements, like neural networks to represent the unknown, otherwise difficult-to-obtain parameters [5,6]. The aim of this paper is to analyze how these hybrid models can be incorporated into the GMC scheme. The key issues of the proposed approach are the following. The design of the controller structure should be based on the first principles model, while the black-box elements of the hybrid model are used as state and/or disturbance estimators. In this case, the utilized hybrid model can be considered as state-space version of Feedback-Block-Oriented NARMAX Models [7] that are special type of gray-box models, where the prior knowledge enters to the black-box model. Thus, this paper is a good example of the small difference between semi-empirical and grey box models because both modeling approaches utilizes DSULRUL and data-based information. To train the neural network part of the hybrid model, input/output process data should be used. Contrary to other works [5] it is not assumed that data directly related to the unmodeled parts (parameters and states) of the system are available. In such problematic cases extended Kalman filter can be used [6], or for slowly varying processes spline smoothing techniques can be applied to estimate the unknown effects. In [6] a sensitivity based training approach has been presented that outperforms the above mentioned methods, especially when only partial state measurements are available. Hence, in this paper this sensitivity approach is applied for the identification of the neural network in hybrid models used in GMC. The underlying framework is illustrated by the temperature control of a continuous stirred tank reactor (CSTR) where a neural network is used to model the heat released by an exothermic chemical reaction. The paper is organized as follows. In Section 2 the GMC algorithm is presented. Section 3 shows how neural network elements can be incorporated into this model based control algorithm. The identification of the resulted control relevant model is discussed in Section 4. Section 5 presents an application example, where the proposed approach is applied to the temperature control of a CSTR. Finally, some conclusions are drawn in Section 6.
2 Generic Model Control Consider a process described by the following equations: = I ([, X, G ) [
=
\
(1)
()
J [
where [ is the state vector of dimension P, X is the input vector of dimension Q, G is the disturbance vector of dimension O, \ is the output vector of dimension Q. In general, I and J are nonlinear functions. In this paper, we assume the relative order, the number of integral states between process input and process output, of the system respect to each input is one. Essentially, this means that the input vector X must have direct effect to the first derivative of the model outputs. It follows from this and from equation (1) that GJ ([ ) ∂J ∂J (2) = = \ = [ I ([, X, G ) GW ∂[ ∂[ If the desired value (setpoint) of the outputs is \ , then we desire the rate of change \ to be proportional to the derivation of the output from the setpoint. Thus, the desired closed-loop trajectory is:
( )* = \
N
(
\
)
−\ +N
∫(
\
)
− \ GW
(3)
0
where
N
and
N
are the tuning parameters of the controller.
For the process defined by equation (1) to follow the reference trajectory of equation (3) we equate (2) and (3), giving: ∂J I ([, X, G ) = N \ − \ +N ∫0 \ − \ GW ∂[ (4)
(
)
(
)
The above equation is solved for X, usually by some numerical nonlinear equation solving routines, but in some cases the solution is analytical. Because there are large amount of chemical processes that can be modeled with models having relative degree one, GMC is widely applied in chemical process control. In the following section the control-relevant identification and application of these models will be discussed, especially from the semi-mechanistic modeling point of view.
3 Hybrid Model based GMC
3.1 Semi-Mechanistic Models
Generally, white box models of chemical processes are based on macroscopic balances, for instance, mass or energy balances. These balances are formulated based on conservation principle that leads to differential equations written as accumulation of [ within the system = time period
flow of [ into the system time period
amount of [ generated within the system − time period
where
[
flow of [ out of the system + − time period
amount of [ consumed within the system time period
(5)
is a certain quantity, for example mass or energy.
In general, not all of the terms in equation (5) are exactly or even partially known. In semi-mechanistic models black-box models are used to represent the otherwise difficult-to-model parts of the model. The resulting semi-mechanistic, also called hybrid model can be formulated similarly to equation (1) = I ([, X, G, I ([, X, G )) [ (6) \ = J ([ ) where I ([, X, G ) represents the first-principles and the black-box (neural network) parts of the model [5,6].
I
(,
,
[ X G
)
represents
The reaction rates (the amount of generated and consumed materials in chemical reactions) and the thermal effects (e.g. reaction heat) are especially difficult to model. However, the first two transport terms in equation (5) (inlet and outlet flows) can be obtained more easily and accurately. Hence, in the modeling phase it turns out which parts of this model structure are easier and which are more laborious to obtain and usually we get the following model structure
=
[ \
=
(, ()
I
J [
,
[ X G
)+
I
() [
(7)
3.2 Relation to Feedback-Block-Oriented Modeling
The model structure defined by equation (7) is identical to the serial approach of a hybrid modeling (Fig. 1.) [5] and shows some similarities to Feedback-BlockOriented Modeling [7].
)LJ
General scheme of feedback-block-oriented semi-mechanistic (hybrid) models
3.3 GMC based on Hybrid Models
As the white-box part of the model comprise the dominant structure of the controller, the proposed hybrid model can be incorporated into the GMC in a straightforward manner. As Fig. 2. shows, the obtained control scheme is similar to indirect measurement based control.
Whitebox Z
X
*0& ]
3URFHVV
\
[
1HXUDO QHWZRUN
Blackbox )LJ
Application of a semi-mechanistic model in GMC
The control law of the semi-mechanistic model based GMC controller can be formulated based on equation (4) and (7) ( ∂J ∂J N # \! − \ + N " ∫0 \ ! − \ GW − ∂[ I &'& ([) = ∂[ I $% ([, X, G) (8)
(
)
(
)
This equation can be solved for X, by inverting the first-principles model:
X
∂J = ∂[
I
−1 ∂J ( ) ( ) ( ) I [ , [, G N \ − \ + N ∫ \ − \ GW − ∂ [ 0 * \
(9)
It should be noted, as the neural network is used to represent inherent effects related to the state of the system, there is no need for the computational demanding inversion of the neural network. This is because the application of the neural network can be simply considered as the modification of the reference trajectory of the GMC with the estimated effects of the inherent, difficult-to-model nonlinear “disturbances” which do not related to the inputs.
4 Identification Based on Sensitivity Approach To train the neural network part of the combined process model, pairs of input/output data vectors can be used. The training of the model ∂J (10) = ([, X, G, I ([, )) \ I ∂[ requires that the weights
are determined in such a way that the sum of the
∑
1 squared deviations, 9 = (\ (W ) − \(W ) )2 , between the output of the hybrid 2 1 =1 model and the corresponding training data becomes minimal. The usual way to minimize 9 is to use gradient procedures, like the GaussNewton algorithm. Weights in the L-th step of this iterative process are changed in the direction of gradient. +1 = − µ5 − 19 ’ (11)
+1
=
1 − K ([ 1 =1
∑
) ( K
[
)
−1
1 − (\W − \W )K([ 1 =1
∑
)
The neural network’s output does not appear explicitly in the above expression. Direct training data can be obtained from well-designed kinetic experiments. If such experiments are not available, extended Kalman filter [6] or for slowly varying processes spline smoothing techniques can be utilized to train the model. In [6] the application of the sensitivity based approach has been suggested, where it is considered that the output of the neural network model is constant in each sampling instant. This method has outperformed extended Kalman filters in estimating the unobserved process parameters, especially when only partial state
measurements are available. Hence, in this paper the sensitivity approach is applied to estimate the parameters of the model. Hence, the gradient of the structured model’s output with respect to the internal parameter can be calculated throughout integration of the sensitivity equations.
( , )= ∂
\ W
K [
()
∂
=
∂\ (W ) ∂I ([,
= )
∂[(W ) ∂I ([, GW
∂I = )
G
(, ) [
G
(,
(12)
∂
∂J ([(W )) ∂I ([, ) = GW
∂\ (W ) ∂I ([, GW G
)
∂I
, , I ∂[(W )
[ X G
∂J ∂[(W ) ∂[ ∂I ([, GW
( , )) [
)
G
∂[(W ) ∂I ([,
)
+
∂ ( I
(,
, , I ([, ∂I ([, )
[ X G
)))
The general procedure of the application of the proposed approach is the following. Set up of the global balance equations, ∂I
1.
(,
,
[ X G
).
Choosing the structure of the neural network, I ([, ) . Establishing the sensitivity equations, see equation (12). Integrating the sensitivity equations and determining ∂\ (W ) / ∂I ([, ) Making use of equation (11) the same way as with classical neural network for pattern or batch learning.
2. 3. 4. 5.
5 Application to Temperature Control of a CSTR
5.1 Process Description
The previously proposed control scheme is applied to the temperature control of an exothermic CSTR that can be modeled by the following dimensionless equations [8,9]: G[
1
GW G[
2
GW G[
3
GW
\
=
= −φκ ([ 2 )[1 + T ([1 − [1 )
(13)
= βφκ ([ 2 )[1 + T ([ 2 − [ 2 )+ δ ([ 3 − [ 2 )
(14)
δ δ 1δ 2
(15)
= [
2
X
δ1
(
[
3
− [ 3 )+
(
[
2
− [3 )
(16)
where X represents the flow-rate of the cooling material, and [ , [ and [ denote the dimensionless concentration, reactor and jacket temperature, respectively. The parameters of the model can be found in [8,10]. 5.2 Hybrid Process Model
The application of the GMC controller based on the first-principles model requires the measurement of the [1 concentration in the reactor and a correct model for estimation of the generated heat, [2 4 = βφκ ([ )[ = βφ exp 2 1 1 + [ / γ [1 . 2 To avoid these assumptions which restrict the application of GMC, hybrid controlrelevant modelling of the process is considered where a neural network models the heat released by the reaction: 4 = I ([2 (W ), [2 (W − ∆W ), [2 (W − 2∆W )) G[
2
GW G[
3
GW
\
=
= I = [
X
δ1
( 2 ( ), 2 ( [
(
[
3
W
[
W
− [ 3 )+
− ∆W ), [ 2 (W − 2∆W )) + T ([ 2 − [ 2 )+ δ ([3 − [ 2 )
(17)
δ δ 1δ 2
(18)
(
[
2
− [3 )
(19)
2
The proposed approach is based on only knowledge connected to the equipment (stirred tank), while the reaction and the heat generated by the reaction are modelled with the use of a neural network. The neural network was trained by an input sequence, similar shown in Fig. 3. For the evaluation of the performance of the models a validation data were used as it is shown in Fig. 3. The network build up ten neurones placed in three layers (6,3,1). As Fig. 3 shows, the model gives perfect prediction of the temperature of the reactor. 8
y , y, ym
6
*
4 2
0
0
20
40
60
80
100
120
140
80
100
120
140
Time
10
x3, u
8 6 4 2 0 0
20
40
60 Time
)LJEvaluation of the performance of hybrid model. The solid line is the system’s output, the dotted line is the prediction of the model (on top).
The good prediction performance is also reflected by the perfect estimation of the steady-state characteristic of the process (see Fig. 4).
8 7
Qrs (heat of reaction)
6 5 4 3 2 1 0 0
1
2
3 x 2s (reactor temp.)
4
5
6
6
x 2s (reactor temp.)
5
4
3
2
1
0 -1
-0.5
0
0.5
1 x 3s (jacket temp.)
1.5
2
2.5
3
Prediction of the steady-state behavior of the process.
)LJ
5.3 Control Scheme
For the temperature control of the chemical reactors, it is advantageous to use cascade-control scheme, where the slave-controller is responsible for the control the jacket temperature based on the set-point given by the master controller as it is shown in Fig. 5.
\
First-P. Model
PI(\
\
)
[
Slave GMC
X
[
4
Reactor [ [
[
Neural Network
\
\
-1
z z-1
Hybrid model
Master GMC
Closed-loop structure of CSTR with cascade control
)LJ
The slave controller is also a GMC controller, whose desired closed-loop trajectory is given by equation (3):
( 3 )* = [
N
1
(
* [ 3
− [3 ) + N 2
∫( 0
[
* 3
− [ 3 ) Gτ
(20)
With the use of (18) the control input can be analytically expressed by:
= ( )* − δ ( − ) δ 1 2 3 3 ( 3 − δ 1δ 2
3
(21)
)
The input of this controller is the desired jacket temperature,
[
* 3
given by the
master controller (see Fig. 5). Similarly to equation (20) and (21), the control rule of the master GMC controller is
= ( 3
) * − ( 2 ( ), 2 ( − 1), 2 ( − 2))− 2 ( )*
where ( )* = 1 (
*
− )+
1 − 2 2
(22)
* − ) 2 ∫( 0
The results were compared to the case when the concentration was measured and the control relevant model was perfect (Fig. 6a, 6b) 8
y *, y, y m
6 4 2 0
0
10
20
30
40
50
60
70
40
50
60
70
Time
10
x 3, u
8 6 4 2 0 0
10
20
30 Time
Control performance of the GMC based on the hybrid model
)LJD
7 6
y *, y, y m
5 4 3 2 1 0
0
10
20
30
40
50
60
70
40
50
60
70
Time
10 8
x 3, u
6 4 2 0 0
10
20
30 Time
Control performance of the GMC based on perfect process model
)LJE
The small difference between the application of hybrid and perfect models suggests that the proposed hybrid modelling approach enables the use the GMC control strategy in cases when some of the state variables cannot be measured and the full first-principles model of the controlled process cannot be obtained.
6 Conclusions A new method to identify control-relevant models for generic model control has been presented. The proposed approach is based on the combination of blackand white-box elements, where the black-box part of the model is represented by a neural network. For demonstration, the model based control of an exothermic continuos stirred tank reactor is presented. Its is shown that the proposed hybrid modeling approach enables the use GMC in cases when only some of the state variables are measured and the full first-principle model of the controlled process cannot be obtained.
Acknowledgements The financial support of the Hungarian Ministry of Culture and Education (FKFP-0073/2001) and the Janos Bolyai Research Fellowship of the Hungarian Academy of Science is greatly appreciated.
References 1.
Lee P.L., Sullivian G. R., “Generic Model Control (GMC)”, Comput. Chem. Engng.,vol.12 no.6, pp.573-580, (1987) 2. Lee P. L., Newell R.B., Generic model control - a case study, Canad. J. Chem. Engng., 67, 478-483,1989 3. Xie X.Q., Zhou D.H,. Jin Y.H., A Novel Approach to Constrained Generic Model Control based on Quadratic Programming, Industrial & Engineering Chemistry Research,39, 4, 989-998, 2000 4. Signal P. D., Lee, P. L., “Robust stability and performance analysis of generic model control (GMC)”, Chem. Eng. Comm.vol.124, pp.57-76, (1993) 5. Dimitris C. P., Ungar L. H., “A hybrid neural network-first-principles approach to process modelling”, AIChE Journal,vol.38 no.10, pp. 1499-1511, (1992) 6. Thompson M. L., Kramer M. A., “Model chemical processes using priori knowledge and neural networks” AIChE Journal,vol.40 no.8, pp. 1328-1340, (1994) 7. Pottman M., Pearson R.K., Block--Oriented NARMAX Models with Output Multiplicities, AIChE Journal, 44, 131-140, 1998 8. Bequette B. W., Sistu P. B., “Nonlinear predictive control of uncertain processes: application to CSTR”, AIChE Journal,vol.37 no.11, pp. 1711-1723, (1991) 9. Cho W., Lee J., Edgar T. F., “Control system design based on a nonlinear first-order plus time delay model”, J. Proc. Vont., vol.7 no.1, pp. 65-73, (1997) 10. Hernandez E., Arkun Y., “Study of the control-relevant propeties of backpropagation neural network models of nonlinear dynamical systems”, Comput. chem. Engng.,vol.16 no.4, pp. 227-240, (1992)