72
Performance comparison of the Extended Kalman Filter and the Recursive Prediction Error Method Examensarbete utf¨ort i Reglerteknik vid Tekniska H¨ogskolan i Link¨oping av Jonas Wiklander Reg nr: LiTH-ISY-EX-3351 Link¨ oping 2003

Performance Comparison of the Extended Kalman Filter and

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Performance Comparison of the Extended Kalman Filter and

Performance comparison of theExtended Kalman Filter and the

Recursive Prediction Error Method

Examensarbete utfort i Reglerteknikvid Tekniska Hogskolan i Linkoping

av

Jonas Wiklander

Reg nr: LiTH-ISY-EX-3351Linkoping 2003

Page 2: Performance Comparison of the Extended Kalman Filter and
Page 3: Performance Comparison of the Extended Kalman Filter and

Performance comparison of theExtended Kalman Filter and the

Recursive Prediction Error Method

Examensarbete utfort i Reglerteknikvid Tekniska Hogskolan i Linkoping

av

Jonas Wiklander

Reg nr: LiTH-ISY-EX-3351

Supervisors: Geir Hovland (ABB)Mats Larsson (ABB)Markus Gerdin (ISY)

Examiner: Svante Gunnarsson

Linkoping 6th June 2003.

Page 4: Performance Comparison of the Extended Kalman Filter and
Page 5: Performance Comparison of the Extended Kalman Filter and

Avdelning, Institution Division, Department

Institutionen för Systemteknik 581 83 LINKÖPING

Datum Date 2003-06-06

Språk Language

Rapporttyp Report category

ISBN

Svenska/Swedish X Engelska/English

Licentiatavhandling X Examensarbete

ISRN LITH-ISY-EX-3351-2003

C-uppsats D-uppsats

Serietitel och serienummer Title of series, numbering

ISSN

Övrig rapport ____

URL för elektronisk version http://www.ep.liu.se/exjobb/isy/2003/3351/

Titel Title

Jämförelse mellan Extended Kalmanfiltret och den Rekursiva Prediktionsfelsmetoden Performance comparison of the Extended Kalman Filter and the Recursive Prediction Error Method

Författare Author

Jonas Wiklander

Sammanfattning Abstract In several projects within ABB there is a need of state and parameter estimation for nonlinear dynamic systems. One example is a project investigating optimisation of gas turbine operation. In a gas turbine there are several parameters and states which are not measured, but are crucial for the performance. Such parameters are polytropic efficiencies in compressor and turbine stages, cooling mass flows, friction coefficients and temperatures. Different methods are being tested to solve this problem of system identification or parameter estimation. This thesis describes the implementation of such a method and compares it with previously implemented identification methods. The comparison is carried out in the context of parameter estimation in gas turbine models, a dynamic load model used in power systems as well as models of other dynamic systems. Both simulated and real plant measurements are used in the study.

Nyckelord Keyword Extended Kalman filter, Parameter estimation, Recursive prediction error methods

Page 6: Performance Comparison of the Extended Kalman Filter and
Page 7: Performance Comparison of the Extended Kalman Filter and

Abstract

In several projects within ABB there is a need of state and parameter estimationfor nonlinear dynamic systems. One example is a project investigating optimisa-tion of gas turbine operation. In a gas turbine there are several parameters andstates which are not measured, but are crucial for the performance. Such pa-rameters are polytropic efficiencies in compressor and turbine stages, cooling massflows, friction coefficients and temperatures. Different methods are being testedto solve this problem of system identification or parameter estimation. This thesisdescribes the implementation of such a method and compares it with previouslyimplemented identification methods. The comparison is carried out in the contextof parameter estimation in gas turbine models, a dynamic load model used in powersystems as well as models of other dynamic systems. Both simulated and real plantmeasurements are used in the study.

Keywords: Extended Kalman filter, Parameter estimation, Recursive predictionerror method

i

Page 8: Performance Comparison of the Extended Kalman Filter and

ii

Page 9: Performance Comparison of the Extended Kalman Filter and

Acknowledgments

First of all I would like to express my gratitude to Geir Hovland and Mats Larssonat ABB Corporate Research in Dattwil, Switzerland, both for the work related aswell as the mountain related guidance.

My examiner, Svante Gunnarsson kindly put me in contact with ABB in thefirst place.

All the members of the Automation and Control and Utility Solutions groupsas well as the other practicants and thesis students at ABB who made my stay inSwitzerland a great one.

My family has always supported me on my adventures, also during this Swissone.

iii

Page 10: Performance Comparison of the Extended Kalman Filter and

iv

Page 11: Performance Comparison of the Extended Kalman Filter and

Notation

Symbols

h Alarm level in CUSUM testK(t) Kalman gainm Number of measurementsn Number of statesP (t) Parameter covariance matrixQ(t) Process noise covariance matrix, EKF tuning matrixR(t) Measurement noise covariance matrix, EKF tuning matrixs Number of parametersv(t) Process noise at time tV (t, θ) Cost function at time tw(t) Measurement noise at time tx(t) State vector at time tx(tk|tk−1) Estimate of state vector at time tk given data up to time tk−1

y(t) Measurement vector at time ty(tk|tk−1; θ) Prediction at time t given data up to time tk−1 and

parameter vector θε(t, θ) Prediction error vector at time tλ Forgetting factorν Test level in CUSUM testθ(t) Parameter vector at time tψ(t, θ) Gradient of prediction with respect to parameter vector θ

Operators and functions

E Expectation value∂f∂x Partial derivative of matrix f with respect to matrix xarg minθ V (tk, θ) Minimising argument θ to function V (t, θ)dxdθ Sensitivity matrix⊗ Kronecker productsvd Singular value decomposition

v

Page 12: Performance Comparison of the Extended Kalman Filter and

Abbreviations

AEKF Augmented Extended Kalman FilterCUSUM Cumulative SumEKF Extended Kalman FilterFACTS Flexible AC Transmission SystemsODE Ordinary Differential EquationPEPP Parameter Estimation for Power PlantsRPEM Recursive Prediction Error Method

vi

Page 13: Performance Comparison of the Extended Kalman Filter and

Contents

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Problem formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.3 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.4 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.5 Thesis outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 The parameterised model 3

3 Kalman filtering 53.1 The extended Kalman filter . . . . . . . . . . . . . . . . . . . . . . . 63.2 State augmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4 The recursive prediction error method 94.1 Gradients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104.2 The EKF vs. the RPEM . . . . . . . . . . . . . . . . . . . . . . . . . 11

5 Implementation 135.1 The central processing unit and its efforts . . . . . . . . . . . . . . . 13

5.1.1 The EKF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135.1.2 The RPEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

5.2 Programming environment . . . . . . . . . . . . . . . . . . . . . . . . 145.3 Matrix differential calculus . . . . . . . . . . . . . . . . . . . . . . . 14

5.3.1 The Kronecker product . . . . . . . . . . . . . . . . . . . . . 155.3.2 Derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

5.4 Numerical derivatives . . . . . . . . . . . . . . . . . . . . . . . . . . 155.5 Identifiability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165.6 Tuning of the filters . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

5.6.1 The EKF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175.6.2 The RPEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.6.3 The CUSUM test . . . . . . . . . . . . . . . . . . . . . . . . . 195.6.4 Initial values . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

vii

Page 14: Performance Comparison of the Extended Kalman Filter and

viii Contents

6 Experiments 216.1 Damped oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

6.1.1 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.1.2 Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216.1.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

6.2 Compressor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256.2.1 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256.2.2 Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266.2.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

6.3 Heat exchanger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306.3.1 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306.3.2 Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326.3.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

6.4 Power system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356.4.1 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356.4.2 Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376.4.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

7 Conclusions 497.1 Summary of the results . . . . . . . . . . . . . . . . . . . . . . . . . 49

A Algorithms 53A.1 State-Augmented Extended Kalman Filter . . . . . . . . . . . . . . . 53A.2 Adaptive Extended Kalman Filter . . . . . . . . . . . . . . . . . . . 54

Page 15: Performance Comparison of the Extended Kalman Filter and

Chapter 1

Introduction

1.1 Background

For the purpose of monitoring and diagnostics of gas turbines there are severalparameters of interest that cannot be measured directly in the plants. At ABBparameterised turbine models have been derived which are based on fundamentalphysical equations. In an ABB project, Parameter Estimation in Power Plants(PEPP), it is investigated how these models can be used together with availablemeasurements from the plants to provide tools for decision making in the plantoperation. For instance, the compressor in the gas turbine gets dirty due to particlesin the air being compressed. This has the effect that the efficiency decreases. Thecompressor then has to be washed, but this means that the turbine has to be takenout of operation for a period of time, with a production loss as consequence. Thedecision when it’s most economic to stop and wash could be made more rationalwith the monitoring of certain parameters in the compressor. The concept ofparameter monitoring also applies to other parts of the turbine plant, such as theheat exchanger used to extract the heat energy in the turbine’s exhaust gases.

In the PEPP project, one of the objectives was, besides applying the estimationmethods on the gas turbine model, to develop a toolbox easy to use for state andparameter estimation on arbitrary dynamic systems, since ABB operates in manyfields within power and automation. Several toolboxes for parameter estimationexist, for example in the Matlab and gPROMS environments. To our knowledge,however, there are no toolboxes available for tracking time-varying non-linear pa-rameters. The parameters of interest are usually parameters in a physical model(eg. heat and mass balances). Since the toolbox is intended for monitoring pur-poses, the key feature is the ability to track both slow (degradation) and fast(failures) changes in physical meaningful parameters. A black-box parameter es-timation toolbox would not satisfy these requirements. In addition, the existingparameter estimation toolboxes are often cumbersome to integrate into ABB prod-ucts. For these reasons, it was decided to develop a new toolbox from the bottomup.

1

Page 16: Performance Comparison of the Extended Kalman Filter and

2 Introduction

When the interest to investigate the use of the toolbox in a power networkapplication arose, it was decided to include this study as a part of the thesis, sinceit not only would be in line with the initial objective, but could also become acontribution. A brief background of this application follows:

In order to optimise transmission in power networks with respect to cost andsafety, it is of interest to monitor the load characteristics at certain points in thenetwork. The relation between load and voltage defines limits to the transferablepower at a given working point. When a disturbance occurs in the system, forinstance a disconnection of a power line, the new set point should be predicted, sothat proper action can be taken in time to keep the system in a safe state. If this isnot done correctly, the system could end up either at a stable working point withpoor utilisation of the network or, in the other extreme, at an unstable point witha (voltage) collapse as a possible consequence.

1.2 Problem formulation

Given is a model of a dynamic system and data collected from the plant. The modelcontains parameters to be determined by use of the measured data. The parameterscan be constant or time varying. This problem is known as system identification,and more specifically grey-box identification since structural knowledge about thephysical system is used when building the model. There exist different approachesto solve this problem, and this thesis will compare two of these: The ExtendedKalman Filter (EKF) and the Recursive Prediction Error Method (RPEM).

