58
DEGREE PROJECT, IN , SECOND LEVEL MECHATRONICS STOCKHOLM, SWEDEN 2014 Bayesian Filtering and Smoothing to Measure Damper Characteristics CHRISTIAN SVENSSON KTH ROYAL INSTITUTE OF TECHNOLOGY INDUSTRIAL ENGINEERING AND MANAGEMENT

Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

DEGREE PROJECT, IN , SECOND LEVELMECHATRONICSSTOCKHOLM, SWEDEN 2014

Bayesian Filtering and Smoothing toMeasure Damper Characteristics

CHRISTIAN SVENSSON

KTH ROYAL INSTITUTE OF TECHNOLOGY

INDUSTRIAL ENGINEERING AND MANAGEMENT

Page 2: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 3: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Bayesian Filtering and Smoothing to MeasureDamper Characteristics

Christian Svensson

Master of Science Thesis MMK 2014:57 MDA 488KTH Industrial Engineering and Management

MechatronicsSE-100 44 STOCKHOLM

Page 4: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 5: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Master of Science Thesis MMK 2014:57 MDA 488

Bayesian Filtering and Smoothing to MeasureDamper Characteristics

Christian Svensson

Approved Examiner Supervisor

2014-06-30 Jan Wikander Bengt ErikssonCommissioner Contact person

Öhlins Racing AB Janne Färm

Abstract

During the development of high performance damper products for vehicle ap-plications, it is essential to measure the dampers’ characteristics to ensure theirperformance. Some of the measurements are performed in dynamometers. Thedynamometer actuates the damper with a predefined position signal and measuresthe actual position and the resulting force. These measurements su↵er from noise;the problem is especially bad if the signals are studied with respect to velocity.This is due to that the velocity is not directly measurable; it must be calculatedfrom position by di↵erentiation, which amplifies the noise.

The purpose of this work was to improve these measurements by doing acomparison of di↵erent Bayesian filters and smoothers. The comparison inclu-ded the Kalman filter, the extended Kalman filter, the unscented Kalman filter, theRauch-Tung-Striebel smoother, the extended Rauch-Tung-Striebel smoother andthe unscented Rauch-Tung-Striebel smoother. The smoothers are only applicablein o✏ine applications, while the filters could be used in real time.

The filters reduced the noise in the position signal and greatly reduced thenoise in the velocity signal. The smoothers showed the same behaviors as thefilters, but with much less noise. Only small improvements were visible in theforce signal.

iii

Page 6: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 7: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Examensarbete MMK 2014:57 MDA 488

Bayesisk filtrering och glättning för mätning avstötdämparkaraktäristik

Christian Svensson

Godkänt Examinator Handledare

2014-06-30 Jan Wikander Bengt ErikssonUppdragsgivare Kontaktperson

Öhlins Racing AB Janne Färm

Sammanfattning

Under utvecklingen av högpesterande dämparprodukter för fordonstillämpningarär det ett måste att mäta dämparnas karakteristik för att säkerställa deras prestanda.Vissa av mätningarna görs i dynamometrar. Dynamometern aktuerar dämparenmed en fördefinierad positionssignal och mäter den faktiska positionen samt denresulterande kraften. Dessa mätningar påverkas av brus, problemet är extra tydligtom signalerna studeras med avseende på hastighet. Detta beror på att hastigheteninte är direkt mätbar, utan måste räknas ut genom derivering, vilken förstärkerbruset.

Syftet med detta arbete var att förbättra dessa mätningar genom att göra enjämförelse mellan olika Bayesiska filter och glättare. I jämförelsen ingick Kal-manfiltret, det utökade Kalmanfiltret, det oparfymerade Kalmanfiltret, Rauch-Tung-Stribelglättaren, den utökade Rauch-Tung-Striebelglättaren och den oparfymera-de Rauch-Tung-Stribelglättaren. Glättarna kan endast användas o✏ine, medan fil-terna kan användas i realtid.

Filterna minskade bruset i positionssignalen och minskade bruset avsevärt ihastighetssignalen. Glättarna uppvisade samma beteende som filterna, men medmycket mindre brus. Endast små förbättringar sågs i kraftsignalen.

v

Page 8: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 9: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Contents

Abstract iii

Sammanfattning v

1 Introduction 11.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.1.1 The Dynamometer . . . . . . . . . . . . . . . . . . . . . 21.2 Purpose and Delimitation . . . . . . . . . . . . . . . . . . . . . . 31.3 Bayesian Filtering and Smoothing . . . . . . . . . . . . . . . . . 3

2 Frame of Reference 72.1 A Motivation to the Chosen Methods . . . . . . . . . . . . . . . . 72.2 Basic Probability Theory . . . . . . . . . . . . . . . . . . . . . . 82.3 Model Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.4 Derivation of Models . . . . . . . . . . . . . . . . . . . . . . . . 10

2.4.1 Damping Force . . . . . . . . . . . . . . . . . . . . . . . 102.4.2 Spring Force . . . . . . . . . . . . . . . . . . . . . . . . 112.4.3 Static Friction . . . . . . . . . . . . . . . . . . . . . . . . 112.4.4 Total Damper Force . . . . . . . . . . . . . . . . . . . . 112.4.5 Linear Model for the Kalman Filter . . . . . . . . . . . . 11

2.5 The Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . . . 132.6 The Rauch-Tung-Striebel Smoother . . . . . . . . . . . . . . . . 142.7 The Extended Kalman Filter . . . . . . . . . . . . . . . . . . . . 152.8 The Extended Rauch-Tung-Striebel Smoother . . . . . . . . . . . 162.9 The Unscented Kalman Filter . . . . . . . . . . . . . . . . . . . . 162.10 The Unscented Rauch-Tung-Striebel Smoother . . . . . . . . . . 19

3 Implementation 213.1 Parameter Identification . . . . . . . . . . . . . . . . . . . . . . . 21

3.1.1 Damping Coe�cient . . . . . . . . . . . . . . . . . . . . 213.1.2 Spring Constant . . . . . . . . . . . . . . . . . . . . . . . 22

vii

Page 10: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CONTENTS

3.2 Noise Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.3 Derivation of Input Signal . . . . . . . . . . . . . . . . . . . . . 253.4 Comparison Method . . . . . . . . . . . . . . . . . . . . . . . . 263.5 Filter Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263.6 UKF Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

4 Results and Analysis 294.1 Performance Comparison . . . . . . . . . . . . . . . . . . . . . . 294.2 Results with Real Data . . . . . . . . . . . . . . . . . . . . . . . 31

5 Discussion and Recommendations 375.1 Rejected Ideas . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375.2 Recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . 38

6 Conclusion 39

A Dynamometer Eigenfrequencies 41A.1 Cross-Head . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41A.2 Vertical Columns . . . . . . . . . . . . . . . . . . . . . . . . . . 42

B Gas Reservoir Spring Force 43

viii

Page 11: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Chapter 1

Introduction

This chapter explains the background of why this work was needed and its pur-pose. The chapter also gives an introduction to Bayesian filtering and smoothing.

1.1 Background

This work was done in collaboration with the company Öhlins Racing AB inUpplands Väsby, Sweden. Öhlins Racing AB develops and manufactures highperformance damping products for vehicle applications. The products are foundin vehicles such as super sport cars, sport bikes, snowmobiles, downhill bicyclesand various types of racing vehicles.

During the development of high performance damper products, it is crucial totest the products to ensure that they meet the engineers’ and the customers’ re-quirements. Some of the tests are performed with purpose-built dynamometers,which actuate the damper with a predefined position signal and measures positionand resulting force. In some cases, the accuracy of the measurements is not sat-isfactory. This is due to measurement noise and quantities that are not directlymeasurable, e.g. velocity, which today is calculated from the position signal.

