Comparison of State Estimators For A Permanent

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

2018 22nd International Conference on System Theory, Control and Computing (ICSTCC)

Comparison of State Estimators for a Permanent


Magnet Synchronous Generator
Lavinius Ioan Gliga Houcine Chafouk Dumitru Popescu Ciprian Lupu
ACSE, ACS IRSEEM, ESIGELEC, UNIRouen ACSE, ACS ACSE, ACS
”Politehnica” University Normandy University ”Politehnica” University ”Politehnica” University
Bucharest, Romania Rouen, France Bucharest, Romania Bucharest, Romania
[email protected] [email protected] [email protected] [email protected]

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.

State estimators are one of the two possible approaches


to assure sensor redundancy, the other being state observers. II. T HE M ODEL OF THE P ERMANENT M AGNET
This redundancy is critical for the monitoring of sensors and S YNCHRONOUS G ENERATOR
different equipments, and for constructing residuals which may
be later used in fault diagnosis. The purpose of this paper is The dynamic model of a surface mounted PMSG is [4]
to lay a foundation for the latter.
Vd (t) − Rd Id (t) + np ωm (t)Lq Iq (t)
State observers and estimators are ideal candidates for I˙d (t) =
software sensors. The main difference between them is that Ld
Vq (t) − R I
q q (t) − np ωm (t)Ld Id (t)
the latter considers the statistic properties of the process. State I˙q (t) = − (1)
estimators use the covariance matrices of the states, the process Lq
and the measurement noises. They also do not require a priori np ωm (t)φ
knowledge of the process uncertainties or the impact of faults. Lq
They can also be more insensitive to noises.
The best-known state estimator is the Kalman Filter (KF). where Id , Iq are the currents (in A), Vd , Vq are the voltages (in
It is an optimal estimator for linear systems and is widely V), obtained using through the Park Transform. Rd , Rq are the
used. The Extended Kalman Filter (EKF) is the first nonlinear stator resistances (in Ω) and Ld , Lq are the inductances (in H).
extension of the classical KF. It is widely used in localization ωm is the angular speed of the rotor shaft (in rpm), φ is flux
and navigation, being the de facto standard. The Unscented linkage between the rotor and the stator (in W b) and nP is
Kalman Filter (UKF) is a further nonlinear extension of the the number of pole pairs. For simplicity, it can be considered
Kalman Filter. It is used in military and aeronautic appli- that Ld ≈ Lq = Ls and Rd ≈ Rq = Rs where Ls and Rs
cations, as it can have superior performance to the EKF, denote the stator inductance (in H) and resistance (in Ω) [5].
depending on the application [1]. The states are the currents and the inputs are the voltages and
The objective of this paper is to study the differences the angular velocity of the shaft.
between these three state estimators. The selected case study The model is nonlinear, as it contains the product between
is the Permanent Magnet Synchronous Generator (PMSG). a state and an input.
These are used in direct drive wind turbines [2], and their The model of the generator is continuous. The goal is to
motor counterparts are widely used in hybrid electric vehicles study the difference between the three filters in a discrete
[3]. Because the mathematical model is the same, and their simulation, to mimic the behaviour of the algorithms running
construction is similar, the results obtained in this paper can on a microcontroller. As a microcontroller is a discrete system,
be extended to motors. the model must be discretized.

978-1-5386-4444-7/18/$31.00 ©2018 IEEE 474


III. D ISCRETIZATION −12
x 10
Estimation error
4
It is difficult to discretize a nonlinear function. So, the most
appealing option is to use the Taylor Series Expansion (TSE) 2

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

results, but this is out of coincidence. The simulation was


checked, but the same results were obtained. Although Fig. 2
Amplitude [A]

III and III are identical, they show that the discrete integrator
behaves like the continuous one, for the chosen sampling 0

period (10−6 s). All the simulations were done in Matlab,


Simulink, using the Simscape/Power Systems toolbox. −2

−4
0 2 4 6 8 10
−12 Estimation error Time [s]
x 10
4