1.3 Objective

The goal is to implement the RPEM and compare it with the EKF. The comparisonwill be made regarding the estimation of parameters in test models as well as modelsused in current ABB projects; Parameter estimation for power plants and Widearea control of FACTS(Flexible AC Transmission Systems).

1.4 Limitations

Apart from the simple example system in chapter 2, the system models used toevaluate the different methods for the parameter estimation will be consideredgiven and no discussion of the background or underlying physics will be made.

1.5 Thesis outline

First, in chapter 2 the concept of grey-box modelling is introduced, followed bya theory section (chapters 3 and 4) where the different filters are described. Im-plementation issues are discussed in chapter 5 and results from simulations areexamined in chapter 6.

Page 17: Performance Comparison of the Extended Kalman Filter and

Chapter 2

The parameterised model

For the analysis and control of a system it is often of interest to have a mathematicalmodel that describes its behaviour. In any dictionary one can find definitions ofsystems in the technical sense: A regularly interacting or interdependent group ofitems forming a unified whole.1 If the interaction of these items, and thereby thesystem, is governed by laws of physics, for example thermodynamics or mechanics,this knowledge may provide us with mathematical equations to form the model.However, if the system is of a complex nature it may be difficult or impossibleto make a detailed model, and one will have to regard the system as a black boxwhere the choice of model structure is based on other approaches. If the insightinto the system is complete and the model is a perfect replica of the actual system,it is called a white-box model, and in between the black and the white we find theidea of grey-box modelling. As the shade suggests, this is a model where some, yetnot all, of the systems’s structure is known. The unknown part of the model maybe expressed in terms of a number of unknown parameters, and different values ofthese parameters may be tested to complete the model, to make the grey box aswhite as possible. The goal is to make the model reproduce the behaviour of thetrue system. This is known as system identification or parameter estimation, toadjust the parameters in the model so that the model reproduces the behaviour ofthe true system. The same principle applies to the case where the parameters arenot constant, in which case the task of the identification procedure is to track thechanges of the parameters.

The concept of grey-box modelling will here be illustrated with a simple exam-ple. Consider the damped oscillator in figure 2.1.

Newton’s second law gives us

mx = −kx− cx + f (2.1)

where x is defined in a coordinate system where x = 0 at the spring equilibrium.

1Encyclopaedia Britannica

3

Page 18: Performance Comparison of the Extended Kalman Filter and

4 The parameterised model

f

m

ck

Figure 2.1. Damped oscillator.

We define natural frequency and damping ratio as

ω =√

k/m and ζ =c

2√

km(2.2)

respectively, and write 2.1 on state space form as

x =[

0 1−ω2 −2ζω

]x +

[0ω2

]f (2.3)

y = x (2.4)

The problem we are facing is to determine the values of ω and ζ. At our disposalwe have measurements of u and y (possibly corrupted by noise), and we have themathematical model above, describing the system dynamics. The parameters thatare discussed here will be referred to as system parameters.

We will here consider two approaches to solve this problem, by Kalman filteringand by the use of a recursive prediction error method. These two methods have alot in common, noted in [13] where discrete-time systems were studied, in [14] aswell as in [2].

As in [2], from where the algorithms used for implementation have been taken,we will here consider continuous-time dynamic systems with discrete-time mea-surements. A general representation of the state space equations can be written:

x(t) = f(x(t), θ(t), u(t)) + v(t) (2.5)y(tk) = h(x(tk), θ(tk), u(tk)) + w(tk) (2.6)

Here x(t) is the state vector, y(t) is the vector of measurements, u(t) is the systeminput and v(t), w(tk) are the process and measurement noises respectively, withzero means and covariance matrices Ev(t)vT (t) = Q(t) and Ew(t)wT (t) = R(t).

Page 19: Performance Comparison of the Extended Kalman Filter and

Chapter 3

Kalman filtering

In 1809, as a result of studying the orbits of celestial bodies, Gauss ([4]) wrote:”. . . since all our measurements and observations are nothing more than approxi-mations to the truth, the same must be true of all calculations resting upon them,and the highest aim of all computations made concerning concrete phenomena mustbe to approximate, as nearly as practicable, to the truth. But this can be accom-plished in no other way than by a suitable combination of more observations thanthe number absolutely requisite for the determination of the unknown quantities.This problem can only be properly undertaken when an approximate knowledge ofthe orbit has been already attained, which is afterwards to be corrected so as tosatisfy all the observations in the most accurate manner possible.”

These ideas also constitute the rationale behind the Kalman filter, which wasderived on discrete-time form for linear dynamical systems by Kalman in 1960([9]). The year after, the continuous-time version was presented by Kalman andBucy ([10]). We will here give a description of the mixed version of the discreteand continuous filters that is required when dealing with continuous dynamics anddiscrete measurements.

As a starting point, we will consider the system (2.5-2.6), neglecting for themoment the parameter dependency and assuming that the functions f and h arelinear. The general system can then be written

x(t) = Ax(t) + Bu(t) + v(t) (3.1)y(t) = Cx(t) + w(t) (3.2)

where A, B and C are matrices of suitable dimensions. The process and measure-ment noise vectors v and w have zero means and variances given by

Q = Ev(t)vT (t) and R = Ew(t)wT (t) (3.3)

Given that these noises have gaussian distributions, the best (gives the lowestvariance of the prediction error) estimator of the states x(t) given the observationsy(t) is the Kalman filter, which we will describe here.

5

Page 20: Performance Comparison of the Extended Kalman Filter and

6 Kalman filtering

The prediction of the state x(tk+1|tk) given the observations y(tk) is obtainedby integrating the process function

˙x(t) = Ax(t) + Bu(tk) (3.4)

from tk to tk+1. We denote the covariance of the prediction error

P (t|t) = E[(

x(t)− x(t|t))((x(t)− x(t|t))T ]. (3.5)

P (tk+1|tk) is obtained by integrating

P = AP + PAT + Q (3.6)

over the same time interval as above. This is often referred to as the time updateor prediction step in the algorithm. As a new measurement is taken into account,the prediction and its corresponding covariance are updated in the measurementupdate or correction step:

x(tk+1|tk+1) = x(tk+1|tk) + K(tk+1)(y(tk+1)− Cx(tk+1|tk)) (3.7)

where K is the Kalman gain, given by

K(tk+1) = P (tk+1|tk)CT [CP (tk+1|tk)CT ) + R)]−1 (3.8)

and the covariance is updated as follows:

P (tk+1|tk+1) = P (tk+1|tk)− P (tk+1|tk)CT ××[CP (tk+1|tk)CT + R]−1CP (tk+1|tk) (3.9)

This algorithm needs to be initiated with values for the state vector x and thecovariance matrix P . The choice of these is discussed in 5.6.4. Then the quantitiesx and P can be updated as new measurements become available.

3.1 The extended Kalman filter

When the functions f and h are nonlinear, an often used approach is to linearisethe functions, thus achieving a linear system allowing the ordinary Kalman filter tobe used. If we make a first order Taylor expansion of f and h in the neighborhoodof the latest available state estimate x and take

A =∂f

∂x

∣∣∣x=x

and C =∂h

∂x

∣∣∣x=x

(3.10)

the recursive algorithm (3.4-3.9) can be used, updating the linearisations (3.10)at every time step using the latest available state estimates. This is the well-known extended Kalman filter (EKF). The implemented version doesn’t use thelinearisations in the state propagation (3.4), but uses the non-linear function (2.5)directly.

Page 21: Performance Comparison of the Extended Kalman Filter and

3.2 State augmentation 7

3.2 State augmentation

The concept of state augmentation is to include in the state vector unknown systemparameters to be estimated. We thereby say there is no formal difference betweena state and a parameter. Let the parameters be stacked in the vector θ. We write

x(t) =[x(t)θ(t)

](3.11)

The system parameters are modelled as stochastic variables, varying as

θ(t) = vθ(t) (3.12)

where vθ is zero mean gaussian noise with covariance Qθ = Evθ(t)vθ(τ)T δ(t − τ).This gives us the possibility to use knowledge about the nature of the parameters,if they are constant or varying, which can be used when tuning the correspondingentries in the augmented process noise matrix Q:

Q =[

Qx 00 Qθ

](3.13)

In this way, augmenting the state vector with the parameters, including (3.12) inthe set of process equations and extending the process noise covariance matrix, theKalman filter (or the extended Kalman filter) can be used to simultaneously trackthe states and the (time varying) parameters. Note that a system linear in thestates often becomes nonlinear using this approach. The convergence properties ofthis method applied on discrete-time systems was given in [13]. The implementedalgorithm of the state augmented extended Kalman filter has been taken from [2]and is given in A.1 for reference.

Page 22: Performance Comparison of the Extended Kalman Filter and

8 Kalman filtering

Page 23: Performance Comparison of the Extended Kalman Filter and

Chapter 4

The recursive predictionerror method

The theory concerning system identification in general is thoroughly described in[14]. The specific part we are interested in is referred to as the Recursive PredictionError Method (RPEM) and is more specifically covered in [15]. Applied to statespace models, this method is closely related to the EKF as pointed out in [13] and[2]. Here we will give a brief description of the RPEM in general and in section 4.1point out the major differences to the EKF.

This method is as the name suggests based on the prediction error, which isformed by subtracting the predicted output from the measured. Given the pastdata, i.e., inputs and measurements, the prediction at a certain point in time isobtained from a parameterised model and the algorithm adjusts the parametersin order to minimise the prediction error, thus tuning the model to reproduce thetrue system’s behaviour.

We takeε(tk, θ) = y(tk)− y(tk|tk−1; θ) (4.1)

as the difference between the prediction y(tk|tk−1; θ) and the system output y(tk).We sum these errors over time to measure how well the model describes the truesystem in a weighted least squares criterion

V (tk, θ) =12

k∑

i=1

λk−iεT (ti, θ)Λ(ti)−1ε(ti, θ) (4.2)

where λ is a forgetting factor used to assign smaller weight to older measurements,further discussed in section 5.6.2. Λ(ti) is a sequence of weighting matrices. Attime tk we choose the parameter vector that minimises this criterion, that is

θtk= arg min

θV (tk, θ) (4.3)

9

Page 24: Performance Comparison of the Extended Kalman Filter and

10 The recursive prediction error method

Using a Gauss-Newton search scheme to find the minimum of this function, includ-ing one more data point in every search iteration gives the following algorithm:

ε(tk) = y(tk)− y(tk) (4.4)

θ(tk) = θ(tk−1) + γ(tk)R−1(tk)ψ(tk)Λ(tk)−1ε(tk) (4.5)R(tk) = R(tk−1) + γ(tk)[ψ(tk)Λ(tk)−1ψT (tk)−R(tk−1)] (4.6)

Here γ(tk) is the adaptation gain. A common choice of forgetting profile is to letλ(tk) be constant (= λ) as in 4.2. λ and γ are related as follows:

γ(tk) =γ(tk−1)

γ(tk−1) + λ(4.7)

Equations (4.4) - (4.4) are usually implemented in a different form to avoid theinversion of the matrix R in 4.5. Using the matrix inversion lemma the algorithmtakes the following form [14]:

ε(tk) = y(tk)− y(tk) (4.8)

θ(tk) = θ(tk−1) + L(tk)ε(tk) (4.9)

L(tk) = P (tk−1)ψ(tk)[λ(tk)Λ(tk) + ψT (tk)P (tk−1)ψ(tk)]−1 (4.10)

P (tk) =

P (tk−1)− P (tk−1)ψ(tk)[λ(tk)Λ(tk) + ψT (tk)P (tk−1)ψ(tk)]−1ψT (tk)P (tk−1)λ(tk)

(4.11)

Apart from the parameters, the algorithm also carries their covariance matrix P .Moreover, the gradient of the prediction with respect to the parameter vector,

ψ(tk, θ) =dy(tk, θ)

dθ(4.12)

is needed. All we need to provide to be able to use this algorithm is thus a param-eterised predictor and its gradient with respect to the parameters. In the followingwe will discuss this further.

4.1 Gradients

The basic idea is now to use the Extended Kalman Filter discussed in section 3.1 totrack the (parameterised) system’s states. We also parameterise the EKF tuningmatrices Q and R. Instead of augmenting the parameters as in section 3.2, weuse the algorithm (4.8) - (4.11) with the EKF as the predictor, thus parameterisedboth through the parameters in the system itself and the parameters in the tuningmatrices. Since the prediction is obtained from (2.6), its gradient has the followingform

dy(tk, θ)

dθ=

∂h

∂x

dx(tk)

dθ+

∂h

∂θ(4.13)

Page 25: Performance Comparison of the Extended Kalman Filter and

4.2 The EKF vs. the RPEM 11

The gradient of the states with respect to the parameters, i.e. dxdθ

is referred toas the sensitivity in [2] and its propagation and update equations can be obtainedby differentiating the corresponding equations for the states themselves. We willhere only account for the derivation of the filter equations up to the point wherethe interesting connection to the EKF can be seen. For a full derivation of thealgorithm, please refer to chapter 4.4 in [2].

We take the state propagation equation (2.5) that is used to propagate the stateestimates and differentiate with respect to θ. Using the chain rule this gives thesensitivity propagation

d ˙x(t)

dθ=

∂f

∂x

dx(t)

dθ+

∂f

∂θ. (4.14)

For the sensitivity update we begin with the state update equation (3.7). Withε(tk+1) = y(tk+1)− Cx(tk) we differentiate with respect to θ and get

dx(tk+1)

dθ=

dx(tk)

dθ− d

dθ(K(tk+1)ε(tk+1)) (4.15)

and by using the product rule and noting that the gradient of the prediction errorε is the negative gradient of the prediction y, we get

dx(tk+1)dθ

=dx(tk)

dθ−K(tk+1)

dy(tk+1)

dθ+

dK(tk+1)

dθε(tk+1). (4.16)

It is the last term in the update equation, dK(tk+1)

dθ, that causes the complexity in

this version of the RPEM. Omitting this term in the continued derivation of thefilter gives an algorithm that strongly resembles the EKF ([13], [2]). The differencesbetween the two algorithms will be further discussed in section 4.2 below. Theimplemented RPEM is taken from [2] and is given in A.2 for reference.

4.2 The EKF vs. the RPEM

The close relationship between these two methods was investigated for discrete-time linear systems by Ljung ([13]) who showed that the missing term dK

dθis what

leads to the convergence problems of the EKF. Ljung started with the EKF andsuggested modifications to overcome this problem: To include the term and acceptthe increased algorithm complexity or to directly parameterise the gain matrix Kto make the computations of dK

dθless demanding, yet keeping the good asymptotic

convergence properties of the stochastic descent method.Also in the thesis of Bohn ([2]) this relationship has been examined, here in the

light of the matrix differential calculus applied to write the algorithms on vectorisedform. The starting point was the general RPEM and then both the version of thefilter with direct parametrisation of the Kalman gain matrix discussed in [13] aswell as the full RPEM was derived using his notation.

We can thus see the EKF as the RPEM applied to a state space model witha simplification in the gradient calculation. The simplification neglects the cou-pling between the parameters and the Kalman gain which gives rise to convergence

Page 26: Performance Comparison of the Extended Kalman Filter and

12 The recursive prediction error method

problems and also makes it impossible to parameterise the EKF tuning matricesas discussed below.

