You are on page 1of 9

Computers and Chemical Engineering 65 (2014) 9–17

Contents lists available at ScienceDirect

Computers and Chemical Engineering


journal homepage: www.elsevier.com/locate/compchemeng

Recursive constrained state estimation using modified extended


Kalman filter
J. Prakash a , Biao Huang b,∗ , Sirish L. Shah b
a
Department of Instrumentation Engineering, Madras Institute of Technology Campus, Anna University, Chennai 600044, India
b
Department of Chemical and Materials Engineering, University of Alberta, Edmonton T6G 2G6, Canada

a r t i c l e i n f o a b s t r a c t

Article history: The extended Kalman filter (EKF) remains the most preferred state estimator for solving both uncon-
Received 26 August 2013 strained and constrained state estimation problems in the field of Chemical Engineering. Given, the wide
Received in revised form 10 February 2014 spread use of EKF, we have proposed a novel optimization free recursive formulation of the EKF, to han-
Accepted 16 February 2014
dle elegantly bounds on the estimated state variables of a stochastic non-linear dynamic system. It is
Available online 5 March 2014
well known that in the EKF, the prior and posterior distributions are approximated to be a multivariate
normal distribution. In the presence of bounds imposed on the state variables, the accuracy of the first
Keywords:
two moments of the initial state distribution and prior distribution namely the means and covariance
Recursive Bayesian state estimation
Constrained state estimation
matrices, plays a significant role in the extended Kalman filter performance. Hence, in this paper, we
Nonlinear state estimators propose two novel schemes to modify the prior and posterior distributions of the EKF in order to satisfy
Extended Kalman filter the bound constraints. In addition, the initial state distribution is also suitably modified in order to satisfy
Non-linear dynamic data reconciliation and the bound constraints. The efficacy of the proposed state estimation schemes using the EKF is validated
truncated distributions on two benchmark problems reported in the literature namely a simulated gas-phase reactor and an
isothermal batch reactor involving constraints on estimated state variables. Extensive simulation studies
show the effectiveness of the proposed optimization free recursive constrained state estimation schemes
using extended Kalman filter.
© 2014 Elsevier Ltd. All rights reserved.

1. Introduction literature (Simon, 2006). However, the above-mentioned uncon-


strained methods do not deal with bounds and constraints imposed
Nonlinear state estimation is an active research area and on state variables and parameters in a systematic way (Abrol &
significant amount of work has been carried out in the Chemi- Edgar, 2011; Haseltine & Rawlings, 2005; Rao, Rawlings, & Mayne,
cal Engineering discipline over the last four decades to develop 2003; Rawlings & Bakshi, 2006; Vachhani, Rengaswamy, Gangwal,
methods for the estimation of state variables and parame- & Narasimhan, 2004; Vachhani, Narasimhan, & Rengaswamy,
ters in nonlinear dynamic systems (Dochain, 1998; Patwardhan, 2006).
Narasimhan, Jagadeesan, Gopaluni, & Shah, 2012; Rawlings & In order to deal with constraints, which arise in most Chemical
Bakshi, 2006). Engineering processes, plethora of methods have been proposed,
The methods for the estimation of state variables and param- namely, moving horizon estimation (MHE) (Rao et al., 2003), recur-
eters in stochastic nonlinear dynamic systems can be broadly sive non-linear dynamic data reconciliation (RNDDR) (Vachhani
categorized into unconstrained state estimation schemes and con- et al., 2004), unscented recursive nonlinear dynamic data reconcili-
strained state estimation schemes. The most common recursive ation (URNDDR) (Vachhani et al., 2006), constrained derivative-free
unconstrained state estimation schemes are extended Kalman fil- Kalman filters (Kandepu, Foss, & Imsland, 2008; Kolås, Foss, &
ter (EKF) (Gelb, 1974), unscented Kalman filter (UKF) (Julier & Schei, 2009; Prakash, Patwardhan, & Shah, 2010; Teixeira, Tôrres,
Uhlmann, 2004), ensemble Kalman filter (EnKF) (Evenson, 2003) Aguirre, & Bernstein, 2010), constrained particle filters (Prakash,
and particle filter (Arulampalam, Maskell, Gordon, & Clapp, 2002). Patwardhan, & Shah, 2011; Shao, Huang, & Lee, 2010; Stano,
Several variants of EKF, UKF and PF have been also proposed in the Lendek, & Babuška, 2013). MHE while being considered as a very
popular constrained state estimation technique does not follow
a predictor-corrector approach whereas, RNDDR, URNDDR, con-
∗ Corresponding author. Tel.: +1 780 492 9016. strained derivative-free Kalman filters and particle filters follow a
E-mail addresses: bhuang@ualberta.ca, biao.huang@ualberta.ca (B. Huang). predictor-corrector approach. For the computation of the arrival

http://dx.doi.org/10.1016/j.compchemeng.2014.02.013
0098-1354/© 2014 Elsevier Ltd. All rights reserved.
10 J. Prakash et al. / Computers and Chemical Engineering 65 (2014) 9–17

