Home Mathematics Practical implementation of extended Kalman filtering in chemical systems with sparse measurements
Article Publicly Available

Practical implementation of extended Kalman filtering in chemical systems with sparse measurements

  • Gennady Yu. Kulikov EMAIL logo and Maria V. Kulikova
Published/Copyright: February 19, 2018

Abstract

Chemical systems are often characterized by a number of peculiar properties that create serious challenges to state estimator algorithms. They may include hard nonlinear dynamics, states subject to some constraints arising from a physical nature of the process (for example, all chemical concentrations must be nonnegative), and so on. The classical Extended Kalman Filter (EKF), which is considered to be the most popular state estimator in practice, is shown to be ineffective in chemical systems with infrequent measurements. In this paper, we discuss a recently designed version of the EKF method, which is grounded in a high-order Ordinary Differential Equation (ODE) solver with automatic global error control. The implemented global error control boosts the quality of state estimation in chemical engineering and allows this newly built version of the EKF to be an accurate and efficient state estimator in chemical systems with both short and long waiting times (i.e., with frequent and infrequent measurements). So chemical systems with variable sampling periods are algorithmically admitted and can be treated as well.

MSC 2010: 93E11

1 Introduction

It is commonly accepted that the state observation in chemical systems is often based on the available measurements of some parameters (depending on the utilized technology) coupled with computation of remaining (not measurable) variables by means of appropriate software. The latter is referred to as the Software Sensor (SS) in [6]. The SS implies that a proper mathematical model of chemical kinetics is to be utilized in parallel with this or that nonlinear filter implemented for estimating the state of considered chemical system. The dynamic behaviour of chemical reactions is simulated effectively with use of conservation laws and presented conveniently in the form of an Ordinary Differential Equation (ODE). However, the corresponding measurement equation is assumed to be discrete due to the modern practice. The process and measurement models are supplied with stochastic noise terms because of possible random disturbances and uncertainties in the process and measurement as well as due to existing plant-model mismatch. Eventually, it is accepted in chemical research and engineering that chemical phenomena are modelled adequately by continuous-time stochastic dynamic state-space systems written in the form of Itô-type Stochastic Differential Equation (SDE)

dx(t)=F(x(t),u(t))dt+G(t)dw(t),t>0(1.1)

where x(t) ∈ ℝn1 is the n1-dimensional vector of system state at time t, u(t) ∈ ℝn2 is a measurable input at time t (further explanation of function u(t) is given in [24]), F : ℝn1 × ℝn2 → ℝn1 is a sufficiently smooth drift function representing reaction kinetics, G(t) is a time-variant diffusion matrix of size n1 × q and {w(t), t > 0} is a zero-mean Brownian process with square covariance matrix Q(t) > 0 of size q. The initial state x0 of SDE (1.1) is supposed to be a random variable. More precisely, x0 ~ 𝒩(0, Π0) with Π0 > 0, where the notation 𝒩(0, Π0) stands for the normal distribution with mean 0 and covariance Π0.

In addition, some measurement information arrives discretely and in equidistant time intervals of size δ = tktk-1. This interval δ is called the sampling period (or waiting time) in filtering theory. The relation of measurement yk to the system state xk is usually fixed by the formula

yk=h(xk)+υk,k1.(1.2)

Here, k is a discrete time index (i.e., xk means x(tk)), yk ∈ ℝm is the information available at time point tk, h : ℝn1 → ℝm is a differentiable function, and the measurement noise {υk, k ⩾ 0} is a zero-mean Gaussian white-noise process with covariance matrix Rk > 0. Also, all realizations of the noises w(t), υk and the initial state x0 are taken from mutually independent Gaussian distributions.

To treat nonlinear continuous-discrete stochastic models of form (1.1), (1.2), a special technology called the Extended Kalman Filter (EKF) has been designed [8, 9, 15, 30, 38]. Historically, the first EKF variant was grounded in the Euler-Maruyama method [18] and implemented as follows. The mentioned method is applied to SDE (1.1) on a time interval [tk-1, tk]. This results in the discretization

x(tk)=x(tk1)+δF(x(tk1),u(tk1))+G(tk1)w˜(tk1)(1.3)

where δ = tktk−1 and the random variable (tk−1) ~ 𝒩(0, δQ(tk-1)). It follows from the discrete-time stochastic model (1.3) that taking the expectation yields

E{x(tk)}=E{x(tk1)}+δE{F(x(tk1),u(tk1))}(1.4)

with E{x(tk)} = (tk) and E{x(tk-1)} = (tk-1). The state vector in the stochastic process (1.3) is independent of the driving noise. Therefore the associated covariance is determined by the formula

var{xk}=var{xk1+δF(xk1,u(tk1))}+δG(tk1)Q(tk1)GT(tk1).(1.5)

The EKF implies that equations (1.4) and (1.5) are solved approximately in each sampling interval [tk-1, tk ] with use of the first-order Taylor expansion of the nonlinear drift function F(x(t), u(t)) around the filtering estimate xk-1\k-1 at the time tk-1:

F(x(t),u(t))=F(x^k1|k1,u(tk1))+Jk1(x(t)x^k1|k1)+HOT(1.6)

where the Jacobian Jk-1 = ∂F(k-1|k-1, u(tk-1))/∂x̂(t) is evaluated at the chemical system state (k-1|k-1, u(tk-1)), and the notation HOT stands for higher-order terms of this Taylor expansion. Now substituting formula (1.6) into the moment equations (1.4) and (1.5) yields the time-update step of the EKF method:

x^k|k1=x^k1|k1+δF(x^k1|k1,u(tk1))(1.7)
Pk|k1=[In1+δJk1]Pk1|k1[In1+δJk1]T+δG(tk1)QT(tk1)GT(tk1)(1.8)

where Pk|k-1 = E{(xk - k|k-1)(xk - k|k-1)T} is the predicted covariance at time tk, while Pk-1|k-1 = E{(xk-1 - k-1|k-1)(xk-1 - k-1|k-1)T} is the filtering covariance at time tk-1 and In1 stands for the identity matrix of size n1. After arrival of a new measurement yk, the measurement-update step of this EKF is:

