# Kalman Randomized Joint UKF Algorithm for Dual Estimation of States and Parameters in a Nonlinear System

• Accepted : 2014.11.14
• Published : 2015.05.01

#### Abstract

This article presents a new nonlinear joint (state and parameter) estimation algorithm based on fusion of Kalman filter and randomized unscented Kalman filter (UKF), called Kalman randomized joint UKF (KR-JUKF). It is assumed that the measurement equation is linear. The KRJUKF is suitable for time varying and severe nonlinear dynamics and does not have any systematic error. Finally, joint-EKF, dual-EKF, joint-UKF and KR-JUKF are applied to a CSTR with cooling jacket, in which production of propylene glycol happens and performance of KR-JUKF is evaluated.

# 1. Introduction

Recently, control of the operation of chemical reactors has been studied enormously [1-3]. There are many process control strategies, in which information about the state of the process is essential for calculating the control input. Since getting an accurate model for a nonlinear chemical process is difficult or probably impossible, it is necessary to obtain an approximate model. Therefore, a technique which provides the best estimation and compensates for the lack of knowledge of uncertainties in the process is required.

The most popular nonlinear estimator is the extended Kalman filter (EKF). The problems associated with EKF are attributed to the approximation introduced by the linearization .This is the idea of the extended Kalman filter (EKF), which was originally proposed by Stanley Schmidt , so that the Kalman filter can be applied to nonlinear problems . Since EKF estimates mean and covariance using first-order approximation of the system dynamics, it can be hard to tune and implement when dealing with significant nonlinearities and then exhibits divergence in extreme cases.

Unscented Kalman filter (UKF) overcomes this theoretical deficiency. The core of UKF is unscented transformation (UT). It uses a minimal set of determinate sample points (Sigma points) to completely assess the true mean and covariance of the states via UT. Studies show that UT is more accurate than linearization for propagating mean and covariance [7-12].

Although UKF is more accurate than EKF, it suffers from systematic error. To remove this systematic error, randomized unscented Kalman filter (RUKF) was suggested . The idea of RUKF is based on Bayesian recursive relation (BRR). BRR is a general solution for estimation problems and is used to compute probability density functions (pdfs) of states conditioned by the measurements. To propagate mean and covariance matrix, multidimensional Gaussian integral should be computed. An improved UT was proposed to randomly generate points for calculating this Gaussian integral. Studies have demonstrated that utilizing the improved UT enables RUKF to provide estimates of higher quality than UKF and CKF .

In addition, most processes have time-varying dynamics or unknown parameters, and since both the EKF and UKF are model-dependent approaches, their estimations may leave the optimal region or even diverge in the case of large amplitude variations. Thus, a dual estimation algorithm which estimates both the states and parameters simultaneously is very practical for handling time varying systems.

One of the first usages of dual estimation is combining both the state vectors and unknown parameters in a jointbilinear state-space representation , which is mentioned for linear dual Kalman. Another approach suggests two independent KFs . These works have considered problem of state estimation in linear systems. Joint-EKF was suggested to model unknown parameters in a model reference adaptive control framework . Dual-EKF  was a nonlinear extension of the linear dual Kalman approach. Although these filtering techniques have shown to perform better than the EKF , they do not perform as well as joint UKF in severe nonlinearity systems. Joint UKF provides a more accurate approximation, but suffers from containing a systematic error.

Nonlinear, time varying behaviour is common in chemical processes. CSTR (continuous stirred-tank reactor) is one of the significantly investigated benchmarks for nonlinear estimation . Nonlinear functions describing a CSTR are generally of exponential form due to the Arrhenius dependence of reaction rate on temperature .