Fig. 4. The linearized model


2
Amplitude [A]

0
TABLE I
C OMPARISON OF THE DISCRETIZATION METHODS

−2 Model Integrator type Order of error


Continuous Continuous ≈ 10−13
−4 Continuous Discrete - FEI ≈ 10−13
0 2 4 6 8 10
Time [s] Continous Discrete - from [6] ≈4
Linearised N/A ≈4
Fig. 1. The continuous model with a continuous integrator

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

– Compute the scaling parameters – Find out the Kalman gain


r
nx Kk = (P̂xk yk /ŜyTk )/Ŝyk (29)
ηi = (16)
1 − Wi
– Update the state estimation
– Choose the actual sigma points
x̂∗k = x̂k + Kk (yk − ŷk ) (30)
χk−10 |k = x̂∗k−1 (17)
– Correct the square root of the state covariance matrix
χk−1i |k = x̂∗k−1 + ηi Ŝk−1

(18)
Sxk = cholupdate(Sxk , Kk Sŷk , −1) (31)
where i = 1, nx
V. R ESULTS AND D ISCUSSION
χk−1i |k = x̂∗k−1 − ηi Ŝk−1

(19)
The results of the comparison are shown and Fig. 5 - 7 and
where i = nx + 1, 2nx they are summarized in Table II.
• Prediction phase The noises in the model are introduced by the way of
– Propagate the sigma points through the state function functioning of the Simscape/Power Systems toolbox. Although
different electrical components are modelled, they are not
χki |k = f (χk−1i |k ) (20) simulated as in a Spice-type program. All the electrical blocks
– Compute the new state estimation and their connections are approximated by a state space model
[7]. To assure stability of this model, it is also advised to use
2nx
X a fix-step solver with a very low sampling period.
x̂k = Wi χki |k (21) The initial error of the SRUKF is not zero but is close to
i=0
10−4 . However, in time it quickly converges to ≈ 10−13 . This
– Calculate and then update the square root of the state is due to improper initialization, so the initial error is ignored.
covariance matrix As complexity, the KF and the EKF are the same. This is
because the Jacobian of the state function can be computed in
p p
Ŝxk = qr([ Wi (χki |k − x̂k ) Qk ]) (22)
advance. It depends on ωmk , but so does the state matrix of
for i = 1, 2nx . ”qr” refers to the QR decomposition. the linear model. The SRUKF is by far the most complex.
The EKF is the fastest of the three filters, being closely
Ŝxk = cholupdate(Sxk , χk0 |k − x̂k , sign(W0 ))
followed by the KF and then, by a large margin, the SRUKF.
(23)
The sigma point selection, the propagation of the 2nx + 1
”cholupdate” is the rank 1 update. The rank update
points through the state function, the QR decompositions and
formula is A1 = A ± x ∗ xT where A is the matrix
the Cholesky rank update slow it down considerably. The
obtained through a Cholesky factorization (QR in
slowdown of the KF might seem surprising. The linear model
this case) and x is a column vector. The sign to be
requires the computation of more mathematical operations
used in the update is the one of W0 .
- 27, in comparison with the nonlinear one - 21. As the
– Propagate the ”state” sigma points through the mea-
algorithms are the same in rest, the slowdown is due only
surement function
to the model.
Yki = h(χki |k ) (24) All filter present oscillations. While the EKF and UKF
assure a very low modelling error, the KF is plagued by rather
– Compute the new measurement estimation
2nx
X
ŷk = Wi Yki (25) TABLE II
i=0
C OMPARISON OF THE STATE ESTIMATORS

• Update phase Estimator Speed [% of EKF] Maximum error Complexity


– Compute and then update the square root of the KF 97.5 ≈ 194 Low
output covariance matrix EKF 100 ≈ 10−13 Low
p p SRUKF 40 ≈ 10−13 High
Ŝyk = qr([ Wi (Yki − ŷk ) Rk ]) (26)

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

Fig. 5. Estimation error for the Kalman Filter


