State Estimation of Linear and Nonlinear Dynamic Systems Part III: Nonlinear Systems: Extended Kalman Filter (EKF) and Unscented Kalman Filter (UKF) James B. Rawlings and Fernando V. Lima Department of hemical and Biological Engineering University of Wisconsin Madison AIES Regional School RWTH Aachen March 17, 8 Rawlings and Lima (UW) EKF and UKF AIES 1 / 18 Outline 1 Nonlinear Dynamic Systems 2 Extended Kalman Filter (EKF) Simulation Example 3 Unscented Kalman Filter (UKF) 4 onclusions 5 Further Reading Rawlings and Lima (UW) EKF and UKF AIES 2 / 18
Nonlinear Dynamic Systems For the nonlinear model with Gaussian noise x(k + 1) = F (x, u)+g(x, u)w y(k) =h(x)+v w N(, Q) v N(, R) x() N(x, Q ) onsider the linearization at every k F (x, u) A(k) = x bx(k),u(k) (k) = h(x) x bx(k),u(k) G(k) =G( x(k), u(k)) Rawlings and Lima (UW) EKF and UKF AIES 3 / 18 Extended Kalman Filter (EKF) Recursion Forecast x (k + 1) = F ( x, u) P (k + 1) = A(k)P(k)A (k)+g(k)qg (k) x () = x P () = Q orrection x(k) = x (k)+l(k)(y(k) h( x (k))) L(k) =P (k) (k)((k)p (k) (k)+r) 1 P(k) =P (k) L(k)(k)P (k) Rawlings and Lima (UW) EKF and UKF AIES 4 / 18
Extended Kalman Filter Remarks EKF has a similar recursion in structure to the KF with Mean propagation through the full nonlinear model ovariance propagation through the linearized model Resulting error from linearization may cause filter divergence Rawlings and Lima (UW) EKF and UKF AIES 5 / 18 EKF on Batch Reactor Example P Estimate the concentrations of A, B, and Model c d A 1 [ ] c B = 1 2 k1 c A k 1 c B c dt k c 1 1 2 cb 2 k 2c Measure the total pressure B + A k 1 k 1 2B k 2 k 2 Poor initial guess y = RT (c A + c B + c ) x = [.5.5 ] T vs. x = [ 4 ] T Rawlings and Lima (UW) EKF and UKF AIES 6 / 18
EKF Results oncentration 1.6 1.2.8.4 -.4 A A B B Pressure 35 3 -.8 5 1 3 1 5 1 3 omponent Predicted EKF Actual Steady-State Steady-State A.27.12 B.238.184 1.137.675 Rawlings and Lima (UW) EKF and UKF AIES 7 / 18 lipped EKF Results oncentration 1 1 1 1.1.1.1.1 1e-5 4 6 8 1 A B 1 14 Pressure 1 1 1 1 1 4 6 8 1 1 14 lipping of States: c j < c j =, j = A, B, Rawlings and Lima (UW) EKF and UKF AIES 8 / 18
onstrained MHE Results oncentration.7.6.5.4.3.2.1 5 A 1 B 3 Pressure 32 3 28 26 24 22 18 16 5 1 3 State onstraints: c j, j = A, B, Rawlings and Lima (UW) EKF and UKF AIES 9 / 18 Extended Kalman Filter Assessment The extended Kalman filter is probably the most widely used estimation algorithm for nonlinear systems. However, more than 35 years of experience in the estimation community has shown that it is difficult to implement, difficult to tune, and only reliable for systems that are almost linear on the time scale of the updates. Many of these difficulties arise from its use of linearization. Julier and Uhlmann (4). Rawlings and Lima (UW) EKF and UKF AIES 1 / 18
Unscented Kalman Filter (UKF) z 4 x z 1 P Q R z 2 n 4 n1 w n 2 m 4 m 1 v m 2 z 3 n 3 m 3 Given x and P, choose sample points, z i, and weights, w i, such that x = i w i z i P = i w i (z i x)(z i x) Similarly, given w N(, Q) and v N(, R), choose sample points n i for w and m i for v. Rawlings and Lima (UW) EKF and UKF AIES 11 / 18 UKF Prediction Step z i k Nonlinear Transformation (van der Merwe et al., ) z i k+1 F (z i k, u k) n i k G(z i k, u k)n i k Propagate sigma points with the nonlinear model zk+1 i = F (zk, i u k )+G(zk, i u k )nk i all i From these compute the forecast x k+1 = w i zk+1 i P k+1 = w i (zk+1 i x k+1)(zk+1 i x k+1) i i Rawlings and Lima (UW) EKF and UKF AIES 12 / 18
UKF Measurement Update z i k F (z i k, u k) z i k+1 h(z i k+1 ) η i k+1 n i k G(z i k, u k)n i k m i k Measurement forecast: η i k+1 = h(z i k+1)+m i k, ŷ k+1 = i w i η i k+1 Output error: Y := y ŷ Rawlings and Lima (UW) EKF and UKF AIES 13 / 18 UKF Recursion First rewrite the Kalman filter update x = x + L(y ŷ ) L = E((x x )Y ) }{{} P ) 1 E(Y Y }{{} (P +R) 1 P = P L E((x x )Y ) }{{} P Approximate the two expectations with the sigma point samples E((x x )Y ) i E(Y Y ) i w i (z i x )(η i ŷ ) w i (η i ŷ )(η i ŷ ) Rawlings and Lima (UW) EKF and UKF AIES 14 / 18
UKF Assessment Does not linearize at a single point. Samples the nonlinearity at several places (2n). omputationally efficient. Does not require even the Jacobian F (x, u)/ x of the model. Has been tested on simulation examples, including process control examples (exothermic STR, ph). (Romanenko and astro, 4; Romanenko et al., 4). Rawlings and Lima (UW) EKF and UKF AIES / 18 UKF Assessment (cont d) Attractive alternative if the EKF gives convergence problems or proves difficult to tune. Recently published work incorporates constraints in the UKF formulation (Vachhani et al., 6) Performance not yet compared to other nonlinear and constrained approaches such as Moving Horizon Estimation (optimization based) Particle Filtering (sampling based) Rawlings and Lima (UW) EKF and UKF AIES 16 / 18
onclusions Here we have learned... State estimation approaches for unconstrained nonlinear systems Extended Kalman Filter Example showed EKF divergence Unscented Kalman Filter Attractive alternative if the EKF fails Incorporation of constraints is under development Rawlings and Lima (UW) EKF and UKF AIES 17 / 18 Further Reading S. J. Julier and J. K. Uhlmann. Unscented filtering and nonlinear estimation. Proc. IEEE, 92(3):41 422, March 4. A. Romanenko and J. A. A. M. astro. The unscented filter as an alternative to the EKF for nonlinear state estimation: a simulation case study. omput. hem. Eng., 28 (3):347 355, March 4. A. Romanenko, L. O. Santos, and P. A. F. N. A. Afonso. Unscented Kalman filtering of a simulated ph system. Ind. Eng. hem. Res., 43:7531 7538, 4. P. Vachhani, S. Narasimhan, and R. Rengaswamy. Robust and reliable estimation via unscented recursive nonlinear dynamic data reconciliation. J. Proc. ont., 16(1): 175 186, December 6. R. van der Merwe, A. Doucet, N. de Freitas, and E. Wan. The unscented particle filter. Technical Report UED/F-INFENG/TR 38, ambridge University Engineering Department, August. Rawlings and Lima (UW) EKF and UKF AIES 18 / 18