In this paper, a new algorithm called KR-JUKF is presented. The KR-JUKF is derived from the combination of KF and RUKF and the concept of joint estimation. KRJUKF propagates mean and covariance of a nonlinear dynamic system using linear measurement equations. The proposed approach is suitable for time varying systems due to utilizing the concept of joint estimation. Also the combination of the KF and RUKF makes the proposed approach proper for online estimation. The advantage of KR-JUKF is to reduce the estimation error compared to existing algorithms. To show the merits of the proposed approach, dual estimation algorithms are utilized to estimate the state and unknown parameters of a highly nonlinear dynamic system. Joint EKF, dual EKF, joint UKF and KR-JUKF are applied to a jacketed CSTR and their performances are compared.

This paper is organized as follows: In section 2, concepts of parameter estimation and Joint-EKF and Joint-UKF are presented. The next section represents the algorithm of dual-EKF. In section 4, KR-JUKF is presented. The dynamic of CSTR is studied in section 5 and simulation results are presented in section 6. Finally, section 7 concludes the paper.

# 2. Parameter Estimation

The idea of state estimation can be extended to unknown parameter estimation, which is due to uncertainties in system dynamics . Parameter estimation was presented by Kopp and Orford . In this approach, unknown parameters are transformed into a new state by combining the states with parameters. Suppose that we have continuous-time nonlinear dynamic and nonlinear measurement equation with additive noise:

Where X(t) is the state vector, P is an unknown parameter vector, U(t) is the input and V and W are the measurement and system noises, respectively. V and W are assumed to be independent, white and Gaussian with zero mean and finite covariance matrix. If we artificially combine the unknown parameters and states into a new state vector as follows:

a new state space is resulted with the augmented state vector:

If the unknown parameters are assumed to be constant, then ṗ = 0 . Therefore, state space can be modified as:

Nonlinear filters such as EKF and UKF can be used to estimate the new state vector. This approach is called joint estimation. Joint-EKF, joint-UKF and KR-JUKF are obtained by using the joint estimation concept.

# 3. Dual EKF Algorithm

In this approach, two separate EKFs are used. One EKF estimates the states while the other estimates the unknown parameters, although two EKFs operate simultaneously. Fig. 1 shows how this algorithm works. Fig. 1.Schematic of Dual-EKF.

Possibility of convergence of dual-EKF is less than joint-EKF. In addition, lowering rank of used matrices can decrease burden of matrix's computational time, especially computation of inverse matrix. Suppose we have a discrete nonlinear dynamic system as follows:

Where Xk is the state vector, Uk Uk is the input, Pk is unknown parameter vector and Vk and Wk are the measurement and system independent white Gaussian noises, respectively. The initial condition for both filters will be set as follows:

For k = 1,2,…, the following are performed:

• Parameter time update

• State time update

• Parameter measurement update

• State measurement update

Computation of needs recursive derivation calculations :

If we suppose that the term is constant with respect to unknown parameters (P), then . This assumption is not really true, but is very accurate. So, we have a simple Dual-EKF . If there is a sever nonlinearity, then EKF techniques which are based on linearization may lead to inaccurate estimation. Joint-UKF algorithm estimates more accurate estimations than others.

# 4. KR-JUKF Algorithm

UKF is still only an approximate nonlinear estimator, in which mean and covariance matrix propagate with thirdorder accuracy. So, it contains systematic error due to higher orders . To remove this error, BRR is used. At the heart of BRR, it is necessary to compute multidimensional integrals which are in the form of Equation (28). The stochastic integration rule (SIR) is suitable for calculation of integrals with the following form :

where g(⋅) is an arbitrary nonlinear function and X ∈ ℝn is a random vector variable with Gaussian pdf, zero mean and finite covariance matrix . In the following two forms of SIR are presented. After that, based on each of the SIR formulations, the corresponding KRJUKF algorithm is proposed.

## 4.1 First form of SIR

In the first form, the number of iterations (Nmax) is a predefined value:

1. Set initial value of the integral 2. For N=1,2,…, Nmax perform the following:

• Generate a uniformly random orthogonal matrix .The random orthogonal matrix can be produced by using a product of appropriately chosen random reflections . • Generate a random number ρ(N) from the chi distribution ρ(N) = chi(n + 2) (The matrix Ψ(N) and scalar ρ(N) are regenerated in each iteration .) • Compute 2n points χi(N) and their weights:

where SX is square-root of the covariance matrix, PX = SXSTX and (ρ(N)SXΨ(N))i are the ith row of the matrix ρ(N)SXΨ(N)

• Compute J(N) and

3. The value of integral μ is Computation of μ using the above algorithm can be shown as . Assume that we have a discrete nonlinear dynamic with equations (6) and (7) and linear measurement equation with measurement noise of equation (9):

## 4.2 KR-JUKF (Algorithm 1)

KR-JUKF (Algorithm 1) which is based on the first form of SIR can be summarized as follows:

1. Primarily assumption will be as follows:

2. For k= 1,2,…, perform the following:

• Time update

• Measurement update

In Algorithm 1, the number Nmax is assumed large enough without any optimization. So, the value of Gaussian integrals can be calculated with maximum accuracy. But, it is possible for the value of Gaussian integral which is calculated by SIR to diverge from its real value and too large value assumption for Nmax increases computational time. The notations used in the first form of SIR and Algorithm 1 are defined in Table 1.

Table 1.SIR algorithm and KR-JUKF notation. ## 4.3 Second form of SIR

In this algorithm, instead of using Nmax, convergence error vector specifies the number of iterations. Norm-2 of convergence error vector is compared to a threshold convergence error (ε) . The iterations continue until norm-2 of convergence error vector becomes greater than the threshold convergence error. Using this approach leads to consuming less computational time, but decreases the accuracy of estimation. The second form of SIR which is regarded as time optimized SIR is as follows:

1. Set initial value of the integral 2. Perform the following: • Generate a uniformly random orthogonal matrix Ψ(N) • Generate a random number ρ(N) from the chi distribution ρ(N) = chi (n + 2) • Compute a set of points, their weights, J(N) and While 3. The value of integral μ is where ε is the threshold convergence error. A flowchart for the SIR algorithm is given in Fig. 2. Computation of μ using the above algorithm can be shown as: Fig. 2.Flowchart of first and second form of SIR.

## 4.4 KR-JUKF (Algorithm 2)

KR-JUKF (Algorithm 2) can be represented based on the time optimized SIR:

1. Use Equation (36) for primary assumption. 2. For k = 1,2,…, perform the following: • Time update

• For measurement updating, use Eqs. (39-41)

In several literatures, results demonstrate that the dual estimators can more effectively compute the system states in the case of unknown system parameters, compared to conventional ones [25-29]. Also, it is proved that the original UKF has a systematic error [13, 30]. In order to relax this defect, the RUKF is presented. Therefore, one can conclude that the RUKF estimates the system states more accurately compared to original UKF. However, RUKF needs more computational burden due to its iterative algorithms. Therefore, it can be concluded that our proposed KR-JUKF can estimate more accurately and more slowly than the original UKF.

# 5. System Dynamics

The chemical process employed in this paper is production process of propylene glycol in CSTR (Continuous Stirred Tank Reactor) with cooling jacket. In this CSTR, propylene oxide and water react in atmosphere pressure. The product of this reaction is propylene glycol. Since the reaction is exothermic, a coolant fluid circulates within the reactor jacket to maintain its temperature. Fig. 3 shows a simple flow-sheet diagram. Fig. 3.Flow sheet diagram of CSTR.

Mathematical model of the CSTR is given by four nonlinear differential equations as follows :

The control input consists of the cooling water flowrate, feed flow and product flow. Unknown vector and state vector can be defined as P = [x5 x6]T = [UAj E]T and X = [x1 x2 x3 x4]T = [Ca Tr Tj Vr]T . Therefore, state space equations can be written as:

where W1, W2, W3, W4 and R are system and measurement noises. Definition of parameters is presented in Table 2. Values of covariance of measurement noises are also presented in Table 3.

Table 2.CSTR Parameters. Table 3.Variance of measurement noises. # 6. Simulation Results