Re,k=Rk+HkPk|k1HkT,Kk=Pk|k1HkTRe,k1(1.9)
x^k|k=x^k|k1+Kkek,ek=ykh(x^k|k1),Pk|k=Pk|k1KkHkPk|k1(1.10)

where the matrix Hk = dh(k|k-1)/dxk is the Jacobian of the right-hand side function in the measurement model (1.2) evaluated at the predicted state expectation k|k-1 from the time-update step (1.7), (1.8), and ek ~ 𝒩 (0, Re,k) are innovations of the KF. The described filter is the simplest but successful state estimator that has been utilized by practitioners for decades [8, 9, 15, 30, 38]. Theoretical justifications of this method in both deterministic and stochastic settings can be found in [4,34].

We stress that the notion of EKF does not imply the unique technique, as presented above, but refers to a class of various methods with different properties. For instance, Frogerais et al. [7] consider and examine five EKF implementations on two nonlinear test problems. They elaborate at least two approaches for constructing EKF schemes, which can lead to a great variety of practical filtering algorithms based on ordinary or stochastic differential equation numerical methods. Thus, some criticism published on performance of the EKF in chemical systems for offline models and industrial applications [6,12,33,35,36,39,40] does not mean that all other implementations of this method will also fail, as shown below.

It should be taken into account that many reasons, namely, poor initialization, sparse measurements, large discretization errors, strong nonlinearities, linearization errors, poor modelling (i.e., models that do not enforce physical constraints), poor tuning of noise covariance, and so on, may influence the EKF performance in practical state estimation tasks. For example, Haseltine and Rawlings [12] report that their EKF fails for a batch reactor with poor initialization. Thus, we aim at addressing the issue of accurate state estimation in stochastic chemical systems (1.1), (1.2) with poor initialization and sparse measurements in detail.

Certainly, the useful model correction technology elaborated by Schneider and Georgakis [37] improves the EKF performance for the batch reactor considered in [12]. However, it can resolve the problem of poor initialization of the traditional EKF, but does not help for chemical systems with sparse measurements. This is illustrated by numerical tests below. The reason is that the above-discussed EKF implementation poorly approximates chemical kinetics for long sampling times, and this may fail the EKF. On the other hand, adaptive ODE solvers with automatic global error control used instead of the fixed-stepsize stochastic Euler-Maruyama method resolve the mentioned difficulty and lead to a more advanced state estimation technology, which is referred to as the Accurate Continuous-Discrete Extended Kalman Filter (ACD-EKF) [22, 24,25, 26, 28]. This filter is outlined in the next section.

The mentioned ACD-EKF is designed for treating chemical systems with short and long waiting times (including variable sampling periods) in the same manner, i.e., without manual tuning. The latter is important because, for instance, Soroush [39] writes: ‘In the chemical/petrochemical and biochemical industries, there are many processes wherein the choice of sampling rate is limited by the availability of the output measurements. For example, composition analyzers such as gas chromatographs have a cycle time say 5-10 min compared to a desired control interval of say 0.1-1 min. If the control interval is increased to match the availability of measurements then control performance deteriorates significantly’. The cited inconsistency can be attacked by the accurate extended Kalman filtering technique constructed in [22, 24, 25, 26, 28]. In the present paper, we study its capacity for estimating states in chemical SDE models with poor initialization and infrequent measurements and compare it with the aforementioned traditional EKF method, which is commonly utilized for estimation purposes in chemistry research and engineering.

2 Software sensors for stochastic systems with sparse measurements

There exist two principal variants of the EKF implementation, namely, the continuous-discrete and discrete- discrete EKFs [7,22]. The continuous-discrete variant is the most suited one for treating chemical engineering tasks due to the continuous-time matter of equation (1.1). This technology is based on replacement of the predicted values of the state mean and covariance matrix determined in the time-update step (1.7), (1.8) of the EKF with the values satisfying the Moment Differential Equations (MDEs)

dx^(t)dt=F(x^(t),u(t))(2.1)
dP(t)dt=J(x^(t),u(t))P(t)JT(x^(t),u(t))+G(t)Q(t)GT(t)(2.2)

where J( (t), u (t)) denotes the Jacobian of the drift function F( (t), u (t)) in SDE (1.1) (i.e., J ((t), u (t)) = ∂F ((t), u(t))/∂x̂(t)) evaluated at the state mean trajectory, G(t) is the diffusion matrix in the process noise term, Q(t) is the covariance matrix of the zero-mean Gaussian white-noise process w(t), (t) is the statemean of the random system state vector x(t) at time t (i.e., x(t) is a solution to SDE (1.1)), and u(t) is the measurable input (i.e., a known function of time).

More formally, we use filtering values of the state mean and covariance matrix calculated in the previous sampling time as the initial values of MDEs (2.1), (2.2)for solving them in the next sampling interval [tk-1, tk], i.e., (tk-1) = k-1\k-1, P(tk-1) = Pk-1|k-1. Then, their predicted values are taken to be: k|k-1 = (tk) and Pk|k-1 = P(tk). After arrival of a new measurement yk, the measurement-update step of this filter is conducted in line with the above formulas (1.9)-(1.10).

The main difficulty associated with the continuous-discrete filtering grounded in formulas (1.9)-(2.2) is that the MDEs arisen in chemical engineering are nonlinear and, hence, should be treated numerically. Strictly speaking, any computed predicted state mean k|k-1 and covariance matrix Pk|k-1 do not further satisfy their MDEs, because these values are always determined with some error, which is referred to as the discretization error. The magnitude of the discretization error depends on the quality of implemented MDE solver. Unfortunately, large discretization errors of inaccurate numerical solutions may fully ruin the proper performance of the EKF method (1.9)-(2.2) and result in wrong solutions to the mathematical model (1.1), (1.2), especially in the case of infrequent measurements [7, 22]. Such a situation often occurs when MDEs (2.1), (2.2) are discretized by a numerical scheme for one step of the size δ. The classical EKF algorithm presented by formulas (1.7)-(1.10) is the case. Its inefficiency is clearly shown for chemical systems with sparse measurement information, below. This is quite obvious because the theory of numerical methods for ODEs [5,10,11,14] says that small discretization errors are ensured only for sufficiently small sizes of the sampling period δ, and this is not the case for chemical systems with long waiting times. On the other hand, Soroush [39] explains that such an inaccurate numerical solution seriously limits the applied potential of the traditional EKF method because it does not succeed in chemical models (1.1), (1.2) with infrequent measurements, and the short sampling periods may be technically (or by any other reason) impossible or too expensive in practice.

