Вы находитесь на странице: 1из 9

Computers and Chemical Engineering 28 (2004) 347355

The unscented filter as an alternative to the EKF for nonlinear state


estimation: a simulation case study
Andrei Romanenko , Jos A.A.M. Castro
Department of Chemical Engineering, University of Coimbra, Pinhal de Marrocos, Plo II, 3030-290 Coimbra, Portugal

Received 20 March 2002; received in revised form 23 July 2003; accepted 23 July 2003

Abstract

The Kalman filter has been widely used for estimation and tracking of linear systems since its formulation in 1960 due to its simplicity and
robustness. In many chemical engineering applications the extended Kalman filter (EKF) is often used to deal with certain classes of nonlinear
systems. In spite of that, designing an EKF for highly nonlinear processes is not a trivial task, particularly those involving highly exothermic
reactions. In this work we compared the performance of a new technique, the unscented filter, with that of the extended Kalman filter. The
unscented filter produced better results without performing potentially ill-conditioned numerical calculations and linearly approximating the
evolution of the state vector covariance.
2003 Elsevier Ltd. All rights reserved.

Keywords: Nonlinear dynamics; Mathematical modeling; Simulation; Nonlinear state estimation; Extended Kalman filter; Unscented filter

1. Introduction (Chang & Hwang, 1998a,b), however, when suboptimal fil-


tering is justified, the original EKF algorithm can be modi-
In many engineering areas the extended Kalman filter fied in order to make it more robust in a nonlinear dynamic
(EKF) is widely used for state estimation and tracking. Nu- environment.
merous successful applications of this tool have been re- In his work, Schei (1997) proposed an improvement for
ported in the literature. Nonetheless, when one applies an the EKF in which using a central difference method it is
EKF to a complex system, a few implementation and numer- possible to perturb the system and determine covariances
ical problems may arise. One of them is the computation of without explicit calculation of the Jacobian.
the state transition matrix which calls for calculation of the Julier, Uhlmann, and Durrant-Whyte (1995) argued that
Jacobian matrix and its matrix exponential. Besides being with a fixed number of parameters it should be easier to ap-
a computationally expensive operation, there is no univer- proximate a Gaussian distribution than to approximate an
sal and robust numerical way to carry it out (Moler & Van arbitrary nonlinear function and introduced a new general-
Loan, 1978). ization of the Kalman filter, the unscented filter (UF), which
Moreover, the linearization at each time step can introduce permits the direct propagation of means and covariances
large errors and even cause divergence of the filter (Wan & through the nonlinear system equations. The main difference
van der Merwe, 2000). These concerns are especially acute between the UF and the method developed by Schei (1997)
in complex industrial set-ups (Wilson, Agarwal, & Rippin, is that the unscented filter approximates the underlying dis-
1998). Although higher order Kalman filters exist, they are tribution.
more difficult to implement and prone to instability. Grewal In a striking review of new contributions in the field of
and Andrews (1993) introduced measures to improve nu- state estimation, Nrgaard, Poulsen, and Ravn (2000) com-
merical stability of the EKF while Mostov (1996) proposed pared the two above mentioned filters and proposed a third
a way to stabilize higher order EKF. In some applications formulation whose performance is argued to be superior to
the filter described in (Schei, 1997) and similar to the one
Corresponding author. Tel.: +35-123-979-8700; of the UF.
fax: +35-123-979-8703. Despite the fact that these techniques apparently surpass
E-mail address: andrew@eq.uc.pt (A. Romanenko). the EKF, there have been no references in the literature to

0098-1354/$ see front matter 2003 Elsevier Ltd. All rights reserved.
doi:10.1016/S0098-1354(03)00193-5
348 A. Romanenko, J.A.A.M. Castro / Computers and Chemical Engineering 28 (2004) 347355

their application in the field of chemical engineering. In this calculated. With this set of points, the unscented transform
work we apply the extended Kalman filter and the unscented guarantees the same performance as the truncated second
filter to a highly nonlinear simulated CSTR in a system state order Gaussian filter, with the same order of calculations as
estimation framework and compare their performance. an extended Kalman filter but without the need to calculate
Jacobians or Hessians (Julier, Uhlmann, & Durrant-Whyte,
2000).
2. The EKF and UF algorithms At first, the system state vector is augmented as

