An Extended Kalman Filter Formulation for Systematic Transfer of

DuPont Nylon, Chattanooga, Tennessee 37415. Ind. Eng. Chem. Res. , 2003, 42 (8), pp 1753–1760. DOI: 10.1021/ie0204181. Publication Date (Web): March...
0 downloads 0 Views 167KB Size
Ind. Eng. Chem. Res. 2003, 42, 1753-1760

1753

An Extended Kalman Filter Formulation for Systematic Transfer of Information from Batch to Batch Andrew W. Dorsey Purdue University School of Chemical Engineering, West Lafayette, Indiana 47907-1283

Jay H. Lee* Georgia Institute of Technology School of Chemical Engineering, Atlanta, Georgia 30332-0100

Stephen A. Russell DuPont Nylon, Chattanooga, Tennessee 37415

In this paper, a modified extended Kalman filter (EKF) formulation is developed that allows for a systematic batch-to-batch transfer of the parameter estimates and covariance information. A simple and tunable stochastic description for the batch-to-batch behavior of the model parameters and initial conditions is proposed. Then, a method for incorporating such a model into a general ODE model describing the batch process is presented. An extended Kalman filter formulated based on this augmented model is capable of systematically transferring the parameter estimates and the covariance information at the end of a batch run to initialize the filter for the next batch. This provides an advantage over traditional EKF formulations, which can suffer due to insufficient measurements imposed by the finite batch duration. A simple tuning parameter is introduced in the stochastic parameter model that weighs the relative importance of the variance components for the batchwise-correlated and independent portions. This would allow the filter performance to be tuned to the particular situation at hand. An application to a simple chemical reactor and a nylon 6,6 autoclave is discussed to demonstrate the usage and the benefits of the proposed formulation. 1. Introduction Given the highly nonlinear nature of batch processes, the use of fundamental models has often been suggested for quality monitoring and control. The use of these models often requires the solution of a nonlinear state estimation problem. Although other alternatives exist,1-3 the extended Kalman filter (EKF) is considered to be the current standard.4 The EKF has been applied extensively in the literature to the batch quality estimation problem, for example, in refs 5-9; only a partial reference listing is given here, and more references can be found therein. The implementation of the EKF on a batch process requires that the mean and covariance of the initial state variables, in addition to the covariances of the state and measurement noises, be specified at the start of each batch. The usual absence of precise information regarding these statistics requires that they be viewed as tuning parameters that need to be adjusted to achieve adequate filter performance. Choosing these proper initialization parameters at the start of each batch is considered to be a difficult task, and the performance can suffer if they are not determined very carefully. Wilson et al. discuss this fact in a critical evaluation of the EKF applied to an industrial batch process.10 Trialand-error tuning remains a common practice of initializing the filter,11 although Valappil and Georgakis suggest a methodology to overcome trial-and-error tuning of the EKF.12,13 * To whom all correspondence should be addressed. Phone: (404)385-2148. Fax: (404)894-2866. E-mail: jay.lee@ che.gatech.edu.

The ability to estimate the model’s state/parameter values and initial conditions accurately is hindered by the fact that measurements relative to unknowns are scarce, especially early in each batch, which means that predictions cannot commonly be trusted until “enough” measurements have been taken. Even when there is minimal mismatch between the model and plant, this problem can arise because of the finite batch duration. This drawback limits the majority of model-based control approaches that are applied to batch processes to either take action in the latter phases of the batch or make only occasional off-line adjustments based on some statistical process control (SPC) chart.14,15 This fact also points to the added importance of filter initialization for batch processes, as an improper or careless initialization would require an unrealistic number of measurements before the estimates became good enough to be useful for corrective action. One important question that arises in the context of filter initialization is how to transfer the estimates and covariance information from the EKF of the previous batch. The most immediate option, which is implied in most papers discussing the use of EKFs in batch processes, is to reset the state estimate and error covariance matrix to some nominal values upon the start of the next batch. However, if the filter is reinitialized to the same settings at the start of each batch, information regarding estimation of key model parameters, initial conditions, and their associated statistics is essentially being thrown away. This issue has not received much scrutiny in the literature despite the fact that proper initialization of the model at the start of