In this paper, we focus on the issue of large discretization errors committed in continuous-discrete stochastic systems with strong nonlinearities and sparse measurements. The above-mentioned obstacle can be overcome by means of the variable-stepsize ODE solvers with automatic error control, i.e., for example, by commonly used MATLAB codes [13, Section 12.2]. However, it is shown in [16, 23, 29,32] that usually EKF techniques grounded in general purpose ODE solvers, including MATLAB software, lose the EKF implementations based on specially created methods for solving MDEs (2.1), (2.2). This is because all MATLAB codes and general purpose ODE integrators are not intended for retaining the positive semi-definiteness of computed covariance matrix and treat the MDEs as conventional ODE systems. We recall that the matrix P(t) in equation (2.2) has the physical meaning of being the variance of the state prediction error, i.e., x(t) - (t), and, theoretically, has to be positive semi-definite. Thus, they compromise the mathematical theory underlying the EKF and, hence, may reduce its practical performance.

The second shortcoming of all MATLAB solvers outlined in [13, Section 12.2] as well as of other methods developed and tested in [19, 32] (all these are utilized for implementation of the above-cited continuous- discrete EKF) is that they exploit only local error control and, hence, cannot ensure a preassigned accuracy of numerical integration of MDEs (2.1), (2.2). This follows from the fact that the local error regulated in such filters is an artificial notion, which hardly relates to the actual accuracy of numerical solution. So the committed numerical integration error (also termed as the global/discretization error) is unpredictable and can be of any magnitude, there. Thus, the global error control seems to be the necessary option of a robust filter. It is also worthwhile to mention that, in contrast to the EKF with only local error control, the methods with global error control regulate the true error of numerical integration of MDEs (2.1), (2.2), automatically. The user needs only to set the required accuracy of numerical integration (a single number) and the code does all remaining work for calculating a numerical solution to MDEs (2.1), (2.2) with the error corresponding to the set accuracy level. The latter property is the reason to name any such state estimator as the Accurate Continuous-Discrete Extended Kalman Filter (ACD-EKF) in [22, 23, 24, 25, 26, 28].

Among the ACD-EKF versions developed in the cited papers, the most promising one is based on the hybrid triple NIRK6(4)M2 and presented with all technical particulars in [24,26]. This is because of the sixth- order convergence of the output numerical solution to the nonlinear state expectation equation (2.1) exploited there instead of the fourth-order convergence enjoyed in the other hybrid triple NIRK4(2)M2 built in [23, 25, 26, 28]. The mentioned numerical scheme applied to MDE (2.1) results in the discretization

x^l12=a112x^l+a122x^l+1+τι[d112F(x^l,ul)+d122F(x^l+1,ul+1)](2.3a)
x^l22=a212x^l+a222x^l+1+τι[d212F(x^l,ul)+d222F(x^l+1,ul+1)](2.3b)
x^l13=a113x^l+a123x^l+1+τι[d113F(x^l,ul)+d123F(x^l+1,ul+1)+d133F(x^l12,ul12)+d143F(x^l22,ul22)](2.3c)
x^l23=a213x^l+a223x^l+1+τl[d213F(x^l,ul)+d223F(x^l+1,ul+1)+d233F(x^l12,ul12)+d243F(x^l22,ul22)](2.3d)
x^l33=a333x^l+a323x^l+1+τl[d313F(x^l,ul)+d323F(x^l+1,ul+1)+d333F(x^l12,ul12)+d343F(x^l22,ul22)](2.3e)
x^l+1=x^l+τl[b1F(x^l13,uι13)+b2F(x^123,u123)+b3F(x^133,u133)](2.3f)

with the fixed coefficients b1 = b3 := 5/18, b2 := 4/9, c12:=33/6,c22:=3+3/6,a112=a222:=1/2+23/9,a122=a212:=1/223/9,d112=d222:=3+3/36,d122=d212:=3+3/36,c13:=515/10,c23:=1/2,c33:=5+15/10,a113=a323:=125+3915/250,a123=a313:=1253915/250,a213=a223:=1/2,d113=d323:=7+215/200,d123=d313:=(7+215)/200,d133=d343:=1815+153/1000,d143=d333:=1815153/1000,d213=d223:=1/32,d233=d243:=33/32 , obtained at each node tl, l = 0,1, 2,..., L - 1, of some mesh

{tl}l=0L={t0=tk1,tl+1=tl+τl,l=0,1,,L1,tL=tk}(2.4)

introduced in the sampling interval [tk-1, tk]. Notice that the presented discrete-time equations are nonlinear and should be solved for the unknown vector l+1 approximating the state mean at time tl+1. The stage value x^lji of method (2.3) implies an approximation to the state mean x^(tlji) evaluated at the time instant tlji=tl+cjiτl, and the measurable input ulji=u(tlji). We recall that the vector u(t) is a known function of time. The function F(‧) represents the right-hand side of MDE (2.1) or, this is the same, the drift function in SDE (1.1).

The high convergence rate is not the only advantage of the scheme under consideration. It is also A-stable, stiffly accurate, symmetric and conjugate to a symplectic method up to order 6 at least. So, discretization (2.3) has sufficiently high stage and classical orders, which are 3 and 6, respectively, and some stage values calculated in a step of this scheme are rather accurate and allow for a sixth-order dense output (see a further discussion of the presented method in [21, 27]). Most importantly, the nonlinear problem (2.3) admits a sufficiently cheap iteration for finding the unknown vector l+1, which is presented with all necessary particulars in [24]. Also, to generate automatically a good mesh (2.4) in each sampling interval [tk-1, tk], our ACD-EKF exploits the local and global error control mechanisms designed for method (2.3) in [20, Algorithm 3.2]. These controls allow the committed numerical integration error to be made negligible in automatic mode.