Mainly, the most requested plot from the dynamometer test is damper forcewith respect to velocity. To measure this correlation, the damper is excited at con-stant velocity at di↵erent velocity levels. The mean values of the measurementsfrom the interval of constant velocity are plotted against force, see Figure 1.1.Since the data points are mean values, the resulting plot does not su↵er fromnoise. However, if time dependent behaviors are considered, the noise impact onthe measurements is significant.

1

Page 12: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 1. INTRODUCTION

−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 0.25−2000

−1500

−1000

−500

0

500

1000

1500

2000

2500

3000

Velocity/(m/s)

Forc

e/N

Low dampingMedium dampingHigh damping

Figure 1.1: Example damping force curves from dynamometer measurements. These curvesconsist of mean valued data points at constant velocities. This measurement method results in aquasi-stationary relationship between velocity and force. This is also the damping curves for thethree di↵erent settings that were used in this work.

1.1.1 The DynamometerThe dynamometer could be divided into four sub-systems: Actuator, mountingassembly for the test object, sensors and data acquisition system. The actuator inthis case is a hydraulic cylinder, which is attached to the mounting assembly. Theactuator is regulated with a closed loop controller, usually with position feedback.Today, primary two sensors are in use; one load cell and one linear variable dif-ferential transformer (LVDT) position sensor. The load cell is placed at the top ofthe mounting assembly and its purpose is to measure force. The LVDT positionsensor is found inside of the hydraulic cylinder and is measuring cylinder posi-tion. The data acquisition system consists of hardware to interface the sensors anda computer to log the measurements. See Figure 1.2 for a schematic illustrationof the dynamometer.

2

Page 13: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

1.2. PURPOSE AND DELIMITATION

Figure 1.2: A schematic illustration of the dynamometer.

1.2 Purpose and Delimitation

The purpose of this work was to improve the dynamometer measurements bycomparing di↵erent Bayesian filters and smoothers.

This work was delimited to Bayesian filtering and smoothing with focus ontechniques suitable for unimodal distributed noise. This delimitation is motivatedin section 2.1.

1.3 Bayesian Filtering and Smoothing

The considered filtering methods are all implementations of the Bayes filter algo-rithm (Thrun et al., 2005, p. 27). The idea of Bayesian filtering is to use infor-mation from multiple noisy sources and combine them in such way that the com-bination, called estimate, has less noise than any of the sources alone. Obviousinformation sources are sensors that measure di↵erent states. It is also possibleto use information about the control signal and physical properties of the systemto predict the next state. This is done with the aid of mathematical models. Themodels use the known control signal to calculate what the next state should be.This is called prediction and is the first step in the Bayes filter algorithm. The sec-ond and last step is to incorporate the measurements. The filter takes into account

3

Page 14: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 1. INTRODUCTION

Figure 1.3: An illustration of the filtering process.

how noisy the prediction and the measurements are. A noisy prediction or mea-surement is trusted less than a more accurate one. The principle behind Bayesianfiltering is illustrated in Figure 1.3.

One of the most famous implementation of the Bayes filter algorithm is theKalman filter (KF) (Kalman, 1960). The KF assumes that the underlying systemis linear and that model and sensor noise are Gaussian distributed with zero mean,i.e. white Gaussian noise. There exist several solutions to extend the KF fornonlinear systems. One common method is the extended Kalman filter (EKF)(see e.g. Thrun et al., 2005; Anderson & Moore, 1979), which uses a first orderTaylor expansion to linearize the underlying system. Another approach presentedby Julier & Uhlmann (1997) linearize the system with so called sigma points. Thismethod is called the unscented Kalman filter (UKF) and is more accurate than theEKF and have the same order of computational complexity.

The filters introduced above treats current data and data collected in the past.However, if all the data is already collected, i.e. the application is not a real timeproblem, then it is possible to get better results by considering all measurements.One way of doing this is to run the filter from the oldest measurement to thenewest and then run the filter backwards. This results in a much better estimateand is called smoothing. The di↵erences of prediction, filtering and smoothingare illustrated in Figure 1.4. All the filters mentioned above have a correspondingsmoother.

The KF and the EKF assumes that the noise is white Gaussian, the UKF cancompensate for some deviations from the standard Gaussian distribution depend-ing on how the sigma points are chosen. All three methods are limited to unimodaldistributions, which are assumed in this case. An analysis of the measurementnoise is given in section 3.2.

4

Page 15: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

1.3. BAYESIAN FILTERING AND SMOOTHING

Figure 1.4: An illustration of the di↵erences between the estimation topics prediction, filteringand smoothing. The gray bars represent available measurement data. In the prediction case, datauntil time step k � 1 are used to form the estimate. With filtering, data until time step k are usedand with smoothing, measurements from all time steps are used.

5

Page 16: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 17: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Chapter 2

Frame of Reference

This chapter gives a theoretical description of the methods and theories that formthe foundation of this work. The chapter starts with a description of the modelsthat are considered. Then each filter method is presented, followed by its corre-sponding smoother. The methods are presented with relevant assumptions in mindand not as generalized as possible. E.g. only time invariant models are considered,even though all filters and smoothers can handle time variant systems.

2.1 A Motivation to the Chosen Methods

The three chosen filtering methods and their corresponding smoothers were cho-sen since they probably are the most common solutions for similar filtering prob-lems. However, there are other methods in the literature that deserves to be men-tioned. A method fairly similar to the UKF is the central di↵erence Kalman filter(CDKF), which was developed by Ito & Xiong (2000) and Nørgaard et al. (2000).According to Van Der Merwe (2004), this filter’s performance is almost identicalto the UKF. For this reason and due to that it seems less popular, it is not includedin this work.

Another method is the Gauss-Hermite Kalman filter (Ito & Xiong, 2000). Ac-cording to Särrkä (2013, p. 205) this filter seems to be more robust and consistentin errors compared to the UKF. But it is su↵ering from high computational com-plexity and it does not seem to introduce any significant improvements over theUKF, therefore it is not a part of this comparison.

The cubature Kalman filter (CKF) is a recent developed filter (Arasaratnam &Haykin, 2009) that is a special case of the UKF with a certain selection of param-eters (Särrkä, 2013, p. 108). It seems to be an interesting alternative method, butsince it is a special case of a filter that is already included in this work, it is notconsidered to be interesting to include.

7

Page 18: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 2. FRAME OF REFERENCE

An option that is completely di↵erent from the Kalman filtering methods is theparticle filter (PF). The PF was introduced by Gordon et al. (1993) and representsthe state space with a large number of samples, called particles. The PF is notlimited to unimodal or Gaussian posterior distributions; this makes it popular forlocalization methods and problems with posteriors that cannot be approximated asa Gaussian with good accuracy. However, the nature of the problem in this workmakes it suitable for Kalman filtering methods. The posterior is assumed to beapproximately Gaussian and therefore, the PF is not included in the comparison.A good introduction to particle filters and smoothing could be found in a tutorialby Doucet & Johansen (2009).

2.2 Basic Probability TheoryThe probability that a random variable X takes the value x is denoted

p(X = x) .

A common abbreviation is to omit the random variable as

p(x) = p(X = x) .

The probability of that X = x and the random variable Y = y is

p(X = x and Y = y) = p(x, y) .

This is called the joint distribution between X and Y . Another important conceptis conditional probability. A conditional probability is if an event Y = y happensgiven that X = x already has happened. This is written as

p(y | x) .