10.1021/ie0204181 CCC: $25.00 © 2003 American Chemical Society Published on Web 03/20/2003

1754

Ind. Eng. Chem. Res., Vol. 42, No. 8, 2003

each batch has a critical bearing on the filter’s overall performance. A reasonable modification of the standard initialization procedure might seek to improve the performance by directly carrying over certain model parameter estimates within the filter for the next batch. Such a procedure would allow, for example, the estimates of constant model parameters to converge with repeated batch runs, thus alleviating the restrictions imposed by the limited number of measurements within a particular batch. A challenge, however, is how to carry this information from batch to batch in a manner commensurate with the particular level of batch-to-batch connectivity that exists. It is desirable that this transfer be carried out in some systematic manner based on a sound principle. This paper considers the development of a modified EKF in which batch-to-batch changes in particular parameters and initial conditions are modeled as the output of a simple stochastic difference equation. Model flexibility is retained by including a parameter that can be conveniently tuned to the particular degree of batch-to-batch correlation at hand. This augmented EKF form provides improved model convergence during batch-to-batch persistent upsets by carrying over key parameters and their statistics. This is a key development for the application of fundamental models to batch processes because the improved convergence within the batch would allow for control decisions to be taken in earlier phases of the batch. Batch-to-batch control decisions would also be improved based on the long-term benefit of improved convergence of the model parameters over several batch runs. The basic properties of the algorithm are illustrated using an isothermal batch reactor in which consecutive reactions occur. Subsequently, an industrially relevant nylon 6,6 example is used to highlight some of proposed benefits of the formulation by illustrating improved detection of changing initial conditions over several batch runs and an improved rate of state error convergence during the batch.

parameter throughout the paper. The parameter values, Θ, are not known precisely and can vary among batches; therefore, they must be estimated in order for the model to provide adequate performance. The most straightforward way to perform this estimation is to augment the parameters directly with the state variables so that they can both be estimated together. Because measurements of product quality are not available during the batch, the EKF formulations considered here are based on the output of the measurement model only. Note, however, that the required arguments of the quality model will be fully specified by the designed estimator to allow for quality predictions during the batch. The formulation of the conventional EKF formulation is presented first, and then the proposed modifications for improved reinitialization of the filter at the start of each batch are discussed. 2.1. Conventional Formulation. To estimate the parameters using the standard EKF formulation, one treats the parameter values as random variables with a priori statistics of Θ ∼ N(0,PΘ). Herein, for the sake of simplicity, it is assumed that these parameter values are constant within the batch, which gives

Θ(t+1) ) Θ(t)

(5)

although this assumption could easily be relaxed by adding appropriate noise terms to the above expression. The developments presented in this paper can be modified to treat this more complicated case, and the modifications needed will be apparent. Defining the augmented state vector as

X(t) )

[ ] x(t) Θ(t)

(6)

allows for the estimation of the parameter and state values based on observations within the batch through the EKF4

X ˆ (t+1|t) ) F(X ˆ (t|t),u(t))

2. Parameter Estimation for Batch Processes Using the Extended Kalman Filter

P(t+1|t) ) A(t)P(t|t)A(t)T +

Consider a particular class of batch systems that can be characterized by the following discrete nonlinear model

x(t+1) ) F(x(t),u(t),Θ) + w(t), w ∼ N(0,Qw) (1)

(7)

[ ] Qw 0 0 0

(8)

K(t+1) ) P(t+1|t)C(t+1)T[C(t+1)P(t+1|t)C(t+1)T + Rv]-1 (9)

y(t) ) g(x(t),Θ) + v(t), v ∼ N(0,Rv)

(2)

X ˆ (t+1|t+1) ) X ˆ (t+1|t) + K(t+1)[y(t+1) g(X ˆ (t+1|t))] (10)

q(tf) ) z(x(tf)) + ,  ∼ N(0,R)

(3)

P(t+1|t+1) ) [I - K(t+1)C(t+1)]P(t+1|t) (11)

x(0) ) f0(Θ) + e, e ∼ N(0,Re)

(4)