Next, the covariance equation (2.2) is discretized on the above mesh (2.4) generated by the aforementioned variable-stepsize solver grounded in formulas (2.3) by means of the modified implicit mid-point rule [32]. The cited discretization reads

Pl+1=Ml+1/2PlMl+1/2T+τlKl+1/2G(tl+1/2)Q(tl+1/2)GT(tl+1/2)Kl+1/2T(2.5)

where tl+1/2 = tl + τl/2 and Kl+1/2 and Ml+1/2 are defined as follows:

Kl+1/2=[In1τl2Jl+1/2]1,  Ml+1/2=Kl+1/2[In1+τl2Jl+1/2](2.6)

with the Jacobian matrix Jl+1/2 = ∂F(l+1/2, u(tl+1/2))/∂x̂(t) evaluated at the point (xl+1/2, u(tl+1/2)). In formulas (2.6), the vector l+1/2 is taken to be equal to the stage value x^l23 from the discretization method (2.3) (see an additional explanation in [24, Section 2.3]). The error of approximation (2.5), (2.6) is not regulated in our filter and considered to be negligible because of the linearity of MDE (2.2).

Mazzoni’s method (2.5), (2.6) is A-stable and convergent of order 2 [32]. However, the main advantage of using this method in practical state estimations is its symmetry and positive semi-definiteness. However, the latter properties are preserved in exact arithmetic, only. So, round-off operations existing in reality might compromise the symmetry and positive semi-definiteness of the computed covariance Pl+1 and fail the ACD- EKF. On the other hand, it is known that square-root implementations of Kalman-like filtering methods based on stable orthogonal rotations allow the committed round-off errors to be reduced dramatically (see, for instance, [1, 2, 3, 9, 17]). That is why we utilize the square-root ACD-EKF variant published in [24, Appendix A] for showing the superiority of the filtering technique (1.9)-(2.2) obtained in the continuous-discrete approach in comparison to the classical EKF method (1.7)-(1.10) built within the discrete-discrete filtering, in particular for chemical stochastic SDE systems with sufficiently long sampling periods. In other words, we address the inconsistency stated for chemical continuous-time stochastic models with sparse measurements by Soroush [39].

We emphasize that the ACD-EKF presented in [24, Appendix A] does not require any manual tuning, maybe, except for altering the value of accuracy parameter εg (its default value εg = 10–4 is accepted in the numerical experiments below). This method is expected to work successfully for short and sufficiently long sampling intervals δ (see more explanation in [22, 24, 25, 26]). In the next section, our argument is demonstrated numerically on a chemical system from [12], for which the classical EKF can fail, in order to exhibit differences in performance of the traditional state estimation technology and the contemporary ACD-EKF.

3 Numerical simulation and discussion

Following Haseltine and Rawlings [12], we consider the gas-phase reversible reaction with three species denoted as A, B, and C:

Ak1k2B+C,2Bk3k4B+C(3.1)

in which the fixed coefficients k1 = 0.5, k2 = 0.05, k3 = 0.2 and k4 = 0.01. The stoichiometric matrix v of reaction (3.1) and the reaction rates r are chosen to be

v=[111021],r=[k1cAk2cBcCk3cB2k4cC](3.2)

where cA, cB, and cC denote the concentrations of the species A, B, and C in moles per liter, respectively. Therefore, the state of this chemical system is defined by the vector

x(t)=[cAcBcC]T.(3.3)

The measurement equation is given in the following form:

yk=[RTRTRT]xk+υk.(3.4)

Here, xk means an approximation to the state vector x(tk), R is the ideal gas constant, T is the reactor temperature in Kelvin, and the measurement noise is υk ~ 𝒩 (0, Rk) with Rk = 0.252 in each measurement information yk. Following [12], we set RT = 32.84. Below, we consider the task of state estimation for a Batch Reactor (BR) discussed in the cited paper.

The well-mixed, constant-volume, isothermal BR is modeled by the SDE

dx(t)=νTrdt+Gdw(t),t>0(3.5)

with the initial values

x0=[0.5,0.05,0]T(3.6)

where the matrix υ and the vectors r, x(t) are defined in (3.2) and (3.3). The matrix G is assumed to be constant and diagonal, i.e., G= diag{1,1,1} in (3.5). The continuous-time process noise w(t) is the Brownian motion with the fixed covariance matrix Q= diag{10–6/δ,10–6/δ,10–6/δ} because the covariance matrix of the discrete-time zero-mean Gaussian process is = diag{0.0012, 0.0012, 0.0012} in [12]. This process noise is added to simulate possible random disturbances and uncertainties in the BR and also due to existing plant- model mismatch in reality. The sampling period δ = tk+1 - tk = 0.25 is set in the first experiment. The initial information for the classical EKF and for the novel ACD-EKF method is supposed to be the same and poor, i.e., 0 = [0,0,4]T and Π0 = diag{0.52, 0.52, 0.52} (compare 0 with the exact initial state given by formula(3.6)). We stress that the numerical simulation results presented for the traditional EKF in [12] exhibit convergence to a wrong steady-state and even negative concentrations. Now we repeat the same experiment, but with our own codes. The state estimation methods and all computations are implemented in MATLAB.

To simulate a measurement history, we integrate SDE (3.5) by the stochastic Euler-Maruyama solver [18] with the small fixed step size equal to 0.001 and apply formula (3.4) with the additive noise υk to calculate a measurement information yk at every sampling instant tk. Then, we solve the reverse problem, i.e., we treat SDE (3.5) by means of the traditional EKF and our ACD-EKF methods with the same above-set initial data and simulated measurements. The results of this numerical experiment (i.e., the estimated concentrations cA, cB, and cC) are shown in Fig. 1, where plots (a) and (b) display one typical behaviour (Regime 1, i.e., Convergence Regime) of the state estimators, when the convergence to the no noise solution is clearly observed, and plots (c) and (d) exhibit the divergence and failure (Regime 2, i.e., Divergence Regime) of both EKF implementations, i.e., when the wrong steady-state and even negative concentrations are calculated after convergence. We stress that the no noise solution has been computed by the ODE solver NIRK6(4) [20] (with the global error control) applied to the underlying ODE (3.5), (3.6), i.e., without the noise term Gdw(t). The latter solution is shown additionally in all figures of this paper and marked as ‘No noise’. The steady-state values of the no noise, EKF, and ACD-EKF estimated concentrations in the convergence and divergence regimes are gathered in Tables 1 and 2, respectively.