2.3 Model BasicsConsider the following system of nonlinear first order di↵erential equations:

x(t) = gc�x(t),u(t)

�, (2.1a)

y(t) = hc�x(t)

�, (2.1b)

where x(t) 2 Rn is a vector with n states dependent of the time t 2 [0,T],gc(·) 2 Rn is a nonlinear, time invariant vector valued function called the processmodel, x(t) 2 Rn is the time derivative of x(t), u(t) 2 Rm is a vector with control

8

Page 19: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

2.3. MODEL BASICS

signals, y(t) 2 Rp is a vector with the measured quantities and hc(·) 2 Rp is anonlinear, time invariant vector valued function called the measurement model.The subscript "c" indicate continuous time.

A special case of Equation 2.1 is if the functions gc(·) and hc(·) are linear,then the system could be described as

x(t) = Acx(t) + Bcu(t), (2.2a)y(t) = Cx(t), (2.2b)

where Ac 2 Rn⇥n is a matrix describing the system behavior, Bc 2 Rn⇥m is a ma-trix describing the control signals’ impact on the system and C 2 Rp⇥n describeswhich states that are observed, with proper scaling.

If the input u(t) is constant during equidistantly spaced time intervals, withthe length Ts, such that

u�(k + ⌧)Ts

�= u(kTs), 0 ⌧ < 1, k = 1,2, . . . , (2.3)

then the time continuous system in Equation 2.1 could be written in discrete timeas

x(kTs) = g⇣x�(k � 1)Ts

�,u

�(k � 1)Ts

�⌘, (2.4a)

y(kTs) = h�x(kTs)

�, (2.4b)

where g(·) and h(·) are the discrete counterparts of gc(·) and hc(·) (Ljung & Glad,2004). These functions could be approximated with e.g. Euler forward, Eulerbackward or Tustins method. The linear state space in Equation 2.2 is discretizedwith zero-order hold as

x(kTs) = Ax�(k � 1)Ts

�+ Bu

�(k � 1)Ts

�, (2.5a)

y(kTs) = Cx(kTs), (2.5b)

where the matrices A and B are given by

A B0 I

!= e

0BB@Ac Bc0 0

1CCATs

, (2.6)

where I is the identity matrix (DeCarlo, 1989, p. 215). For practical reasons, thefollowing notation will be used:

xk := x(kTs),

with this notation Equation 2.5 becomes

xk = Axk�1 + Buk�1, (2.7a)yk = Cxk . (2.7b)

9

Page 20: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 2. FRAME OF REFERENCE

Figure 2.1: A visualization of a hidden Markov model. A state only depends on the previous stateand the control that form the transition between the states. The states, which are hidden, are onlyobservable through noisy measurements.

In reality, the models are seldom perfect and sensor readings are a↵ected bynoise. These imperfections could be modeled as additive noise with

xk = Axk�1 + Buk�1 + �k , (2.8a)yk = Cxk + "k , (2.8b)

where �k 2 Rn is the process noise and "k 2 Rp is the measurement noise.Equation 2.8 could also be written in probabilistic form as

xk ⇠ p(xk | xk�1, uk�1) , (2.9a)yk ⇠ p

�yk | xk

�. (2.9b)

As seen in Equation 2.9a, the state xk only depends on the previous state xk�1 andcontrol uk�1. This mean that all states before xk�1 are irrelevant for the currentstate. The true state is also unknown, it could only be observed through noisymeasurements. This is called a hidden Markov model (HMM) and is illustrated inFigure 2.1.

2.4 Derivation of ModelsThis section describes the di↵erent models that have been used. A motivation tothe exclusion of models for the mechanical parts of the dynamometer is given inAppendix A.

2.4.1 Damping ForceThe simplest model of a damper is a linear relationship between the damping forceFd and velocity z:

Fd = dz, (2.10)

10

Page 21: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

2.4. DERIVATION OF MODELS

where d is the constant damping coe�cient. This model is suitable and used forthe Kalman filter. However, most dampers are better described with the nonlinearmodel

Fd = d( z) z. (2.11)

The nonlinear damping coe�cient d( z) could preferably be implemented frommeasurements as a piecewise linear function.

2.4.2 Spring Force

A pressurized non-through rod damper will have a position dependent force dueto the displacement of the piston rod. This position dependent force could bedescribed as

Fk = kz, (2.12)

where k is the spring constant. A detailed analysis of the gas spring force is foundin Appendix B.

2.4.3 Static Friction

The static friction force Ff is modeled as

Ff = Fc sgn( z), (2.13)

where Fc is the absolute friction force and sgn(·) is the signum function. In com-puter simulations, this is commonly implemented as Karnopp’s stick-slip model(Karnopp, 1985). However, if the implementation mentioned in subsection 2.4.1with a piecewise linear damping force model, the static friction is already incor-porated from the measurements.

2.4.4 Total Damper Force

The total damper force is given by the sum of the forces from the modeled dampercomponents:

F = Fd + Fk + Ff . (2.14)

2.4.5 Linear Model for the Kalman Filter

The Kalman filter requires a linear process and measurement model on the formin Equation 2.8. Since the Kalman filter estimates the state vector and the goal is

11

Page 22: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 2. FRAME OF REFERENCE

to estimate the position z, velocity z and force F, these will be the states. Thisgives the state vector

x(t) =

0BB@x1(t)x2(t)x3(t)

1CCA =

0BB@

z(t)z(t)F (t)

1CCA . (2.15)

Now, the matrices in Equation 2.2 needs to be derived. The time derivative of thefirst state is

x1(t) = x2(t). (2.16)

The time derivative for the second state is acceleration, which is given as an input.This gives

x2(t) = u(t). (2.17)

The equation for the third and last state is given by taking the time derivativeof Equation 2.14. Since this is a linear model, the nonlinear static friction isneglected and the linear damping coe�cient is used. This gives

F (t) = k z(t) + dz(t) = k x2(t) + du(t). (2.18)

Finally, the model could be written as

x(t) =

0BB@0 1 00 0 00 k 0

1CCA

| {z }Ac

x(t) +

0BB@01d

1CCA

|{z}Bc

u(t), (2.19)

y(t) = 1 0 00 0 1

!

| {z }C

x(t). (2.20)

An illustration describing the system model can be seen in Figure 2.2.

12

Page 23: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

2.5. THE KALMAN FILTER

Figure 2.2: A figure describing the system model with sensors and actuator.

2.5 The Kalman FilterThe KF was derived by Kalman (1960) with orthogonal projections as a recursivesolution to the linear filtering problem. The KF is an optimal estimator if thesystem is linear and the noises are white Gaussians (Anderson & Moore, 1979,pp. 46–49), i.e. on the form in Equation 2.8 with

�k ⇠ N (0,Q) (2.21a)"k ⇠ N (0,R) (2.21b)

where N (·) is the multivariate normal distribution function with the mean as firstargument and the covariance matrix as second. Q 2 Rn⇥n and R 2 Rp⇥p are thecovariance matrices for the process and the measurement noise, respectively. Notethat the noises are assumed to be stationary, i.e. the statistics does not change overtime. This is not an assumption claimed by the KF, but an assumption made inthis work.

Since the dynamics are linear and the disturbances are Gaussians, the posteriordistribution will be Gaussian as well. This is formulated as

p�xk | y1:k , u1:k

�= N �

µk ,⌃k�

(2.22)

where µk is the mean vector and ⌃k is the covariance matrix for the belief. y1:kare all measurements from time step 1 to k and u1:k are all controls from time step1 to k.