where t ) {0, ..., tf}, with tf specifying the total number of sample points within the batch. In the typical case, the underlying nonlinear model is a system of continuous nonlinear differential equations, and F denotes the operation of integrating the differential equations for one sample interval. Note that the chosen model representation includes two kinds of model outputs: one for the on-line measurements, y(t), and one for the end quality variables, q(tf). Θ represents a collection of uncertain model parameters as well as disturbance parameters that affect the initial state in some structured manner. Hence, the initial state is viewed as a

The linearized matrices A(t) and C(t+1) are given by

[

|

∂F A(t) ) ∂x 0

X ˆ (tt),u(t)

∂F ∂Θ I

|

X ˆ (tt),u(t)

]

(12)

and

C(t+1) )

[∂g∂x|

X ˆ (t+1|t)

∂g ∂Θ

|

X ˆ (t+1|t)

]

(13)

Throughout this paper, the argument (t+i|t) is used to indicate the fact that the estimate or the covariance is for the variable at time t + i, based on the measurements available up to time t.

Ind. Eng. Chem. Res., Vol. 42, No. 8, 2003 1755

The general form of the state error covariance matrix is given by

P)

[

Px Px,ΘT

Px,Θ PΘ

]

(14)

Here, Px is the error covariance for the state x, and Px,Θ is the covariance between the state and the parameters. A key to achieving adequate performance is to set the initial correlation between the parameter and state values appropriately. Typically, Px,Θ is set to 0, and Px and PΘ are “tuned” in some restricted form, such as a scalar times identity. However, ignoring the correlations can lead to unacceptably slow convergence, especially when the state dimension is high. Lee and Datta pointed to this fact in their application of the EKF to a batch pulp digester model.6 They proposed the use of a parametrized form of the initial state variation, such as that in eq 4, which can be built by considering how major sources of variations affect the initial state and model parameters. Then, using a linearization of eq 4, such as

ˆ (0|0)) + x(0) ≈ f0(Θ

( )| ∂f0 ∂Θ

Θ ˆ (0|0)

(Θ(0) - Θ ˆ (0|0)) + e (15)

the initial covariances can be calculated as

Px )

( | ) ( | ) ( | ) ∂f0 ∂Θ

Θ ˆ (0|0)

Px,Θ )



∂f0 ∂Θ

∂f0 ∂Θ

Θ ˆ (0|0)

Θ ˆ (0|0)



T

+ Re

(16)

(17)

where Re represents the unstructured part of the covariance, which is kept relatively small as major variations are assumed to be captured by the parametrized portion. Once P, Θ(0), and x(0) are given, EKF eqs 7-11 are run recursively throughout the batch based on incoming measurements y(t) for t ) {0, ..., tf}. At the start of the next batch, a choice is required in terms of how to reinitialize the filter. One such choice could carry over the parameter estimates directly and reset the covariance information to its nominal condition, another possibility could carry over both the covariance and parameter information directly, and a final option could reset all values to their predefined nominal conditions. The next section provides an explicit model for the batch-to-batch parameter changes that allows for a more systematic and rigorous initialization of the filter for the next batch. 2.2. Modified Representation of Parameter Changes. The filter development in the previous section was presented entirely in terms of time and without any stipulation of a particular batch index. The standard design shows how to proceed from the start of any batch, given initial conditions of x, Θ, and their statistics, to calculate some estimate of the “true” trajectory of the system based on incoming measurements y(t). Because the model representation involves only time, it is not obvious how to proceed once the next batch is initiated and a new measurement trajectory begins to evolve. Specifically, the above model does not tell us how to make the transition from batch to batch in terms of initializing the essential parameters that define the

filter model or initial conditions of the next batch and their associated statistics. Hence, we seek to incorporate into the model information on how model parameters behave from batch to batch so that the filter for the next batch can be initialized systematically on the basis of the model, rather than in some arbitrary manner. The following dynamic model of the parameter changes can be used as a more general characterization of the changes that would be present in a batch process

Θ ˜ k+1(0) ) Θ ˜ k(tf) + Wk, W ∼ N(0,φQW)

(18)

Θk(0) ) Θ ˜ k(0) + Vk, V ∼ N(0,(1 - φ)QW) (19) ˜ k(t) Θ ˜ k(t+1) ) Θ

(20)

Θk(t+1) ) Θk(t)

(21)