Fig. 1 Actual (no noise), EKF and ACD-EKF estimated concentrations (with initial values [0, 0, 4]T and the initial covariance Π0) for the batch reactor: Regimes 1 (convergence, top plots) and 2 (divergence, bottom plots).
Fig. 1

Actual (no noise), EKF and ACD-EKF estimated concentrations (with initial values [0, 0, 4]T and the initial covariance Π0) for the batch reactor: Regimes 1 (convergence, top plots) and 2 (divergence, bottom plots).

Tab. 1

Actual (no noise) and estimated steady-state concentrations (with initial values [0, 0, 4]T, the initial covariance Π0 and δ= 0.25) for the batch reactor.

ConcentrationEKF estimated steady-state (Regime 1)EKF estimated steady-state (Regime 2)Actual steady-state
cA0.0117-0.02960.0124
cB0.1794-0.26270.1859
cC0.65051.18030.6635

Tab. 2

Actual (no noise) and estimated steady-state concentrations (with initial values [0, 0, 4]T, the initial covariance Π0 and δ= 0.25) for the batch reactor.

ConcentrationACD-EKF estimated steady-state (Regime 1)ACD-EKF estimated steady-state (Regime 2)Actual steady-state
cA0.0118–0.02950.0124
cB0.1806–0.26230.1859
cC0.64921.17980.6635

Having compared the derived results to those published in [12] we see a principal difference. Our simulation shows that about 25% of EKF runs and 17% of ACD-EKF runs are successful. The exact numbers of fails of these state estimators out of 1000 runs are presented for this numerical experiment in the first column of Table 6, below. Note that Schneider and Georgakis [37] also confirm the existence of these two performance regimes for the batch reactor (3.5), (3.6) and the inexact initial state vector 0 = [0,0, 4]T and the initial covariance Π0.

In Regime 1, the EKF and ACD-EKF estimated concentrations converge to the actual steady-state in contrast to the results published in [12], where the convergence only to the wrong value is reported. Our Tables 1 and 2 exhibit good accuracies of the estimated steady-states in Regime 1. Moreover, the traditional EKF algorithm, given by formulas (1.7)-(1.10), and the advanced ACD-EKF method from [24, Appendix A] do not produce non-physical data (i.e., negative concentrations) in this performance regime. Certainly, negative values are possible during the convergence (transient) period (see Figs. 1a and 1b) because any filtering method is just looking for the true solution in this stage. However, both filters converge to the true solution of the BR (3.5), (3.6) in Regime 1 and, then, all the concentrations become positive, as predicted by theory.

It is worthwhile to recall that altering the true initial values (3.6) to the untrue ones given by the vector 0 = [0,0,4]T and utilized by the filter obliges the latter to solve another, say, untrue mathematical model. Besides, the EKF does not know that the model is wrong and follows its wrong state trajectory, which has no relation to the original system (3.5), (3.6). On the other hand, at every sampling time, the filter receives some information on the true state of the batch reactor (i.e., true measurements). Then, this information is used to amend the calculated wrong state in the measurement-update step of the filtering procedure. In other words, after each measurement-update, the filter moves from one state expectation trajectory of the process model to the other, which is expected to be closer to the true solution of the considered problem. A certain amount of true measurements allow the state expectation trajectory of the BR (3.5), (3.6) to be identified correctly. The traditional EKF and ACD-EKF methods expose good accuracies of their convergence regimes after reasonable time, i.e., when tk ⩾ 10 in this numerical experiment. We stress that the filter convergence time (the transient period) is not prefixed by the model and depends on many factors including the frequency of measurements, i.e., the sampling rate δ. Thus, the wrong states computed in the transient period of the filter (i.e., for tk < 10) are not the concentrations of the BR under examination. Their values may be positive or negative because they do not relate to the original mathematical model (3.5), (3.6). That is why they must be merely ignored and excluded from consideration. The states estimated by the converged filter, when tk ⩾ 10, are only of the interest. We stress that the states estimated in the transient period of filtering are of no sense, but the convergence time itself is an important characteristic of any practical SS. A further discussion on convergence issues of the Kalman filter, also known as the transient behaviour, for linear and nonlinear stochastic models can be found, for instance, in [15,31].

Eventually, the EKF and ACD-EKF estimated steady-states in Regime 1 are positive and correspond well to its no noise value (see Tables 1 and 2) in contrast to the data published in [12]. On the other hand, Regime 2 is in line with the outcome reported in the cited paper. Thus, if we take now into account the numbers of fails presented in the first column of Table 6 we will conclude that the EKF and the ACD-EKF work poorly for the BR model under consideration. The reason is clearly identified in [37]. This is because the continuous-discrete stochastic system (3.5), (3.4) with the above discussed initial state 0 and the initial covariance Π0 is ill-posed.

In other words, the matrix Π0, which has the physical meaning of being the variance of the initial state error, i.e., x0 -0, is too far from the exact covariance corresponding to the initial state given by formula (3.6). Thus, altering this matrix to the modified initial covariance Π0mod = diag{0.52, 0.052,42} recommended in [37] fully resolves all the problems and, then, the EKF and ACD-EKF state estimators work well and without a single fail out of 1000 independent runs for the inexact initial state vector x0 = [0, 0, 4]T (see Fig. 2 and Tables 3 and 6). In addition, both filters demonstrate their swift convergence in this experiment.

Fig. 2 Actual (no noise), EKF and ACD-EKF estimated concentrations (with initial values [0, 0, 4]T and the modified initial covariance Π0mod${{\Pi }}_0^{{\text{mod}}}$) for the batch reactor.
Fig. 2