The KF algorithm is presented in Algorithm 1. The filter begins by predictingthe mean and covariance in line 2 and 3, where µ�k and ⌃�k are the statistics of

13

Page 24: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 2. FRAME OF REFERENCE

the prior distribution, i.e. before the measurement is taken into account. This isdenoted by the minus sign superscript.

The next and last step is called the update step and is performed in the lines4 to 6. In this step the measurement is taken into account and statistics for theposterior distribution are calculated. The matrix calculated in line 4, Kk , is calledthe Kalman gain and determines how much the filter should trust the measurementor the process.

Algorithm 1 Kalman Filter1: function KF(µk�1,⌃k�1,uk�1,yk)2: µ�k = Aµk�1 + Buk�1

3: ⌃�k = A⌃k�1AT +Q4: Kk = ⌃

�k CT

⇣C⌃�k CT + R

⌘�1

5: µk = µ�k +Kk⇣yk � Cµ�k

6: ⌃k = (I � KkC) ⌃�k7: return µk ,⌃k8: end function

2.6 The Rauch-Tung-Striebel SmootherThe KF only considers measurements before and at time step k, which is wellsuited for online implementations. However, if all data already is collected and tobe treated o✏ine, it is possible to use the information from all measurements upto time step N . The belief for this problem is

p�xk | y1:N ,u1:N

�= N

⇣µs

k ,⌃sk

⌘, 1 k < N, (2.23)

where µsk is the smoothed mean and ⌃s

k is the smoothed covariance matrix. Asolution to this problem is the Rauch-Tung-Striebel smoother (RTSS), which waspresented by Rauch et al. (1965).

This algorithm requires the means and covariances at all time steps from theKalman filter. So first the data is Kalman filtered and then the smoothing algorithmis started with µs

N = µN and ⌃sN = ⌃N and goes backwards in time. The algorithm

is similar to the KF and is presented in Algorithm 2.

14

Page 25: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

2.7. THE EXTENDED KALMAN FILTER

Algorithm 2 Rauch-Tung-Striebel Smoother1: function RTSS(µs

k+1,⌃sk+1,µk ,⌃k ,uk)

2: µ�k+1 = Aµk + Buk

3: ⌃�k+1 = A⌃kAT +Q4: Lk = ⌃kAT

⇣⌃�k+1

⌘�1

5: µsk = µk + Lk

⇣µs

k+1 � µ�k+1

6: ⌃sk = ⌃k + Lk

⇣⌃s

k+1 � ⌃�k+1

⌘LT

k7: return µs

k ,⌃sk

8: end function

2.7 The Extended Kalman Filter

As seen in section 2.5, the KF requires linear models. However, if a system isnonlinear, it could be approximated as a linear system with a first order truncatedTaylor expansion. This yields the EKF and is probably one of the most usedmethods for filtering problems.

The EKF is presented in Algorithm 3. The predict step takes place in line 2to 4 and the update is done in line 4 to 8. Since the Jacobians of the models areneeded in the EKF, the functions g(·) and h(·) need to be di↵erentiable at leastonce with respect to the state vector.

Algorithm 3 Extended Kalman Filter1: function EKF(µk�1,⌃k�1,uk�1,yk)2: µ�k = g

�µk�1,uk�1

3: Gk =@g(µk�1,uk�1)

@µk�1

4: ⌃�k = Gk⌃k�1GTk +Q

5: Hk =@h(µk�1)@µk�1

6: Kk = ⌃�k HT

k

⇣Hk⌃

�k HT

k + R⌘�1

7: µk = µ�k +Kk⇣yk � h

⇣µ�k

⌘⌘

8: ⌃k = (I � KkHk ) ⌃�k9: return µk ,⌃k

10: end function

15

Page 26: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 2. FRAME OF REFERENCE

2.8 The Extended Rauch-Tung-Striebel SmootherThe extended Rauch-Tung-Striebel smoother (ERTSS) is the corresponding smootherto the EKF and is presented in Algorithm 4 (Särrkä, 2013). The di↵erences com-pared to the RTSS are corresponding to the di↵erences between the KF and theEKF. Just like the RTSS, the ERTSS is started with µs

N = µN and ⌃sN = ⌃N .

Algorithm 4 Extended Rauch-Tung-Striebel Smoother1: function ERTSS(µs

k+1,⌃sk+1,µk ,⌃k ,uk)

2: µ�k+1 = g�µk ,uk

3: Gk =@g(µk ,uk )

@µk

4: ⌃�k+1 = Gk⌃kGTk +Q

5: Lk = ⌃kGTk

⇣⌃�k+1

⌘�1

6: µsk = µk + Lk

⇣µs

k+1 � µ�k+1

7: ⌃sk = ⌃k + Lk

⇣⌃s

k+1 � ⌃�k+1

⌘LT

k8: return µs

k ,⌃sk

9: end function

2.9 The Unscented Kalman FilterThe UKF uses a set of discrete points, called sigma points, to parameterize themean and covariance of the posterior. The UKF captures the mean and covariancewith an accuracy of at least a second order truncated Taylor expansion (Julier &Uhlmann, 1997). The sigma points are passed directly through the nonlinear func-tion, which means that no Jacobian matrices need to be evaluated. A result of thisis that the models do not need to be di↵erentiable. This benefits in that the modelscould be treated as “black boxes”. The algorithm is presented in Algorithm 5 andis for systems of the form in Equation 2.7 with additive noise.

A state vector with mean µk 2 Rn needs 2n + 1 sigma points. These are

X(i)k�1 =

8>>>>>>><>>>>>>>:

µk�1 for i = 0,

µk�1 +✓q

(n + �)⌃k�1

◆ (i)for i = 1, . . . ,n,

µk�1 �✓q

(n + �)⌃k�1

◆ (i�n)for i = n + 1, . . . ,2n,

Xk�1 =⇣X(0)

k�1 X(1)k�1 . . . X

(2n)k�1

⌘, (2.24)

where Xk�1 is a matrix with the sigma points, (·)(i) denotes the ith column of a

16

Page 27: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

2.9. THE UNSCENTED KALMAN FILTER

matrix and � 2 R is a scaling factor given by

� = ↵2(n + ) � n, (2.25)0 ↵ 1,0 .

↵ controls the spread of the sigma points and � 0 to guarantee a positive definitecovariance matrix (Van Der Merwe, 2004).

To perform the prediction step of the filter, the sigma points are first passedthrough the nonlinear process function in line 4, this gives a new set of sigmapoints, Sk . From this set, the statistics of the prediction is calculated in line 5 and6, where the weights for the mean is given by

w(i)m =

8><>:

�n+� for i = 0,

12(n+�) for i , 0

(2.26)

and the weights for the covariance by

w(i)c =

8><>:

�n+� +

⇣1 � ↵2 + �

⌘for i = 0,

12(n+�) for i , 0.

(2.27)

� � 0 is a constant that could be used to include information about the fourthorder term in the Taylor expansion. For a Gaussian distribution, � = 2 is optimal(Julier, 2002).

A new set of sigma points are now calculated in line 7 with the predicted meanand covariance matrix. This set with predicted sigma points are passed throughthe measurement model in line 9, which gives a set of sigma points, Y �k , for thepredicted measurement. The statistics of this set are calculated in line 10 to 12,where yk is the mean, Sk is the covariance matrix and Tk is the cross-covariancematrix for the predicted measurement.

Finally, the mean and covariance of the estimate are calculated in line 14 and15.

17

Page 28: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 2. FRAME OF REFERENCE

Algorithm 5 Unscented Kalman Filter1: function UKF(µk�1,⌃k�1,uk�1,yk)

2: X(i)k�1 =