In this section, two simulations are presented to show the superiority of the proposed algorithms. The first experiment deals with a comparison of the proposed approach with other existing algorithms. The second example investigates and compares results of the two type of KR-JUKF.

## 6.1 Experiment 1

In Experiment 1, unknown parameters and states are estimated using joint-EKF, dual-EKF, joint-UKF and KRJUKF (Algorithm 1). Measurement noise characteristics are given in Table 3. The number of repetitions was chosen as Nmax=40. Values of MSE (Mean Square Error) of each state and also unknown parameters are presented in Table 4.

Table 4.MSE of states. Table 4 illustrates that KR-JUKF can estimate the unknown states and parameters more accurately than the others. Fig. 4 presents the time that each algorithm consumes per one stage for different initial values. Fig. 4 shows that joint-EKF is the fastest algorithm. The computational time of Dual-EKF is relatively the same as joint-EKF. But KR-JUKF needs more computational time than the other algorithms. The KR-JUKF algorithm estimates are significantly more accurate compared to the other ones. Although it needs more computational time, but the time of the states and parameters estimation is of the order of 10-3 seconds which makes the proposed algorithm suitable for online estimation. Fig. 4.Time of each algorithm.

Fig. 5-8 present the estimation error of each algorithm for each of states. Fig. 5.Error of state Ca. Fig. 6.Error of state Tr. Fig. 7.Error of state Tj. Fig. 8.Error of state Vr.

Figs. 5-8 show that the proposed approach greatly decreases the estimation error of the states compared to other algorithms. This is due to the usage of SIR to calculate the multi-dimensional Gaussian integrals appeared in the BRR algorithm. Figs. 9-12 show the real and the approximate value of each state for KR-JUKF (Algorithm 1). Fig. 9.Approximation of state Ca (KR-JUKF Algorithm 1). Fig. 10.Approximation of state Tr (KR-JUKF Algorithm 1). Fig. 11.Approximation of state Tj (KR-JUKF Algorithm 1). Fig. 12.Approximation of state Vr (KR-JUKF Algorithm 1).

Figs. 9-12 indicate that the proposed approach can effectively handle the state estimation issue of CSTR system with unknown system parameters.

## 6.2 Experiment 2

In this experiment, the variance of measurement noise is given in Table 5. Unknown parameters and states were estimated by using two algorithms of KR-JUKF. The number of repetitions is chosen as Nmax=40 and let the convergence error vector . Values of MSE of each state and unknown parameter and average time of each algorithm are given in Table 6.

Table 5.Variance of measurement noise. Table 6.MSE of states and average time per stage. Table 6 shows that the estimation accuracy of KR-JUKF Algorithms 1 and 2 are relatively similar. Algorithm 2 needs less computational time than Algorithm 1. This is due to the usage of the threshold convergence error instead of using pre-known number of repetitions. Figs. 13-16 show the errors of Algorithms 1 and 2 for each of states. These figures indicate that the Algorithm 1 provides more accurate estimations compared to the Algorithm 2. This is due to the fact that the Algorithm 1 involves higher number of iterations in measurement and time update. Fig. 13.Error of state Ca (KR-JUKF Algorithm 1 and 2). Fig. 14.Error of state Tr (KR-JUKF Algorithm 1 and 2). Fig. 15.Error of state Tj (KR-JUKF Algorithm 1 and 2). Fig. 16.Error of state Vr (KR-JUKF Algorithm 1 and 2).

# 7. Conclusion

In this paper, a novel nonlinear dual-estimation algorithm based on the fusion of the Kalman filter, randomized Unscented Kalman filter and dual estimation is proposed. The proposed algorithm is proper for time varying and severe nonlinear dynamics. Moreover, the computational time decreases in this approach compared to RUKF, which makes it suitable for online estimation. To show the estimation accuracy of the proposed approach, its performance is compared to the other existing dual estimators by applying the algorithms to a severe nonlinear exothermic CSTR with cooling jacket. The applied estimators are Joint-EKF, Dual-EKF, Joint-UKF and -KRJUKF (Algorithms 1 and 2). Simulations show that KRJUKF (Algorithm 1) estimates more accurately than the others. This is due to the propagation of the mean and covariance through a nonlinear function using SIR algorithm; however, it needs more computational time. KRJUKF (Algorithm 2) is an optimized method of KR-JUKF (Algorithm 1). The accuracy of Algorithm 2 is relatively equal to Algorithm 1 but needs less computational time.