Actual (no noise), EKF and ACD-EKF estimated concentrations (with initial values [0, 0, 4]T and the modified initial covariance Π0mod) for the batch reactor.

Tab. 3

Actual (no noise) and estimated steady-state concentrations (with initial values [0, 0, 4]T, the initial covariance Π0mod and δ= 0.25) for the batch reactor.

ConcentrationEKF estimated steady-stateACD-EKF estimated steady-stateActual steady-state
cA0.01320.01330.0124
cB0.18380.18460.1859
cC0.65450.65360.6635

Next, we show that the initialization technique elaborated in [37] is not capable of addressing the problem of infrequent measurements discovered in [39] in the frame of the traditional EKF, and the advanced ACD-EKF helps a lot. For that, we assume that the BR (3.5) is to be estimated by the same EKF and ACD-EKF methods with the initial data 0 = [0, 0, 4]T and Π0mod = diag{0.52, 0.052, 42}, but for the longer sampling period δ= 2.0. The behaviour of estimated concentrations and their steady-states are displayed in Fig. 3 and Table 4, respectively.

Fig. 3 Actual (no noise), EKF and ACD-EKF estimated concentrations (with initial values [0, 0, 4]T and the modified initial covariance Π0mod${{\Pi }}_0^{{\text{mod}}}$) for the batch reactor.
Fig. 3

Actual (no noise), EKF and ACD-EKF estimated concentrations (with initial values [0, 0, 4]T and the modified initial covariance Π0mod) for the batch reactor.

Tab. 4

Actual (no noise) and estimated steady-state concentrations (with initial values [0, 0, 4]T, the initial covariance Π0mod and δ= 2.0) for the batch reactor.

ConcentrationEKF estimated steady-stateACD-EKF estimated steady-stateActual steady-state
cA–0.03440.01260.0124
cB–0.30750.18630.1859
cC1.20300.66810.6635

The latter numerical experiment exhibits that the ACD-EKF clearly outperforms the traditional EKF. Figure 3 and Table 4 show that despite the slightly worsened convergence to the true solution (because the ACD- EKF needs a certain amount of measurements to converge, and these have been reduced in our experiment), the modern method computes the true state estimates to the BR (3.5) and its steady-state with good accuracy. In contrast, the classical state estimator is not able to capture correctly the BR dynamic behaviour because of poor approximation of the chemical kinetics and, hence, it produces wrong trajectories of the concentrations and their untrue steady-states in the majority of runs. We have done 1000 independent runs of our codes and revealed no fail for the ACD-EKF, whereas the classical EKF has been successful in less than 1% of runs (see the precise numbers of fails of these state estimators in the third column of Table 6). Here, we do not show the convergence regime of the EKF for the BR under examination because the method working successfully with the probability of less than 1% is of no practical significance. In addition to the accuracy of state estimation, the ACD-EKF is flexible and insensitive to the sampling rate δ. We stress that exactly the same ACD-EKF code has been run for δ = 0.25 and for δ= 2.0.So this filter accommodates changes in the length of the sampling interval, automatically [22,24, 25, 26]. That is why it can also be efficient in chemical systems with irregular sampling.

Next, we show that even the exact initial data do not ensure the accurate state estimation by the traditional EKF method when the waiting time of the chemical system is sufficiently long. To simulate such a situation, we merely solve SDE (3.5) assuming that its exact initial value (3.6) is known, i.e., the initial values for the EKF and ACD-EKF techniques are now taken to be 0 = [0.5, 0.05,0]T and Π0exact = diag{0.012, 0.012, 0.012}. Note that the latter correspond well to the theoretical stability requirement of EKF [34]. At the same time, we suppose that the measurement information arrives discretely and in the interval δ = 4.0. The outcome of our last experiment is displayed in Fig. 4 and Table 5.

Fig. 4 Actual (no noise), EKF and ACD-EKF estimated concentrations (with the initial values [0.5, 0.05, 0]T and the initial covariance Π0exact${{\Pi }}_0^{{\text{exact}}}$) for the batch reactor.
Fig. 4

Actual (no noise), EKF and ACD-EKF estimated concentrations (with the initial values [0.5, 0.05, 0]T and the initial covariance Π0exact) for the batch reactor.

Tab. 5

Actual (no noise) and estimated steady-state concentrations (with the initial values [0.5, 0.05, 0]T, the initial covariance Π0exact and δ= 4.0) for the batch reactor.

ConcentrationEKF estimated steady-stateACD-EKF estimated steady-stateActual steady-state
cA–0.03530.01260.0124
cB0.23890.18770.1859
cC0.66630.66470.6635

Again, we observe a great difference in the behaviour of the traditional EKF and modern ACD-EKF methods. We see that the classical state estimator has not converged yet in the interval [0,30] (see Fig. 4a). So, its ‘steady-state’ shown in Table 5 is not actually a steady-state, but only the value calculated at the last sampling point in the simulation interval. At the same time, the ACD-EKF works well and reconstructs accurately the concentration trajectories (see Fig. 4b) and the chemical system steady-state (see Table 5). Moreover, the described picture retains for all 1000 independent runs of the codes (see the last column in Table 6). All this confirms the superiority of the modern state estimation technique presented in [24, Appendix A] towards the traditional EKF method (1.7)-(1.10). The latter experiment also explains that the method of model tuning [37] may be useless when the state estimator is not able to reconstruct correctly the true chemical system dynamics due to sparse measurements. In contrast, the ACD-EKF is flexible and insensitive to the size δ of the utilized sampling intervals. The presented computation results have been obtained by the same code, i.e., without any manual tuning for a specific δ. This is a clear evidence that our novel filter can be useful for addressing the contradiction between the measurement time available in reality and the optimum sampling rate of the filter stated in [39]. In other words, the ACD-EKF works for much longer waiting periods without significant deterioration of the accuracy and robustness of state estimation in chemical systems. The latter is important when frequent measurements are technically (or by any other reason) impossible or too expensive in practice.

Tab. 6

Numbers of fails out 1000 runs of the EKF and ACD-EKF applied to the batch reactor for various initial data and sizes of the sampling interval.