Here, the batch index is defined by k. Note that it is assumed that the parameter values are the outputs of a dynamic system with Θ ˜ being analogous to the concept of “state”, and thus Θ ˜ holds the batchwise-correlated portion of the parameter values. Hence, Θ consists of a batchwise-correlated portion and an independently varying portion, V. Note that Θ is shown as a constant within any batch k. This assumption could easily be relaxed in the formulation of the estimator by adding integrators to the appropriate parameters. The incorporation of this model into the estimator design introduces additional tuning parameters in terms of setting the covariance information for W and V. It is recommended that the tuning be simplified by choosing QW only and then setting a scalar multiplier to weight the expected parameter fluctuations in terms of correlated versus purely independent batch-to-batch behavior. For example, if the process is behaving in a completely random fashion, then setting φ ) 0 would make sense. On the other hand, if the process is strongly correlated in a batch-to-batch sense, then setting φ ) 1 would make sense. Hence, φ can be set between 0 and 1 according to the actual batch-to-batch behavior of the process, or even tuned according to the observed filter behavior. The incorporation of this parameter model into the EKF design will allow for a systematic initialization at the start of each batch. 2.3. Modified EKF Formulation. The original fundamental model can now be rewritten and combined with the developed parameter model to give

xk(t+1) ) F(xk(t),uk(t),Θk) + wk(t), wk ∼ N(0,Qw) (22) yk(t) ) g(xk(t),Θk) + vk(t), vk ∼ N(0,Rv)

(23)

xk(0) ) f0(Θk) + ek, ek ∼ N(0,Re)

(24)

with the parameter changes being defined by eqs 1821. Then, one can define the augmented system as ˜ ]kT and write the within-batch estimator Xk ) [x,Θ, Θ for t ) 0, ..., tf during batch k as

ˆ k(t|t),u(t)) X ˆ k(t+1|t) ) F(X

(25)

Pk(t+1|t) ) A(t)Pk(t|t)A(t)T + Q

(26)

1756

Ind. Eng. Chem. Res., Vol. 42, No. 8, 2003

K(t+1) ) Pk(t+1|t)C(t+1)T[C(t+1)Pk(t+1|t)C(t+ 1)T + Rv]-1 (27) X ˆ k(t+1|t+1) ) X ˆ k(t+1|t) + K(t+1)[yk(t+1) g(X ˆ k(t+1|t))] (28) Pk(t+1|t+1) ) [I - K(t+1)C(t+1)]Pk(t+1|t)

[

where the linearized matrices are given by

|

∂F ∂x A(t) ) 0 0 C(t+1) )

∂F ∂Θ I 0

X ˆ (t|t), u(t)

[| ∂g ∂x

and Q is defined as

[

X ˆ (t|t), u(t)

0 0 0

0 0 I

∂g ∂Θ

X ˆ (t+1|t)

Qw Q) 0 0

|

|

0 0 0

X ˆ (t+1|t)

]

0

]

]

(29)

(30)

(31)

(32)

[

|

Θ ˆ (tf|tf)

]

∂f0 ∂Θ Pk(tf|tf) 0 0 I 0 0 I

|

|

T

Θ ˆ (tf|tf)

) ΦXPk(tf|tf)(ΦX)T + Qx

|

Θ ˆ (tf|tf)

+

Px,Θ )

∂f0 ∂Θ

Θ ˜ (tf|tf)

( )

E2 > E1

(40)

Alternatively, the dimensionless form of the model can be used to simplify the number of parameters considered

QW φQW φQW φQW

(35)

φQW

(36)

The key advantage of this modified EKF formulation is that information about the parameter values is carried over from one batch to the next in a systematic manner according to the user-specified batch-to-batch behavior of the parameters. This formulation introduces additional “tuning” parameters into the EKF design but provides increased flexibility in following varying degrees of batch-to-batch trends. The ability to carry over the previous batch information also allows a much

( )

(38) (39)

dxa ) u(1 - xa) dτ

(41)

dxb ) u(1 - xa) - βuRxb dτ

(42)

Px,Θ Px,Θ˜

QW

(37)

-E1 -E2 dCb Ca - A2 exp C ) A1 exp dt RT RT b