0.138 0.1385 0.139 0.1395 0.14 0.1405 0.141 0.1415 0.142 0.1425
Time [s]

−13 Estimation error


x 10
2
Fig. 8. Zoom in of the estimation error of the KF, before the large spike

1
Estimation error
Amplitude [A]

0
0.06

−1 0.04

Amplitude [A] 0.02


−2
0 2 4 6 8 10
Time [s] 0

−0.02
Fig. 6. Estimation error for the Extended Kalman Filter
−0.04

large spikes. To understand what is happening, two zoomed in −0.06

views of the estimation error of the KF are used: one before


6.46 6.47 6.48 6.49 6.5
the large spike (Fig. 8) and one after the large spike (Fig. 9). Time [s]
Before the large spike, the error of the KF oscillates but
fairly slow, with certain pauses between each oscillation. In Fig. 9. Zoom in of the estimation error of the KF, after the large spike
time, due to accumulation of energy, large oscillations appear,
like the great spikes. After the large spike, the oscillation
frequency has increased, so all the energy causing the previous are present, but with a very high frequency.
large spikes is dissipated more quickly. A similar phenomenon The cause of these oscillations is the approximation made
can be seen for the EKF and UKF, where very small oscillation by Simulink. The electrical model of the wind turbine (which
includes a generator, a three level back to back converter,
and RL filter and a voltage source which represents the grid)
x 10
−13 Estimation error was made using the Simscape/PowerSystems toolbox. When
the Simulink diagram is compiled, all the electrical model
3 is approximated by a state space model. This introduces
differences between the model used in the state estimators
2
and the one used by Simulink. All filters try to compensate
Amplitude [A]

1 for this difference in a similar manner as a P controller. As the


KF uses a linearized model which is even further away from
0
the one used by Simulink, it is harder for it to achieve and
−1 maintain a null error. However, because both the state matrix
used by the KF and the Jacobian of the state function used
−2
by the EKF depend on time, together with the intrinsic design
−3 (varying amplification and state covariance matrix) of the two
0 2 4 6 8 10
filters, they manage to minimize the error. The UT transform
Time [s] helps the SRUKF to minimize the error. The EKF and SRUKF,
as they use the nonlinear model, are better.
Fig. 7. Estimation error for the Square Root Unscented Kalman Filter One might argue that both the EKF and the nonlinear model

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

VI. C ONCLUSIONS AND P ERSPECTIVES