xk1|k1
The linear filtering problem is concerned with the estima-
tion of the state vector of a dynamic system, approximated xak1|k1  k1 . (9)
in discrete time as k1
xk = f(xk1 , uk1 , k1 , k 1), (1) Its mean is

xk1|k1
provided discrete observations, according to the measure-
ment model E[xak1|k1 ] = 0q1 , (10)
0r1
yk = h(xk , uk , k , k), (2)
where 0q1 and 0r1 are vectors of zeroes and q and r
where x is the state vector, u the control input vector, the
are the sizes of the covariance matrices of the system and
system noise vector, the measurement noise vector, f()
measurement noise, respectively.
the process model, and h() is the measurement model.
The covariance of the augmented state vector is, therefore
The extended Kalman filter algorithm can be summarized
as a series of the following steps: P k1|k1 0nq 0nr

xk|k1 = f(xk1|k1 , uk1 , k 1), (3) P ak1|k1 = 0qn Qk1 P k1 , (11)
0rn P
k1 Rk1
P k|k1 = k1 P k1|k1 Tk1 + Bk1 Qk1 BTk1 , (4)
where n is the dimension of the original state vector, and
yk = h(xk|k1 , uk1 , k), (5) P
k1 and P k1 are the correlations between the system and
measurement noises.
Kk = P k|k1 H Tk [H k P k|k1 H Tk + Dk Rk DTk ]1 , (6) At the next step, a set of 2(n+q +r)+1 symmetric sigma
xk|k = xk|k1 + Kk (yk yk ), (7) points is computed

P k|k = [I Kk H k ]P k|k1 , (8) Xk1|k1 = 0, (n + q + r + )P ak1|k1 ,
 
provided (n + q + r + )P ak1|k1 , (12)
f f h h where is a parameter for fine tuning the higher order
k1 = , Bk1 = , Hk = , Dk = .
x x moments of the approximation (Julier & Uhlmann, 1997).
In the equations above, Q and R are the covariance ma- For any symmetric prior distribution with kurtosis k, if is
trices of the process and measurement noises, respectively. chosen such that 0 < n + q + r + k, then the predictions
More detailed information about the EKF algorithm, in- of means and covariances are more accurate than those of
cluding different implementation equations and improve- the EKF (Julier et al., 1995). For a Gaussian distribution,
ments, can be found elsewhere (Jazwinski, 1970; Grewal & n + q + r + = 3 should be used.
Andrews, 1993). It is known that the matrix square root has no unique
One of the main flaws of the EKF is the assumption that solution. Despite this fact, the algorithm properties presented
the errors in the state estimates are small and that the pre- above hold for any choice of its form. Julier et al. (1995)
dicted mean of the state vector is equal to the prior mean recommends the Cholesky decomposition as a robust and
projected through f(). It is also assumed that the state er- efficient method, which is of special importance in real-time
rors propagate through a separate linearized system (4). In applications.
a nonlinear environment these assumptions may undermine The sigma point set X is zero mean and has the same
the filter performance. variance as the augmented state vector xa . In order to correct
In the unscented transformation (Julier et al., 1995; Julier the mean, the estimate xak1|k1 is added to each sigma point
& Uhlmann, 1997), on which the UF is based, a set of in vector Xk1|k1 and the resulting vector of sigma points is
weighed sigma points are deterministically chosen so that
certain properties of these points match those of the prior Xk1|k1 = Xk1|k1,1 + xak1|k1 , . . . ,
distribution. Each point is then propagated through a non- 
linear function and the properties of the transformed set are Xk1|k1,2na +1 + xak1|k1 , (13)
A. Romanenko, J.A.A.M. Castro / Computers and Chemical Engineering 28 (2004) 347355 349

where na is the dimension of the augmented state vector. In Table 1


(13), the subscript j of Xk1|k1,j is the sigma point index. Model parameters
The state temporal update consists of two steps in which Parameter Expression Value Unit
the vector X is mapped through the nonlinear system FR,ref
p1 3.333 102 s1
VR
Xk|k1 = f(Xk1|k1 , uk1 , k 1), (14) p2 k0 4.08 107 s1
Ea
and the predicted mean is computed as p3 25.347
RTR,ref
a +1