where

(34)

( | ) ( | ) Θ ˜ (tf|tf)

( )

-E1 dCa ) -A1 exp C dt RT a

T

where the cross-correlation terms Px,Θ and Px,Θ˜ are given by

∂f0 Px,Θ ) ∂Θ

k2

The model of the system can be written as

(33)

0 0

∂f0 ∂f0 Θ ˆ (tf|tf) QW ∂Θ ∂Θ Px,ΘT Px,Θ˜ T

To illustrate the benefits of the proposed EKF modifications, we consider two case studies. The first, a consecutive batch reaction, is used to show the basic properties of the algorithm and its behavior during varying types of batch-to-batch disturbances. The nylon 6,6 example is then used as a more complicated example of the estimation of model initial conditions in the presence of significant plant-model mismatch. This example shows that the proposed formulation allows for better estimates of initial conditions over several batches and, in turn, provides for a greater speed of convergence during a batch. 3.1. Consecutive Reaction. To illustrate the benefits of the proposed modifications, we first consider a simple example involving the consecutive reaction k1

[ ] [ ] ( ) ( ) [ ]

∂f0 ∂Θ Pk+1(0|0) ) 0 0 I 0 0 I 0 0

3. Case Studies

A 98 B 98 C (B desired)

These equations define the filter within batch k in terms of the measurement trajectory yk(t). After a batch is completed, the following update should occur according to parameter model eqs 18-21

f0(Θ ˜ k(tf|tf)) (t Θ ˜ X ˆ k+1(0|0) ) k f|tf) Θ ˜ k(tf|tf)

greater number of observations to be used for improved estimates of batch parameters. The improved detection of changes in initial conditions or model parameters allows for improved speed of convergence during any particular batch and also for more effective corrective action.

xa ) τ)

CA0 - CA CA0

Θ Θf

R)

E2 E1

xb )

Cb CA0

u ) ΘfA1e-E1/RT β)

ΘfA2 (ΘfA1)R

The aim is to estimate values of R and β from concentration data for xb during the reaction. Let Θ ) [R, β]T represent the parameter set of interest to be estimated from simulated process data. For this simulation example, no structural mismatch was included between the plant and the model. The only mismatch introduced was a random step change in the plant parameter values from their nominal condition of Θ ) [2, 0.5]T. The standard extended Kalman filter was

Ind. Eng. Chem. Res., Vol. 42, No. 8, 2003 1757

Figure 1. Estimate of R using three different parameter augmented EKF (aEKF) formulations. Each marker indicates the initial point of a batch.

Figure 2. Prediction of product quality xb(final) made halfway through the batch based on three methods of parameter updating.

formed based on eqs 7-11 and using the following settings and initial conditions

X0(0) ) [0, 0, 2, 0.5]T P0 ) 10I4 Rv ) 1e-4 where I4 is used to denote the identity matrix of dimension 4. Three modifications were considered for implementation of the standard filter. The first EKF, which resets the state covariance to P0 and resets the estimates of the parameter values to their nominal values after each batch, is likely the most common implementation. The second EKF carries the estimates of the parameters over from batch to batch but resets the covariance information to P0. The final EKF carries both the parameter estimates and covariance information over from batch to batch directly. The results of these three approaches were compared to the proposed formulation of modeling the parameter changes deterministically and stochastically from batch to batch with parameters QW ) 1e-3 and φ ) 0.2. The real-time estimation of the first model parameter R over 10 batches with no measurement or state noise is shown in Figure 1. The predictions of the product quality based on the four different methods of model/parameter updating are shown in Figure 2. The predictions are made halfway through the batch in all cases. The results point to the importance of carrying over information in a batch-tobatch sense. Notice that the predictions from the filter that is reset at the start of each batch are considerably biased. This bias is a direct result of having insufficient measurements within each batch to converge on the state and parameter values. Carrying over the state error covariance and the parameter estimates arbitrarily allows for eventual convergence of the parameter estimates and hence allows for eventual bias-free prediction of the quality variables. The best result is the proposed methodology of building a dynamic-stochastic model to describe how the parameters change from batch to batch. It can be seen that this formulation