8>>>>>>><>>>>>>>:

µk�1 for i = 0,

µk�1 +✓q

(n + �)⌃k�1

◆ (i)for i = 1, . . . ,n

µk�1 �✓q

(n + �)⌃k�1

◆ (i�n)for i = n + 1, . . . ,2n

3: Xk�1 =⇣X(0)

k�1 X(1)k�1 . . . X

(2n)k�1

4: Sk = g(Xk�1,uk�1)5: µ�k =

P2ni=0 w

(i)m S(i)

k

6: ⌃�k =P2n

i=0 w(i)c

⇣S(i)

k � µ�k⌘ ⇣S(i)

k � µ�k⌘T+Q

7: X(i)�k =

8>>>>>>><>>>>>>>:

µ�k for i = 0,

µ�k +✓q

(n + �)⌃�k◆ (i)

for i = 1, . . . ,n,

µ�k �✓q

(n + �)⌃�k◆ (i�n)

for i = n + 1, . . . ,2n

8: X�k =⇣X(0)�

k X(1)�k . . . X(2n)�

k

9: Y �k = h⇣X�k

10: yk =P2n

i=0 w(i)m Y (i)�

k

11: Sk =P2n

i=0 w(i)c

⇣Y (i)�

k � yk

⌘ ⇣Y (i)�

k � yk

⌘T+ R

12: Tk =P2n

i=0 w(i)c

⇣X(i)�

k � µ�k⌘ ⇣Y (i)�

k � yk

⌘T

13: Kk = TkS�1k

14: µk = µ�k +Kk�yk � yk

15: ⌃k = ⌃�k � KkSkKT

k16: return µk ,⌃k17: end function

18

Page 29: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

2.10. THE UNSCENTED RAUCH-TUNG-STRIEBEL SMOOTHER

2.10 The Unscented Rauch-Tung-Striebel SmootherThe unscented Rauch-Tung-Striebel smoother (URTSS) is the corresponding smootherto the UKF and was introduced by Särkka (2008). The algorithm is presented inAlgorithm 6.

Algorithm 6 Unscented Rauch-Tung-Striebel Smoother1: function URTSS(µs

k+1,⌃sk+1,µk ,⌃k ,uk)

2: X(i)k =

8>>>>><>>>>>:

µk for i = 0,

µk +⇣p

(n + �)⌃k⌘ (i)

for i = 1, . . . ,n

µk �⇣p

(n + �)⌃k⌘ (i�n)

for i = n + 1, . . . ,2n3: Xk =

⇣X(0)

k X(1)k . . . X(2n)

k

4: Sk+1 = g(Xk ,uk )5: µ�k+1 =

P2ni=0 w

(i)m S(i)

k+1

6: ⌃�k+1 =P2n

i=0 w(i)c

⇣S(i)

k+1 � µ�k+1

⌘ ⇣S(i)

k+1 � µ�k+1

⌘T+Q

7: Uk+1 =P2n

i=0 w(i)c

⇣X(i)

k � µk

⌘ ⇣S(i)

k+1 � µ�k+1

⌘T

8: Lk = Uk+1⇣⌃�k+1

⌘�1

9: µsk = µ�k + Lk

⇣µs

k+1 � µ�k+1

10: ⌃sk = ⌃k + Lk

⇣⌃s

k+1 � ⌃�k+1

⌘LT

k11: return µs

k ,⌃sk

12: end function

19

Page 30: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 31: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Chapter 3

Implementation

This chapter describes how the models, filters and smoothers were implementedand which methods that were used.

All software and simulations were implemented in MATLAB (2014) and Simulinkwith the signal processing toolbox.

The filter performance depends on, to some degree, how nonlinear the processfunction is and the nonlinearity of the process function depends on the dampersetting. Therefore, three di↵erent damping settings were used to compare filterperformance. These settings could be seen in Figure 1.1.

3.1 Parameter IdentificationThe damper models include a damping coe�cient and a spring constant that needsto be measured. This section describes how this was done.

3.1.1 Damping Coe�cientThe damping coe�cients for the linear models were identified with linear interpo-lation of the damping curves in Figure 1.1. The slope of the curve is the dampingcoe�cient and this resulted in the coe�cients presented in Table 3.1.

Table 3.1: Linear damping coe�cients

Setting Damping coe�cient

Low damping 4289 N s/mMedium damping 5160 N s/mHigh damping 5688 N s/m

21

Page 32: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 3. IMPLEMENTATION

The velocity dependent damping coe�cient Equation 2.11 was implementedas a lookup table with data points from Figure 1.1. Values outside and in betweenthe data points were found with linear extrapolation and interpolation. These mea-surements also include the static friction force and therefore no separate term wasneeded.

3.1.2 Spring ConstantThe spring constant determines how strong the position dependent force is. Theobvious way to identify its value is to run the damper from one position to anotherand measure how much the force changes. This is preferably done at low speedto minimize the damping force. This were done by collecting a force measure-ment data series at a velocity of �0.02 m/s and a position span of 50 mm. Therelationship between force and position were linear interpolated and this resultedin a spring constant of 628.9 N/m

3.2 Noise AnalysisThe filters and smoothers considered in this work assumes that the noise are Gaus-sian, therefore, it were of interest to make an analysis of the noise to see how wellthe noise could be approximated as Gaussian. To do this, a 30 s long data serieswere collected at 3184 Hz with the actuator at a static position. No damper wasmounted to prevent eventual vibrations to propagate to the load cell. The mean ofthe data series were subtracted to render the noise unbiased.

A frequency spectrum was generated for each sensor to reveal eventual fre-quency peaks. The frequency spectrum for the position sensor could be seen inFigure 3.1. Three prominent peaks are visible in the figure at 50 Hz, 336 Hz and1424 Hz. The peak at 50 Hz does most likely come from the switching frequencyin the mains electricity. The sources of the other two are unknown.

The spectrum of the force sensor noise reveals one high peak at 50 Hz anda smaller one at 550 Hz. This concludes that the measurement system seems tosu↵er from disturbances from the mains electricity.

To see how well the noise matches a Gaussian distribution, a histogram overthe measurement values were drawn. For the position signal, this show an approx-imately Gaussian distribution with a negative skewness, see Figure 3.3. The highfrequency peaks does not seem to have a↵ected the distribution too much. Theprobability distribution of the force signal seems to be approximately Gaussian aswell, see Figure 3.4. However, the histogram shows some negative kurtosis. Thefrequency peaks does not seem to have much influence on this distribution either.

The statistic properties of the noise are presented in Table 3.2.

22

Page 33: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

3.2. NOISE ANALYSIS

0 200 400 600 800 1000 1200 1400 16000

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8x 10

−6

Frequency/Hz

|Posi

tion|/m

Figure 3.1: A single sided frequency spectrum of the absolute value of the position noise. Threefrequencies stand out with high amplitudes, 50 Hz, 336 Hz and 1424 Hz.

0 200 400 600 800 1000 1200 1400 16000

1

2

3

4

5

6

Frequency/Hz

|Forc

e|/N

Figure 3.2: A single sided frequency spectrum of the absolute value of the force noise. A highpeak at 50 Hz is visible, there is also a small peak at 550 Hz.

23

Page 34: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 3. IMPLEMENTATION

−2 −1.5 −1 −0.5 0 0.5 1 1.5

x 10−5

0

2

4

6

8

10

12x 10

4

Position/m

Pro

bab

ilit

y D

ensi

ty/(

1/m

)

HistogramGaussian approximation

Figure 3.3: A histogram of the position noise and a white Gaussian with the same variance asthe noise for reference. The distribution seems to be approximately Gaussian with a negativeskewness.