2n (hAT )i
a p4 6.63 101 s1
xk|k1 = Wi Xi,k|k1 , (15) VR (Cp )f
i=1 (HR )CA,ref
p5 1.45
(Cp )f TR,ref
where W is a weight vector of size 2na + 1 with elements
(hAT )i
p6 5.97 s1

a , if i = 1, VW (Cp )W
n + (hAT )e
Wi = 1 (16) p7 s1

, otherwise. VW (Cp )W
5.97
a
2(n + ) FJ,ref
p8 1.67 101 s1
The predicted covariance is computed as VJ
(hAT )e
a +1 p9 1.33 s1

2n
  VJ (Cp )J
P k|k1 = Wi Xi,k|k1 xk|k1
i=1
 T applied to a highly nonlinear dynamic system describing the
Xi,k|k1 xk|k1 . (17) behavior of a non-adiabatic CSTR in which an irreversible
highly exothermic chemical reaction (AB) takes place.
In a similar way the statistics for the innovation sequence The reactors wall significantly affects the system dynam-
must be determined. The mean observation is found from ics and therefore has also been taken into account. The cor-
Yk = h(Xk|k1 , uk , k), (18) responding model leads to the following set of ODEs in a
normalized and dimensionless form:

2na +1
dx1
yk = Wi Yi,k , (19)
= p1 u1 + p1 u1 u2 p1 u2 x1

dt


i=1

p2 ep3 /(1+x2 ) (1 + x1 ) p1 x1 ,


and the covariance is determined as
dx2

= p1 u3 + p1 u2 u3 p1 x2 p1 u2 x2 p4 x2
a +1
dt

2n
Py = Wi [Yi,k yk ][Yi,k yk ]T . (20) + p4 x3 + p5 p2 ep3 /(1+x2 ) (1 + x1 ), (25)


i=1
dx 3

= p6 x2 p6 x3 p7 x3 + p7 x4 ,

dt
The cross-correlation between the state estimate and the


dx4
measurement sequence is, therefore,
= p 8 u 4 + p 8 u 4 u 5 p 8 x4 p 8 u 5 x 4

dt
a +1

2n + p9 x3 p9 x4 ,
P xy = Wi [Xi,k|k1 xk|k1 ][Yi,k yk ]T . (21)
i=1 with the system state vector defined as

At this point, the Kalman gain can be determined as CA CA,ref TR TR,ref
x =
T
CA,ref TR,ref
Kk = P xy P 1
y , (22) 
TW TW,ref TJ TJ,ref
, (26)
the measurement update can be performed from TW,ref TJ,ref
xk|k = xk|k1 + Kk (yk yk ), (23) where CA is the concentration of reactant A, TR the reactor
temperature, TW the wall temperature, and TJ is the jacket
and the corresponding covariance matrix
P k|k = P k|k1 Kk P y KTk .
Table 2
(24) Steady states
Low-temperature stable Unstable High-temperature stable

3. Application and results x1 0.0140582 0.37748 0.97640


x2 0.0068168 0.18304 0.47345
x3 0.0061321 0.16465 0.42590
In order to evaluate the relative performance of the un-
x4 0.0054473 0.14627 0.37834
scented filter in comparison to that of the EKF, they were
350 A. Romanenko, J.A.A.M. Castro / Computers and Chemical Engineering 28 (2004) 347355

temperature. The unit of CA is mol/m3 and the unit of TR , perature, and FJ is the coolant flowrate. The unit of CA0 is
TW , and TJ is K. mol/m3 and the unit of T0 and TJ0 is K, and the unit of
The input vector is FR and FJ is m3 /s. The corresponding reference values are:
 CA0,ref = CA,ref = 3 mol/m3 , FR,ref = 60 105 m3 /s,
CA0 CA,ref FR FR,ref FJ,ref = 15 104 m3 /s, TR,ref = TW,ref = TJ,ref = T0,ref =
uT =
CA,ref FR,ref TJ0,ref = 298 K.

T0 T0,ref TJ0 TJ0,ref FJ FJ,ref The measurement model is assumed to be
, (27)
T0,ref TJ0,ref FJ,ref 1 0 0 0