Figure 3. Performance of parameter estimates during correlated variations using different augmented extended Kalman filtering (aEKF) formulations over 25 batches (plotted against time). Each marker indicates the start of a batch.

allows for faster convergence of the parameter and quality estimates over consecutive batch runs. To evaluate the proposed advantage of the algorithm in following different degrees of batch-to-batch behavior by appropriate tuning of the covariance information for the disturbance model, as shown in eq 34, two different batch-to-batch disturbance patterns were considered. The first simulation assumed a relatively high level of correlation from batch to batch over 100 batches. The second simulation assumed that the parameter variations were changing more independently from batch to batch. For the implementation of the proposed EKF formulations based on eq 34, a value of φ ) 0.9 was used for the correlated case, and a value of φ ) 0.2 was used for the independently varying case. For both cases, a value of QW ) 0.5 was used. To ensure an equal comparison, all other EKF parameters were set to the same values for all of the formulations, and the same values for P0 and Rv as in the first example were used. These result are shown over the first 25 batches of the simulation study in Figures 3 and 4 and are summarized in Table 1, which shows the mean squared

1758

Ind. Eng. Chem. Res., Vol. 42, No. 8, 2003

nonreactive stabilized end groups (SE) according to the degradation reactions 43 and 44. The full kinetic model is given by

Figure 4. Performance of parameters estimates during independent variations using different augmented extended Kalman filtering (aEKF) formulations over 25 batches (plotted against time). Each marker indicates the start of a batch. Table 1. Summary of MSEs of Parameter Estimates for Both Correlated and Independent Parameter Variation Cases method

correlated variations

independent variations

reset all reset covariance carry all batch-to-batch (B2B)

0.0195 0.0114 0.3825 0.0076

0.0182 0.0316 0.1576 0.0125

error (MSE) of the estimates of the parameters at the end of the batch over the entire 100-batch simulation study. Note that, in regard to the modified versions, directly carrying over the parameter estimates and resetting the covariance information from batch to batch works best for correlated disturbances. However, resetting all values to their nominal conditions provides better performance in the presence of independent-type variations. The proposed batch-to-batch modeling approach allows for tuning of the expected variations from batch to batch and shows adequate performance in both extremes. 3.2. Nylon 6,6 Autoclave. The batch polymerization of nylon 6,6 is considered here for a more industrially relevant application of the proposed techniques. The focus of the study is on improving the estimate of the initial conditions through the batch and over several batch runs through implementation of the proposed batch-to-batch EKF formulation. The importance of estimating the initial conditions for quality monitoring or control of the nylon 6,6 process was discussed by Russell et al.8 Details of the model can be found therein and in Russell et al.16 For the purposes of this paper, only a general overview of the kinetics will be given. The polymerization reaction can be described as the condensation reaction between functional groups of amine ends (A) on either hexamethylenediamine (HMD) monomer or polymer chain ends and carboxylic end groups (C) on either adipic acid monomer or polymer ends. The result is the formation of polymer chain links (L) with the evolution of water (W) as described by the main polymerization eq 45. In addition, carboxylic end groups can decompose to form

C f SE + W

(43)

L f SE + A

(44)

A+ChL+W

(45)

This polymerization is performed in a batch autoclave reactor fitted with a valve for venting vaporized water (W), as well as a dowtherm jacket for supplying the heat needed for reaction and vaporization. An equimolar mixture of aqueous monomer salts (HMD and adipic acid) is fed to the autoclave from the evaporator. In addition, the practice of consistently filling the vessel to a standard volume results in a high degree of correlation in the initial conditions (i.e., more water means less salt and vice versa). Once the mixture is charged, heat is supplied through the jacket to drive the polymerization reaction, with the vent being closed to prevent the loss of volatile HMD. When most of the HMD has reacted, the valve is opened to vent off the water, shifting the equilibrium in eq 45 toward the formation of more polymer links (L). Heating is then continued until the desired quality is achieved. The key initial condition of the process is the initial water content (W0), which has a great impact on determining when the venting should begin so that volatile HMD is not lost. The estimator design described above will be evaluated on the basis of its ability to improve the estimates of the initial water content over several batches and within any particular batch. A second criterion will be used to show that the proposed method delivers improved convergence of the state estimates during the batch by evaluating the integral time-weighted absolute error (ITAE) of the state estimate of the actual time evolution of the water content within the reactor. Improvements in these regards would allow for better corrective action in terms of determining when venting should begin. The estimator was formulated on the basis of a simplified kinetic expression around eq 45 without including the side degradation reactions 43 and 44. This represents a significant structural mismatch between the plant and the model used in this simulation study. In addition, the dynamics of the functional groups A and C are identical, so only a single pseudo-state is needed in the estimator model based on the assumption of an equimolar feed as discussed by Russell et al.8 It was assumed that both the batch temperature and an estimate of the heat input into the reactor, Qheat, are available for measurements, y ) [T/1e2, Qheat/1e8], with noise covariance