−40 −30 −20 −10 0 10 20 300

0.01

0.02

0.03

0.04

0.05

0.06

Force/N

Pro

bab

ilit

y D

ensi

ty/(

1/N

)

HistogramGaussian approximation

Figure 3.4: A histogram of the force noise and a white Gaussian with the same variance as thenoise for reference. The distribution seems to be approximately Gaussian, but with a lower kurto-sis.

24

Page 35: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

3.3. DERIVATION OF INPUT SIGNAL

Table 3.2: Statistics of the sensors’ noise

Sensor Variance Skewness Kurtosis

Position 2.233 ⇥ 10�5 m2 -0.1949 2.349Force 83.53 N2 -0.01907 2.329

3.3 Derivation of Input SignalAs described in subsection 2.4.5, the input to the model was acceleration. Sincethe reference position signal was known, it was possible to calculate the referenceacceleration. However, since the control loop and the time constants in the sys-tem a↵ected the output, the dynamometer could not follow the reference exactly.Hence, a model of the dynamometer was needed. The reason for using a simulatedposition signal and not a measured signal to generate the input is noise. Noise isamplified with derivation and an input signal that was calculated from measuredposition would not have been as useful as a simulated signal.

By inspection and after some simulations, it was found that the dynamometertransfer function from reference position to output position were on the form

G(s) =K (s + a)

(s + b)(s + c), (3.1)

where s is the Laplace variable, a, b and c are constants that determine the loca-tions of the zero and poles. K is a constant that controls the static gain. The staticgain is given by the final value theorem (Ljung & Glad, 2006) and a step input tothe transfer function:

lims!0

sG(s)1s= K

abc. (3.2)

The static gain were one, which gives

Kabc= 1) K =

bca. (3.3)

The parameters were found by trial and error, this method resulted in the fol-lowing values:

a = 3.525,b = 3.6,c = 500.

There was also an input-output delay of 2.7 ms. The result from this model canbe seen in Figure 3.5. With the aid of this model, a predicted position signal wascreated. To get the final acceleration input, this signal was di↵erentiated twicewith respect to time.

25

Page 36: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 3. IMPLEMENTATION

53.5 54 54.5 55 55.5 56

1.04

1.06

1.08

1.1

1.12

1.14

1.16x 10

−3

Time/s

Posi

tion/m

Measured positionSimulated position

Figure 3.5: A comparison between model output and measured output for a selected part of adrive file.

3.4 Comparison MethodThe filters’ and smoothers’ performance were evaluated with the mean squarederror (MSE) between the estimate and the true value. This is a convenient measuresince it could be compared directly with the variance of the sensor noise. Themean squared error is defined as

MSE =1N

NX

k=1

( xk � xk )2, (3.4)

where xk is the estimate and xk is the true value. As usual, N is the total number ofsamples. It should be mentioned that these comparisons were done with simulateddata since it is impossible to know the true value xk in the real system.

3.5 Filter TuningThe noise covariance matrices Q and R are key variables for the performance ofthe filters. Their values decide if the filter should trust the model or the measure-ment. The measurement noise covariance matrix is determined from the noiseanalysis in section 3.2. The diagonal elements in the covariance matrix are the

26

Page 37: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

3.6. UKF PARAMETERS

measured sensor variance. The first element is the position variance and the sec-ond is the force variance. The cross-covariance between the noise from the forceand position sensor are assumed to be zero, which gives

R = 2.233 ⇥ 10�5 0

0 83.53

!. (3.5)

This left the covariances for the process noise as tuning parameters. The idea wasto make the estimate look “good” with the real data and use the same covariancesfor the simulated process noise. This was done with the UKF since it possessesthe best linearization method and hence should give the lowest model error in theforce state. The EKF and the KF must be compensated for their flaws by increas-ing the process noise covariance for the force model. This strategy also gave thecovariance for the velocity model. However, the position model has no uncer-tainty since it is a pure integration from position, which is a correct model. Butsetting this value to zero is not possible since it would make the matrix singularand non-invertible. The solution was to choose a low number, compared to theother covariances, but as high as possible to get a well-conditioned matrix. Thisgave one covariance matrix for each filter and for the UKF it was

Q =

0BB@1 ⇥ 10�13 0 0

0 1 ⇥ 10�5 00 0 3500

1CCA , (3.6)

for the EKF

Q =

0BB@1 ⇥ 10�13 0 0

0 1 ⇥ 10�5 00 0 4000

1CCA , (3.7)

and for the KF

Q =

0BB@1 ⇥ 10�13 0 0

0 1 ⇥ 10�5 00 0 7000

1CCA . (3.8)

The order of the variances in the covariance matrices are the same as in the statevector; position, velocity and force. The same covariance matrix was used foreach filter’s corresponding smoother.

3.6 UKF ParametersBesides of the covariance matrices, the UKF gives additional degrees of freedomthat include information about the noise. This is tuned with the parameters ↵, �

27

Page 38: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 3. IMPLEMENTATION

and (see section 2.9 for more information about the parameters). The startingpoint for tuning these parameters were

↵ = 1,� = 2, = 0.

The parameters were tuned by trial and error with the goal of achieving a lowerMSE. But it turned out that the starting point parameters were as good as it gets.

28

Page 39: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Chapter 4

Results and Analysis

This chapter presents, describe and analyze the outcome of this work. First, aperformance comparison with simulated data is presented. The simulated resultsare followed by figures showing the e↵ect of the filters and smoothers on realmeasured data. The results are presented in figures that are relevant for a realapplication. Some results were so similar that figures that would have appearedidentical are left out; instead a representing case is presented.

4.1 Performance ComparisonThe results for each filter for the position state are presented in Figure 4.1. The KFand EKF have the same MSE, while the UKF is a bit lower. The reason for thisinteresting result is that the UKF is better at incorporating the information fromthe force sensor to estimate the position. However, if the force signal is left out,or extremely noisy, all filters will be equally good. This is as expected since theposition model is linear and there is no benefit from using a filter that could handlenonlinear models. The corresponding results hold for the smoothers. There is asmall visible di↵erence between the low damping setting compared to the othersettings with the UKF and the URTSS.

The results for the velocity state are shown in Figure 4.2. As seen, since thevelocity state is not measured directly, but derived from the position signal, it isvery beneficial to use some sort of filter to use information from other states toform a velocity estimate. The reason for the discrepancy between KF, EKF andUKF is the same as described for the position state.

The results for the force state are presented in Figure 4.3. Here, the benefit ofusing a filter or smoother is almost neglectable. There are some small improve-ments, but it is obvious that the information other than the measured force is toonoisy to improve the estimate.

29

Page 40: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 4. RESULTS AND ANALYSIS

Unfiltered KF EKF UKF RTSS ERTSS URTSS0

0.5

1

1.5

2

2.5x 10

−11

MS

E/m

2

High dampingMedium dampingLow damping

Figure 4.1: A comparison of the position mean squared error for each filter type and each dampersetting, including the variance of the position sensor noise as a reference.

Unfiltered KF EKF UKF RTSS ERTSS URTSS0

1

2

3x 10

−4

MS

E/(

m/s

)2

High dampingMedium dampingLow damping

Figure 4.2: A comparison of the velocity mean squared error for each filter type and each dampersetting, including the variance of the time derivative of the position sensor noise as a reference.

30

Page 41: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

4.2. RESULTS WITH REAL DATA

Unfiltered KF EKF UKF RTSS ERTSS URTSS0

20

40

60

80

100

120

MS

E/N

2

High dampingMedium dampingLow damping