where CA0 is the feed concentration of reactant A, FR the y = Hx with H = 0 1 0 0 , (28)
flowrate, T0 the feed temperature, TJ0 the inlet jacket tem- 0 0 0 1

0
-0.1
-0.2
-0.3
-0.4
x1 , y 1

-0.5
-0.6
-0.7
-0.8 x
-0.9 y
-1
0 200 400 600 800 1000 1200 1400
t /s
0.5
0.45 x
0.4 y
0.35 y sp
x2, y2, y sp

0.3
0.25
0.2
0.15
0.1
0.05
0
0 200 400 600 800 1000 1200 1400
t /s
0.45
0.4 x
0.35
0.3
0.25
x3

0.2
0.15
0.1
0.05
0
0 200 400 600 800 1000 1200 1400
t /s
0.4
x
0.35 y
0.3
0.25
x4 , y 3

0.2
0.15
0.1
0.05
0
0 200 400 600 800 1000 1200 1400
t /s
Fig. 1. Results of Test I (state (x), output (y), and the output setpoint (ysp ) are represented with solid, dashed, and dotted lines, respectively).
A. Romanenko, J.A.A.M. Castro / Computers and Chemical Engineering 28 (2004) 347355 351

that is, measurements of the wall temperature x3 are not of such ideally tuned filters with no model mismatch af-
available. fecting the results. For the purpose of evaluation the filters
Table 1 summarizes the model parameters used in the behavior in a wide range of operating conditions, the sim-
present work. The model has three steady states which are ulation is performed in closed loop with clear intervals
represented in Table 2. of regulatory and servo control and with the system state
The objective of the present simulation is to compare the vector driven to each of the three steady states.
UF and the EKF in a nonlinear environment where the exact Three simulation tests are carried out with different mea-
system and measurement models are available to the filters, surement noise parameters. Each of the tests starts out with
as is the statistical information about the stochastic distur- the state vector initialized at the high-temperature stable
bances. Although such situation is oftentimes unrealistic steady state. The reactor temperature (y2 ) is under control
in industrial practice, yet here it enables a fair comparison of two PI controllers working in a cascade: the first controls

2.0
1.5
1.0
x1 103

0.5
0.0
-0.5
-1.0
-1.5
-2.0
0 200 400 600 800 1000 1200 1400
t /s
2.0
1.5
1.0
x2 103

0.5
0.0
-0.5
-1.0
-1.5
-2.0
0 200 400 600 800 1000 1200 1400
t /s
2.0
1.5
1.0
x3 103

0.5
0.0
-0.5
-1.0
-1.5
-2.0
0 200 400 600 800 1000 1200 1400
t /s
2.0
1.5
1.0
x4 103

0.5
0.0
-0.5
-1.0
-1.5
-2.0
0 200 400 600 800 1000 1200 1400
t /s
Fig. 2. Test II: EKF estimation errors and 2 bounds.
352 A. Romanenko, J.A.A.M. Castro / Computers and Chemical Engineering 28 (2004) 347355

the reactor temperature by manipulating the jacket temper- The state vector x is subject to zero mean additive white
ature (y3 ) setpoint of the second PI controller, the latter ma- noise with covariance
nipulating the jacket flowrate (u5 ). In each experiment the
reactor temperature setpoint is Q = diag{106 , 106 , 106 , 106 },


0.47345, if t 300 s,



0.47345 0.29041(t 300)/200, if 300 s < t 500 s,

sp
y2 = 0.18304, if 500 s < t 800 s,



0.18304 0.1762232(t 800)/200, if 800 s < t 1000 s,



0.0068168, if 1000 s < t 1300 s.
The measurement and control interval is 1 s.
2.0
1.5
1.0
0.5
0.0
-0.5
-1.0
-1.5
-2.0
0 200 400 600 800 1000 1200 1400
t /s
2.0
1.5
1.0
0.5
0.0
-0.5
-1.0
-1.5
-2.0
0 200 400 600 800 1000 1200 1400
t /s
2.0
1.5
1.0
0.5
0.0
-0.5
-1.0
-1.5
-2.0
0 200 400 600 800 1000 1200 1400
t /s
2.0
1.5
1.0
0.5
0.0
-0.5
-1.0
-1.5
-2.0
0 200 400 600 800 1000 1200 1400
t /s
Fig. 3. Test II: UF estimation errors and 2 bounds.
A. Romanenko, J.A.A.M. Castro / Computers and Chemical Engineering 28 (2004) 347355 353