[

R)

0.1 0

0 1

]

(46)

The state noise covariance matrix used for all cases is

Qw ) 1e-5I3

(47)

and the initial state error covariance was set to

[

7e-4 P0 ) -5.302e-3 0

-5.302e-3 4e-4 0

0 0 9e

-6

]

(48)

Ind. Eng. Chem. Res., Vol. 42, No. 8, 2003 1759

Figure 5. Weight fraction of initial water disturbance for 100batch study.

based on the imposed correlation of the initial conditions through the modeling equations and the assumption of a fixed total mass. The augmented EKF (aEKF) was formed by augmenting the initial conditions of the pseudo-state (for A and C) and initial water content (W). The complete correlation of the whole augmented system was set as discussed in section 2. This aEKF is identical to the fixed-pointer smoother (FPS) presented by Russell et al.8 for estimation of the initial conditions. The standard aEKF formulation is compared with the proposed modification that includes a batch-to-batch update of the initial filter conditions. The batch-to-batch disturbance model was used with

QW )

[

10 0

0 1

]

(49)

with φ ) 0.3 based on eq 34. For the simulation study, batch-to-batch variations were generated in the initial water content over 100 batches by simulating changes in the initial mass fraction of water for each batch charge

dk+1 ) adk + k,  ∼ N(0,σd2)

Figure 6. Performance of initial condition estimates through each batch using different augmented extended Kalman filtering (aEKF) formulations over 100 batches (Plotted against time). Each marker indicates the start of a batch.

(50)

with a ) 0.9 and variance σd2 ) 5.1e-5 to give the initial water disturbance shown in Figure 5. The proposed formulation was compared to the augmented EKF with resetting of the initial state error covariance to the nominal conditions at the start of each batch. One interpretation of this comparison would be that both estimators have the same batch-to-batch deterministic model in that they directly carry over the previous estimate of the initial conditions. However, they differ in stochastic model. Hence, this example shows the proposed advantage of systematically setting the statistics around the initial state vector at the start of each batch. The model was simulated for 38 min into each batch to show the performance that would be obtained prior to the beginning of venting of the autoclave, which is a key time frame for determining when venting should begin to compensate for disturbances in the initial water content. Figure 6 shows the estimation of the initial water content for both formulations over all 100 batches. The values of the estimates at the end of each simulation (38 min for each batch) are shown in Figure 7. The

Figure 7. Initial condition estimates using different augmented extended Kalman filtering (aEKF) formulations over 100 batches.

mean squared error for the conventional aEKF formulation that carries over only initial conditions from batch to batch and resets the covariances was 115.32. The MSE for the proposed formulation was 48.57, which represents a 57.9% improvement in estimation of the initial conditions at a very early stage in the batch. A secondary benefit that is a result of improved initialization from batch to batch is that the speed of convergence of the filter is improved. To judge this aspect of the problem, the integral of the time-weighted absolute error (ITAE) was used to judge the state prediction error of the water concentration (W) through the batch. The ITAE was calculated for each batch and averaged over the entire 100-batch simulation study. The ITAE for the aEKF formulation that resets the covariance from batch to batch was 0.3751, whereas the formulation with batch-to-batch updating of the covariance information was 0.3323. This represents an improvement of about 11% in state estimates, which is a direct result of both the improved initial conditions estimates and the improved specification of the initial error covariance matrix. One such batch result is displayed in Figure 8, which shows the estimator performance for batch 18. Note that, for this batch, the two algorithms had similar initial condition estimates,