Figure 4.3: A comparison of the force mean squared error for each filter type and each dampersetting, including the variance of the force sensor as a reference.

4.2 Results with Real Data

This section present and illustrate the filtered results with real data. Only the UKFand the URTSS were used to form these results since the di↵erence between otherfilters and smoothers are so small that they basically look the same as the UKFand the URTSS. The UKF and the URTSS gives a representable view of how thefilters and smoothers can improve the measurements.

A comparison between an UKF estimate and a measurement is shown in Fig-ure 4.4 as the velocity with respect to position during one constant velocity stroke.As seen, there is a significant improvement of the signal quality.

The corresponding smoothed result for the velocity with respect to positionis shown in Figure 4.5. This figure should be compared with Figure 4.4. Theresult for the URTSS is much "smoother" than the UKF estimate, hence the namesmoother.

The filtered results for the velocity with respect to time during the same strokeas shown before is presented in Figure 4.6. It is clear how the filter improves themeasurement and this result could be put in relation to the variance comparison inFigure 4.2 to give an idea of what the improvement looks like in reality.

Figure 4.7 contains the result for the smoothed estimate of the velocity withrespect to time, this should be compared with Figure 4.6.

31

Page 42: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 4. RESULTS AND ANALYSIS

−0.03 −0.02 −0.01 0 0.01 0.02 0.03−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

Position/m

Vel

oci

ty/(

m/s

)

MeasurementUKF estimate

Figure 4.4: Filtered velocity with respect to filtered position during a 0.2 m/s stroke.

−0.03 −0.02 −0.01 0 0.01 0.02 0.03−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

Position/m

Vel

oci

ty/(

m/s

)

MeasurementURTSS estimate

Figure 4.5: Smoothed velocity with respect to smoothed position during a 0.2 m/s stroke.

32

Page 43: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

4.2. RESULTS WITH REAL DATA

45.5 45.6 45.7 45.8 45.9 46 46.1 46.2−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

Time/s

Vel

oci

ty/(

m/s

)

MeasurementUKF estimate

Figure 4.6: Filtered velocity with respect to time during a 0.2 m/s stroke.

45.5 45.6 45.7 45.8 45.9 46 46.1 46.2−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

Time/s

Vel

oci

ty/(

m/s

)

MeasurementURTSS estimate

Figure 4.7: Smoothed velocity with respect to time during a 0.2 m/s stroke.

33

Page 44: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 4. RESULTS AND ANALYSIS

The UKF estimate of the dynamic damping force with respect to velocity ispresented in Figure 4.8. The estimate contains less noise than the measurement,however, the estimate does not seem to conform with the measurement at 0.2 m/s.

Figure 4.9 shows the result for the smoothed relationship between dampingforce and velocity. Here, the estimate seems to have better conformity with themeasurement at 0.2 m/s compared to the UKF estimate.

34

Page 45: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

4.2. RESULTS WITH REAL DATA

−0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8−4000

−3000

−2000

−1000

0

1000

2000

3000

4000

Velocity/(m/s)

Forc

e/N

MeasurementUKF estimate

Figure 4.8: Filtered force with respect to filtered velocity. The damper were actuated with a 8 Hzsine wave during 1 s. The sine wave had and an amplitude of 0.5 m/s.

−0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8−4000

−3000

−2000

−1000

0

1000

2000

3000

4000

Velocity/(m/s)

Forc

e/N

MeasurementURTSS estimate

Figure 4.9: Smoothed force with respect to smoothed velocit. The damper were actuated with a8 Hz sine wave during 1 s. The sine wave had and an amplitude of 0.5 m/s.

35

Page 46: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 47: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Chapter 5

Discussion and Recommendations

There was almost no improvement of the force signal; this might be solved invarious ways. One way is to develop improved models and more accurate inputsignals to let the filters trust the process more. Another way might be to add moresensors. Depending on hardware and resources, it could be possible to add loadcells in series with each other. This would give more information to the filter aboutthe force signal and a lower variance as a result.

The measurements could be improved by investigate the noise sources, thisis out of the scope of this work and is only discussed briefly. As seen in thenoise analysis in section 3.2, the measurement system is probably a↵ected by themains supply. This might be di�cult or easy to resolve, depending on how thenoise is coupled to the system. Even if the noise sources are eliminated and themeasurement system is improved, old measurements remain noisy. The filtershowever, are able to improve data that is already collected.

The filtering techniques could be used to improve the dynamometer perfor-mance. With a filter in the control loop, the system benefits from the availabilityof a velocity estimate. I.e. the filter acts as a state observer. With a proper de-signed feed forward controller, this could result in higher controller performance.

5.1 Rejected Ideas

This section present and discuss ideas that were rejected, either because they didnot work or because a better solution were found.

An early idea was to use accelerometers to add usable information to the fil-tering algorithms. However, the method described in section 3.3 with a calculatedacceleration signal were proven to be superior to a noisy measured accelerometersignal. For applications were the input is not known, it could be suitable to use anaccelerometer to measure the input.

37

Page 48: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

CHAPTER 5. DISCUSSION AND RECOMMENDATIONS

Another theory was that the mounting assembly of the dynamometer was notsti↵ enough. Therefore, measurements were made with an accelerometer mountedon the cross head as well. But as Appendix A shows, including a model of themounting assembly would have resulted in a very sti↵ problem with numerical is-sues. Besides, it would have been necessary to develop some sort of measurementmethod to verify the models, maybe with strain gauges.

5.2 RecommendationsIf the application is o✏ine and a good model of the damper is available, it isrecommended to use the URTSS since it is the most accurate in this case. If thesame conditions are met, but the estimate is needed at real time, the UKF is thefirst choice. If there is no damper model or if no force measurements are available,the system is reduced and the model becomes linear. In this case, there is no needfor a filter that is capable of handling nonlinear models. Therefore the RTSS isa suitable choice for o✏ine applications and the KF is the appropriate filter foronline implementations.

38

Page 49: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Chapter 6

Conclusion

This comparison of Bayesian filters and smoothers shows the great benefit of us-ing a filter or smoother when observing states that are not measured, in this casevelocity. The filters also greatly improve the position estimate, while the force isalmost una↵ected in this case. It was shown that the KF and EKF perform thesame for estimating position and velocity. The UKF were slightly better since itincorporates information from the force signal to estimate position and velocity.

39

Page 50: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 51: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Appendix A

Dynamometer Eigenfrequencies

This appendix analyze the dynamic properties of the mounting assembly of thedynamometer and will act as a motivation for the exclusion of these dynamicsin the system model derived in section 2.4. The mounting assembly of the dy-namometer could be seen as three flexible beams, one horizontal beam supportedby two vertical columns.

A.1 Cross-HeadThe horizontal beam is called cross-head and is modeled as a simply supportedbeam with the length L, the density ⇢, the flexural rigidity EI and the cross sec-tional area A. The eigenfrequencies !n is given by the bending wave equation(Bodén et al., 2001):

d4 n

d x4 � !2n⇢AEI

n = 0, n = 1,2, . . . , (A.1)

where n is the mode shape for eigenfrequency n. With the given boundary con-ditions, the mode shape is

n = sin(knx) , (A.2)

where kn is the wave number for mode n and x denotes the position where thedeflection is measured. (Bodén et al., 2001). Only the first mode is consideredrelevant and this gives k1 =

⇡L (Bodén et al., 2001). Equation A.2 inserted in

Equation A.1 gives

k4n sin(knx) � !2

n⇢AEI

sin(knx) = 0. (A.3)

The force F is acting on the beam at half its length, which gives

x =L2. (A.4)