The performance of the EKF strongly depends on the tuning of the covariancematrices Q and R. In the case of a linear system with gaussian noise the optimalfilter is achieved when these matrices correspond to the covariance matrices of thenoise affecting the process and the measurements. Otherwise these matrices areto be seen as tuning parameters that are adjusted to make the algorithm work ina satisfactory way. In this version of the RPEM the elements in the mentionedmatrices are seen as filter parameters to be adapted by the filter itself (along withthe system parameters in (2.5-2.6).

The calculation effort needed to compute the term dKdθ

in (4.16) i.e. the deriva-tive of the Kalman gain matrix with respect to the parameters depends on theway the parameters affect the gain. In the Kalman filter this dependence is rathercomplex, and practically all the filter prediction and update equations (3.4-3.9)have to be differentiated with respect to θ to obtain dK

dθ.

To be able to incorporate prior knowledge about the nature of the (time vary-ing) system parameters it is of interest to have the possibility to parameterise thematrices Q and R. We have therefore chosen to implement the version where thefilter parameters enter the Kalman filter through the mentioned tuning matrices,instead of directly parameterising the gain. This version of the RPEM is the fil-ter that is compared with the state augmented EKF on the considered systems inchapter 6. The implementation of the RPEM is taken from Bohn ([2]), who callsit an Adaptive Extended Kalman Filter (AEKF). Both the RPEM and the EKFalgorithms are given in appendix A.

Page 27: Performance Comparison of the Extended Kalman Filter and

Chapter 5

Implementation

Here we will discuss practical issues that has been considered during the imple-mentation of the algorithms in question. We will also give an overview how to tunethe filters to alter their behaviour.

5.1 The central processing unit and its efforts

The fact that the recursive prediction error method is computationally demandingwas suggested in [13]:. . . will require an amount of computing that may be forbid-ding for higher order systems.”. Since the time of this statement the computerpower has increased by a factor of approximately 2(2003−1979)∗12/18 = 65536, soone would think that this no longer presents a problem.1

5.1.1 The EKF

The main computational burden in the EKF algorithm is the solving of the Riccatiequation. This equation grows like n2, where n is the number of states, and it hasto be numerically integrated between time steps. Measures to be taken can be toremove all the redundant entries in the covariance matrix before the propagationand make sure that the method used for the integration is efficient.

5.1.2 The RPEM

The RPEM suffers from even heavier computations than the EKF. This is dueto that first, the second derivatives, or the Hessian, of the system are needed andsecondly, the propagation of the sensitivity needs to be numerically integrated. Thesecond derivatives are not a big problem as long as function calls are cheap. The

1Gordon Moore stated in 1964 that computational power at a given cost would double every12 months, which later has been adjusted to 18 months. On the other hand, the somewhat ironiccounterpart to Moore’s law, Gate’s law, states that computer software gets half as fast duringthat same time period.

13

Page 28: Performance Comparison of the Extended Kalman Filter and

14 Implementation

numerical evaluation of the derivatives could of course be replaced by analyticalderivatives, but when the functions get complicated, the numerical approach ismore appealing in a setting where the user should be required to provide the modelonly, not its derivatives. The time consuming part is the sensitivity propagationequation, which grows like n+(1+n)(n+ s) where s is the number of parameters.The need for efficient ODE solvers is thus even more important for this filter. Herewe can also take away redundant entries in the matrices, but this will only reducethe number by approximately half and not alleviate the ”curse” of dimension.

5.2 Programming environment

The algorithms have been implemented in Matlab and in C++. The transferto the latter was made when the estimation of the larger systems became tootime-consuming for the use of Matlab to be efficient. For this purpose the freelydownloadable matrix library Newmat ([3]), has been used which incorporates mostof the basic matrix and vector algebraic functions. Unfortunately, the librarydoes not provide the use of sparse matrices, which would have been preferablewhen implementing the algorithms considered. For the propagation (numericalintegration) of states and covariance/sensitivity matrices we have used a fourthorder Runge-Kutta solver. We have also tested other, more complex solvers butfor the simulation examples in this thesis, no performance gain has been seencompared to the mentioned Runge-Kutta solver. The choice between the differentsolvers is to be made by the user regarding the nature of the differential equationsin the system to be estimated. The solvers listed in table 5.1 are available.

Euler1 Forward Euler integrationRungekutta4 4th order Runge-Kutta integrationAdaptiveRungeKutta Adapative Runge-Kutta from the Numerical Recipies

in C ([1])AdaptiveRosenbrock Adaptive Rosenbrock (Stiff solver), also from [1]LSODE Livermore Solver for Ordinary Differential Equations

(Non-stiff/stiff solver) ([7])

Table 5.1. Tested solvers for numerical integration. The solvers are listed according totheir complexity with Euler1 being the simplest.

5.3 Matrix differential calculus

The main contribution from the thesis of Bohn[2] is the application of matrixdifferential calculus that makes it possible to write all the equations on a completelyvectorised form. Matlab is known to be slow when it comes to for-loops and

Page 29: Performance Comparison of the Extended Kalman Filter and

5.4 Numerical derivatives 15

therefore Bohn’s implementation with Kronecker products combined with sparsematrices is appealing. Here some of the basics are mentioned to facilitate thereading of the notation in the algorithms. For a complete reference please refer tothe mentioned thesis by Bohn.

5.3.1 The Kronecker product

Let A and B be matrices of dimension m by n and p by q respectively. TheKronecker product A⊗B is the mp by nq matrix:

A⊗B =

A11B . . . A1nB...

. . ....

Am1B . . . AmnB

(5.1)

5.3.2 Derivatives

Let f(x) be a m by n matrix function and x its p by q matrix argument. Then thederivative df(x)

dx is defined as the np by mq matrix:

df(x)dx

=d

dx⊗ f(x) =

ddx11

. . . ddx1n

.... . .

...d

dxm1. . . d

dxmn

⊗ f(x) = (5.2)

=

df(x)dx11

. . . df(x)dx1n

.... . .

...df(x)dxm1

. . . df(x)dxmn

For the special case where f and x are vectors, dfdxT becomes the Jacobian matrix

and d2f(x)dxT dx

is the Hessian matrix.

5.4 Numerical derivatives

The definitions of the first and second derivatives have been taken from NumericalRecipes ([1]), and are defined as the limits when h → 0 of

∂f

∂x=

f(x + h)− f(x− h)2h

(5.3)

for the first derivatives, and

∂f

∂x∂y=

14h2

[[f(x + h, y + h)− f(x + h, y − h)]−− [f(x− h, y + h)− f(x− h, y − h)]] (5.4)

Page 30: Performance Comparison of the Extended Kalman Filter and

16 Implementation

for the second. The choice of h in the actual computation has been made accordingto the discussion in [1] considering machine accuracy.

As different configurations of the derivatives are used in the RPEM, the deriva-tive df

dxdx is first computed, then restacked to form the needed dfT

dxT dxand df

dxT dxT .The same goes for the mixed derivatives of df

dxdp . The first derivatives are simpler

to handle, as ( dfdxT )T = dfT

dx .

5.5 Identifiability

The quality of the estimates is defined by the certainty with which they are deter-mined. How do we know that the estimated parameters are unique? Even if theyconverge to certain values, it is of interest to know if these values are the only solu-tion or just one among many. A way of monitoring this property of the estimates isto evaluate the rank of the jacobian of the vector function containing 2.5 and 2.6.We stack these and differentiate with respect to the states and parameters and usethe following test:

min svd(d[f(t, θ); h(t, θ)]

d[x, θ])|(x,θ)=(x,θ) < ε (5.5)

and check this for some suitable value of ε > 0. Frequent failures of this test indicatethat θ and x can not be assessed from the available measurements. This methodis further described in [8]. In this implementation the indicators are computed ateven time intervals. A typical execution of the estimation algorithm gives a printoutas the one displayed in 5.2, where ”Trust1” is the criterion discussed above while”Trust2” is a version where the derivation in 5.5 only is made with respect to theparameters.

5.6 Tuning of the filters

The filter performance depends on the choices of tuning parameters such as initialvalues, weighting matrices etc., different choices to be made by the user. Thetime spent on tuning the filters must of course stand in proportion to the expectedperformance gain. Moreover, if a filter is extremely difficult to tune to a satisfactorybehaviour, there is also the question how robustly it can be implemented in a real-time setting.

If the parameters we are trying to estimate are not constant, we need to have thisin mind when tuning the filters. There is always a fundamental tradeoff between afilters tracking capabilities and its robustness to noise and disturbances. In otherwords, if we want a filter to respond quickly to changes, the estimates will be”noisy”.

First we will discuss filter specific tuning issues, followed by an overview of filterindependent choices. We will also indicate how to adjust the filters to comply withchanging parameters.

Page 31: Performance Comparison of the Extended Kalman Filter and

5.6 Tuning of the filters 17

5.6.1 The EKF

The main design variables of the EKF are the elements of the matrices Q andR, which correspond to the covariances of the process and measurement noiserespectively. For a linear system with gaussian noise the true covariance matricesgive the best performance, but this is not true for the non-linear case, where thesematrices are to be seen as tuning parameters to obtain a satisfactory behaviour ofthe filter. In addition, wrongly tuned covariance matrices can give biased parameterestimates ([13], [2]).

When looking at equation 3.6, it is clear that large values of Q gives a largeP and in turn a large Kalman gain, K. This means a large step size with which

Estimating Parameters with Filter: AEKFIndividual element adaptation of Q diagonalIndividual element adaptation of R diagonalNumber of filter parameters: 4Number of estimated system parameters: 1Size of sensitivity propagation matrix: 2x175 % completed. t=2.5 Trust1=868.816 Trust2=0.029454910 % completed. t=5 Trust1=877.919 Trust2=0.029315915 % completed. t=7.5 Trust1=876.271 Trust2=0.029358520 % completed. t=10 Trust1=856.031 Trust2=0.029996825 % completed. t=12.5 Trust1=871.249 Trust2=0.029510730 % completed. t=15 Trust1=863.933 Trust2=0.029716935 % completed. t=17.5 Trust1=880.885 Trust2=0.029205640 % completed. t=20 Trust1=879.413 Trust2=0.029249945 % completed. t=22.5 Trust1=872.462 Trust2=0.029474750 % completed. t=25 Trust1=874.819 Trust2=0.029387355 % completed. t=27.5 Trust1=879.117 Trust2=0.029243860 % completed. t=30 Trust1=879.387 Trust2=0.029234465 % completed. t=32.5 Trust1=850.732 Trust2=0.029785170 % completed. t=35 Trust1=868.356 Trust2=0.029614675 % completed. t=37.5 Trust1=867.269 Trust2=0.029628180 % completed. t=40 Trust1=859.001 Trust2=0.02990285 % completed. t=42.5 Trust1=871.785 Trust2=0.029460190 % completed. t=45 Trust1=877.746 Trust2=0.029288395 % completed. t=47.5 Trust1=842.633 Trust2=0.0300516100% completed. t=50 Trust1=870.232 Trust2=0.0295367Estimation Complete

Table 5.2. Example of typical printout of an estimation showing the trust indicators.

Page 32: Performance Comparison of the Extended Kalman Filter and

18 Implementation

the parameters2 are updated in 3.7, and the filter adjusts the parameters fasterto track changes. Sometimes there is prior knowledge about the nature of theparameters, for example that different parameters change more rapidly than others.This information could and should be used when tuning the Q matrix. The Rmatrix represents the confidence in the measurements, a large value means that weassume that the measurements are corrupted by noise with a large covariance, andwill make the gain K smaller in 3.6.

5.6.2 The RPEM

Theoretically, every element of the Q and R matrices can be parameterised as longas the number of unknowns does not exceed nm, where n is the number of statesand m the number of measurements ([2]). However, since the complexity of, andthereby the computation time needed to run the algorithm, heavily depends on thenumber of parameters, it is of interest to keep this number as small as possible.Therefore, in this implementation the user can choose between the following con-figurations: Every element of the diagonal of a matrix is parameterised, the matrixis parameterised using one parameter times an identity matrix, or the matrix isnot parameterised at all. Every combination of the above for each of Q and R isalso valid. If there is prior knowledge of some suitable scaling of the diagonals, thiscould also be used instead of the identity matrix in the one-parameter approachoption. The approach used in the experiments has been to first test with fullyparameterised diagonals, then lower the number of parameters until a decrease ofperformance is noticed.

Using a forgetting profile that gives more weight to recent measurements keepsthe algorithm focused on the present behaviour while ”forgetting” older data. Thisenters the RPEM in the tuning parameter λ. This parameter affects the wholealgorithm and it is not possible to include knowledge about differences in variationspeed between separate parameters.

Bohn [2] used prior knowledge about which parameter that would change andwhen, using this to apply a lower bound on the corresponding element in theparameter covariance matrix P just before the changes occurred. This method hasbeen implemented with the lower bound as a tuning parameter.

Ljung [14] suggests a method that resembles the Kalman filter state augmen-tation approach, to introduce a model of the parameter changes. The assumptionthat the parameters vary according to

θ = vθ with EvθvTθ = Qθ (5.6)

will have the impact on the RPEM algorithm that Qθ is added in the parametercovariance update equation (4.11), corresponding to the update equation of P in theimplemented algorithm. This has thus the same effect as the bounding discussed

2What said about parameters here also apply to the system states, since there is no formal dif-ference between states and parameters in the EKF. We choose, however, to refer to the parametersin this context.

Page 33: Performance Comparison of the Extended Kalman Filter and

5.6 Tuning of the filters 19

t Tλ

λend

λstart

λ

0

Figure 5.1. Plot of lambda over time.

above, to keep the parameter covariance matrix from getting too small, but thisapproach makes it easier for the user since the tuning becomes identical to thatof the EKF. Known differences between different parameters are in this way easyto incorporate in the filtering process, and we therefore propose this change to theimplemented algorithm, instead of the lower bounding of P discussed earlier.

In [14] as well as in [2] a forgetting factor, λ, is proposed for two purposes: firstto make the filter handle varying parameters and secondly, to improve its transientbehavior. These approaches are combined in the following way of computing λ attime tk:

λ(tk) = λend − (λend − λinit)e− 7tk

Tλ (5.7)

in this way, we can specify the start and end value, λinit and λend, and approx-imately over how many data λt will increase from λinit to λend, Tλ. Keepinglambda small in the beginning of the data set increases the initial convergencerate. A slightly different version of this is mentioned in [14] where it is motivated:”The reason is apparently that early information is somewhat misused and shouldcarry a lower weight. . . ”. The value λend corresponds to the λ mentioned in section4. The factor (7) in the exponent has been chosen to give Tλ the desired lengthscale. The principal appearance of lambda is displayed in Figure 5.1, and typicalvalues [14] for the parameters are λend ∈ [0.98 0.995] for a tracking filter, λend = 1for estimation of constant parameters and λinit ∈ [0.95 λend].

5.6.3 The CUSUM test

If a filter is working well, the residuals of the filter should be white noise. Thisindicates that all information has been extracted from the available data, thus thefilter is doing its very best. A way of testing whether a signal has an average thatexceeds a certain level is the CUSUM test described in [6], and the algorithm isgiven here:

g(t) = max(g(t− 1) + e(t)− ν, 0); alarm when g(t) > h (5.8)

Page 34: Performance Comparison of the Extended Kalman Filter and

20 Implementation

After a change in the parameters, the residuals will no longer be white, and theiraverage will be larger than the level ν. After an alarm, g(t) is set to zero, andappropriate action is taken to give the filter a chance to re-converge under thenew conditions. For the EKF, this action may be to change the tuning covariancematrices Q and R in some fashion and for the RPEM to reset the parameter co-variance matrix P to its initial (or some other) value. The extra design parametersthat have to be tuned are h and ν.

5.6.4 Initial values

The filters estimate the states of the system as well as system, and, in the RPEMcase, filter parameters. The filters also carry the parameter and state variances, andall these quantities need initial values for the first recursion. If typical values forthe parameters are known, these should be used. The start-up covariance matrixwill affect the step size in the beginning of the estimation and should reflect thecertainty of the initial parameter guess. In the RPEM, initial values for the filterparameters in the tuning matrices Q and R must also be given and often thesevalues are very uncertain. This should be reflected in the corresponding elementsof P which in most cases should be kept significantly larger than the elementscoupled to the system parameters.

Page 35: Performance Comparison of the Extended Kalman Filter and

Chapter 6

Experiments

Here the filters have been applied to a number of dynamical systems. For each sys-tem we first give a description of the model, then we account for how the data setshave been generated. The two filters are then applied to estimate the parameters,followed by a discussion of the results.

6.1 Damped oscillator

6.1.1 Model

The estimation algorithms are here applied to the test system described in section2.

6.1.2 Estimation

The system has been simulated using the parameter values ω = 10 and ζ = 0.1.The noise added during simulation was gaussian with covariance matrices

Q =[

1 00 1

]R =

[1 00 10

](6.1)

Up to a certain level of process and measurement noise the EKF gives correctestimates of the parameters. When more noise is included in the simulation, theEKF estimates becomes biased as shown in 6.1. The estimation was also carried outfor a longer period of time to verify that what we see is not only slow convergence.

In figure 6.2 the simulated (noisy) measurements together with the predictionsare plotted. The difference of these two signals, the prediction error, should bewhite noise when the filter is working, since they represent what the model can notpredict. This signal is displayed in figure 6.3, which is an indication of good filterbehaviour.

Under the exact same conditions the RPEM parameter estimates converge tothe correct values as shown in figure 6.4. The plots of measurements and RPEM

21

Page 36: Performance Comparison of the Extended Kalman Filter and

22 Experiments

prediction errors have been left out since they look identical to those of the EKF.Forthis estimation the diagonals of both matrices Q and R were parameterised givinga total of four filter parameters. These parameters are shown in figure 6.5.The timeneeded for the estimations were measured and not surprisingly the EKF beats themore complicated RPEM on this point. To estimate 100 seconds of system activity,the EKF finished in about 15 seconds, the RPEM needed 120 seconds.

6.1.3 Discussion

The EKF gives slightly biased estimates under certain conditions involving highnoise levels, still the prediction errors are white noise. The interesting point is thatthe RPEM gives correct estimates under the exact same conditions. Even for thissmall system the higher complexity of the RPEM results in an execution time ofapproximately eight times that of the EKF.

10 20 30 40 50 60 70 80 90 1009

9.5

10

10.5

Time (seconds)

Parameter Estimates

10 20 30 40 50 60 70 80 90 1000.05

0.1

0.15

0.2

0.25

Figure 6.1. Biased EKF parameter estimates. (The correct values are 10 and 0.1respectively.)

Page 37: Performance Comparison of the Extended Kalman Filter and

6.1 Damped oscillator 23

20 20.5 21 21.5 22 22.5 23 23.5 24 24.5 25−5

0

5

Time (seconds)

Measurements and filtered measurements

20 20.5 21 21.5 22 22.5 23 23.5 24 24.5 25−20

−10

0

10

20

Figure 6.2. Measurements (noisy) and EKF predictions (or filtered measurements) ofposition (top) and velocity of the spring.

0 5 10 15 20 25 30 35 40 45 50−4

−2

0

2

4

Time (seconds)

Prediction Errors

0 5 10 15 20 25 30 35 40 45 50−15

−10

−5

0

5

10

15

Figure 6.3. The EKF prediction errors (white noise).

Page 38: Performance Comparison of the Extended Kalman Filter and

24 Experiments

0 5 10 15 20 25 30 35 40 45 500

2

4

6

8

10

12

Time (seconds)

Parameter Estimates

0 5 10 15 20 25 30 35 40 45 500

0.05

0.1

0.15

0.2

0.25

Figure 6.4. The parameter estimates obtained with the RPEM

0 5 10 15 20 25 30 35 40 45 500

0.5

1

Time (seconds)

Estimated covariance matrix elements(Q and/or R)

0 5 10 15 20 25 30 35 40 45 500

0.5

1

0 5 10 15 20 25 30 35 40 45 500

0.5

1

0 5 10 15 20 25 30 35 40 45 500

2

4

6

Figure 6.5. Estimated diagonal elements of tuning matrices Q (top two) and R.

Page 39: Performance Comparison of the Extended Kalman Filter and

6.2 Compressor 25

6.2 Compressor

The compressor that delivers the pressurised air for the combustion in the gasturbine (figure 6.6) gets dirty due to particles in the input air. This causes anefficiency reduction which has to be alleviated through a wash of the compressor.The wash in turn means that the compressor (thus the entire turbine) has to beshut down for a period of time, an event that obviously costs money due to theproduction loss. On the other hand, low efficiency also costs money and this isthe tradeoff: At what level of efficiency is it economically justifiable to make thewash? The PEPP project aims to develop a tool that addresses this optimisationproblem, in which an estimate of the compressor efficiency over time is crucial.

Figure 6.6. Image of a gas turbine with the compressor located at the far right.

6.2.1 Model

A parameterised model of the compressor taken from [5] has the state equations

m(t) =A

L

(p0(t)− p(t)

)(6.2)

p(t) =a2

Vp

(m(t)− kt

√p(t)− pamb(t)

), (6.3)

Page 40: Performance Comparison of the Extended Kalman Filter and

26 Experiments

and the following measurement equations

tac(t) =tis(t)− tamb(t)

η + tamb(t)(6.4)

tit(t) =ff (t)Cg(t) + cptac(t)m(t)

ff (t)cp2 + m(t)cp, (6.5)

where

tis(t) = tamb(t)(

p0(t)pamb(t)

)κ−1κ

. (6.6)

For further reference to the model please refer to [5]. The quantities in theequations above are listed in table 6.1.

States: m(t) Compressor mass flowp(t) Plenum pressure

Inputs: pamb(t) Ambient pressurep0(t) Pressure downstream compressortamb(t) Ambient temperatureCg(t) Fuel heat valueff (t) Fuel mass flow

Measurements: tac(t) Temperature after compressortit(t) Turbine inlet temperature

Compressor specific A Duct areaconstants: L Duct length

a Inlet stagnation sonic velocityVp Plenum volumekt Throttle gainκ Specific heat ratioη Isentropic efficiency

Physical constants: cp Specific heat for aircp2 Specific heat for gas

Table 6.1. List of the quantities in the compressor model 6.2-6.6

6.2.2 Estimation

Real plant measurements have been used for this estimation. As discussed above,the parameter we want to estimate is the compressor efficiency, η. The EKF

Page 41: Performance Comparison of the Extended Kalman Filter and

6.2 Compressor 27

estimate is plotted in figure 6.7. The RPEM gives a somewhat smoother estimateshown in figure 6.8. When we look at the predictions and measurements we cansee that the RPEM (figure 6.10) reproduces one of the measurements better thanthe EKF (figure 6.9).

0 500 1000 1500 2000 2500 3000 3500 4000 4500 50000.5

0.55

0.6

0.65

0.7

0.75

0.8

0.85

0.9

Figure 6.7. Estimated efficiency (η) with the EKF

6.2.3 Discussion

Here we have tested the filters on the compressor model where we have estimatedthe efficiency to be used in the compressor wash optimisation algorithm. Thefilters show a slight difference regarding the output predictions, but it is hard tosay whether this is a matter of tuning or not.

Page 42: Performance Comparison of the Extended Kalman Filter and

28 Experiments

0 500 1000 1500 2000 2500 3000 3500 4000 4500 50000.5

0.55

0.6

0.65

0.7

0.75

0.8

0.85

0.9

Figure 6.8. Estimated efficiency (η) with the RPEM

0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000750

800

850

900

950

1000

0 500 1000 1500 2000 2500 3000 3500 4000 4500 50001350

1400

1450

1500

1550

1600

1650

Figure 6.9. Measurements and EKF predictions

Page 43: Performance Comparison of the Extended Kalman Filter and

6.2 Compressor 29

0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000

780

790

800

810

820

0 500 1000 1500 2000 2500 3000 3500 4000 4500 50001320

1340

1360

1380

1400

1420

1440

Figure 6.10. Measurements and RPEM predictions

Page 44: Performance Comparison of the Extended Kalman Filter and

30 Experiments

6.3 Heat exchanger

The exhaust from the gas turbine is led through a heat exchanger to make useof the surplus heat energy. This is done to increase the overall efficiency of theplant. It is here investigated how the filters can be used to detect faults in the heatexchanger by monitoring of certain parameters. A fault is simulated by a changein the heat transfer coefficient between steam and metal, Ks and this example willbe used to study different ways of dealing with parameter changes. Only simulateddata are used.

6.3.1 Model

The heat exchanger model is built up from sub models, each sub model representinga pipe. The configuration of a model with two pipes is illustrated in figure 6.11.

Gas

Exhaust gas

-Q1

Metal

Tm1

-Q1

Steam

Steam

?Ps1

?Ts1

6fs1

6Pg1

6Tg1

?fg1

Gas -Q2

Metal

Tm2

-Q2

Steam

? ?

6

?Ps2

?Ts2

6fs2

6 6

?

6Pg2

6Tg2

?fg2

Pipe 1

Pipe 2

Figure 6.11. Illustration of heat exchanger model

The dynamics of each pipe are governed by the following equations:

ρ(t) =1Vs

(fi(t)− fo(t)

)(6.7)

Ts(t) =1

ρVs

(Tsi(t)fi(t)− Ts(t)fo(t) + Q(t)/cs − ρ(t)VsTs(t)

)(6.8)

Tg(t) =1

ρgVg

((Tgi(t) − Tg(t)

)fg(t)−Q/cg

). (6.9)

Page 45: Performance Comparison of the Extended Kalman Filter and

6.3 Heat exchanger 31

Two states are measured, Ts and Tg, and we also have two measurement equations:

fs(t) = fr

√Pi(t)Po(t)

− 1 (6.10)

Tm(t) =Kgfg(t)0.6Tg(t) + Ksfs(t)0.8Ts(t)

Kgfg(t)0.6 + Ksfs(t)0.8(6.11)

and static relationsQ(t) = Kg

(Tgi(t)− Tm(t)

)fg(t)0.6 (6.12)

Tgo(t) = Tgi(t)− Q(t)fg(t)cg

. (6.13)

The variables and constants are listed in table 6.2

States: ρ(t) Steam densityTs(t) Steam temperatureTg(t) Gas temperature

Inputs: Tgi(t) Input gas temperatureTsi(t) Input steam temperaturefg(t) Gas flowPi(t) Input steam pressurefo(t) Output steam flow

Measurements: Tm(t) Metal temperaturefi(t) Input steam flow

Signals in static relations: Tgo(t) Gas temperature after heat exchangerQ(t) Heat from gas path

Constants: ρg Gas densityVs Steam volumeVg Gas volumefr Friction coefficientcs Specific heat for steamcg Specific heat for gasPo Output steam pressureKg Heat transfer coefficient gas to metalKs Heat transfer coefficient metal to steam

Table 6.2. List of quantities in the heat exchanger model (6.7)-(6.13).

Page 46: Performance Comparison of the Extended Kalman Filter and

32 Experiments

6.3.2 Estimation

Only simulated data have been used in this estimation. Measurement noise hasbeen added. Here we estimate the heat transfer coefficients Ks and Kg in twopipes. At time 1000 a change in Ks in the first pipe is simulated, corresponding toa sudden fault in the pipe. The parameter changes from a value of 8000 to 6500.Two different tunings of the EKF have been tested to point out the tradeoff betweentracking capability and noise sensitivity. The parameter estimates from a slow EKFare shown in figure 6.12. The filter tracks the change correctly. The result froma faster filter is displayed in figure 6.13. Here the filter reacts more rapidly to thechange, at the cost of a higher noise level in the parameter estimates. The RPEMhas been tested using two approaches for the tracking of the changing parameter. Infigure 6.14 bounding of the matrix P has been used and this results in a behavioursimilar to the faster EKF. The filter tracks the change quite well, but the estimatesare noisy. The CUSUM test has been tried and the resulting parameter estimatescan be found in figure 6.15. Here the estimates do converge nicely yet the filtermanages to track the change in the first parameter. On the other hand we cansee that the estimates of the constant parameters are also affected by the changes.In these estimations all parameters have been treated the same way. Knowledgeabout which parameter that would change has not been used, since it would beunrealistic to assume that one would know in which of the pipes the fault wouldoccur.

The average execution times for these estimations were 30 seconds for the EKFand 890 seconds for the RPEM.

6.3.3 Discussion

The fundamental tradeoff between the tracking capability and the noise robust-ness has been displayed. Both filters give correct estimates of the parameters andhandle the case where parameters change. Since the RPEM is designed to esti-mate constant parameters, measures have to be taken when parameters change.Two approaches have been evaluated, to apply a bound to the matrix Ppp and theCUSUM test. The CUSUM test turned out to be rather difficult to tune, but whenit is working satisfactorily it is clearly an improvement to the algorithm. The es-timation with the RPEM takes approximately 30 times longer than with the EKFfor this system size.

Page 47: Performance Comparison of the Extended Kalman Filter and

6.3 Heat exchanger 33

0 200 400 600 800 1000 1200 1400 1600 1800 20006000

7000

8000

0 200 400 600 800 1000 1200 1400 1600 1800 20007500

8000

8500

0 200 400 600 800 1000 1200 1400 1600 1800 20006500

7000

7500

0 200 400 600 800 1000 1200 1400 1600 1800 20006500

7000

7500

Figure 6.12. EKF parameter estimates

0 200 400 600 800 1000 1200 1400 1600 1800 20006000

7000

8000

0 200 400 600 800 1000 1200 1400 1600 1800 20007500

8000

8500

0 200 400 600 800 1000 1200 1400 1600 1800 20006500

7000

7500

0 200 400 600 800 1000 1200 1400 1600 1800 20006500

7000

7500

Figure 6.13. EKF parameter estimates

Page 48: Performance Comparison of the Extended Kalman Filter and

34 Experiments

0 200 400 600 800 1000 1200 1400 1600 1800 20006000

7000

8000

0 200 400 600 800 1000 1200 1400 1600 1800 20007500

8000

8500

0 200 400 600 800 1000 1200 1400 1600 1800 20006500

7000

7500

0 200 400 600 800 1000 1200 1400 1600 1800 20006500

7000

7500

Figure 6.14. RPEM parameter estimates with bounding of P

0 200 400 600 800 1000 1200 1400 1600 1800 20006000

7000

8000

Parameter Estimates

0 200 400 600 800 1000 1200 1400 1600 1800 20007500

8000

8500

9000

0 200 400 600 800 1000 1200 1400 1600 1800 20006500

7000

7500

0 200 400 600 800 1000 1200 1400 1600 1800 20006500

7000

7500

Figure 6.15. RPEM parameter estimates with the CUSUM test

Page 49: Performance Comparison of the Extended Kalman Filter and

6.4 Power system 35

6.4 Power system

For protection, control and analysis of power systems it is of interest to be ableto estimate the characteristics of the connected load at certain points in the net-work. To be able to operate closer to the limits thus transferring as much poweras possible is interesting from an economical point of view, especially with thepresent deregulation of the power supply utilities that presents new demands oncost efficiency. The structure and voltage levels of one part of the power systemin southern Sweden is shown in figure 6.16. The points we are interested in arethe load buses that are indicated by an arrow with the text ”load”. The activeand reactive load demands acting on such a bus are considered to be dynamicallyrelated to the bus voltage. Hill and Karlsson [11] have proposed an aggregatedload model that describes this load-voltage relation in the bus. Here we will makea feasibility test to see if the parameters in their model can be estimated with thestudied filters, and if so, compare the filters in accordance with the objective of thethesis.

Figure 6.16. The model structure of a part of the power network in the south ofSweden. (The abbreviations stand for Tomelilla, Jarrestad and Ostra Tommarp.)

6.4.1 Model

Since the load consists of a great number of different devices such as lighting,heating and motors and the measurements are affected by tap changers and othercontrol devices it is virtually impossible to construct a model based on physical lawsdue to the complexity and size of the system. The dynamical model consideredin [11] is a combination of an aggregated static power dependency of voltage thatdescribes the response in active or reactive power after a change in the voltage:

P (t) = P0

(V (t)V0

(6.14)

and first order dynamics that describe the observed power recovery. For furtherreference to the origin of the model, please refer to [11]. The model has the following

Page 50: Performance Comparison of the Extended Kalman Filter and

36 Experiments

structure:

xp(t) = P0

[(V (t)V0

)αs −(V (t)

V0

)αt]− xp(t)

Tp(6.15)

xq(t) = Q0

[(V (t)V0

)βs −(V (t)

V0

)βt]− xq(t)

Tq(6.16)

Pl(t) =xp(t)Tp

+ P0

(V (t)V0

)αt

(6.17)

Ql(t) =xq(t)Tq

+ Q0

(V (t)V0

)βt

(6.18)

Note that the equations for active and reactive power are identical and decou-pled. Unlike the active, the reactive nominal load Q0 is not always positive, and thesituation where it is zero, or close to zero can give rise to problems as mentionedin [16]. The quantities in the model are listed in table 6.3.

States: xp(t) Active power recoveryxq(t) Reactive power recovery

Inputs: V (t) Supply voltage

Measurements: Pl(t) Active power consumtionQl(t) Reactive power consumption

Parameters: V0 Pre-fault supply voltageP0 Active power consumption at pre-fault voltageQ0 Reactive power consumption at pre-fault voltageαs Steady state active load-voltage dependanceαt Transient active load-voltage dependanceβs Steady state reactive load-voltage dependanceβt Transient reactive load-voltage dependanceTp Active load recovery time constantTq Reactive load recovery time constant

Table 6.3. List of quantities in the load model

This model has been identified in field tests in the power network in southernSweden in [11] and an approach with a linearised model and automated identifica-tion has been developed in [16]. These identification procedures are both based onanalysing a step response in the load after a step has been applied in the voltage.Then V0, P0 and Q0 are chosen as the pre-step values of V , Pl and Ql respectively.In the first approach the parameters αt was then computed using the value of Pl

immediately after the step, and finally the estimates of αs and Tp were obtained

Page 51: Performance Comparison of the Extended Kalman Filter and

6.4 Power system 37

using a least-squares method (The same goes for the corresponding reactive partof the model). In the second approach the system was first linearised around theworking point U0 and then the linear parameters were estimated using a least-squares method and then the original parameters were extracted from the linearestimates through an iterative scheme. The automation in this approach consistsof detecting steps of a certain quality in the input, i.e the voltage, and thereafterfitting the model to the step response in the mentioned manner.

The study here aims to investigate if it is possible to use methods that would becontinually active, i.e., not event triggered and estimate the parameter using theever-present small variations in the measured voltage. The reason for estimatingthe parameter values is to be able to forecast the steady-state level of the loads ata time directly after the step. This will let us predict a dangerous situation in thenetwork, and then use the time before the load recovers to take action to preventan unwanted situation. It is clear that a step caused by a tripped transmissionline is not a suitable starting point for the estimation since that would be the timeto have access to the estimated parameters. For on-line use, it is thus imperativethat it be possible to estimate the parameters using only minor excitations in thevoltage. In [11], steps of a magnitude of 10% of the initial voltage level were used.The automated scheme in [16] triggered the estimation procedure on voltage stepsof 1.6% or higher.

6.4.2 Estimation

No complete sets of real data from actual operation have been available for thisestimation. We have studied two ways to generate the data, referred to here as testcases. In the first test case a simplified system (6.17) has been used to generate thedata in Modelica, where only step signals have been used as system inputs and tosimulate parameter changes. The second test case has been a model of the systemin figure 6.16 which is a more realistic structure and here we have used real datato some extent: The nominal load levels have been taken from real measurements,but the voltage and load signals are generated by simulation. Further informationabout this system modelled in Modelica can be found in ([12]). In this study thetwo filters have shown a very similar behaviour. In an effort to give the testingsome structure we have also divided the procedure in three setups where differentcombinations of the parameters have been estimated. Moreover, since there wouldbe no point in showing two versions of almost identical plots from the differentsimulations we have chosen just to display results from one of the filters for everysetup.

First setup

According to the law of parsimony1 we start by trying the estimation on the firsttest case keeping V0, P0 and Q0 constant set to 1. The other parameters are chosenas typical values listed in table 6.4.

1try simple things first

Page 52: Performance Comparison of the Extended Kalman Filter and

38 Experiments

Active load αs = 1.28 αt = 1.92 Tp = 173Reactive load βs = 1.32 βs = 2.92 Tq = 83.5

Table 6.4. Typical values for the load model parameters.

The input used is a sequence of steps (figure 6.19) with a step size of 2%.All the parameters converge to their correct values in this setup (figure 6.18). Thevariance of the parameters are shown in figure 6.20 where we can see that the valuescorresponding to the parameters Tp and Tq (the two bottom curves) decrease slowerthan the others. This indicates that the data contain less information about theseparameters. Note that for the other parameters there is a sudden decrease at thetime of the negative flank of the first step in the input. Here we only let the RPEMadjust the elements of the process noise covariance matrix Q while keeping Rconstant, to keep the number of parameters down. There was no notable differencefrom estimating both matrices. The estimated diagonal of Q is shown in figure6.21.

For the second test case the input is shown in figure 6.22 and the parameterestimates are displayed in figure 6.23. Also in this case all the unknown parametersconverge nicely. Figure 6.24 shows the estimated Q matrix elements.

All the estimates in this setup are generated with the RPEM, but very similarresults (therefore omitted) were obtained using the EKF.

Figure 6.17. The simplified model structure.

Page 53: Performance Comparison of the Extended Kalman Filter and

6.4 Power system 39

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000.5

1

1.5

Time (seconds)

P0

Parameter Estimates

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000.5

1

1.5

Q0

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

2

4

α s

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

2

4

α t

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−5

0

5

β s

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

5

β t

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000149

150

151

Tp

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1000095

100

105

Tq

Figure 6.18. Parameter estimates, first setup with constant nominal loads. All param-eters converge to correct values.

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

0.98

1

1.02

Figure 6.19. Input voltage used in first setup.

Page 54: Performance Comparison of the Extended Kalman Filter and

40 Experiments

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

2040

Time (seconds)

Covariance Matrice Ppp

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

2040

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000012

x 105

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1000005

10x 10

4

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1000005

10x 10

4

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 1000005

10x 10

4

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

5x 10

7

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000024

x 107

Figure 6.20. Parameter variances, first setup. Note the slower decrease of the bottomtwo values.

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

100

200

300

400

500

Time (seconds)

Estimated covariance matrix elements(Q and−or R)

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

200

400

600

800

1000

1200

Figure 6.21. Estimated elements of Q matrix in RPEM.

Page 55: Performance Comparison of the Extended Kalman Filter and

6.4 Power system 41

0 1 2 3 4 5 6 7 8 9

x 104

1

1.02

1.04

1.06

1.08

1.1

Time (seconds)

System input

Figure 6.22. Input used on test case two, first setup.

0 1 2 3 4 5 6 7 8 9

x 104

0.5

1

1.5

Time (seconds)

Parameter Estimates

0 1 2 3 4 5 6 7 8 9

x 104

1

2

3

0 1 2 3 4 5 6 7 8 9

x 104

0.5

1

1.5

0 1 2 3 4 5 6 7 8 9

x 104

0

5

0 1 2 3 4 5 6 7 8 9

x 104

0

100

200

0 1 2 3 4 5 6 7 8 9

x 104

80

90

100

Figure 6.23. Parameter estimates using known nominal loads in test case two.

Page 56: Performance Comparison of the Extended Kalman Filter and

42 Experiments

0 1 2 3 4 5 6 7 8 9

x 104

0

100

200

300

400

500

600

Time (seconds)

Estimated covariance matrix elements

0 1 2 3 4 5 6 7 8 9

x 104

0

5

10

15

20

Figure 6.24. Estimated elements of Q matrix in test case two. (First setup)

Page 57: Performance Comparison of the Extended Kalman Filter and

6.4 Power system 43

Second setup

In the next step we try to estimate changes in the nominal loads P0 and Q0, whilekeeping the other parameters constant. The voltage variations driving the loadchanges are shown in 6.25. The steps in this input signal are slightly rounded sincethe applied voltage is separated from the load bus in the model by an impedancerepresenting a power line. This time we use the first test case and the parametershave been estimated with the EKF. As before, similar results have been obtainedwith the RPEM.

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000.95

0.96

0.97

0.98

0.99

1

1.01

1.02

1.03

Time (seconds)

Input data

Figure 6.25. Input voltage signal used in second and third setup.

The changes in nominal load were chosen as steps with a period time of 3000seconds. The estimates of the nominal loads are displayed in figure 6.26 where wesee that the filter (in this case the EKF) is able to track the changes.

In figure 6.27 parts of the simulated measurements with added noise, togetherwith the smoother predictions are shown. The small steps in the bottom curveresult from the input voltage steps, and we can see how the changes in nominalload result in the change of level at t = 4500. The top plot is magnified to showthe transient prediction error caused by the sudden change of nominal load. Thesame thing can be seen in the plot of the prediction errors themselves, in figure6.28.

Page 58: Performance Comparison of the Extended Kalman Filter and

44 Experiments

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000.4

0.45

0.5

0.55

0.6

0.65

Time (seconds)

P0

Parameter Estimates

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000.05

0.1

0.15

Q0

Figure 6.26. Second setup, estimated nominal power levels.

4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000

0.45

0.5

0.55

0.6

0.65

Time (seconds)

Pl

Measurements and filtered measurements

3000 3500 4000 4500 5000 5500 60000.08

0.1

0.12

0.14

0.16

Ql

Figure 6.27. Measurements and predictions in the second setup.

Page 59: Performance Comparison of the Extended Kalman Filter and

6.4 Power system 45

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−0.2

0

0.2

0.4

0.6

Time (seconds)

ε 1

Prediction Errors

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−0.05

0

0.05

0.1

0.15

ε 2

Figure 6.28. Prediction errors, second setup.

Third setup

Since the nominal loads P0 and Q0 cannot be measured at the load bus we attemptto also estimate these as time-varying parameters. A typical example of the nominalload variations over 24 hours is shown in figure 6.29. Note the load increase ataround seven o’clock when the daily residential and business activities start.

For test case one, we apply the same voltage variations as above, shown in figure6.25. The parameters converge to certain values but not the correct ones. Anothersign is the trust levels (5.5) that show values of a magnitude of about a thousandtimes smaller than when only the nominal loads were estimated, indicating theuncertainty in the estimation. One example of an estimation result is shown in6.30 together with the estimated covariance matrix Q in figure 6.31. Anotherexample is shown in figure 6.32, this time showing the estimated parameters forthe more complex second test case. This approach has thus proven infeasible forboth filters on both test cases.

Page 60: Performance Comparison of the Extended Kalman Filter and

46 Experiments

0 5 10 15 20 250

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Time in hours after midnight

Active and reactive load measurements

Figure 6.29. Daily variations of active(top) and reactive loads.

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

0.5

1

Time (seconds)

P0

Parameter Estimates

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

0.1

0.2

Q0

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−50

0

50

α s

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−50

0

50

α t

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−10

0

10

β s

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

10

20

β t

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−200

0

200

Tp

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

100

200

Tq

Figure 6.30. Parameter estimates in third setup. Parameters do not converge to correctvalues.

Page 61: Performance Comparison of the Extended Kalman Filter and

6.4 Power system 47

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

2

4

6

8

10

12x 10

7

Time (seconds)

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 100000

0.5

1

1.5

2x 10

8

Figure 6.31. Example of estimates of diagonal Q elements in third setup.

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−50

0

50

Time (seconds)

P0

Parameter Estimates

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−10

0

10

Q0

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−200

0

200

α s

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−200

0

200

α t

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−200

0

200

β s

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−200

0

200

β t

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−5

0

5x 10

4

Tp

0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000−5000

0

5000

Tq

Figure 6.32. Example of RPEM parameter estimates in third setup, test case two.

Page 62: Performance Comparison of the Extended Kalman Filter and

48 Experiments

6.4.3 Discussion

Three setups for the estimation have been tested on two test cases. The results ofthe tests can be summoned as follows:

• The estimation of the parameters works under the condition of known orconstant active and reactive nominal loads.

• The estimation of the nominal loads works in the situation of known param-eters.

• When both parameters and nominal loads are estimated, both methods failin giving consistent estimates.

No principal differences have been found between the two filters. The problemwith the third setup could be that the data is not informative enough for it tobe possible to assess all the parameters at once. Another way of looking at itwould be to say that the model is overly parameterised, but this will not be furtherelaborated on here since it is beyond the scope of the thesis. Estimating this modelusing these filters have proven infeasible.

Future work

The load demands are subject to ”spontaneous” changes due to connections anddisconnections of loads on the consumer side. These are uncorrelated with the loadresponse coming from the variations in the voltage. Moreover, on the generatorside the voltage is also affected by variations caused by tap changer and capacitoroperations. The variations in voltage help keep the input ”persistently exciting” forthe estimation and is to be viewed as an asset in that sense. The situation with theconsumer side variations is somewhat different. These are to be seen as changes inthe nominal load, and when simulated, these changes enter the system through theparameters P0 and Q0. This means that the consumer side ”noise” is multiplied intoboth the process and measurement equations, which clearly complicates matters.Another way of looking at the consumer variations could be to consider them tobe noise, not time varying parameters, analyse it accordingly and investigate thepossibility to incorporate them in the model as some form of additive process noise.The considered model describes how the loads depend on the voltage. However,the voltage also depends on the load, something we maybe are not interested inmodelling, but may nevertheless be investigated further, to see if other equationsand/or measurements could be added to the model to perhaps make it compliantwith the high number of unknowns.

Page 63: Performance Comparison of the Extended Kalman Filter and

Chapter 7

Conclusions

A comparison of two methods for joint state and parameter estimation has beenmade for a number of dynamic systems. A Recursive Prediction Error Method(RPEM) has been successfully implemented in MatLab and in C++ as a part inthe project Parameter Estimation for Power Plants in the Automation and Controlgroup at ABB Corporate Research. This method has been compared to the widelyused Extended Kalman Filter. A feasibility study has been made to evaluate theuse of these methods in a power systems application, and this has been made aspart in a Utility Solutions project also at ABB.

7.1 Summary of the results

The methods have very much in common in theory yet the differences make theRPEM more complex and computationally demanding. The EKF can be seen asa special case of the RPEM with a simplification made in the calculation of theupdate step. This simplification makes the EKF algorithm computationally lighter,but gives rise to convergence problems in certain cases.

When it comes to applying these filters both need tuning to make them work ina satisfactory way. The impression after tuning both filters for a number of systemsand different simulation setups is that in general, it can not be said that one filteris easier to tune than the other. It is more a matter of user experience. The onlything that can be said is that the RPEM is somewhat easier to tune in the caseof constant parameters. This is maybe not all that surprising, since the RPEM isdesigned for just this. We have tried to make the tuning as similar as possible forthe two filters to facilitate the tuning procedure for new users.

The results from the different test cases show small differences between thetwo filters’ performance in terms of estimate quality. Estimating parameters withthe EKF is considerably faster than with the RPEM, an advantage that has twoconsequences, first that the EKF allows for a shorter sampling time in real-timeestimation and secondly that the tuning procedure is quicker simply because esti-

49

Page 64: Performance Comparison of the Extended Kalman Filter and

50 Conclusions

mations finish faster. If biased estimates are not suspected, the recommendationis thus to start with the EKF and then, to see if it gives an improvement, try theRPEM as a second alternative.

Page 65: Performance Comparison of the Extended Kalman Filter and

Bibliography

[1] Numerical recipes. http://www.nr.com/, 2002.

[2] C. Bohn. Recursive parameter estimation for non-linear continous timesystems through sensitivity-model-based adaptive filters. PhD thesis, Ruhr-Universitat, Bochum, 2000.

[3] R. Davies. Newmat, c++ matrix library. http://www.robertnz.net, 2002.

[4] C. F. Gauss. Theoria motus corporum coelestium in sectionis conicis solemambientum, 1809. Hamburg.

[5] J. T. Gravdahl, F. Willens, B. de Jager, and O. Egeland. Modeling for surgecontrol of centrifugal compressors: comparison with experiment. Technical re-port, Department of Engineering Cybernetics, Norwegian University of Scienceand Technology and Faculty of Mechanical Engineering, Eindhoven Universityof Technology.

[6] F. Gustavsson, L. Ljung, and M. Millnert. Signalbehandling. Studentlitteratur,Lund, Sweden, 2001.

[7] A. C. Hindmarsh. Odepack, a systematized collection of ode solvers. IMACSTransactions on Scientific Computation, 1:55–64, 1983. http://www.llnl.gov/CASC/odepack/.

[8] G. Hovland, E. Gallestey, T. Von Hoff, and J. Wiklander. Parameter esti-mation for power plants. Technical Report CH-RD 2003-3, ABB CorporateResearch, Switzerland, January 2003.

[9] R. E. Kalman. A new approach to linear filtering and prediction problems.Transactions of the ASME - Journal of Basic Engineering, 82(Series D):35–45,1960.

[10] R. E. Kalman and R. S. Bucy. New results in linear filtering and predictionproblems. Transactions of the ASME - Journal of Basic Engineering, 83(SeriesD):95–108, 1961.

[11] D. Karlsson and D. J. Hill. Modelling and identification of nonlinear dynamicloads in power systems. IEEE Transactions on Power Systems, 9(1), 1994.

51

Page 66: Performance Comparison of the Extended Kalman Filter and

52 Conclusions

[12] M. Larsson. Coordinated Tap Changer Control - Theory and Practice. Techni-cal report, Department of Industrial Electrical Engineering and Automation,Lund University, Sweden, 1997. ISBN 91-88934-07-1.

[13] L. Ljung. Asymptotic behaviour of the extended kalman filter as a parameterestimator for linear systems. IEEE transaction on automatic control, AC-24(1), February 1979.

[14] L. Ljung. System Identification: Theory for the User. Prentice-Hall, Engle-wood Cliffs, N.J. USA, 1987.

[15] L. Ljung and T. Soderstrom. Theory and Practice of Recursive Identification.MIT Press, Cambridge, MA, USA, 1983.

[16] I. Romero Navarro. Dynamic Load Models for Power Systems. Lic. thesis,Department of Industrial Electrical Engineering and Automation, 2002. ISBN91-88934-26-8.

Page 67: Performance Comparison of the Extended Kalman Filter and

Appendix A

Algorithms

The filter algorithms were presented in Bohn ([2]) and we summarise them herefor completeness. What is referred to by Bohn as the Adaptive Extended KalmanFilter (AEKF) in section A.2 corresponds to the RPEM discussed earlier in thethesis.

Differences in notation

The parameter vector is here denoted p instead of θ that has been used throughoutthe thesis. The matrix P is here split in Pxx and Ppp for the covariances of the stateand parameter estimates respectively. The prediction error is denoted e instead ofthe previously used ε.

A.1 State-Augmented Extended Kalman Filter

The EKF is given in table A.1. Note that the equations for the state and covariancepropagation are a mixture of continuous and discrete equations. First, the statevector and the covariances are propagated continuously in t+k ≤ t ≤ t−k+1 usingthe nonlinear system model and the linearised Riccati equations. Secondly, thestate and parameter vectors and the covariances are updated discretely by usingthe Kalman filter gains from t = t−k+1 to t = t+k+1. Note that the quadratic termsin the Riccati equations are introduced in the discrete covariance update step fornumerical stability reasons.

Note also that the nonlinear system is only linearised when computing the co-variance updates and the filter gain coefficients. For the state estimate propagation,the complete nonlinear model is used.

53

Page 68: Performance Comparison of the Extended Kalman Filter and

54 Algorithms

State estimate propagationt+k ≤ t ≤ t−k+1

˙x = f(x, u, p(tk))

Covariance propagationt+k ≤ t ≤ t−k+1

Pxx =df

dxTPxx + Pxx

dfT

dx+

df

dpTPT

xp + PxpdfT

dp+ Qxx

Pxp =df

dxTPxp +

df

dpTPpp

Ppp = Qpp

Predicted output y(tk+1) = h(x(t−k+1), u(tk+1), p(tk))

Prediction error e(tk+1) = y(tk+1 − y(tk+1))

Approximate predictionerror covariance matrix

A(tk+1) = R +dh

dxTPxx(t−k+1)

dhT

dx+

dh

dxTPxp(t−k+1)

dhT

dp

+dh

dpTPT

xp(t−k+1)

dhT

dx+

dh

dpTPpp(t−k+1)

dhT

dp

Filter gain matricesK(tk+1) =

(Pxx(t−k+1)

dhT

dx+ Pxp(t−k+1)

dhT

dp

)A−1(tk+1)

L(tk+1) =(

PTxp(t

−k+1)

dhT

dx+ Ppp(t−k+1)

dhT

dp

)A−1(tk+1)

State update x(t+k+1) = x(t−k+1) + K(tk+1)e(tk+1)

Parameter update p(t+k+1) = p(t−k+1) + L(tk+1)e(tk+1)

Covariance updatePxx(t+k+1) = Pxx(t−k+1)−K(tk+1)A(tk+1)KT (tk+1)Pxp(t+k+1) = Pxp(t−k+1)−K(tk+1)A(tk+1)LT (tk+1)Ppp(t+k+1) = Ppp(t−k+1)− L(tk+1)A(tk+1)LT (tk+1)

Table A.1. State-augmented Extended Kalman Filter.

A.2 Adaptive Extended Kalman Filter

The AEKF is given in tables A.2 - A.4. The above comments regarding the EKFequally apply to the AEKF. The only modification that has been done to thisalgorithm is the inclusion of a term in the parameter covariance update equationat the bottom of table ??. This equation then change to

Ppp(t+k+1) = (Ppp(t−k+1)− L(tk+1)S(tk+1)LT (tk+1) + Qθ)/λ (A.1)

Page 69: Performance Comparison of the Extended Kalman Filter and

A.2 Adaptive Extended Kalman Filter 55

for details, refer to section 5.6.2.

State estimatepropagationt+k ≤ t ≤ t−k+1

˙x = f(x, u, p(tk))

Covariance propagationt+k ≤ t ≤ t−k+1

Pxx =∂f

∂xTPxx + Pxx

∂fT

∂x+ Q(p(tk))

Sensitivity propagationt+k ≤ t ≤ t−k+1

d ˙xdpT

=∂f

∂xT

dx

pT+

∂f

∂pT

dPxx

dpT=

d2f

dpT dxT(Is ⊗ Pxx) +

∂f

∂xT

dPxx

dpT+

+dPxx

dpT(Is ⊗ ∂fT

∂x) + Pxx

d2fT

dpT dx+

∂Q

∂pT

where

d2f

dpT dxT=

∂2f

∂xT ∂xT(

dx

dpT⊗ In) +

∂2f

∂pT ∂xT

d2fT

dpT dx=

∂2fT

∂xT ∂x(

dx

dpT⊗ In) +

∂2fT

∂pT ∂x

Predicted output y(tk+1) = h(x(t−k+1), u(tk+1), p(tk))

Prediction error e(tk+1) = y(tk+1)− y(tk+1)

Approximate predictionerror covariance matrix A(tk+1) = R(p(tk)) +

∂h

∂xTPxx(t−k+1)

∂hT

∂x

Filter gain matrix K(tk+1) = Pxx(t−k+1)dhT

dxA−1(tk+1)

Gradient of prediction dyT (tk+1)dp

= (∂h

∂xT

dx(t−k+1)dpT

+∂h

∂pT)T

Table A.2. Adaptive Extended Kalman Filter.

Page 70: Performance Comparison of the Extended Kalman Filter and

56 Algorithms

Derivative of predictionerror covariance matrix

dA(tk+1)dpT

=∂R

∂pT+

d2h

dpT dxT(Is ⊗ Pxx(t−k+1)

∂hT

∂x)

+∂h

∂xT

dPxx(t−k+1)dpT

(Is ⊗ ∂hT

∂x) +

∂h

∂xTPxx(t−k+1)

d2hT

dpT dx

where

d2hT

dpT dxT=

∂2h

∂xT ∂xT(

dx

dpT⊗ In) +

∂2h

∂pT ∂xT

d2hT

dpT dx=

∂2hT

∂xT ∂x(

dx

dpT⊗ Im) +

∂2hT

∂pT ∂x

Derivative of inverseof prediction errorcovariance matrix

dA−1(tk+1)dpT

= −A−1(tk+1)dA(tk+1)

dpT(I ⊗A−1(tk+1))

Derivative of filter gain

dK(tk+1)dpT

=dPxx(t−k+1)

dp(Is ⊗ ∂hT

∂xA−1(tk+1))+

+Pxx(t−k+1)d2hT

dpT dx(Is ⊗A−1(tk+1))+

+Pxx(t−k+1)∂hT

∂x

dA−1(tk+1)dpT

Parameter adaptationgain

S(tk+1) = λA(tk+1) +dy(tk+1)

dpTPpp(tk)

dy(tTk+1)dp

L(tk+1) = Ppp(tk)dy(tk+1)T

dpS−1(tk+1)

Parameter covarianceupdate Ppp(t+k+1) = (Ppp(t−k+1)− L(tk+1)S(tk+1)LT (tk+1))/λ

Table A.3. Adaptive Extended Kalman Filter, continued.

Page 71: Performance Comparison of the Extended Kalman Filter and

A.2 Adaptive Extended Kalman Filter 57

Sensitivity updates

dx(t+k+1)dpT

=dx(t−k+1)

dpT−K(tk+1)

dy(tk+1)dpT

+

+dK(tk+1)

dpT(Is ⊗ e(tk+1))

dPxx(t+k+1)dp

= (In −K(tk+1)∂h

∂xT)dP (t−k+1)

dpT−

−K(tk+1)d2h

dpT dxT(Is ⊗ Pxx(t−k+1))−

−dK(tk+1)dpT

(Is ⊗ ∂h

∂xTPxx(t−k+1))

Covariance update Pxx(t+k+1) = (In −K(tk+1)∂h

∂xT)Pxx(t−k+1)

State update x(t+k+1) = x(t−k+1) + K(tk+1)e(tk+1)

Parameter update p(t+k+1) = p(t−k+1) + L(tk+1)e(tk+1)

Table A.4. Adaptive Extended Kalman Filter, continued.

Page 72: Performance Comparison of the Extended Kalman Filter and

På svenska

Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare –under en längre tid från publiceringsdatum under förutsättning att inga extra-ordinära omständigheter uppstår.

Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner,skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ick-ekommersiell forskning och för undervisning. Överföring av upphovsrätten viden senare tidpunkt kan inte upphäva detta tillstånd. All annan användning avdokumentet kräver upphovsmannens medgivande. För att garantera äktheten,säkerheten och tillgängligheten finns det lösningar av teknisk och administrativart.Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i denomfattning som god sed kräver vid användning av dokumentet på ovan beskrivnasätt samt skydd mot att dokumentet ändras eller presenteras i sådan form eller isådant sammanhang som är kränkande för upphovsmannens litterära eller konst-närliga anseende eller egenart.

För ytterligare information om Linköping University Electronic Press se för-lagets hemsidahttp://www.ep.liu.se/

In English

The publishers will keep this document online on the Internet - or its possiblereplacement - for a considerable time from the date of publication barring excep-tional circumstances.

The online availability of the document implies a permanent permission foranyone to read, to download, to print out single copies for your own use and touse it unchanged for any non-commercial research and educational purpose. Sub-sequent transfers of copyright cannot revoke this permission. All other uses ofthe document are conditional on the consent of the copyright owner. The pub-lisher has taken technical and administrative measures to assure authenticity,security and accessibility.

According to intellectual property law the author has the right to be men-tioned when his/her work is accessed as described above and to be protectedagainst infringement.

For additional information about the Linköping University Electronic Pressand its procedures for publication and for assurance of document integrity, pleaserefer to its WWW home page:http://www.ep.liu.se/

© Jonas Wiklander