1760

Ind. Eng. Chem. Res., Vol. 42, No. 8, 2003

Acknowledgment The authors gratefully acknowledge financial support from the National Science Foundation (CTS-#0096326). Literature Cited

Figure 8. Example batch showing improved convergence of water estimates within the batch from improved batch-to-batch initialization of the filter.

but because of the improved evolution of the initial error covariance matrix, the proposed batch-to-batch formulation exhibited faster convergence. 4. Conclusions This paper introduces a formulation that models uncertainty in batch reactors by including dynamic batch-to-batch models of parameters into the design of the extended Kalman filter. The method delivers a more consistent and systematic estimation of the plant from batch to batch. This allows for a runwise improvement in estimation of changing model parameters or initial conditions. In many cases, the proposed method allows for a faster rate of convergence during the batch, which would allow for faster and more effective corrective action. In particular, the algorithm will prove useful when only a limited number of observations are available during any particular batch run or when estimates are required early in the batch, where information is limited. The tunability of the algorithm was demonstrated by using varying degrees of batch-to-batch disturbances of a consecutive reaction. The improvement in estimating the plant initial conditions and delivering a faster rate of convergence was demonstrated using a fundamental model of the nylon 6,6 autoclave.

(1) Robertson, D. G.; Lee, J. H. A least squares formulation for state estimation. J. Process Control 1995, 5, 291-299. (2) Terwiesch, P.; Agarwal, M. A discretized nonlinear state estimator for batch processes. Comput. Chem. Eng. 1995, 19, 155169. (3) Tatiraju, S.; Soroush, M.; Oggunnaike, B. A. Multirate nonlinear state estimation with application to a polymerization reactor. AIChE J. 1999, 45, 769-780. (4) Jazwinski, A. H. Stochastic Processes and Filtering Theory; Academic Press: New York, 1970. (5) Kozub, D. J.; MacGregor, J. F. State estimation for semibatch polymerization reactors. Chem. Eng. Sci. 1992, 47, 10471062. (6) Lee, J. H.; Datta, A. K. Nonlinear inferential control of pulp digester. AIChE J. 1994, 40, 50-64. (7) Clarke-Pringle, T.; MacGregor, J. F. Nonlinear adaptive temperature control of multi-product, semi-batch polymerization reactors. Comput. Chem. Eng. 1997, 21, 1395-1409. (8) Russell, S. A.; Robertson, D. G.; Lee, J. H.; Ogunnaike, B. A. Model-based quality monitoring of batch and semi-batch processes. J. Process Control 2000, 317-332. (9) Park, M. J.; Hur, S.-M.; Rhee, H.-K. Online estimation and control of polymer quality in a copolymerization reactor. AIChE J. 2002, 48, 1013-1021. (10) Wilson, D. I.; Agarwal, M.; Rippin, D. W. T. Experiences implementing the extended kalman filter on an industrial batch reactor. Comput. Chem. Eng. 1998, 22, 1653-1672. (11) Prasad, V.; Matthias, S. R. L. P. B. B. W. Product property and production rate control of styrene polymerization. J. Prod. Control 2002, 12, 353-372. (12) Valappil, J.; Georgakis, C. Systematic estimation of state noise statistics for extended kalman filters. AIChE J. 2000, 46, 292-308. (13) Valappil, J.; Georgakis, C. Nonlinear model predictive control of end-use properties in batch reactors. AIChE J. 2002, 48, 2006-2021. (14) Yabuki, Y.; MacGregor, J. F. Product quality control in semibatch reactors using midcourse correction policies. Ind. Eng. Chem. Res. 1997, 36, 1268-1275. (15) Flores-Cerrillo, J.; MacGregor, J. F. Control of particle size distributions in emulsion semibatch polymerization using midcourse correction policies. Ind. Eng. Chem. Res. 2002, 41, 18051814. (16) Russell, S. A.; Robertson, D. G.; Lee, J. H.; Ogunnaike, B. A. Control of product quality for batch nylon 6,6 autoclaves. Chem. Eng. Sci. 1998, 53, 3658-3702.

Received for review June 5, 2002 Revised manuscript received December 16, 2002 Accepted January 15, 2003 IE0204181