while the measurements are corrupted by zero mean additive The EKF and UF filter parameters are
white noise with covariance
x0 = x0 + [103 , 103 , 103 , 103 ]T

diag{108 , 108 , 108 } in Test I,

7 7 = [0.97540, 0.47245, 0.42690, 0.37934]T ,
diag{6.5 10 , 6.5 10 , 6.5
R =

107 } in Test II, P 0 = diag{106 , 106 , 106 , 106 },

5 5 5
diag{10 , 10 , 10 , 10 } 5 in Test III.
Q = Q and R = R.
The simulation results of Test I are illustrated in Fig. 1. For
the sake of space, we omit the respective graphics of Tests Additionally, parameter of the UF is set to 5 based on
II and III as the state vector and outputs behave similarly. the dimension of the state vector and the characteristics of

4.0

2.0
x1 103

0.0

-2.0

-4.0

0 200 400 600 800 1000 1200 1400


t /s

4.0

2.0
x2 103

0.0

-2.0

-4.0

0 200 400 600 800 1000 1200 1400


t /s

4.0

2.0
x3 103

0.0

-2.0

-4.0

0 200 400 600 800 1000 1200 1400


t /s

4.0

2.0
x4 103

0.0

-2.0

-4.0

0 200 400 600 800 1000 1200 1400


t /s
Fig. 4. Test III: EKF estimation errors and 2 bounds.
354 A. Romanenko, J.A.A.M. Castro / Computers and Chemical Engineering 28 (2004) 347355