#### References

1. Hanif Tahersima, Mohammadjafar Saleh, Akram Mesgarisohani and Mohammadhossein Tahersima, “Design of stable model reference adaptive system via Lyapunov rule for control of chemical reactor,” 3rd Australian Control Conference (AUCC), Fremantle, WA, pp. 348-353, 2013.
2. Majdi Mansouri, Hazem Nounou and Mohamed Nounou, “State estimation of a chemical reactor process model - A comparative study,” 10th Int. Multi- Conf. Syst., Signals & Devices, pp. 1-6, 2013.
3. Rudolph E. Kalman, “A new approach to linear filtering and prediction problems,” Trans. ASME-J. Basic Eng., pp. 35-45, 1960.
4. Hazem N. Nouou and Mohamed N. Nounou, “Application of delay-dependent adaptive control to a continuous stirred tank reactor,” IEEE Symp. Comput. Intel. Cont. Auto. (CICA), Singapore, pp. 140-147, 2013.
5. Don Simon, “Optimal state estimation,” New Jersey: John Wiley & Sons, 2006.
6. J. Bellantoni, K. Dodge, “A square root formulation of the Kalman-Schmidt filter,” AIAA Journal, vol. 5, pp. 1309-1314, 1967. https://doi.org/10.2514/3.4189
7. Andrey Romanenko, Jose A. Castro, “The unscented filter as an alternative to the EKF for nonlinear state estimation: a simulation case study,” Comput. Chem. Eng., vol. 28, no. 3, pp. 347-355, 2004. https://doi.org/10.1016/S0098-1354(03)00193-5
8. Andrey Romanenko, Lino O. Santos and Paulo AFNA Afonso, “Unscented Kalman filtering of a simulated pH system,” Ind. Eng. Chem. Res., vol. 43, pp. 7531-7538, 2004. https://doi.org/10.1021/ie049899+
9. Rudolph Van der Merwe, Eric A. Wan and Simon Julier, “Sigma-point Kalman filters for nonlinear estimation and sensor-fusion-applications to integrated navigation,” AIAA, pp. 2004-5120, 2004.
10. Eric A. Wan and Rudolph Van der Merwe, “The unscented Kalman filter for nonlinear estimation,” Center for Spoken Language and Understanding, OGI School of Science and Engineering, 2006, URL: http://cslu.cse.ogi.edu/nsel/ukf/.
11. Eric A. Wan, Rudolph Van der Merwe and Alex T. Nelson, “Dual estimation and the unscented transformation,” Neural Inf. Proc. Syst., vol. 12, MIT Press, Massachusetts, USA, pp. 666-672, 2000.
12. Lawrence Nelson and Edwin Stear, “The simultaneous on-line estimation of parameters and states in linear systems,” IEEE Trans. Auto. Cont., pp. 438-442, 1967.
13. Stefano Mariani and Aldo Ghisi, “Unscented Kalman filtering for nonlinear structural dynamics,” Nonlinear Dyn., vol. 49, pp. 131-150, 2007. https://doi.org/10.1007/s11071-006-9118-9
14. Jindrich Dunik, Ondrej Straka and Miroslav Simandl, “The Development of a Randomised Unscented Kalman Filter,” 18th IFAC World Congress, pp. 8-13, Milano, Italy, 2011.
15. Henry Cox, “On the estimation of state variables and parameters for noisy dynamic systems,” IEEE Trans. Auto. Cont., vol. 9, pp. 5-12, 1964. https://doi.org/10.1109/TAC.1964.1105635
16. S. C. Stubberud and M. Owen, “Artificial neural network feedback loop with on-line training,” Proc. IEEE. Int. Symp. Intell. Cont. Dearborn, August, pp. 514-519, 1996.
17. Eric A. Wan and Alex T. Nelson, “Dual Kalman filtering methods for nonlinear prediction, estimation, and smoothing,” Adv. in Neural Inf. Proc. Syst. Vol. 9, Cambridge, MA: MIT Press, 1997.
18. Stefano Mariani and Alberto Corigliano, “Impact induced composite delamination: state a parameter identification via joint and dual extended Kalman filters,” Comput. Methods Appl. Mech. Eng., vol. 194, pp. 5242-5272, 2005. https://doi.org/10.1016/j.cma.2005.01.007
19. Jacek Czeczot, “Balance-based adaptive control methodology and its application to the non-isothermal CSTR,” Chem. Eng. Proc., pp. 359-371, 2006.
20. William L. Luyben, “Chemical reactor design and control,” New Jersey: John Wiley & Sons, 2007.
21. Richard E. Kopp and Richard J. Orford, “Linear regression applied to system identification for adaptive control systems,” AIAA Journal, vol. 1, no. 10, pp. 2300-2306, 1963. https://doi.org/10.2514/3.2056
22. Vinary A. Bavdekar, R. Bhushan Gopaluni and Sirish L. Shah, “Evaluation of Adaptive Extended Kalman Filter Algorithms for State Estimation in Presence of Model-Plant Mismatch”, 10th IFAC Int. Symp. Dyn. Cont. Proc. Syst., Mumbai, India, 2013.
23. Eric A. Wan and Alex T. Nelson, “Dual extended Kalman filter methods,” Kalman filtering and neural networks, pp. 123-173, 2001.
24. Hossein Khodadadi and Hooshang Jazayeri-Rad, “Applying a dual extended Kalman filter for the nonlinear state and parameter estimations of a continuous stirred tank reactor,” Comput. Chem. Eng., vol. 35, no. 11, pp. 2426- 2436, 2011. https://doi.org/10.1016/j.compchemeng.2010.12.010
25. Alan Genz and John Monahan, “A Stochastic Algorithm for High Dimensional Integrals over Unbounded Regions with Gaussian Weight,” J. Comput. Appl. Math, vol. 112, no. 1, pp. 71-81, 1999. https://doi.org/10.1016/S0377-0427(99)00214-9
26. M.F. Samadi, S.M. Alavi, and M. Saif, “Online state and parameter estimation of the Li-ion battery in a Bayesian framework,” American Control Conference (ACC), pp. 4693-4698, June 2013, Washington, DC.
27. Nader Meskin, Hazem Nounou, Mohamed Nounou, and A. Datta, “Parameter Estimation of Biological Phenomena: An Unscented Kalman Filter Approach,” IEEE/ACM Trans. Comput. Biol. Bioinforma., Vol. 10, No. 2, 2013.
28. Li Meng, Liu Li, and S.M. Veres, “Aerodynamic Parameter Estimation of an Unmanned Aerial Vehicle Based on Extended Kalman Filter and Its Higher Order Approach,” Adv. Comput. Cont. (ICACC), 2nd Int. Conf., Vol. 5, pp. 526-531, March 2010, Shenyang, China.
29. Ji-Hoon Seung, Deok-Jin Lee and Kil-To Chong, “Parameter Estimation Method for Coupled Tank System using Dual Extended Kalman Filter,” 13th Int. Conf. Cont., Auto. Syst., pp. 1223-1228, Gwangju, Korea, October, 2013.
30. Ondrej Straka, Jindrich Dunik, and Mioslav Simandl, “Randomized unscented Kalman filter in target tracking,” 15th Int. Conf. Inf. Fusion (FUSION), pp. 503-510, Singapore, July 2012.

#### Cited by

1. Improved Stabilization of Nonlinear DC Microgrids: Cubature Kalman Filter Approach vol.54, pp.5, 2018, https://doi.org/10.1109/TIA.2018.2848959