A. Conclusions
−5
In the first part of this paper, it was proven the necessity for 0 2 4 6 8 10
Time [s]
using a nonlinear model, in the case of a PMSG. A nonlinear
model has an insignificant estimation error, while a linear one Fig. 11. Estimation error for the EKF, in the presence of noise
has an error with a amplitude around four. Moreover, it was
shown that using a discrete integrator with a continuous model
is the best approach. a good estimation. This comparison will be made in a future
Therefore, the resulting system is hybrid, having both a paper, while also considering model uncertainties (using a
continuous part (the model) and a discrete one (the state LPV model) and faults in the generator.
estimator).
R EFERENCES
Three state estimators were compared: the KF, the EKF
and the SRUKF. However, the EKF is about 2.5 times faster [1] G. Y. Kulikov and M. V. K., ”Do the Cubature and Unscented Kalman
Filtering Methods Outperform Always the Extended Kalman Filter?” in
than the SRUKF and its error is in the order of 10−13 as the IFAC-PapersOnLine, vol. 50, no. 1, pp. 3762-3767, July 2017.
SRUKF, which can be reasonably approximated by 0. The KF [2] L.I. Gliga, C. Lupu, H. Chafouk and D. Popescu, ”Innovations in fault
could not compensate completely for the linearization of the detection and tolerant control for a wind farm, using Wireless Sensor
Networks”, in Proceedings of the 18th International Carpathian Control
model. Because the new model required more mathematical Conference, pp. 332-336, Sinaia, Romania, May 2017
operations, it was also slower than the EKF. [3] K. Alameh, N. Cite, G. Hoblos and G. Barakat, ”Vibration-based Fault
Diagnosis Approach for Permanent Magnet Synchronous Motors”, in
The behavior of the different filters in the presence of the IFAC-PapersOnLine, vol. 48, no. 21, pp. 1444-1450, 2015
uncertainties generated by the functioning of Simulink and [4] L. I. Gliga, D. Popescu, H. Chafouk and C. Lupu, ”Extended Kalman
of the Simscape/PowerSystems toolbox was also examined. It Filter for a Permanent Magnet Synchronous Generator”, in the 14th
European Workshop on Advanced Control and Diagnosis, Bucharest,
was shown that the behaviors of the filters are similar to a Romania, November 2017.
proportional controller. [5] F. Morel, X. Lin-Shi, J. M. Retif, B. Allard and C. Buttay, ” A Com-
parative Study of Predictive Current Control Schemes for a Permanent-
B. Perspectives Magnet Synchronous Machine Drive,” in IEEE Transactions on Indus-
trial Electronics, vol. 56, no. 7, pp. 2715-2728, July 2009.
An interesting perspective would be the comparison of the [6] S. A. A. Shahriari, M. Raoofat, M. Dehghani, M. Mohammadi and M.
presented state estimators with state observers. The best known Saad, ”Dynamic state estimation of a permanent magnet synchronous
generator-based wind turbine,” in IET Renewable Power Generation,
nonlinear observers are the Nonlinear Unknown Input Ob- vol. 10, no. 9, pp. 1278-1286, October 2016.
server (NUIO) and the Sliding Mode Observer (SMO). While [7] Hydro Quebec, ”SimPowerSystems User’s Guide”, The MathWorks,
Kalman-type filters are suitable to estimate the state, their https://www.mathworks.com/help/releases/R13sp2/pdf doc/physmod/
powersys/powersys.pdf, 2003, Accessed 17.05.2018.
behavior is undefined in fault situations. The NUIO is designed [8] D. Stefanoiu and J. Culita, ”Kalman Filtering of Distributed Time
to consider the uncertainties in the process and the faults which Series,” in Proceedings of the 17th International Conference on Control
can occur, together with their impact on the states. The SMO Systems and Computer Science (CSCS), vol. 1, pp. 101-108, Bucharest,
Romania, May 2009.
has very good robustness, which, theoretically, should ensure [9] L.I. Gliga, H. Chafouk, D. Popescu and C. Lupu, ”Recursive Covariance
Estimation for an Extended Kalman Filter”, 2018 unpublished
[10] F. Gilbert, X.N. Zhang, D.M. Vilathgamuwa, ”A Sensor Fault Detection
Estimation error and Isolation Method in Interior Permanent Magnet Synchronous Motor
0.15 Drives based on Extended Kalman Filter”, in IEEE Transactions on
Industrial Electronics, vol. 60, no. 8, pp. 3485-3495, February 2013.
0.1
[11] R. Baesso Althof and M. Ferber, ”Efficient uncertainty analysis of
0.05 wind farms in the time domain using the Unscented Transform”, in
Amplitude [A]

Proceedings of the 8th International Symposium on Power Electronics


0 for Distributed Generation Systems (PEDG), Florianopolis, Brazil, July
2017
−0.05
[12] R. Van der Merwe and E.A. Wan, ”The square-root unscented Kalman
−0.1 filter for state and parameter-estimation”, in Proceedings of the In-
ternational Conference on Acoustics, Speech, and Signal Processing
−0.15 (ICASSP), vol. 6, pp. 3461-3464, Salt Lake City, UT, USA, May 2001
−0.2
[13] G. Terejanu, ”Unscented Kalman Filter Tutorial”, Department of Com-
0 2 4 6 8 10 puter Science and Engineering, University at Buffalo, Buffalo, New
Time [s]
York, Web-tutorial , 2008.
Fig. 10. Estimation error for the nonlinear model, in the presence of noise

479

You might also like