the noises. We emphasize that no further adjustment of lated as twice the square root of the trace of the state covari-
with the purpose of improving UF performance took place. ance matrix) are illustrated in Figs. 25. For the purpose of
Finally, it is worth mentioning that the filter parameters ensuring a fair comparison of the filtering techniques under
are consistent and reflect the parameters of the actual noise consideration, a Monte-Carlo simulation of 50 runs was car-
sources acting on the system. ried out for each set of noise parameters with a consequent
In order to decrease estimation errors of the EKF algo- step of averaging the results. The overall estimation errors
rithm, the predicted state estimate (3) was computed using are summarized in Table 3. A description of the filtering re-
direct numerical integration of the state equations. sults obtained in each test follows.
The profiles of the estimation errors (residuals) of both Test I: Since the measurement noise covariance is small
filters and the respective 2 bounds in single runs (calcu- as compared to the dynamics of the system, the estimation

4.0

2.0
x1 103

0.0

-2.0

-4.0

0 200 400 600 800 1000 1200 1400


t /s

4.0

2.0
x2 103

0.0

-2.0

-4.0

0 200 400 600 800 1000 1200 1400


t /s

4.0

2.0
x3 103

0.0

-2.0

-4.0

0 200 400 600 800 1000 1200 1400


t /s

4.0

2.0
x4 103

0.0

-2.0

-4.0

0 200 400 600 800 1000 1200 1400


t /s
Fig. 5. Test III: UF estimation errors and 2 bounds.
A. Romanenko, J.A.A.M. Castro / Computers and Chemical Engineering 28 (2004) 347355 355

Table 3
Mean square estimation errors over 50 runs
Method x1 x2 x3 x4

Test I: R = diag{108 , 108 , 108 }


EKF 1.1918 105 1.1993 105 1.3878 104 1.1808 105
UF 1.1918 105 1.1986 105 1.3830 104 1.1806 105
Test II: R = diag{6.5 107 , 6.5 107 , 6.5 107 }
EKF 5.3636 104 1.0863 103 8.9844 104 4.3803 104
UF 2.2175 104 2.7366 104 2.6355 104 1.8314 104
Test III: R = diag{105 , 105 , 105 }
EKF 200.310 71.636 60.324 48.166
UF 1.0423 103 1.3258 103 9.7272 104 7.0139 104

errors of the EKF and the UF are essentially the same Acknowledgements
(Table 3), that is, although there may exist linearization
errors in the calculation of the state transition matrix in This work had financial support from Program PRAXIS
the EKF algorithm, they do not have significant impact on in the form of a scholarship for the first author (PRAXIS
the filter performance as the estimates are mostly based on XXI/BD/19609/99). The authors are grateful to Simon Julier
measurements. However, even in this case the UF may be for his assistance in the theory of UF. The efforts of John
preferred to the EKF because it needs the system and mea- W. Eaton and the other developers of Octave, a high-level
surement models only and does not require derivative infor- computer language used in this work, are acknowledged.
mation. Because of the similar performance of EKF and UF
in this test, the corresponding graphic of filtering residuals
is omitted. References
Test II: As the measurement noise increases, the filters
tend to weigh more the a priori estimate obtained using the Chang, C.-T., & Hwang, J.-I. (1998a). Simplification techniques for EKF
model. In this case, the linearization errors of the EKF begin computations in fault diagnosissuboptimal gains. Chemical Engineer-
ing Science, 53(22), 38533862.
to play a significant role and the estimation residuals of the
Chang, C.-T., & Hwang, J.-I. (1998b). Simplification techniques for EKF
EKF are from two to five times greater than the ones of computations in fault diagnosis: model decomposition. AIChE Journal,
the UF (Table 3). Analyzing the 2 bounds in Fig. 2 one 44(6), 13921403.
can observe that the EKF overestimates the state covariance Grewal, M. S., & Andrews, A. P. (1993). Kalman filtering: Theory and
and this leads to inconsistent results. On the contrary, the practice. Englewood Cliffs, NJ: Prentice-Hall.
Jazwinski, A. H. (1970). Stochastic processes and filtering theory. New
residuals produced by the UF lie within the 2 interval most York: Academic Press.
of the time (Fig. 3). Julier, S. J., & Uhlmann, J. K. (1997). A new extension of the Kalman
Test III: In this extreme case the measurement noise is filter to nonlinear systems. In Proceedings of AeroSense: The 11th
very significant and the filter estimates are based mostly on International Symposium on Aerospace/Defense Sensing, Simulation
the a priori estimate. The linearization errors of the EKF and Controls (pp. 182193). Orlando, FL, USA: SPIE.
Julier, S. J., Uhlmann, J. K., & Durrant-Whyte, H. F. (1995). A new
impact severely its state estimates and ultimately lead to its approach for filtering nonlinear systems. In Proceedings of the 1995
divergence (Fig. 4). However, the UF continues operating American Control Conference (pp. 16281632).
satisfactorily (Fig. 5). Julier, S. J., Uhlmann, J., & Durrant-Whyte, H. F. (2000). A new method
for the nonlinear transformation of means and covariances in filters and
estimators. IEEE Transactions on Automatic Control, 45(3), 477482.
Moler, C., & Van Loan, C. (1978). Nineteen dubious ways to compute
4. Conclusions the exponential of a matrix. SIAM Review, 20, 801836.
Mostov, K. (1996). Fuzzy adaptive stabilization of higher order Kalman
In this paper, we have assessed the use of the unscented filters. Masters thesis. Berkley: University of California.
filter in a typical chemical engineering application and found Nrgaard, M., Poulsen, N. K., & Ravn, O. (2000). Advances in
out that this estimation tool is able to provide superior ac- derivative-free state estimation for nonlinear systems. Automatica,
36(11), 16271638.
curacy in comparison to the ones produced by the EKF. Schei, T. S. (1997). A finite difference method for linearization in nonlinear
The absence of model linearization step and, consequently, estimation algorithms. Automatica, 33(11), 20512058.
errors induced by it, allows the UF to be used in a wider Wan, E. A., & van der Merwe, R. (2000). The unscented Kalman fil-
range of operating conditions as well as in situations where ter for nonlinear estimation. In Proceedings of Symposium 2000 on
the differentiability of the system model cannot be assured. Adaptive Systems for Signal Processing, Communication, and Control
(AS-SPCC) (pp. 153158). Lake Louise, Alberta, Canada: IEEE.
Furthermore, the derivative free design of the UF makes Wilson, D. I., Agarwal, M., & Rippin, D. W. T. (1998). Experiences
its implementation significantly simpler than the one of the implementing the extended Kalman filter on an industrial batch reactor.
EKF. Computers Chemical Engineering, 22(11), 16531672.

Вам также может понравиться