Filtering methodδ = 0.25 0 = [0, 0, 4] Π0δ = 0.25 0 = [0, 0, 4] Π0modδ = 2.0 0 = [0; 0; 4] Π0modδ = 4.0 0 = [0.5, 0.05, 0] Π0exact
EKF75409911000
ACD-EKF831000

In conclusion, Table 6 summarizing performances of two state estimators applied to SDE (3.5) with various initial data demonstrates that when the given mathematical model is ill-posed both EKF implementations work poorly. However, the initialization technique recommended in [37] fully resolves this difficulty and all the methods expose the excellent performance with no fail. Besides, when the sampling rate δ is reduced only the ACD-EKF retains accurate. The latter confirms the promising applied potential of the ACD-EKF and creates the necessary background for its further practical testing, including in industrial environment.

4 Conclusion

This paper investigates the issue of the EKF failure reported for the batch reactor in [12]. For resolving this problem, two different approaches have been examined above. The first one is grounded in the model correction technology recommended in [37]. It improves the EKF performance by addressing the issue of poor initialization of the state estimator. In other words, Schneider and Georgakis suggest reformulation of the chemical system such that the conventional EKF method works well for the batch reactor studied in [12]. The sole shortcoming of this approach is that the technique discussed in [37] may fail at least for some chemical systems with infrequent measurements. The reason is that the ‘textbook’ EKF given by formulas (1.7)-(1.10) poorly approximates swiftly changing chemical kinetics for long sampling intervals, and this may also fail the EKF. The second approach is based on adaptive ODE solvers with automatic global error control used instead of the stochastic Euler-Maruyama method. It reconstructs accurately chemical model dynamics and resolves the problem of sparse (and even irregular) measurements. Thus, this approach underlies advanced Accurate Continuous-Discrete Extended Kalman Filters (ACD-EKF) designed in [22, 23, 24, 25, 28].

Actually, our research and the technique considered in [37] deal with different aspects of the problem of EKF failure in chemical research and engineering. We do not change the ‘model’ (i.e., the chemical system with initial values and noises), but improve the ‘method’ (the state estimation technique) so that it works for long waiting times. In contrast, Schneider and Georgakis [37] improve the ‘model’ such that even the classical EKF treats the examples of the EKF failure published in [12], successfully. Obviously, these two approaches are equally important and only their combination will lead to most effective state estimation techniques for difficult offline chemical models and industrial applications in future.

  1. Funding: This work was supported by Portuguese National Fund ( Fundaçâo para a Ciência e a Tecnologia) within projects UID/Multi/04621/2013, SFRH/BPD/64397/2009 and the Investigador FCT 2013 programme.

References

[1] I. Arasaratnam, S. Haykin, and T. R. Hurd, Cubature Kalman filtering for continuous-discrete systems: Theory and simulations. IEEE Trans. Signal Process. 58 (2010), 4977-4993.10.1109/TSP.2010.2056923Search in Google Scholar

[2] G. J. Bierman, Factorization Methods for Discrete Sequential Estimation. Academic Press, New York, 1977.Search in Google Scholar

[3] G. J. Bierman, M. R. Belzer, J. S. Vandergraft, and D. W. Porter, Maximum likelihood estimation using square root information filters. IEEE Trans. Automat. Contr. 35 (1990), 1293-1298.10.23919/ACC.1989.4790637Search in Google Scholar

[4] M. Boutayeb, H. Rafaralahy, and M. Darouach, Convergence analysis of the extended Kalman filter used as an observer for nonlinear deterministic discrete-time systems. IEEE Trans. Automat. Contr. 42 (1997), 581-586.10.1109/9.566674Search in Google Scholar

[5] J. C. Butcher, Numerical Methods for Ordinary Differential Equations. John Wiley and Sons, Chichester, 2008.10.1002/9780470753767Search in Google Scholar

[6] D. Dochain, State and parameter estimation in chemical and biochemical processes: a tutorial. J. Process Control 13 (2003), 801-818.10.1016/S0959-1524(03)00026-XSearch in Google Scholar

[7] P. Frogerais, J.-J. Bellanger, and L. Senhadji, Various ways to compute the continuous-discrete extended Kalman filter. IEEE Trans. Automat. Contr. 57 (2012), 1000-1004.10.1109/TAC.2011.2168129Search in Google Scholar

[8] G. C. Goodwin and K. S. Sin, Adaptive Filtering Prediction and Control. Prentice-Hall, Englewood Cliffs, New Jersey, 1984.Search in Google Scholar

[9] M. S. Grewal and A. P. Andrews, Kalman Filtering: Theoryand Practice. Prentice Hall, New Jersey, 2001.10.1002/0471266388Search in Google Scholar

[10] E. Hairer, S. P. Nørsett, and G. Wanner, Solving Ordinary Differential Equations I: Nonstiff Problems. Springer-Verlag, Berlin, 1993.Search in Google Scholar

[11] E. Hairer and G. Wanner, Solving Ordinary Differential Equations II: Stiff and Differential-Algebraic Problems. Springer Verlag, Berlin, 1996.10.1007/978-3-642-05221-7Search in Google Scholar

[12] E. L. Haseltine and J. B. Rawlings, Critical evaluation of extended Kalman filtering and moving-horizon estimation, Ind. Eng. Chem. Res. 44 (2005), 2451-2460.10.1021/ie034308lSearch in Google Scholar

[13] D.J. Higham and N. J. Higham, MATLAB Guide. SIAM, Philadelphia, 2005.10.1137/1.9780898717891Search in Google Scholar

[14] Z. Jackiewicz, General Linear Methods for Ordinary Differential Equations. John Wiley and Sons, Hoboken, 2009.10.1002/9780470522165Search in Google Scholar

[15] A. H. Jazwinski, Stochastic Processes and Filtering Theory, Academic Press, New York, 1970.Search in Google Scholar

[16] J. B. Jørgensen, P. G. Thomsen, H. Madsen, and M. R. Kristensen, A computationally efficient and robust implementation of the continuous-discrete extended Kalman filter. In: Proc. of the American Control Conference, New York, USA, pp. 37063712, Jul. 2007.10.1109/ACC.2007.4282549Search in Google Scholar