41

Page 52: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

APPENDIX A. DYNAMOMETER EIGENFREQUENCIES

When Equation A.3 is evaluated at this position and with the relevant wave num-ber, it becomes

⇡4

L4 � !21⇢AEI= 0. (A.5)

This gives

!21 =

⇡4EIL4⇢A

. (A.6)

The eigenfrequency fb of the beam is given by plugging in physical data ofthe cross-head into Equation A.6. This gives

!21 ⇡ 1.4 ⇥ 104 rad/s) fb ⇡ 2200 Hz, (A.7)

If included in the system model, this would have resulted in a very fast pole and asti↵ system. Besides, the eigenfrequency is out of the bandwidth of the measure-ment system and therefore not included in the model.

A.2 Vertical ColumnsThe two vertical columns are assumed to vibrate in phase with each other andtherefore modeled as one beam with twice the cross sectional area. The boundaryconditions are considered to be fixed in the lower end and with a point mass at theother (the horizontal beam). Only quasi-longitudinal waves are considered andthis gives the transcendental equation

cot � =m⇢SL

�, (A.8)

where m is the mass of the horizontal beam, ⇢ is the density of the vertical beam,S is the cross sectional area and L is the length (Bodén et al., 2001). � is used inthe following equation to calculate the eigenfrequency:

fn =cL

2⇡L�n, (A.9)

where cL is the phase velocity for quasi-longitudinal waves and fn is the eigenfre-quency for the nth modal shape (Bodén et al., 2001). This gives

f1 ⇡ 1200 Hz,

which will a↵ect the system more than the horizontal beam. However, even thisis considered irrelevant to include in the system model.

42

Page 53: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Appendix B

Gas Reservoir Spring Force

This appendix presents an analysis of the gas spring force from a thermodynam-ical point of view. Denote the pressure in the gas reservoir as p, the volume ofthe gas as V and the position coordinate z (origin at fully extension). Accordingto Dixon (2007, p. 269), the process could be seen as adiabatic for fast dynamicsand isothermal for slow dynamics. A more accurate model could be an polytropicprocess with an identified polytropic index, as discussed by Warner (1996). How-ever, an adiabatic process is considered accurate enough for this application. Thefollowing holds for an adiabatic process:

pV � = constant, (B.1)

where � is the heat capacity ratio, in this case � = 1.4 since the gas reservoir isfilled with nitrogen. The gas volume is

V = V0 � Ar z, (B.2)

where V0 is the initial volume and Ar is the cross sectional area of the piston rod.Equation B.1 and Equation B.2 yields

p0V �0 = p (V0 � Ar z)� ) p =

V0

V0 � Ar z

!�p0. (B.3)

The gas force contribution Fk is given by

Fk = Ar (p � pa), (B.4)

where pa is the atmospheric pressure. The nonlinear spring force could be lin-earized around a stationary point z⇤ as

Fk (z) ⇡ Fk (z⇤) +dFk (z)

dz

�����z⇤(z � z⇤)

= Fk (z⇤) +p0V �

0 A2r�

(V0 � Ar z⇤)�+1 (z � z⇤). (B.5)

43

Page 54: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

APPENDIX B. GAS RESERVOIR SPRING FORCE

For readability reasons, Equation B.5 is rewritten as

Fk (z) ⇡ k (z + Zp), (B.6)

where the spring constant is

k =p0V �

0 A2r�

(V0 � Ar z⇤)�+1 . (B.7)

The equivalent preload Zp is derived as

k Zp = Fk (z⇤) � kz⇤ ) Zp =Fk (z⇤)

k� z⇤. (B.8)

If the physical data of the considered damper is inserted into Equation B.7, thecalculated spring sti↵ness is

k ⇡ 250 N/m. (B.9)

This result is consistent with Dixon (2007, p. 269), who claims that the sti↵-ness usually is about 200 N/m. However, this is not even close to the measuredvalue of 628.9 N/m from section 3.1. This discrepancy is left unexplained and themeasured value was used in the models.

44

Page 55: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

Bibliography

Anderson, B. D. O. & Moore, J. B. (1979). Optimal Filtering. Prentice-Hall, Inc.

Arasaratnam, I. & Haykin, S. (2009). Cubature kalman filters. Automatic Control,IEEE Transactions on, 54(6), 1254–1269.

Bodén, H., Carlsson, U., Glav, R., Wallin, H., & Åbom, M. (2001). Ljud och Vi-brationer. Marcus Wallenberg Laboratoriet för Ljud- och Vibrationsforskning.

DeCarlo, R. A. (1989). Linear systems: A State Variable Approach with Numeri-cal Implementation. Prentice Hall.

Dixon, J. C. (2007). The Shock Absorber Handbook. John Wiley & Sons, Ltd.

Doucet, A. & Johansen, A. M. (2009). A tutorial on particle filtering and smooth-ing: Fifteen years later. In D. Crisan & B. Rozovskii (Eds.), The Oxford Hand-book of Nonlinear Filtering, volume 12 (pp. 656–704). Oxford: Oxford Uni-versity Press.

Gordon, N., Salmond, D., & Smith, A. F. M. (1993). Novel approach tononlinear/non-gaussian bayesian state estimation. Radar and Signal Process-ing, IEE Proceedings F, 140(2), 107–113.

Ito, K. & Xiong, K. (2000). Gaussian filters for nonlinear filtering problems.Automatic Control, IEEE Transactions on, 45(5), 910–927.

Julier, S. (2002). The scaled unscented transformation. In American ControlConference, 2002. Proceedings of the 2002, volume 6, (pp. 4555–4559 vol.6).

Julier, S. J. & Uhlmann, J. K. (1997). New extension of the kalman filter tononlinear systems.

Kalman, R. E. (1960). A new approach to linear filtering and prediction problems.Journal of basic Engineering, 82(1), 35–45.

45

Page 56: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

BIBLIOGRAPHY

Karnopp, D. (1985). Computer simulation of stick-slip friction in mechanical dy-namic systems. Journal of dynamic systems, measurement, and control, 107(1),100–103.

Ljung, L. & Glad, T. (2004). Modellbygge och simulering. Studentlitteratur.

Ljung, L. & Glad, T. (2006). Reglerteknik. Studentlitteratur.

MATLAB (2014). MATLAB and Signal Processing Toolbox Release R2014a.Natick, Massachusetts: The MathWorks Inc.

Nørgaard, M., Poulsen, N. K., & Ravn, O. (2000). New developments in stateestimation for nonlinear systems. Automatica, 36(11), 1627 – 1638.

Rauch, H. E., Striebel, C., & Tung, F. (1965). Maximum likelihood estimates oflinear dynamic systems. AIAA journal, 3(8), 1445–1450.

Särkka, S. (2008). Unscented rauch–tung–striebel smoother. Automatic Control,IEEE Transactions on, 53(3), 845–849.

Särrkä, S. (2013). Bayesian Filtering and Smoothing. Cambridge UniversityPress.

Thrun, S., Burgard, W., & Fox, D. (2005). Probabilistic Robotics. MIT Press.

Van Der Merwe, R. (2004). Sigma-point Kalman filters for probabilistic inferencein dynamic state-space models. PhD thesis, University of Stellenbosch.

Warner, B. (1996). An analytical and experimental investigation of high perfor-mance suspension dampers. PhD thesis, Concordia University.

46

Page 57: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes
Page 58: Bayesian Filtering and Smoothing to Measure Damper ...1075512/FULLTEXT01.pdf1.3 Bayesian Filtering and Smoothing The considered filtering methods are all implementations of the Bayes

www.kth.se