cost in MHE, constrained recursive state estimators have been The organization of the paper is as follows. Section 2 dis-
recently used (López-Negrete, Patwardhan, & Biegler, 2011). In all cusses the recursive Bayesian state estimation and presents the
the above methods, nonlinearity and constraints on state variables unconstrained EKF formulation. The proposed constrained state
and parameters have been handled elegantly by posing the state estimation schemes based on EKF are presented in Section 3. The
and parameter estimation problem in an optimization framework simulation results are presented in Section 4 followed by main con-
(Patwardhan et al., 2012). clusions drawn through the analysis of these results as discussed
Recursive nonlinear dynamic data reconciliation has been in Section 5.
recently developed (Vachhani et al., 2004), which combines com-
putational advantages of recursive estimation while handling 2. Extended Kalman filter
constraints on the state variables. In the correction step of RNDDR,
an optimization problem is solved to update the predicted state Consider a nonlinear system represented by the following dis-
estimates using measurements. The computation of one-step ahead crete nonlinear state space equations:
predicted state estimate (x̂(k|k − 1)), predicted error covariance   
k
matrix (P(k|k − 1)) and updated error covariance matrix P(k|k) in
x(k) = x(k − 1) + F[x(), u(k − 1)] d + w(k) (1)
RNDDR formulation are identical to that of the extended Kalman fil-
k−1
ter. RNDDR also requires computing derivatives of nonlinear state
transition function and nonlinear measurement model, and is accu- and
rate to the first order. Hence, RNDDR can be viewed as one form of
a constrained extended Kalman filter. Vachhani et al. (2006) later y(k) = H[x(k)] + v(k) (2)
proposed unscented recursive nonlinear dynamic data reconcilia- xL ≤ x(k) ≤ xH (3)
tion (URNDDR) to estimate the state variables and parameters of the
nonlinear system by combining the advantages of the unscented In the above equations, x(k) is the system state vector (x ∈ Rn ), u(k) is
Kalman filter (UKF) and RNDDR. Modified versions of RNDDR and known input (u ∈ Rm ), w(k) is the process noise (w∈Rn ) with known
URNDDR have been recently proposed (Kadu, Bhushan, Gudi, & Roy, distribution, y(k) is the measured variable (y ∈ Rr ) and V(k) is the
2010; Rengaswamy, Narasimhan, & Kuppuraj, 2011). measurement noise (v(k) ∈ Rr ) with known distribution. The index
It should be noted that the extended Kalman filter still remains ‘k’ represents the sampling instant and the symbols F and H are
as the most preferred state estimator for solving constrained namely the state transition function and measurement function,
state estimation problems in the field of chemical engineering respectively, and is assumed to be known in this work. It is further
(Dewasme, Goffaux, Hantson, & Vande Wouwer, 2013; Khodadadi assumed that the initial state of the system x(0) is a random vec-
& Jazayeri-Rad, 2011). In the EKF, to the best of our knowl- tor with known probability distribution. It may be noted that the
edge, the bounds have been handled either by clipping only the process noise and measurement noise have been assumed to influ-
state estimate or by solving the on-line optimization problem as ence the system dynamics and measurement map in an additive
suggested in RNDDR. In both the approaches, the bounds and con- manner.
straints have not been accounted while computing the covariance The objective of the recursive Bayesian state estimation problem
matrices of the errors in the predicted (P(k|k − 1)) and updated is to find the mean and variance of a random variable x(k) using the
state estimates (P(k|k), innovation covariance matrix (V (k)), conditional probability density function p[x(k)|Y(k) ]. Y(k) denotes
Kalman gain (K(k)) and one-step ahead predicted state estimate the set of all the available measurements, i.e. Y(k)  {y(k), y(k −
(x̂(k|k − 1)). 1), . . .}. The posterior density p[x(k)|Yk ] is estimated in two steps
It should be noted that the accuracy of the first two moments namely the prediction step and the update step. In the prediction
of the initial state distribution p[x(0)] and prior distribution step, the posterior density p[x(k − 1)|Yk−1 ] at the previous time step
p[x(k)|Yk−1 ], namely the means and covariance matrices, play a sig- is propagated into the next time step through the transition density
nificant part in the extended Kalman filter performance (Schneider {p[x(k)|x(k − 1)]} as follows:
& Georgakis, 2013). We propose two novel schemes to approx- 
k−1
imate the prior and posterior distributions to be a truncated p[x(k)|Y ]= p[x(k)|x(k − 1)]p[x(k − 1)|Yk−1 ] dx(k − 1) (3)
multivariate normal distribution (Robert, 1995; Kotecha & Djuric,
1999; Wilhelm & Manjunath, 2010) through (i) generation of The update stage involves the application of Bayes’ rule:
i
samples {x̂c (k|k − 1)} from the truncated multivariate normal dis-
p[y(k)|x(k)]
tribution NT [x̂(k|k − 1), P(k|k − 1), xL , xH ], computation of first two p[x(k)|Yk ] = × p[x(k)|Yk−1 ] (4)
moments of the truncated prior distribution such as x̂c (k|k − 1), p[y(k)|Yk−1 ]
Pc (k|k − 1), respectively, from the randomly drawn samples and use It should be noted that the properties of the state transition
them to compute the innovation and Kalman gain (ii) generation equation (1) are accounted through the transition density function
i
of samples {x̂c (k|k − 1)} from the multivariate normal distribu- p[x(k)|x(k − 1)] while p[y(k)|x(k)] accounts for the nonlinear mea-
tion N[x̂(k|k − 1), P(k|k − 1)], while those samples lying outside the surement model. The prediction and update strategies provide an
bounds are clipped; then the first two moments of the truncated optimal solution to the state estimation problem and the analyti-
prior distribution are computed and being used in the compu- cal solution to the recursive propagation of the posterior density is
tation of the innovation and Kalman gain. In addition, the first difficult to obtain. However, when the process model is linear and
two moments of the initial state distribution p[x(0)]∼N[x̂(0), P(0)] process and measurement noise sequences are zero mean Gauss-
and posterior distribution are also modified in order to satisfy the ian white noise sequences, and in the absence of state constraints,
bound imposed on the state variables. The efficacy of the proposed the Kalman filter describe the optimal recursive solution to the
approaches is demonstrated using following benchmark problems sequential state estimation problem (Soderstorm, 2002).
in the literature: The extended Kalman filter (EKF) is probably the most widely
used nonlinear filter. We have assumed in this work that the initial
state and the sequence {w(k)} and {v(k)} are white, Gaussian, and
independent of each other.
• gas-phase reactor (Rawlings & Bakshi, 2006);
• isothermal batch reactor (Haseltine & Rawlings, 2005). E[w(k)] = 0 (5)
J. Prakash et al. / Computers and Chemical Engineering 65 (2014) 9–17 11

E[v(k)] = 0 (6) state variables of a stochastic nonlinear dynamic system subject to


bounds on the state variables (xL ≤ x(k) ≤ xH ).
Cov[w(k)] = Q (7)

Cov[v(k)] = R (8) 3.1. Recursive nonlinear dynamic data reconciliation (Vachhani


et al., 2004)
Cov[w(k), w(j)] = 0, j=
/ k (9)

Cov[v(k), v(j)] = 0, j=
/ k (10) The RNDDR (or C-EKF) approach combines computational
advantages of recursive estimation while handling constraints on
Cov[w(k), v(j)] = 0 (11) the states. The computation of one-step ahead predicted state esti-
mate (x̂(k|k − 1)), predicted error covariance matrix (P(k|k − 1)) and
Eqs. (5) and (6) imply that the random variables w(k) and v(k)
updated error covariance matrix P(k|k) in RNDDR formulation are
have zero mean. The respective covariance matrices are given by
identical to that of the extended Kalman filter (see previous sec-
Eqs. (7) and (8). Eqs. (9) and (10) imply that the random distur-
tion). In the update step, the updated state estimates are obtained
bances which affect the state model at different times are not
by solving the following optimization problem:
correlated; similarly the measurement errors at different time
instants are not correlated. Eq. (11) stipulates that the disturbances min
−1
(k|k − 1) + e(k) R−1 e(k)]
T T
and measurement errors are not cross-correlated. The uncon- x(k)[␰(k|k − 1) P(k|k − 1) (22)
strained extended Kalman filter algorithm is as follows: where
The predicted state estimates are obtained as
 k
␰(k|k − 1) = x̂(k|k − 1) − x(k) (23)
x̂(k|k − 1) = x̂(k − 1|k − 1) + F[x(), u(k − 1)] d (12) e(k) = y(k) − H[x(k)] (24)
k−1
Such that
The covariance matrix of estimation errors in the predicted esti-
mates is obtained as follows: xL ≤ x(k) ≤ xH (25)
T
P(k|k − 1) = (k)P(k − 1|k − 1)(k) + Q (13) The solution of the optimization problem yields the updated state
estimate x(k|k).
where (k) = exp[A(k) × T ] and A(k), is nothing but Jacobian matri-
ces of partial derivatives of F with respect to x̂(k − 1|k − 1) and is
3.2. Constrained state estimation using modified extended
expressed as
  Kalman filters
∂F
A(k) = (14)
∂x In the RNDDR formulation, the bounds have not been accounted
[x̂(k−1|k−1),u(k−1)]
while computing the covariance matrices of the errors in the pre-
and T is nothing but the sampling time. The measurement pre- dicted (P(k|k − 1)) and updated state estimates (P(k|k), innovation
diction, computation of innovation and covariance matrix of covariance matrix (V(k)), Kalman gain (K(k)) and one-step ahead
innovation are computed as follows: predicted state estimate (x̂(k|k − 1)). In the following subsections,
we will propose two novel schemes to modify the prior and pos-
ŷ(k|k − 1) = H[x̂(k|k − 1)] (15)
terior distributions such that the bounds imposed on the state
(k) = y(k) − ŷ(k|k − 1) (16) variables are satisfied.

and 3.2.1. Modified extended Kalman filter


V(k) = C(k)P(k|k − 1)C(k) + R
T
(17) In this approach we generate samples {x̂ci (k|k − 1)} from the
truncated multivariate normal distribution NT [x̂(k|k − 1), P(k|k −
where C(k) is the Jacobian matrix of partial derivatives of H with 1), xL , xH ] and compute the first two moments of the truncated
respect to x̂(k|k − 1). prior distribution such as x̂c (k|k − 1), Pc (k|k − 1), respectively from
  the randomly drawn samples and use them to compute the inno-
∂H
C(k) = (18) vation and Kalman gain. The modified extended Kalman filter
∂x
[x̂(k|k−1),u(k−1)] algorithm to handle bounds imposed on state variables are as fol-
The Kalman gain is computed using the following equation: lows:
Initialization: At k = 0, N samples are drawn
K(k) = P(k|k − 1)C(k) V−1 (k)
T
(19) from the  truncated 
multivariate normal distribution;
(i)
x̂c (0|0)∼NT x̂(0|0), P(0|0), xL , xH . The truncated density function
The updated state estimates are obtained using the following
is as follows:
equation:
exp[(−1/2)(x − )T ˙ −1 (x − )]
x̂(k|k) = x̂(k|k − 1) + K(k)␥(k) (20) NT (x; , ˙, xL , xH ) = xH (26)
xL
exp[(−1/2)(x − )T ˙ −1 (x − )] dx
The covariance matrix of estimation errors in the updated state
estimates is obtained as In the above equation NT (x; , ˙, xL , xH ) is a truncated multi-
variate Gaussian density with argument mean  and covariance 
P(k|k) = [I − K(k)C(k)]P(k|k − 1) (21) for xL ≤ x ≤ xH and 0 otherwise. xL and xH are the lower and upper
bounds imposed on the state variables.
3. Constrained state estimation using recursive state (i)
These sample points {x̂c (0|0)} are then used to estimate sample
estimators
mean and covariance as follows:

1
(i)
N
In this section, we discuss RNDDR and the proposed constrained
state estimation schemes using modified extended Kalman filter x̂c (0|0) = x̂c (0|0) (27)
N
(MEKF and MEKF-1) algorithms that can be used to estimate the i=1
12 J. Prakash et al. / Computers and Chemical Engineering 65 (2014) 9–17

The initial error covariance matrix (Pc (0|0)) is estimated as state estimate and constrained updated covariance matrix can be
determined as follows:
1
(i)
N
T
Pc (0|0) = [␧ (0)][␧(i) (0)] 1
(i)
(28) N
N−1 x̂c (k|k) = x̂c (k|k) (43)
i=1 N
i=1
(i)
␧(i) (0) = x̂c (0|0) − x̂c (0|0) (29)
1
(i)
N
T
The predicted state estimates are obtained as Pc (k|k) = [␧ (k)][␧(i) (k)] (44)
N−1
 k i=1
x̂(k|k − 1) = x̂c (k − 1|k − 1) + F[xc (), u(k − 1)] d (30) (i)
k−1
ε(i) (k) = x̂c (k|k) − x̂c (k|k) (45)

The covariance matrix of estimation errors in the predicted esti-


3.2.2. Modified extended Kalman filter-1
mates is obtained as follows:
The second modified approach is presented in
this section. In
T
P(k|k − 1) = (k)Pc (k − 1|k − 1)(k) + Q (31) this approach we generate samples
i
x̂c (k|k − 1) from the mul-
where, (k) = exp[A(k) × T ] and A(k), is nothing but Jacobian tivariate normal distribution N[x̂(k|k − 1), P(k|k − 1)] while those
matrices of partial derivatives of F with respect to x̂c (k − 1|k − 1) samples lying outside the bounds are clipped and then the first two
and is expressed as moments of the truncated prior distribution x̂c (k|k − 1), Pc (k|k − 1)
  are computed and being used in the computation of the innovation
∂F and Kalman gain. The modified extended Kalman filter algorithm-1
A(k) = (32)
∂x to handle bounds imposed on state variables are as follows:
[x̂c (k−1|k−1),u(k−1)]
Initialization: At k = 0, N samples are drawn from the multivariate
N samples are drawn from the truncated prior distribution normal distribution, N[x̂(0|0), P(0|0)]. The samples are drawn as
(i)
x̂c (k|k − 1)∼NT [x̂(k|k − 1), P(k|k − 1), xL , xH ] and these sample follows:
(i)
points {x̂c (k|k − 1)} are then used to compute the constrained (i)
mean and covariance as follows: x̂ (0|0) = x̂(0|0) + P(0|0)1/2  (i)
(46)
 (i) ∼N(0, I)
1

N
(i)
x̂c (k|k − 1) = x̂c (k|k − 1) (33)
N In the above equation N(x;␮,), is a multivariate Gaussian density
i=1
with argument mean ␮ and covariance , i.e.
−1 
1
(i)
N
N(x; ␮, ) = (2)−N/2 |˙|−1/2 exp
T
Pc (k|k − 1) = [␧ (k)][␧(i) (k)] (34) (x − )T ˙ −1 (x − ) (47)
N−1 2
i=1
The initial sample points which are lying outside the feasible
(i) (i)
␧ (k) = x̂c (k|k − 1) − x̂c (k|k − 1) (35) region are projected to the boundary (by clipping) to obtain the
(i)
constrained sample points (xc (0|0)) as given below:
The measurement prediction, computation of innovation and
covariance matrix of innovation are computed as follows: (i)
x̂c (0|0) = Pr [x̂ (0|0)],
(i)
i = 1, 2, . . ., N (48)
ŷ(k|k − 1) = H[x̂c (k|k − 1)] (36) (i)
These sample points (x̂c (0|0)) are then used to estimate sample
␥(k) = y(k) − ŷ(k|k − 1) (37) mean and covariance as follows:

1
(i)
N
and
x̂c (0|0) = x̂c (0|0) (49)
V (k) = C(k)P c (k|k − 1)C(k) + R
T
(38) N
i=1

where C(k) is the Jacobian matrix of partial derivatives of H with The initial error covariance matrix (Pc (0|0)) is estimated as
respect to x̂c (k|k − 1).
  1
(i)
N
T
∂H Pc (0|0) = [␧ (0)][␧(i) (0)] (50)
C(k) = (39) N−1
∂x i=1
[x̂c (k|k−1),u(k−1)]
(i)
The Kalman gain is computed using the following equation: ␧(i) (0) = x̂c (0|0) − x̂c (0|0) (51)
T −1
K (k) = P c (k|k − 1)C(k) V (k) (40) The predicted state estimates are obtained as
 k
The updated state estimates are obtained using the following
equation: x̂(k|k − 1) = x̂c (k − 1|k − 1) + F[xc (), u(k − 1)] d (52)
k−1
x̂(k|k) = x̂c (k|k − 1) + K (k)␥(k) (41) The covariance matrix of estimation errors in the predicted esti-
The covariance matrix of estimation errors in the updated state mates is obtained as follows:
estimates is obtained as T
P(k|k − 1) = (k)Pc (k − 1|k − 1)(k) + Q (53)
P(k|k) = [I − K (k)C(k)]P c (k|k − 1) (42)
where (k) = exp[A(k) × T ] and
It should be noted that updated sample points can be drawn  
(i) ∂F
from the truncated posterior x̂c (k|k)∼NT [x̂(k|k), P(k|k), xL , xH ] and A(k) = (54)
∂x
using these constrained sample points, the constrained updated [x̂c (k−1|k−1),u(k−1)]
J. Prakash et al. / Computers and Chemical Engineering 65 (2014) 9–17 13

N samples are drawn from the prior distribution N[x̂(k|k − 4.1. Gas-phase reactor (Rawlings & Bakshi, 2006)
1), P(k|k − 1)] as follows:
Consider the gas-phase irreversible reaction in a well-mixed,
(i) 1/2
x̂ (k|k − 1) = x̂(k|k − 1) + P(k|k − 1)  (i) constant volume, isothermal batch reactor. The governing equation
(55) for the isothermal batch reactor is as follows (Rawlings & Bakshi,
 (i) ∼N(0, I)
2006):
The transformed sample points which are lying outside the fea- dpA
sible region are projected to the boundary (by clipping) to obtain = −2k1 p2A (60)
dt
(i)
the constrained sample points (x̄c (k|k − 1)) as given below:
dpB
= k1 p2A (61)
(i) dt
x̄c (k|k − 1) = Pr [x(i) (k|k − 1)], i = 1, 2, . . ., N (56)  
(i)
  pA
These particles (x̄c (k|k − 1)) are then used to compute mean P= 1 1 (62)
and covariance as follows: pB

2A → B k1 = 0.16
1
(i)
N (63)
x̂c (k|k − 1) = x̄c (k|k − 1) (57)
N where x = [PA ; PB ] denotes the partial pressures of A and B. We have
i=1
assumed that the random errors (Gaussian white noise) are present
in the measurement (total pressure) as well as in the state variables.
1
(i)
N
T The covariance matrices of state noise and measurement noise are
Pc (k|k − 1) = [␧ (k)][␧(i) (k)] (58)
N−1 assumed as follows:
i=1
 
(i)
(0.001)2 0  
(i)
ε (k) = x̄c (k|k − 1) − x̂c (k|k − 1) (59) Q= and R = (0.1)2
2
0 (0.001)
The measurement prediction, computation of innovation and
covariance matrix of innovation, Kalman gain, the updated state  state error
The sampling time has been chosen as 0.1. The initial
estimates and the covariance matrix of estimation errors in the 36 0
covariance matrix has been chosen as [P(0|0) = . The
updated state estimates are computed using Eqs. (36)–(42). 0 36
It should be noted that updated sample points can be drawn  for the process and the stateestimator are chosen as
initial state
from the posterior distribution N[x̂(k|k), P(k|k)] and the updated x(0|0) = 3 1 and x̂(0|0) = 0.1 4.5 , respectively. In all the
sample points which are lying outside the feasible region can be simulation runs, the process is simulated using the nonlinear first
projected to the boundary (by clipping) to obtain the constrained principles model (60) and (61) and the true state variables are
(i)
updated sample points (x̂c (k|k)) and using these sample points, computed by solving the nonlinear differential equations using dif-
the constrained updated state estimate and constrained updated ferential equation solver in MATLAB 7.7.0-R 2008(b).
covariance matrix can be determined using Eqs. (43)–(45). In this section, we have compared the performance of the
Note. In both the schemes instead of using the constrained proposed constrained state estimation schemes namely modified
updated estimates as the initial condition in subsequent prediction extended Kalman filters (MEKF and MEKF-1) with recursive non-
step, unconstrained updated estimates can be used and constrained linear dynamic data reconciliation (RNDDR), in the presence of
updated estimates can be used as point estimates. deliberately introduced large plant model mismatch in the initial
state variables. The main goal is to generate non-negative estimates
of state variables namely partial pressures A and B respectively.
4. Simulation studies
The lower bound and upper bound values imposed on the state
T T
variables are xL = [ 0 0 ] and xU = [ 100 100 ] , respectively. As
In this section, we present the simulation case studies to illus-
outlined in Section 3.2.1, the initial samples for the state variables
trate the efficacy of the two proposed modified constrained EKFs (i)
to handle simple lower and upper bounds imposed on state vari- (x̂ (0|0)) have been drawn from the truncated multivariate nor-
ables. We evaluate the efficacy of the (MEKFs) on the following mal distribution NT [x̂(0|0), P(0|0), xL , xH ]. Using the sample points,
benchmark problems in state estimation literature. we have computed the constrained initial state estimate and con-
strained initial covariance matrix respectively as outlined in Section
3.2.1. The sample points have been chosen to be equal to 5000 in the
• Constraints on process state variables:
case of modified extended Kalman filters. The performance of the
◦ gas-phase reactor with irreversible reaction system (Rawlings
proposed MEKF has been compared with unconstrained EKF and is
& Bakshi, 2006);
shown in Fig. 1a. From Fig. 1a, it can be concluded that reasonably
◦ isothermal batch reactor (Haseltine & Rawlings, 2005).
accurate estimates of the partial pressures of A and B are obtained
using MEKF whereas the estimated partial pressures A and B are
The performance of the proposed constrained nonlinear state found to be significantly biased in the case of EKF. The estimated
estimation scheme has to be assessed through stochastic simula- value of the partial pressure of A has been found to be negative in
tion studies. Thus, for each case that is being analyzed, a simulation the case of EKF. On the other hand, constraints never get violated
run consisting of NT trials with length of each simulation trail being when the proposed MEKF, MEKF-1 and RNDDR are employed for
equal to L is conducted. The sum of square estimation errors (SSEE), state estimation (See Fig. 1c–e). In Fig. 1b, we have compared the

L
(i) 2 performance of MEKF, RNDDR, and MEKF-1. From Fig. 1c and e, it
defined as SSEE = [(x(i) (k) − x̂ (k|k)) ] is used as a performance can be inferred that the estimates generated by MEKF and MEKF-
k=1 1 stay far from the constraint boundaries and quickly converge to
index, where x(i) denotes the ith entry of the vector x. Statistics the true values compared to RNDDR (see Fig. 1d). The average sum
of SSEE computed for each simulation run are used to assess the of square of estimation errors based on NT (=25) trials is reported
efficacy of the estimation scheme. in Table 1. The average value of the sum of square of estimation
14 J. Prakash et al. / Computers and Chemical Engineering 65 (2014) 9–17

4
a 4 b True MEKF RNDDR MEKF-1
True EKF MEKF Lower Bound
2 3
0

PA
2
PA

-2
1
-4

-6 0
10 20 30 40 50 60 70 80 90 100 10 20 30 40 50 60 70 80 90 100
Sampling Instants Sampling Instants

10 5
True EKF MEKF Lower Bound True MEKF RNDDR MEKF-1
8 4
6 3
PB

PB
4 2
2 1
0 0
10 20 30 40 50 60 70 80 90 100 10 20 30 40 50 60 70 80 90 100
Sampling Instants Sampling Instants

c 4 d 4

3 3
True Estimated(MEKF) True Estimated(RNDDR)

PA
2
PA

1 1

0 0
10 20 30 40 50 60 70 80 90 100 10 20 30 40 50 60 70 80 90 100
Sampling Instants Sampling Instants

5 5

4 4
True Estimated(MEKF) True Estimated(RNDDR)
3 3
PB
PB

2 2

1 1

0 0
10 20 30 40 50 60 70 80 90 100 10 20 30 40 50 60 70 80 90 100
Sampling Instants Sampling Instants

e 4

3
True Estimated(MEKF-1)
PA

0
10 20 30 40 50 60 70 80 90 100
Sampling Instants

4
True Estimated(MEKF-1)
3
PB

0
10 20 30 40 50 60 70 80 90 100
Sampling Instants

Fig. 1. (a) Gas-phase reactor: evolution of true and estimated state variables using EKF and MEKF. (b) Gas-phase reactor: evolution of true and estimated state variables using
MEKF, RNDDR and MEKF-1. (c) Gas-phase reactor: evolution of true and estimated state variables using MEKF (based on 25 MC simulation studies). (d) Gas-phase reactor:
evolution of true and estimated state variables using RNDDR (based on 25 MC simulation studies). (e) Gas-phase reactor: evolution of true and estimated state variables
using MEKF-1 (based on 25 MC simulation studies).
J. Prakash et al. / Computers and Chemical Engineering 65 (2014) 9–17 15

a b 0.4
0.4 True EKF MEKF Lower Bound
True MEKF RNDDR MEKF-1

CA
CA

0.2 0.2
0 0
-0.2
20 40 60 80 100 120 140 20 40 60 80 100 120 140
Sampling Instants Sampling Instants
True EKF MEKF Lower Bound
0.5 0.4

CB
0
CB

0.2
-0.5 True MEKF RNDDR MEKF-1
0
-1
20 40 60 80 100 120 140 20 40 60 80 100 120 140
Sampling Instants Sampling Instants
2 True EKF MEKF Lower Bound 1

0.5

CC
1
CC

True MEKF RNDDR MEKF-1


0 0
20 40 60 80 100 120 140 20 40 60 80 100 120 140
Sampling Instants Sampling Instants

c 0.5 d 0.5
True Estimated(MEKF)
CA

CA
True Estimated(RNDDR)

0 0
20 40 60 80 100 120 140 20 40 60 80 100 120 140
Sampling Instants Sampling Instants
0.5
0.5
True Est imated(MEKF) True Estimated(RNDDR)
CB
CB

0
0 20 40 60 80 100 120 140
20 40 60 80 100 120 140
Sampling Instants
Sampling Instants
1.5
1.5
1 True Estimated(RNDDR)
True Est imated(MEKF)
CC

1
CC

0.5
0.5
0
0 20 40 60 80 100 120 140
20 40 60 80 100 120 140 Sampling Instants
Sampling Instants

e 0.5
CA

True Estimated(MEKF-1)

0
20 40 60 80 100 120 140
Sampling Instants
0.5
True Estimated(MEKF-1)
CB

0
20 40 60 80 100 120 140
Sampling Instants
1.5
1 True Estimated(MEKF-1)
CC

0.5
0
20 40 60 80 100 120 140
Sampling Instants

Fig. 2. (a) Isothermal batch reactor: evolution of true and estimated state variables using MEKF and EKF. (b) Isothermal batch reactor: evolution of true and estimated state
variables using MEKF, RNDDR and MEKF-1. (c) Isothermal batch reactor: evolution of true and estimated state variables using MEKF (based on 25 MC simulation studies).
(d) Isothermal batch reactor: evolution of true and estimated state variables using RNDDR (based on 25 MC simulation studies). (e) Isothermal batch reactor: evolution of
true and estimated state variables using MEKF-1 (based on 25 MC simulation studies).

error of the proposed schemes has reduced as we increased the be inferred that the performance of MEKF is better than MEKF-1,
ensemble size. From Table 1, it can be observed that proposed state as evident from the lower sum of square of estimation error value
estimation schemes (MEKF and MEKF-1) have yielded lower sum of than MEKF-1. The average computation time per iteration (MAT-
square of estimation error value than RNDDR. From Table 1, it can LAB 7.7.0-R 2008(b), Intel Core 2 Duo Processor-2.13 GHz) of the
16 J. Prakash et al. / Computers and Chemical Engineering 65 (2014) 9–17

Table 1
Gas-phase reactor: mean SSEE for 25 trials.

State estimation scheme Partial pressure of A Partial pressure of B Average computation


time per iteration (s)

MEKF (N = 25) 1.8071 2.4375 0.0080


MEKF (N = 50) 1.5743 1.9332 0.0081
MEKF (N = 500) 1.2685 1.5424 0.0086
RNDDR 39.8489 43.7737 0.0368
MEKF-1 (N = 25) 3.7170 4.2525 0.010
MEKF-1 (N = 50) 3.4207 3.8896 0.013
MEKF-1 (N = 500) 2.5891 2.9369 0.0519

Table 2
Isothermal batch reactor: mean SSEE for 25 trials.

State estimation scheme CA CB CC Average computation


time per iteration (s)

MEKF (N = 150) 0.0897 0.0453 0.0936 0.0074


MEKF (N = 500) 0.0868 0.0424 0.0897 0.0089
MEKF (N = 5000) 0.0833 0.0326 0.0726 0.0232
RNDDR 0.2059 0.2820 0.6604 0.0387
MEKF-1 (N = 250) 0.4240 0.6118 1.4735 0.0415
MEKF-1 (N = 500) 0.3989 0.4930 1.2738 0.0564

proposed (MEKF and MEKF-1) and RNDDR algorithms is reported state variables generated by MEKF, RNDDR and MEKF-1 has been
in Table 1 (see third column of Table 1). compared in Fig. 2b. From Fig. 2a, it can be concluded that non-
negative estimates of the concentrations of A, B and C are obtained
4.2. Isothermal batch reactor (Haseltine & Rawlings, 2005) using M-EKF whereas the concentrations of A, B and C are found to
be significantly biased in the case of EKF. Moreover, the estimated
Consider the two gas-phase irreversible reaction in a well mixed, value of the concentrations of B has been found to be negative in
isothermal batch reactor the case of EKF. From Fig. 2c–e, it can be inferred that the estimates
 T generated by MEKF stay far from the constraint boundaries and con-
k1
AB + C k = 0.5 0.05 0.2 0.01 verge to the true values quickly, compared to RNDDR and MEKF-1.
k2
Further, it should be noted that the constraints never get violated
k3
2BC when the proposed M-EKF, MEKF-1 and RNDDR are employed for
k4 state estimation. The average sum of square of estimation errors
The governing equation for the isothermal batch reactor is as based on NT (=25) trials is reported in Table 2. From Table 2, it
follows: can be observed that proposed state estimation scheme (MEKF)
    yields lower sum of square of estimation error value than RNDDR,
k1 cA − k2 cB cC −1 1 1 and MEKF-1. The average computation time per iteration (MATLAB
ẋ = f (x) = vT r, r= , v= 7.7.0-R 2008(b), Intel Core 2 Duo Processor-2.13 GHz) of the pro-
k3 cB2 − k4 cC 0 −2 1
  posed (MEKF and MEKF-1) and RNDDR algorithms is reported in
y = 32.84 32.84 32.84 x Table 2 (see fourth column of Table 2).
where x = [cA ; cB ; cc ] denotes the concentrations A, B and C. We
have assumed that the random errors (Gaussian white noise) are 5. Conclusions
present in the measurement as well as in the state variables. The
covariance matrices of state noise and measurement noise are In this work, we have proposed a recursive formulation of the
assumed as follows: extended Kalman filter (EKF) to systematically deal with bounds on
⎡ ⎤
10ˆ− 6 0 0 the estimated state variables. The efficacy of the proposed modi-
Q=⎣ 0 10ˆ− 6 0 ⎦ and R = [(0.25)2 ] fied EKF schemes (MEKF and MEKF-1), EKF and RNDDR have been
evaluated on two benchmark examples from the literature which
0 0 10ˆ− 6
involve simple bounds constraints on the estimated state vari-
The sampling time is chosen as 0.25. The initial state error covari- ables. In both these examples, the unconstrained EKF failed to
ance matrix is chosen as generate non-negative partial pressure estimates and non-negative
⎡ ⎤ concentration estimates. The estimates generated by the proposed
0.25 0 0 MEKF scheme, on the other hand, remained far from the constraint
P(0|0) = ⎣ 0 0.25 0 ⎦ boundaries and quickly converged to the true values compared to
0 0 0.25 MEKF-1 and RNDDR.

The problem at hand is to generate estimates of concentrations,


such that the estimated values will not violate lower and upper Acknowledgments
bound values. The lower bound and upper bound values imposed on
T T
the state variables are xL = [ 0 0 0 ] and xU = [1 0 10 10 ] , The authors would like to acknowledge the financial support
respectively. The evolution of true and estimated state variables through the NSERC Industrial Research Chair in Control of Oil Sands
generated by unconstrained EKF and MEKF in the presence of delib- Processes and Alberta Innovates Technology Futures Industry Chair
erately introduced large plant model mismatch in the initial state at the Department of Chemical and Materials Engineering, Univer-
variables is shown in Fig. 2a. The evolution of true and estimated sity of Alberta, Edmonton, Canada.
J. Prakash et al. / Computers and Chemical Engineering 65 (2014) 9–17 17

References Prakash, J., Patwardhan, S. C., & Shah, S. L. (2010). Constrained state estimation using
ensemble Kalman filter. Industrial and Engineering Chemistry Research, 49(5),
Abrol, S., & Edgar, T. F. (2011). A fast and versatile technique for constrained state 2242–2253.
estimation. Journal of Process Control, 21(3), 343–350. Prakash, J., Patwardhan, S. C., & Shah, S. L. (2011). On the choice of importance distri-
Arulampalam, S., Maskell, S., Gordon, N., & Clapp, T. (2002). A tutorial on particle butions for unconstrained and constrained state estimation using particle filter.
filters for online nonlinear/non-Gaussian Bayesian tracking. IEEE Transactions Journal of Process Control, 21, 119–129.
on Signal Processing, 50(2), 174–188. Rao, C. V., Rawlings, J. B., & Mayne, D. Q. (2003). Constrained state estimation for
Dewasme, L., Goffaux, G., Hantson, A. L., & Vande Wouwer, A. (2013). Experimental nonlinear discrete-time systems: stability and moving horizon approximations.
validation of an extended Kalman filter estimating acetate concentration in E. coli IEEE Transactions on Automatic Control, 48(2), 246–258.
cultures. Journal of Process Control, 23(2), 148–157. Rawlings, J. B., & Bakshi, B. R. (2006). Particle filtering and moving horizon estimation.
Dochain, D. (1998). State and parameter estimation in chemical and biochemical Computers and Chemical Engineering, 30, 1529–1541.
processes: A tutorial. Journal of Process Control, 13, 801–818. Rengaswamy, R., Narasimhan, S., & Kuppuraj, V. (2011). Receding nonlinear Kalman
Evenson, G. (2003). The ensemble Kalman filter: Theoretical formulation and prac- (RNK) filter for nonlinear constrained state estimation. Computer Aided Chemical
tical implementation. Ocean Dynamics, 53, 343–367. Engineering, 29, 844–848.
Gelb, A. (1974). Applied optimal estimation. Cambridge, MA: MIT Press. Robert, C. P. (1995). Simulation of truncated normal variables. Statistics and Comput-
Haseltine, E. L., & Rawlings, J. B. (2005). Critical evaluation of extended Kalman filter- ing, 121–125.
ing and moving horizon estimation. Industrial & Engineering Chemistry Research, Schneider, R., & Georgakis, C. (2013). How to not make the extended Kalman filter
44(8), 2451–2460. fail. Industrial and Engineering Chemistry Research, 52, 3354–3362.
Julier, S. J., & Uhlmann, J. K. (2004). Unscented filtering and nonlinear estimation. Shao, X., Huang, B., & Lee, J. M. (2010). Constrained Bayesian estimation: A compar-
Proceedings of the IEEE, 92(3), 401–422. ative study and a new particle filter based approach. Journal of Process Control,
Kadu, S. C., Bhushan, M., Gudi, R., & Roy, K. (2010). Modified unscented recursive 20(2), 143–157.
nonlinear dynamic data reconciliation for constrained state estimation. Journal Simon, D. (2006). Optimal state estimation – Kalman, H∞ and nonlinear approaches.
of Process Control, 20(4), 525–537. Hoboken, NJ, USA: John Wiley & Sons Inc.
Kandepu, R., Foss, B., & Imsland, L. (2008). Applying the unscented Kalman filter for Soderstorm, T. (2002). Discrete-time stochastic systems. Advanced textbooks in control
nonlinear state estimation. Journal of Process Control, 18, 753–768. and signal processing. Springer.
Khodadadi, H., & Jazayeri-Rad, H. (2011). Applying a dual extended Kalman filter Stano, P. M., Lendek, Z., & Babuška, R. (2013). Saturated particle filter: Almost sure
for the nonlinear state and parameter estimations of a continuous stirred tank convergence and improved resampling. Automatica, 49, 147–159.
reactor. Computers & Chemical Engineering, 35(11), 2426–2436. Vachhani, P., Rengaswamy, R., Gangwal, V., & Narasimhan, S. (2004). Recur-
Kolås, S., Foss, B., & Schei, T. (2009). Constrained nonlinear state estimation based sive estimation in constrained nonlinear dynamical systems. AIChE Journal,
on the UKF approach. Computers & Chemical Engineering, 33(8), 1386–1401. 946–959.
Kotecha, J. H., & Djuric, P. M. (1999). Gibbs sampling approach for generation of Vachhani, P., Narasimhan, S., & Rengaswamy, R. (2006). Robust and reliable estima-
truncated multivariate Gaussian random variables. In ICASSP ‘99: Proceedings of tion via unscented recursive nonlinear dynamic data reconciliation. Journal of
the acoustics, speech, and signal processing (pp. 1757–1760). Process Control, 16, 1075–1086.
López-Negrete, R., Patwardhan, S. C., & Biegler, L. T. (2011). Constrained particle filter Wilhelm, S., & Manjunath, B. G. (2010). tmvtnorm: Truncated multivari-
approach to approximate the arrival cost in moving horizon estimation. Journal ate normal distribution. R package version 0.9-2. http://CRAN.R-project.
of Process Control, 21(6), 909–919. org/package=tmvtnorm
Patwardhan, S. C., Narasimhan, S., Jagadeesan, P., Gopaluni, B., & Shah, S. L. (2012). Teixeira, B. O. S., Tôrres, L. A. B., Aguirre, L. A., & Bernstein, D. S. (2010). On unscented
Nonlinear Bayesian state estimation: A review of recent developments. Control Kalman filtering with state interval constraints. Journal of Process Control, 20(1),
Engineering Practice, 20(10), 933–953. 45–57.

You might also like