[17] T. Kailath, A. H. Sayed, and B. Hassibi, Linear Estimation, Prentice Hall, New Jersey, 2000.Search in Google Scholar

[18] P. E. Kloeden and E. Platen, Numerical Solution of Stochastic Differential Equations, Springer, Berlin, 1999.Search in Google Scholar

[19] M. R. Kristensen, J. B. Jørgensen, P. G. Thomsen, and S. B. Jørgensen, An ESDIRK method with sensitivity analysis capabilities, Comput. Chem. Eng. 28 (2004), 2695-2707.10.1016/j.compchemeng.2004.08.004Search in Google Scholar

[20] G. Yu. Kulikov, Cheap global error estimation in some Runge-Kutta pairs, IMA J. Numer. Anal. 33 (2013), 136-163.10.1093/imanum/drr060Search in Google Scholar

[21] G. Yu. Kulikov, Embedded symmetric nested implicit Runge-Kutta methods of Gauss and Lobatto types for solving stiff ordinary differential equations and Hamiltonian systems, Comput. Math. Math. Phys. 55 (2015), 983-1003.10.1134/S0965542515030100Search in Google Scholar

[22] G. Yu. Kulikov and M. V. Kulikova, Accurate numerical implementation of the continuous-discrete extended Kalman filter. IEEE Trans.Automat. Contr. 59 (2014), 273-279.10.1109/TAC.2013.2272136Search in Google Scholar

[23] G. Yu. Kulikov and M. V. Kulikova, The accurate continuous-discrete extended Kalman filter for continuous-time stochastic systems. Russ.J. Numer. Anal. Math. Modelling 30 (2015), 239-249.10.1515/rnam-2015-0021Search in Google Scholar

[24] G. Yu. Kulikov and M. V. Kulikova, High-order accurate continuous-discrete extended Kalman filter for chemical engineering. Eur. J. Contr. 21 (2015), 14-26.10.1016/j.ejcon.2014.11.003Search in Google Scholar

[25] G. Yu. Kulikov and M. V. Kulikova, The accurate continuous-discrete extended Kalman filter for radar tracking. IEEE Trans. Signal Process. 64 (2016), 948-958.10.1109/TSP.2015.2493985Search in Google Scholar

[26] G. Yu. Kulikov and M. V. Kulikova, The continuous-discrete extended Kalman filter revisited. Russ.J. Numer. Anal. Math. Modelling 32 (2017), 27-38.10.1515/rnam-2017-0003Search in Google Scholar

[27] G. Yu. Kulikov and S. K. Shindin, Adaptive nested implicit Runge-Kutta formulas of Gauss type. Appl. Numer. Math. 59 (2009), 707-722.10.1016/j.apnum.2008.03.019Search in Google Scholar

[28] M. V. Kulikova and G. Yu. Kulikov, Square-root accurate continuous-discrete extended Kalman filter for target tracking. In: Proc. of the 52-nd IEEE Conference on Decision and Control, Florence, Italy, pp. 7785-7790, Dec. 2013.10.1109/CDC.2013.6761125Search in Google Scholar

[29] M. V. Kulikova and G. Yu. Kulikov, Adaptive ODE solvers in extended Kalman filtering algorithms. J. Comput. Appl. Math. 262 (2014), 205-216.10.1016/j.cam.2013.09.064Search in Google Scholar

[30] F. L. Lewis, Optimal Estimation: with an Introduction to Stochastic Control Theory. John Wiley & Sons, New York, 1986.Search in Google Scholar

[31] P. S. Maybeck, Stochastic Models, Estimation and Control: Volume 1. Academic Press, London, 1979.Search in Google Scholar

[32] T. Mazzoni, Computational aspects of continuous-discrete extended Kalman filtering. Comput. Statist. 23 (2008), 519-539.10.1007/s00180-007-0094-4Search in Google Scholar

[33] J. B. Rawlings and D. Q. Mayne, Model Predictive Control: Theory and Design. Bob Hill Publishing, LLC, Madison, Wisconsin, 2013.Search in Google Scholar

[34] K. Reif, S. Günther, E. Yaz, and R. Unbehauen, Stochastic stability of the continuous-time extended Kalman filter. IEE Proc. Control Theory Appl. 147 (2000), 45-52.10.1049/ip-cta:20000125Search in Google Scholar

[35] A. Romanenko and J. A. A. M. Castro, The unscented filter as an alternative to the EKF for nonlinear state estimation: a simulation case study. Comput. Chem. Eng. 28 (2004), 347-355.10.1016/S0098-1354(03)00193-5Search in Google Scholar

[36] A. Romanenko, L. O. Santos, and P. A. F. N. A. Afonso, Unscented Kalman filtering of a simulated pH system. Ind. Eng. Chem. Res. 43 (2004), 7531-7538.10.1021/ie049899+Search in Google Scholar

[37] R. Schneider and C. Georgakis, How to not make the extended Kalman filter fail. Ind. Eng. Chem. Res. 52 (2013), 3354-3362.10.1021/ie300415dSearch in Google Scholar

[38] D. Simon, Optimal State Estimation: Kalman, H Infinity and Nonlinear Approaches. Wiley, Hoboken, New Jersey, 2006.10.1002/0470045345Search in Google Scholar

[39] M. Soroush, State and parameter estimation and their applications in process control. Comput. Chem. Eng. 23 (1998), 229-245.10.1016/S0098-1354(98)00263-4Search in Google Scholar

[40] D. I. Wilson, M. Agarwal, and D. W. T. Rippin, Experiences implementing the extended Kalman filter on an industrial batch reactor. Comput. Chem. Eng. 22 (1998), 1653-1672.10.1016/S0098-1354(98)00226-9Search in Google Scholar

Received: 2017-4-20
Accepted: 2017-11-26
Published Online: 2018-2-19
Published in Print: 2018-2-23

© 2018 Walter de Gruyter GmbH, Berlin/Boston

Downloaded on 15.1.2026 from https://www.degruyterbrill.com/document/doi/10.1515/rnam-2018-0004/html
Scroll to top button