Comparison of State Estimators For A Permanent
Comparison of State Estimators For A Permanent
Comparison of State Estimators For A Permanent
Abstract—A Permanent Magnet Synchronous Generator is The contribution of this paper is the comparison between
chosen as a case study for this comparison. A continous model the three different state observers in the case of the PMSG
with a discrete integrator is shown to be the best solution for the and the discussion about the behaviour of the KF and EKF,
discretization of the nonlinear model. Then, the Kalman Filter
(KF), the Extended Kalman Filter (EKF) and the Unscented when estimating the states of a process.
Kalman Filter are compared. The results are presented and it This paper is organized as follows: the model of the PMSG
is shown that the EKF is the best suited for this application. will be presented in Section II. The different discretization
Moreover, a discussion regarding the behaviour of the filters methods will be shown and compared in Section III. The
follows, where all are shown to act like proportional controllers.
algorithms of the KF, EKF and UKF will be presented in
Index Terms—Nonlinear Model, Discretization, Kalman Filter,
Extended Kalman Filter, Unscented Kalman Filter Section IV. The obtained results will be shown in Section
V, and they will be discussed. The conclusions and the
I. I NTRODUCTION perspectives will close this paper.
Amplitude [A]
to obtain a linear model [5]
idk+1 idk V 0
= Fk ∗ + Gk ∗ dk + Hk (2)
iqk+1 iqk Vqk
−2
where " #
Rs Ts
1− Ts nP ωmk
Ls
Fk = −4
−Ts nP ωmk 1 − RLs Ts s 0 2 4
Time [s]
6 8 10
" #
Ts
Fig. 2. The continuous model with the discrete FEI
Ls 0 0
Gk = Ts and Hk = − Ts nP ωk φ
0 L s Ls
Estimation error
and Ts is the sampling period. 4
However, any linearization might introduce errors in the
model. In [6] it is suggested to use the continuous model, 2
Amplitude [A]
but with the following discrete integrator
0
xk = xk−1 + ẋ ∗ T s;
where x is the state vector of the process.. −2
However, this integrator differs from the one used in
Simulink, in the Power Systems Toolbox. There, when the −4
0 2 4 6 8 10
PMSG is simulated in discrete mode, the continuous model is Time [s]
used but with a Forward Euler Integrator (FEI) [7]
Fig. 3. The continuous model with the discrete integrator from [6]
yk = xk
xk+1 = xk + Ts ∗ uk
A small error appears for the continuous model with a
where y is the output of the integrator, x is its internal state continuous integrator because of how Simulink compiles the
and u is its input, i.e. the derivative of the system states. schematic. Any collection of Power Systems blocks is approx-
The simulation results are presented in Table I. The errors imated by a state space model [7].
obtained with the continuous integrator and the FEI are similar,
because the sampling period was chosen to be very small,
10−6 . This is to prevent numerical instability in the simulation. Estimation error
In Fig. III and Fig. III, the methods appear to return the same 4
III and III are identical, they show that the discrete integrator
behaves like the continuous one, for the chosen sampling 0
−4
0 2 4 6 8 10
−12 Estimation error Time [s]
x 10
4
0
TABLE I
C OMPARISON OF THE DISCRETIZATION METHODS
475
IV. T HE S TATE E STIMATORS B. The Extended Kalman Filter
A. The Kalman Filter The EKF also introduces a linearization, through the TSE
of the state function. This linearization is used to compute
Although the linear model from (2) introduces significant the estimation of the state covariance matrix. However, these
modelling errors, it would be interesting to see if a KF, linearizations are computed only around the current estimated
which integrates this model, would achieve better results. The state, so the introduced error should be smaller.
Kalman Filter uses a linear model of the form The EKF uses the most general formulation of a nonlinear
x̂k+1 = Ak ∗ x̂k + Bk ∗ uk model
(3) x̂k+1 = f (x̂k , uk ) (9)
ŷk = C ∗ x̂k
yk = h(x̂k ) (10)
where x ∈ Rnx are the states of the process. u ∈ Rnu are
nx +nu nx
the inputs and y ∈ Rny are the outputs of the process. A ∈ where the state function is f : R → R and the
Rnx ∗nx is the state matrix, B ∈ Rnx ∗nu is the input matrix and measurement function is h : Rnx → Rny . For the EKF, the
C ∈ Rny ∗nx is the output matrix. The number of states is nx , model presented in (1) is already written in the required form.
the number of inputs is nu and the number of measurements The algorithm of the EKF is [10]
is ny . The sampling time is k. The ”ˆ” denotes an estimation. • Prediction phase
The model from (2) can be put into this form by combining
the matrices G and H and using a vector with three elements P̂k = Fk P̂k−1 FkT + Qk (11)
for the inputs • Update phase
Kk = P̂k HkT (Hk P̂k HkT + Rk )−1
" # " # Vdk (12)
idk+1 idk
= Ak ∗ + Bk ∗ Vqk (4) x̂∗k
iqk+1 iqk = x̂k + Kk ∗ (yk − ŷk ) (13)
φ
P̂k∗ = (I − Kk Hk )P̂k (14)
where " # where F ∈ Rnx ∗nx and H ∈ Rny ∗nx are the Jacobians of the
R s Ts
1− Ls Ts nP ωk state and measurement functions.
Ak = Fk = R s Ts
−Ts nP ωk 1− Ls C. The Unscented Kalman Filter
The UKF uses the Unscented Transform (UT) [11] to ac-
" #
Ts
Ls 0 0
Bk = count for the nonlinearity in the model. The current estimation
0 Ts
Ls − Ts nLPs ωk of the state is treated as the mean value of a probability
" # distribution, which has the same covariance as the states.
1 0 Depending on the implementation, either 2nx + 1 (for a full
C=
0 1 order UT) or nx + 1 (for a reduced order UT) points are
chosen around the current mean. Each sigma point has a
Then, the classical KF algorithm can be used [8] certain weight associated with it. There are multiple ways to
• Prediction phase choose the sigma points [12] [13].
The UKF uses the same model as in (1). The chosen (sigma)
P̂k = Ak P̂k∗ ATk + Qk ; (5) points are propagated through the state function. The new
points are used to compute the new estimate of the mean,
• Update phase i.e. the state, and its covariance. The new points are also
propagated through the measurement function, and their mean
Kk = P̂k C T (C P̂k C T + Rk )−1 (6)
is the estimated output of the system [12]. The next steps are
somewhat like the algorithm of the EKF.
x̂∗k+1 = x̂k + Kk (yk − C x̂k ) (7)
The classical formulation of the UKF uses the square root
of the state covariance matrix to compute the sigma points.
P̂k∗ = (I − Kk C)P̂k (8)
To calculate the square root, the covariance matrix must be
where P ∈ Rnx ∗nx is the state covariance matrix, Q ∈ Rnx ∗nx at least positive semi-definite, which is not guaranteed by the
and R ∈ Rny ∗ny are the covariance matrices of the process algorithm. A more stable version of the UKF, with a similar
and the measurement noises. K ∈ Rnx ∗ny is the Kalman gain degree of complexity is the Square Root UKF (SRUKF). Its
and y ∈ Rny are the measurements acquired from the process. algorithm is [12]
The ”∗ ” denotes the corrected estimation. • Choose the sigma points
For all the presented state estimators, the covariance matri- – Select the weights of the sigma points [13]
ces of the process and of the measurement noises are computed 1 − W0
as in [9]. Wi = (15)
2nx
476
where W0 is chosen arbitrarily. A positive value for i = 1, 2nx
moves the sigma points further away from the previ-
Ŝyk = cholupdate(Syk , Yk0 − ŷk , sign(W0 )) (27)
ous estimate of the state, while a negative one brings
them closer to the previous average. However, the – Calculate the covariance between the states and the
weights must obey the condition measurements
2nx
X 2nx
X
Wi = 1 P̂xyk = Wi (χki |k − x̂k )(Yki − ŷk )T (28)
i=0 i=0
477
Estimation error Estimation error
150 0.8
100
0.6
50
Amplitude [A]
0.4
0
Amplitude [A]
−50 0.2
−100
0
−150
−0.2
−200
0 2 4 6 8 10
Time [s]
−0.4
1
Estimation error
Amplitude [A]
0
0.06
−1 0.04
−0.02
Fig. 6. Estimation error for the Extended Kalman Filter
−0.04
478
with a discrete integrator produce a similar estimation error (in −6
x 10
Estimation error
5
the order of 10−12 and 10−13 ), so the added complexity of
the EKF is useless. However, when noise is added, the utility
of the EKF is obvious (Fig. 10 and Fig. 11). Zero mean noise
Amplitude [A]
with a variance of one was added to the measurement of the
voltages, which are used as inputs for the model. 0
479