Content uploaded by Haakon Jondal Helle

Author content

All content in this area was uploaded by Haakon Jondal Helle on Feb 06, 2019

Content may be subject to copyright.

Methods for Identification of

Instantaneous Frequencies for

Application in Isolated Microgrid

Haakon Jondal Helle

Master of Science in Cybernetics and Robotics

Supervisor: Marta Maria Cabrera Molinas, ITK

Co-supervisor: Mohammad Amin, ITK

Department of Engineering Cybernetics

Submission date: June 2017

Norwegian University of Science and Technology

Problem Description

Name: Haakon Jondal Helle

Faculty: Faculty of Information Technology and Electrical Engineering

Department: Department of Engineering Cybernetics

Study program: Cybernetics and robotics (Master, 5 years)

Main proﬁle: Control of smart grids and renewable energy

Start date: 9 January 2017

Due date: 5 June 2017

Supervisor: Professor Marta Molinas

Title: Methods for Identiﬁcation of Instantaneous Frequencies for Application in Isolated

Microgrids

Work Description:

• Find a suitable model for the extended Kalman ﬁlter and unscented Kalman ﬁlter for

estimating ”instantaneous frequencies” or time-varying frequencies in multicompo-

nent signals.

• Implement an Extended Kalman ﬁlter and an unscented Kalman ﬁlter using this

model, in Matlab and Simulink.

• Assess the strengths and limitations of this model when identifying instantaneous

frequencies in synthetic signals.

• Implement Hilbert Huang Transform (empirical mode decomposition and Hilbert

Transform) in Matlab and Simulink.

• Propose the method of merging empirical mode decomposition and Kalman ﬁl-

tering. Suggest structures for single-phase and three-phase systems. Validate the

merged tool using synthetic signals.

• Assess the aforementioned methods with real voltage measurements from a marine

vessel power system. Implement a phase-locked loop to serve as reference for the

tracking of the fundamental frequency.

i

ii

Abstract

THE introduction of new methods for production and distribution of electrical energy

has increased the attention related to problems with power quality and the presence

of time-varying frequencies. It has been reported several cases with such problems in iso-

lated electrical systems such as isolated microgrids for incorporation of renewable energy

sources and marine vessel power systems. The sources and loads in such systems are usu-

ally interfaced with power electronic equipment, meaning that there is low or no inertia.

The low inertia and the stochastic nature of the generation and loads results in systems

that are prone to nonlinear distortions and variations in the fundamental frequency. The

hitherto used measurement- and monitoring equipment have mostly been based on average

value calculation. The aforementioned problems in isolated electrical systems have made

the need of measurement of instantaneous values instead of average values apparent, in

order to have monitoring- and control systems with satisfying performance and accuracy.

This thesis studies the use of several types of Kalman ﬁlters (KF), Hilbert-Huang Trans-

form (HHT) and the proposed method of merging empirical mode decomposition (EMD)

and KF for the purpose of tracking instantaneous values of voltage- and current waveforms

in isolated microgrids with the aforementioned challenges. Both synthetic signals and real

measurements from a marine vessel power system were used to validate the methods. The

algorithms and methods were implemented in Matlab and Simulink.

In varying degrees, the methods did all prove to be viable options for tracking of the funda-

mental frequency on the marine vessel. The proposed method turned out to be particularly

powerful to decompose multicomponent signals consisting of several time-varying mono-

components, and track their instantaneous amplitude and frequency.

iii

iv

Sammendrag

INNFØRINGEN av nye metoder for produksjon og fordeling av elektrisk energi har økt

oppmerksomheten rundt problemer med strømkvalitet og tidsvarierende frekvenser.

Det har blitt rapportert ﬂere hendelser med slike problemer i isolerte kraftsystem som for

eksempel isolerte microgrids for inkorporering av fornybare energikilder og kraftsystem

ombord p˚

a marinfartøy med elektrisk fremdrift. Kilder og laster i slike system er van-

ligvis knyttet sammen gjennom kraftelektronisk utstyr, noe som fører til lavt treghetsmo-

ment. Det lave treghetsmomentet, i tillegg til kraftproduksjonens og lastenes stokastiske

natur, resulterer i system som er utsatt for ulineære forvrengninger og variasjoner i grunn-

frekvensen. Det hittil benyttede m˚

ale- og overv˚

akingsutstyret har for det meste vært basert

p˚

a gjennom- snittsverdi beregninger. De tidligere nevnte problemene i isolerte kraftsys-

tem har gjort det tydelig at m˚

alinger heller burde baseres p˚

a momentanverdier, slik at

overv˚

akings- og kontrollsystemer opprettholder tilfredsstillende ytelse og nøyaktighet.

Denne masteroppgaven studerer bruken av forskjellige Kalman-ﬁltre (KF), Hilbert-Huang

Transform (HHT) og den foresl˚

atte metoden for sammensl˚

aing av empirical mode decom-

position (EMD) og KF for følging av momentantverdier i spennings- og strøm bølgeformer

i isolerte microgrids med de nevnte utfordringene. B ˚

ade syntetiske signaler og ekte spen-

ningsm˚

alinger fra et kraftystem p˚

a marinfartøy ble brukt til ˚

a validere de forskjellige meto-

dene. Algoritmene og metodene ble implementert i Matlab og Simulink.

I varierende grad, viste de foresl˚

atte metodene seg ˚

a være gode metoder for følging av

grunnfrekvensen om bord p˚

a marinfartøyet. Den foresl˚

atte metoden viste seg ˚

a være spe-

sielt kraftig for ˚

a dekomponere signal bestende av ﬂere tidsvarierende monokomponenter,

og estimere deres momentane amplitude og frekvens.

v

vi

Preface

THIS is the master’s thesis to conclude the Master of Science degree in Cybernetics

and Robotics at the Norwegian University of Science and Technology. The work

was carried out at the Department of Engineering Cybernetics during spring 2017.

I would like to express my sincere gratitude to my supervisor, professor Marta Molinas

for giving me the opportunity to work with such an interesting topic. The completion of

the thesis would not have been possible without her tireless guidance and her remarkable

insight on the topic. Secondly, I would like to thank Vijay Venu Vadlamudi. His great

lectures aroused my interest for the world of electric power engineering.

I am grateful for the mail conversations with Manuel Duarte Ortigueira and Raul Rato for

increasing my understanding of their version of the EMD.

I would also like to thank Tomasz Tarasiuk from Gdynia Maritime Institute for providing

the measurements from the marine vessel power system.

Trondheim, 5 June 2017

Haakon Jondal Helle

vii

viii

Table of Contents

Problem Description i

Abstract iii

Sammendrag v

Preface vii

Table of Contents ix

List of Tables xiii

List of Figures xv

Abbreviations xvii

1 Introduction 1

1.1 Background and Motivation . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Thesis Objective and Scope of Work . . . . . . . . . . . . . . . . . . . . 2

1.3 MainContributions............................. 2

1.4 StructureoftheReport ........................... 2

2 State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids 5

2.1 Introduction to Microgrids . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 Fundamental Deﬁnitions . . . . . . . . . . . . . . . . . . . . . . . . . . 6

2.2.1 Time- and Phasor Domain . . . . . . . . . . . . . . . . . . . . . 6

2.2.2 RMS, Effective Value . . . . . . . . . . . . . . . . . . . . . . . . 8

2.2.3 Harmonics and Total Harmonic Distortion . . . . . . . . . . . . . 8

2.2.4 FourierAnalysis .......................... 8

2.2.5 Clarke Transformation . . . . . . . . . . . . . . . . . . . . . . . 9

2.2.6 Symmetrical Component Theory - Fortescue’s Theorem . . . . . 10

2.3 Frequency Identiﬁcation Methods . . . . . . . . . . . . . . . . . . . . . 12

ix

2.3.1 Kalman Filter and Extended Kalman Filter . . . . . . . . . . . . 12

2.3.2 The Unscented Kalman Filter . . . . . . . . . . . . . . . . . . . 14

2.3.3 Hilbert Transform . . . . . . . . . . . . . . . . . . . . . . . . . 18

2.3.4 Hilbert-Huang Transform . . . . . . . . . . . . . . . . . . . . . 19

2.3.5 Phase-Locked Loop . . . . . . . . . . . . . . . . . . . . . . . . 23

3 Summary of Previous Work 25

3.1 The Kalman ﬁlter and the Adaptive Kalman ﬁlter . . . . . . . . . . . . . 25

3.2 The Extended Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . 29

4 Harmonics- and Frequency Tracking Using Kalman Filters 31

4.1 Tracking of Three-Phase Harmonics Based on Linear Kalman Filter . . . 31

4.2 Tracking of Fundamental Frequency Based on Extended- and Unscented

KalmanFilter ................................ 35

4.3 Simulations ................................. 37

4.3.1 Estimation of the Phase Angle . . . . . . . . . . . . . . . . . . . 37

4.3.2 Tracking of Time-Varying- Amplitude and Fundamental Frequency 38

5 Merging Empirical Mode Decompositon and Kalman Filtering 41

5.1 Single-PhaseSystems............................ 41

5.2 Three-PhaseSystems ............................ 42

5.3 Merging Empirical Mode Decompositon and Kalman Filtering - A Vali-

dationStudy................................. 44

5.3.1 Experiment1 ............................ 44

5.3.2 Experiment2 ............................ 47

6 Assessment of Methods for Tracking of Time-Varying Frequencies in real data

from a Marine Vessel Power System 51

6.1 3.33secondanalysis ............................ 53

6.2 60secondanalysis ............................. 55

6.3 Interpreting the Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

7 Conclusion and Future Work 63

Bibliography 65

Appendices 71

A Simulink Models 73

A.1 Tracking in Three-Phase Test System . . . . . . . . . . . . . . . . . . . . 73

A.2 Tracking in Marine Vessel Power System . . . . . . . . . . . . . . . . . 75

B Matlab Code 77

B.1 Voltage Source in the Three-Phase Test System . . . . . . . . . . . . . . 77

B.2 Empirical Mode Decomposition . . . . . . . . . . . . . . . . . . . . . . 78

B.3 Calculation of Instantaneous Amplitude and Frequency . . . . . . . . . . 80

B.4 Extended Kalman Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

x

xii

List of Tables

3.1 Parameters for project experiment 1. . . . . . . . . . . . . . . . . . . . . 27

3.2 Parameters for project experiment 2. . . . . . . . . . . . . . . . . . . . . 29

5.1 Parameters and tuning in experiment 1. . . . . . . . . . . . . . . . . . . . 45

5.2 Parameters and tuning in experiment 2. . . . . . . . . . . . . . . . . . . . 47

6.1 UKF tunings for tracking on the marine vessel. . . . . . . . . . . . . . . 52

xiii

xiv

List of Figures

2.1 An example microgrid with DC bus and the possibility to connect to the

maingrid. .................................. 6

2.2 Three-phase voltages in the time domain. Phase voltages plotted with solid

lines and line voltages plotted with dotted lines. . . . . . . . . . . . . . . 7

2.3 Three-phase voltages shown in a phasor diagram. . . . . . . . . . . . . . 7

2.4 The Clarke transformation shown graphically. . . . . . . . . . . . . . . . 10

2.5 Unbalanced three phase voltages. . . . . . . . . . . . . . . . . . . . . . . 11

2.6 The sequence components of the unbalanced voltages. . . . . . . . . . . 12

2.7 TheKFalgorithm. ............................. 14

2.8 Comparison between the HT and FFT. . . . . . . . . . . . . . . . . . . . 19

2.9 Signal with spline interpolations and mean. . . . . . . . . . . . . . . . . 21

2.10StepsoftheEMD............................... 22

2.11 Instantaneous amplitude and frequency of the three ﬁrst IMFs. . . . . . . 23

2.12 PLL structure and step response. . . . . . . . . . . . . . . . . . . . . . . 24

3.1 The regular KF and the AKF compared. . . . . . . . . . . . . . . . . . . 26

3.2 Comparison between the KF and the AKF. . . . . . . . . . . . . . . . . . 27

3.3 The analytical impedance of the MMC compared with impedance obtained

by small-signal perturbation. . . . . . . . . . . . . . . . . . . . . . . . . 28

3.4 The analytical impedance of the MMC compared with impedance obtained

by KF and FFT for selected harmonics. . . . . . . . . . . . . . . . . . . 28

3.5 Simulations of the EKF. . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4.1 A small section of the three-phase voltages. . . . . . . . . . . . . . . . . 37

4.2 Simulations of the EKF, no noise. . . . . . . . . . . . . . . . . . . . . . 38

4.3 Simulations of the EKF, with noise. . . . . . . . . . . . . . . . . . . . . 38

4.4 Three-phase voltages and frequency. . . . . . . . . . . . . . . . . . . . . 39

4.5 Tracking of voltages with time-varying amplitude and frequency with fv=

2Hz, fm= 1 H z, fc= 10 H z. ...................... 39

xv

4.6 Tracking of voltages with time-varying amplitude and frequency with fv=

10 Hz, fm= 5 H z, fc= 100 H z...................... 40

4.7 Tracking of voltages time-varying amplitude and frequency with fv=

2Hz, fm= 1 H z, fc= 3 H z........................ 40

5.1 Merging of EMD and KF. Single-phase structure. . . . . . . . . . . . . . 42

5.2 Merging of EMD and KF. Three-phase structures. . . . . . . . . . . . . . 43

5.3 The IMFs and residue of the space vector. . . . . . . . . . . . . . . . . . 45

5.4 Experiment1results. ............................ 46

5.5 The IMFs and residue of the space vector. . . . . . . . . . . . . . . . . . 48

5.6 Experiment2results. ............................ 49

6.1 Line voltages and FFT plot. . . . . . . . . . . . . . . . . . . . . . . . . . 52

6.2 IMFs of the 3.33 seconds space vector. . . . . . . . . . . . . . . . . . . . 53

6.3 Results using the different methods. . . . . . . . . . . . . . . . . . . . . 54

6.4 IMFs of the 60 seconds space vector. . . . . . . . . . . . . . . . . . . . . 55

6.5 Results using the different methods. . . . . . . . . . . . . . . . . . . . . 56

6.6 The instantaneous amplitude and frequency obtained by HHT for the ﬁrst

andsecondIMFs............................... 57

6.7 The instantaneous amplitude and frequency obtained by the merged EMD

and UKF for the two ﬁrst IMFs. . . . . . . . . . . . . . . . . . . . . . . 57

6.8 The three ﬁrst IMFs of the space vector, and the space vector it self, plotted

for three fundamental periods. . . . . . . . . . . . . . . . . . . . . . . . 58

6.9 Comparison between HHT and merged EMD and UKF . . . . . . . . . . 59

6.10SineﬁttingtoIMF1. ............................ 60

6.11 Sine wave ﬁtted to the instantaneous amplitude and frequency obtained by

HHT. .................................... 61

6.12 Sine wave ﬁtted to the instantaneous frequency obtained by HHT. . . . . 62

A.1 Implementation of the three-phase test system in Simulink. . . . . . . . . 73

A.2 Implementation of three-phase voltage source in Simulink. . . . . . . . . 74

A.3 Implementation of the extended Kalman ﬁlter in the test system. . . . . . 74

A.4 Implementation of the unscented Kalman ﬁlter in the test system. . . . . . 75

A.5 Implementation of the unscented Kalman ﬁlter for tracking on the marine

vessel..................................... 75

A.6 Implementation of the different tracking methods on the marine vessel. . . 76

A.7 Implementation of the PLL. . . . . . . . . . . . . . . . . . . . . . . . . . 76

xvi

Abbreviations

AC Alternating current

AKF Adaptive Kalman ﬁlter

DC Direct current

DFT Discrete Fourier transform

EKF Extended Kalman ﬁlter

EMD Empirical mode decomposition

FFT Fast Fourier transform

FIR Finite impulse response

HHT Hilbert-Huang transform

HT Hilbert transform

IMF Intrinsic mode function

PV Photovoltaics

KF Kalman ﬁlter

MAF Moving average ﬁlter

MMC Modular multilevel converter

PI Proportional-Integral

PLL Phase-locked loop

RMS Root mean square

THD Total harmonic distortion

UKF Unscented Kalman ﬁlter

xvii

xviii

Chapter 1

Introduction

1.1 Background and Motivation

DUE to a large amount of rotating masses in the electric generators and loads, classi-

cal electric power systems have been characterized by excellent power quality and

frequency with very small drifts away from the fundamental frequency, usually at 50 Hz

or 60 Hz. With the increasing amount of power electronics equipment in the grids, such

as rectiﬁers, inverters, adjustable speed drives and the like, harmonics and nonlinear dis-

tortions are increasingly injected. This makes real-time measurement and estimation of

essential quantities such as frequency and magnitude a challenging, but necessary task.

With no connections to a strong-/stiff grid, stand-alone power systems such as isolated

microgrids (e.g photovoltaics (PV) microgrids or marine vessel power systems) are prone

to problems with severe frequency deviations. The low inertia in such systems requires

properly implemented controllers in order to maintain satisfying operation. In addition to

the harmonic pollution, advanced inverter control may produce time-varying oscillations

in conditions with varying load demand [1]. The role of these invertes are to serve as an

interface between the generation source and the loads. ”Static” power electronics equip-

ment such as the inverter is a means of inverting DC power to AC power in the cases where

the generation source is not rotating, e.g solar panels, fuel cells or battery banks supplying

DC power [1]. Hitherto, data acquisition- and measurement systems have generally been

based on average value calculations and harmonics that are integer multiples of a con-

stant fundamental frequency [2, 3]. After an extensive study of IEC Standard 61000-4-7

measuring methods, [4] states that these methods do not produce accurate results in envi-

ronments with time-varying angular frequency. Keeping the aforementioned problems of

nonlinearities and time-varying quantities in mind, measurements and estimation in iso-

lated microgrids should rather be based on instantaneous amplitude and frequency rather

than the usage of average values [1,5]. With improved data acquisition- and measurement

tools, the supervisory control systems in isolated microgrids may perform better actions,

and earlier hidden distortions may be revealed.

1

Chapter 1. Introduction

1.2 Thesis Objective and Scope of Work

THE objective of this thesis is to review current literature on speciﬁc frequency iden-

tiﬁcation methods, and assess their viability in microgrids with time-varying funda-

mental frequency and nonlinear distortions. This is obtained by running simulations using

synthetic signals and real voltage measurements from a marine vessel power system.

Fundamental theory for microgrids and the methods used in this thesis are carried out in a

thorough manner. The extended Kalman ﬁlter (EKF) and unscented Kalman ﬁlter (UKF)

algorithms, and their models are derived. Also a phase-locked loop (PLL), EMD, Hilbert

transform (HT) and the proposed method of merging EMD and UKF are outlined. These

methods are implemented in Matlab and Simulink for assessment of their potential for

tracking of instantaneous amplitude and frequency of voltage- and current waveforms in

isolated microgrids, and for veriﬁcation of the derived models used by the EKF and UKF.

It is also studied how some of the methods are able to break down multicomponent signals

into monocomponents, from which instantaneous amplitude and frequency with physical

meaning can be studied. Synthetic signals and real voltage measurements from a marine

vessel power system during sea voyage will be used for this purpose.

1.3 Main Contributions

THE main contributions of this thesis are:

• An extensive literature review of papers and books relevant to the objective is ren-

dered in an easy-to-read and compact thesis.

• A proposed method for better phase angle estimation in noisy environments.

• Study of the nonlinear KF model limitations, regarding tracking of signals with

time-varying amplitude and frequency.

• The merging of EMD and KF is in this thesis proposed by the supervisor and author,

for the ﬁrst time to the authors knowledge. Single-phase and three-phase topologies

are developed. This new method is tested with synthetic signals and real voltage

measurements, showing promising results.

1.4 Structure of the Report

THE thesis is outlined as follows:

Chapter 1: Introduction - This chapter presents the background and motivation for

the work in this thesis. It also contains the thesis objective, scope of work, main contribu-

tions and the structure of the report.

Chapter 2: State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

- This chapter introduces the concept of microgrids, fundamental deﬁnitions and impor-

tant frequency identiﬁcation methods. It also contains literature review and state-of-the-art

within the ﬁeld.

2

1.4 Structure of the Report

Chapter 3: Summary of Previous Work - This chapter summarizes the most important

results from the specialization project carried out autumn 2016.

Chapter 4: Harmonics- and Frequency Tracking using Kalman Filters - Linear and

nonlinear mathematical models for the different KFs are developed. Simulations are con-

ducted to conﬁrm the models and to study their feasibility.

Chapter 5: Merging Empirical Mode Decomposition and Kalman Filtering - The pro-

posed method of combining EMD and KF is outlined, and validated with simulations.

Chapter 6: Assessment of Methods for Tracking of Time-Varying Frequencies in a

Marine Vessel Power System - The feasibility of the different frequency identiﬁcation

methods outlined in this thesis are assessed by using real voltage measurements from a

marine vessel power system during sea voyage in rough sea conditions.

Chapter 7: Conclusion & Future Work - Conclusion of the thesis and recommended

work for future papers and master theses.

Appendix A: Simulink Models - Some of the Simulink models used in this thesis are

included in this appendix.

Appendix B: Matlab Code - Some of the scripts and functions used in Matlab and

Simulink are listed here.

3

Chapter 1. Introduction

4

Chapter 2

State-of-the-art in Methods for

Frequency Identiﬁcation in

Microgrids

2.1 Introduction to Microgrids

ACCORDING to the U.S Department of Energy a microgrid is ”a group of intercon-

nected loads and distributed energy resources with clearly deﬁned electrical bound-

aries that acts as a single controllable entity with respect to the grid and can connect and

disconnect from the grid to enable it to operate in both grid connected or island modes”

[6]. The International Energy Agency (IEA) estimates that to achieve the goal of universal

access to electrical energy, 70% of rural areas lacking electricity will have to connect to

mini-grid or off-grid solutions [7]. Often microgrids are intended as a means of incorpo-

rating distributed and renewable energy sources such as solar PV, wind power, small hydro

and more. Microgrids are also used for military applications, offshore and maritime appli-

cations. Figure 2.1, inspired by [8], shows an example DC microgrid with a PV array and

battery bank supplying DC and AC loads. The microgrid is able to connect to and discon-

nect from the main grid. This point is called the point of common coupling (PCC). When

operating in island mode the available capacity from the energy storage and PV array must

exceed the power drawn from critical loads. Should there be any surplus energy in the mi-

crogrid, it may be sent to the main grid or be stored in the battery bank. The AC/DC block

is a rectiﬁer/inverter, depending on the direction of the power ﬂow. The DC/DC blocks are

mainly buck or boost converters, depending on whether the voltage levels should decrease

or increase. The DC/DC block connected to the battery bank is a so-called bi-directional

converter, having the ability to increase or decrease the voltage levels depending on the

direction of the power ﬂow.

5

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

Though having many advantages, there are several challenges related to the microgrids. In

isolated microgrids the amount of rotating mass is usually low, i.e low inertia. This can

often lead to severe frequency deviations if the controllers are not properly implemented

[9].

Figure 2.1: An example microgrid with DC bus and the possibility to connect to the main grid.

2.2 Fundamental Deﬁnitions

INthe following subsections several fundamental terms and deﬁnitions used in the the-

sis are explained, containing basic three-phase system and circuit analysis theory, har-

monics, Fourier analysis, different transformations and more.

2.2.1 Time- and Phasor Domain

Balanced three-phase voltages are shown in the time- and phasor domain in Figure 2.2 and

Figure 2.3. The three phases are denoted a,band c, and can be represented as in equation

(2.1). The three phases are displaced by 120◦or 2π

3radians in balanced systems, and has

the frequency fn, usually 50 Hz or 60 H z in most power systems. Currents will have the

same waveforms as the voltages.

va(t) = ˆ

Vacos(2πfnt)(2.1a)

vb(t) = ˆ

Vbcos(2πfnt−120◦)(2.1b)

vc(t) = ˆ

Vccos(2πfnt+ 120◦)(2.1c)

Line voltages, or line-line voltages may be expressed as vab(t) = va(t)−vb(t)and so on.

Phase- and line voltages are often denoted as vφand vl. The following relations applies:

vl=√3vφ∠30◦(2.2)

Three-phase quantities may also be represented in the phasor domain:

Va=ˆ

Vaej0◦=ˆ

Va∠0◦(2.3a)

6

2.2 Fundamental Deﬁnitions

Vb=ˆ

Vbe−j120◦=ˆ

Vb∠−120◦(2.3b)

Vc=ˆ

Vcej120◦=ˆ

Vc∠120◦(2.3c)

where the the angular frequency ωn= 2πfnis assumed to be known. In fact each phasor

is multiplied with the term ejωnt, but is usually omitted as it is implied.

Vl=1.732·Vφ

-Vφ

-Vl

120°

30°

Vφ

VaVbVc

Vab Vbc Vca

Figure 2.2: Three-phase voltages in the time domain. Phase voltages plotted with solid lines and

line voltages plotted with dotted lines.

Re

Im

Vca Vab

Va

Vb

Vbc

Vc

Figure 2.3: Three-phase voltages shown in a phasor diagram.

7

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

2.2.2 RMS, Effective Value

The term root mean square (RMS) is commonly used in electrical power engineering.

Vrms is the effective value of v(t), it can be regarded as the DC-value that will give the

same dissipated power over an resistance as v(t)does on average [10]. The instantaneous

power over an resistance can be expressed as:

p(t) = v(t)i(t) = v(t)2

R(2.4)

The RMS value of any voltage can be found by an integral, as in (2.5).

V2

RMS

R=1

R

1

TZT

0

v(t)2dt (2.5)

giving

VRMS =s1

TZT

0

v(t)2dt (2.6)

For sinusoids, it can be shown that ˆ

V=√2VRM S .

2.2.3 Harmonics and Total Harmonic Distortion

Total harmonic distortion (THD) is a measure of harmonic distortion, and is deﬁned as the

ratio between the sum of the power of the harmonics and the power of the fundamental

frequency. Harmonic components are often introduced by power electronics equipment,

such as rectiﬁers and inverters, and has frequencies with an integer times the fundamental

frequency. Let a distorted voltage be deﬁned as:

vs(t) = vs1(t) + X

h6=1

vsh(t),(2.7)

where vs1(t)is the fundamental component and vsh(t)are the harmonics. In terms of

RMS, the THD of the voltage deﬁned in equation (2.7) can be found as follows [10]:

%T H Dv= 100 ·pV2

s−V2

s1

Vs1

= 100 ·v

u

u

tX

h6=1 Vsh

Vs12

(2.8)

2.2.4 Fourier Analysis

Fourier analysis of electrical voltage and current waveforms is hitherto the most widely

used method in instrumentation for electrical applications such as smart meters, spectrum

analyser, phasor measurement units and many more. With the presence of time-varying

quantities the frequency based methods may suffer from the leakage and picket-fence ef-

fects [11]. Leakage refers to the spreading of energy from one frequency to the adjacent

frequencies. The picket-fence effect occurs if the analysed signal contains harmonics that

are not an integer times the fundamental.

8

2.2 Fundamental Deﬁnitions

According to IEEE 519 and IEC 61000-4-7, harmonic measurements using Fourier series

should be done in the following manner [2,3, 12]:

x(t) = a0+∞

X

h=1

chsin( h

Nωnt+φh)(2.9a)

ch=qa2

h+b2

h(2.9b)

φh= tan−1ah

bh,if bh≥0(2.9c)

φh=π+ tan−1ah

bh,if bh<0(2.9d)

and

ah=2

TwZTw

0

x(t) cos h

Nωnt+φhdt (2.10a)

bh=2

TwZTw

0

x(t) sin h

Nωnt+φhdt (2.10b)

a0=1

TwZTw

0

x(t)dt (2.10c)

where wnis the fundamental frequency, his the harmonic order, Twis the duration of

the window and Nis the number of fundamental periods within the window width. As

the measurements obtained by data acquisition- and measurement systems are in discrete

time, the equations above is not used exactly as they are given. The aforementioned trans-

forms DFT and FFT are in that case used, where the only difference between the two is

that the latter is a more efﬁcient implementation. The FFT takes advantage of symmetries,

reducing the number of computing operations needed from O(N2)(DFT) to O(Nlog N)

(FFT) [13].

2.2.5 Clarke Transformation

The Clarke transformation, also known as αβγ-, or αβ0transformation, is a means of

simplifying three-phase quantities by projecting them onto a stationary reference frame

denoted αand β[14]. This transformation is conceptually similar to the Park-, or dq0

transformation, where the difference is that the Park transformation projects three-phase

quantities onto a rotating reference frame. The transformation from abc reference frame

to the stationary reference frame, αand β, can be obtained by:

Xαβ0=T Xabc ,(2.11)

and inversely from αβ0to abc:

Xabc =T−1Xαβ0.(2.12)

9

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

The transformation matrices in equation (2.11) and (2.12) are deﬁned as in (2.13) and

(2.14).

T=2

3

1−1

2−1

2

0√3

2−√3

2

1

2

1

2

1

2

(2.13)

T−1=

1 0 1

−1

2

√3

21

−1

2−√3

21

(2.14)

The transformation is shown in Figure 2.4, where balanced three phase quantities are trans-

formed into the α−and βaxis. Since the system is balanced, the γor 0component equals

zero.

Re

Im

Clarke Transform

a

α

β

b

c

Figure 2.4: The Clarke transformation shown graphically.

2.2.6 Symmetrical Component Theory - Fortescue’s Theorem

The fundamentals for symmetrical component theory was ﬁrst presented by Fortescue in

[15], which is a paper that is by many seen upon as one of the most important papers

in electric power engineering. Fortescue proposed that any set of N unbalanced phasors

could be expressed as the sum of N symmetrical sets of balanced phasors. This does of

course apply to three phase system, where the three symmetrical sets of balanced phasors

are called positive-, negative- and zero sequence components. The positive sequence com-

ponents is a set of three balanced vectors, with equal magnitude, same phase sequence and

displaced by 120◦with respect to each other. The same properties applies to the negative

sequence components except that the phase sequence is opposite. The zero sequence com-

ponents is a set of three balanced vectors with equal magnitudes and equal phase angles,

i.e in phase.

10

2.2 Fundamental Deﬁnitions

Any set of unbalanced voltages or currents in the abc reference frame, Xabc, can be trans-

formed into balanced positive, neqative and zero sequence components, X012.X012 =

A−1Xabc, where A−1is the transformation matrix:

A−1=1

3

1 1 1

1a a2

1a2a

,(2.15)

where a=ej120◦. Similarly the sequence components can be transformed back to the

original unbalanced quantities. Xabc.Xabc =AX012 where Ais the transformation

matrix:

A=

1 1 1

1a2a

1a a2

(2.16)

Figure 2.5 shows an unbalanced three-phase system, whereas Figure 2.6 shows the se-

quence components.

Re

Im

Vabc

Vc

Va

Vb

Figure 2.5: Unbalanced three phase voltages.

11

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

Re

Im

Positive sequence

Re

Im

Negative sequence

Re

Im

Zero sequence

Vc1

Va1

Vb1

Vb2

Va2

Vc2

Va0=b0 =V c0

Figure 2.6: The sequence components of the unbalanced voltages.

2.3 Frequency Identiﬁcation Methods

THE task of estimating frequency and other parameters in isolated microgrids is a task

of grave importance, for many different reasons. The methods mentioned in section

1.2 will here be outlined. Rich literature on these methods is available, and also for other

methods that will not be covered in this thesis. Some other widely used methods for

on-line fundamental frequency estimation (and other parameters) are: adaptive Prony’s

method [16], least squares methods [17, 18], adaptive notch ﬁltering [19, 20] and Newton

type algorithms [21, 22].

2.3.1 Kalman Filter and Extended Kalman Filter

For time-domain- and model based methods, KF is a widely used tool for a variety of

power system applications. The use of KF for electrical engineering purposes has been

around since the early 80’s [23,24], and has been of interest in applications and research

ever since. Several great approaches have been suggested for both balanced and unbal-

anced power system, under the assumption of both stationary- and non-stationary fre-

quency in [11, 25–29]. Another example of usage is state estimation in electrical drives

[30].

The KF has been around for over 50 years, and is still alive and well and widely used in

many applications. In 1960 R. E. Kalman found a recursive solution for the Wiener ﬁlter

problem, the solution was called KF and was ﬁrst presented in [31]. The theory in this

section is based on [32].

It is assumed that the following discrete state-space model can be used to estimate the

random process:

xk+1 =Akxk+wk(2.17a)

yk=Ckxk+vk(2.17b)

12

2.3 Frequency Identiﬁcation Methods

xkand ykare the process state- and measurement vector at time tk.Akis the system

matrix relating xkto xk+1, assuming there is no noise. Matrix Ckgives the noiseless

relationship between the state- and measurement vector at time tk.wkand vkare the

model error and measurement error, assumed to be white sequences with zero mean, and

normal distributed covariances wk∼ N(0, Qk)and vk∼ N(0, Rk). Furthermore the

covariance matrices Qkand Rkare uncorrelated, and are uncorrelated at different time

instants, as stated in (2.18).

E[wkwT

i] = (Qk, i =k

0=, i 6=k,(2.18a)

E[vkvT

i] = (Rk, i =k

0=, i 6=k,(2.18b)

E[wkvT

i] = 0,∀k, i (2.18c)

To start the KF algorithm, an initial estimate ˆx−

0and its error covariance P−

0is needed.

The ”hat” denotes that this is an estimate, and the superscript ”-” denotes that this is the a

priori estimate, meaning this is the best estimate before taking the measurement at time tk

into consideration. Furthermore the estimation error is deﬁned as:

e−

k=xk−ˆx−

k.(2.19)

Assuming the estimation error in (2.19) has zero mean, the error covariance matrix is given

by (2.20).

P−

k=E[e−

ke−

k

T] = E[(xk−ˆx−

k)(xk−ˆx−

k)T](2.20)

We now want to improve our a priori estimate, ˆx−

k, by using the measurement yk. The a

posteriori estimate ˆxkcan be found by:

ˆxk= ˆx−

k+Kk(yk−Ckˆx−

k).(2.21)

Kkis the yet to be determined Kalman gain, with the purpose of giving an optimal updated

estimate through properly weighting the measurement residual yk−ˆykand adding it to

the a priori estimate. The a posteriori estimate results in the following error covariance

matrix:

Pk=E[ekeT

k] = E[(xk−ˆxk)(xk−ˆxk)T].(2.22)

The purpose of the Kalman gain Kk, and the KF itself, is to minimize the individual terms

along the major diagonal of Pk. It can be shown that (2.23) minimizes the mean-square

estimation error.

Kk=P−

kCT

k(CkP−

kCT

k+Rk)−1(2.23)

For optimal gain conditions the error covariance matrix for the updated estimate is given

as:

Pk= (I−KkCk)P−

k(2.24)

The a priori estimate for the next time step, tk+1, can be found by simply projecting ˆxk

ahead via the system matrix Ak, as given in (2.25).

ˆx−

k+1 =Akˆxk(2.25)

13

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

The error covariance matrix for the next time step is given by:

P−

k+1 =E[e−

k+1e−T

k+1] = AkPkAT

k+Qk(2.26)

For the case of systems with highly nonlinear characteristics , the KF will normally behave

badly and the EKF may be a better candidate. Assuming the state-space model is on the

form:

˙x=f(x, t) + w(2.27a)

y=h(x, t) + v(2.27b)

To obtain the state transition matrix, Ak, and measurement matrix, Ck, at time step k

equation (2.28) and (2.29) are used.

Ak=∂f

∂x ˆxk

(2.28)

Ck=∂h

∂x ˆxk

(2.29)

Though the above equations may seem abstract at ﬁrst, the goal of the KF is quite sim-

ple. It is simply a computer algorithm that processes discrete measurements into optimal

estimates. Figure 2.7 shows the KF loop visually, and summarizes equations (2.21)-(2.26).

Figure 2.7: The KF algorithm.

2.3.2 The Unscented Kalman Filter

For nonlinear systems, the EKF is the most widely used state estimation algorithm. It has

low complexity and is easy to implement. Though the EKF possess many advantages,

such as simple tuning, it also falls short when compared to other nonlinear state estimation

algorithms, mostly due to linearization errors and the need of calculating derivatives [33]

[34]. The theory in this part is based on [33] and [35].

Assume we have a n-dimensional state-space model as given in (2.30):

xk+1 =f(xk, tk) + wk(2.30a)

14

2.3 Frequency Identiﬁcation Methods

yk=h(hk, tk) + vk(2.30b)

wk∼(0, Qk)(2.30c)

vk∼(0, Rk)(2.30d)

The UKF is initalized:

ˆx0=E[x0](2.31a)

P0= [ekeT

k] = E[(x0−ˆx0)(x0−ˆx0)T](2.31b)

As opposed to the EKF which uses linearized models to propagate from time step k−1

to k, the UKF picks a minimal set of sigma points around the mean, which is further

propagated through the nonlinear functions, meaning it is derivative free. This is known

as the unscented transformation, which results in a new mean and covariance estimate.

The unscented transformation is based on the idea that it is easy to perform nonlinear

transformations on single points. By using Cholesky factorization to ﬁnd matrix square

roots, i.e √nP T√nP =nP , the sigma points are deﬁned as follows:

χ(i)

k−1= ˆxk−1+ ˜x(i), i = 1, ..., 2n(2.32a)

˜x(i)=pnPk−1T

i, i = 1, ..., n (2.32b)

˜x(n+i)=−pnPk−1T

i, i = 1, ..., n (2.32c)

The sigma points are then propagated through the nonlinear function f(·), making the

vector χ(i)

k:

χ(i)

k=f(χ(i)

k−1, uk, tk)(2.33)

The elements of χ(i)

kare then combined, serving as the a priori estimate at time k.

ˆx−

k=1

2n

2n

X

i=1

χ(i)

k(2.34)

The a priori error covariance is deﬁned as in (2.35), where it should be noted that Qk−1is

added to take model error into account.

P−

k=1

2n

2n

X

i=1

(χ(i)

k−ˆx−

k)(χ(i)

k−ˆx−

k)T+Qk−1(2.35)

The equations deﬁned above are usually denoted as the time update equations. The mea-

surement update equations are yet to be deﬁned. Equation (2.36) deﬁnes new sigma points

using the current best estimates, in fact ˆx−

kand P−

k. To save computational effort one may

omit the calculation of new sigma points, if one is willing to sacriﬁce accuracy, that is.

χ(i)

k= ˆx−

k+ ˜x(i), i = 1, ..., 2n(2.36a)

15

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

˜x(i)=qnP −

kT

i

, i = 1, ..., n (2.36b)

˜x(n+i)=−qnP −

kT

i

, i = 1, ..., n (2.36c)

The nonlinear measurement function h(·)is now used to transform the sigma points into

vectors of predicted measurements, γ(i)

k.

γ(i)

k=h(χ(i)

k, tk)(2.37)

The vectors of predicted measurements are then combined to obtain the predicted mea-

surement ˆyk, as shown in (2.38).

ˆyk=1

2n

2n

X

i=1

γ(i)

k(2.38)

Equation (2.39) deﬁnes the covariance of the predicted measurement.

Py=1

2n

2n

X

i=1

(γ(i)

k−ˆyk)(γ(i)

k−ˆyk)T+Rk(2.39)

The cross covariance between ˆx−

kand ˆykis deﬁned as:

Pxy =1

2n

2n

X

i=1

(χ(i)

k−ˆx−

k)(γ(i)

k−ˆyk)T(2.40)

The a posteriori estimates can now be found as in equation (2.41)

Kk=PxyP−1

y(2.41a)

ˆxk= ˆx−

k+Kk(yk−ˆyk)(2.41b)

Pk=P−

k−KkPyKT

k(2.41c)

Using 2n+ 1 Sigma Points

[35] suggests different scaling parameters and weights for combining the sigma points into

estimates. Also an additional sigma point is added, i.e 2n+ 1 sigma points. Compared to

equation (2.32) the a priori sigma points vectors χ(i)

kare now deﬁned as:

χ(0)

k−1= ˆxk−1, i = 0 (2.42a)

χ(i)

k−1= ˆxk−1+ ˜x(i), i = 1, ..., 2n(2.42b)

˜x(i)=p(n+λ)Pk−1T

i, i = 1, ..., n (2.42c)

16

2.3 Frequency Identiﬁcation Methods

˜x(n+i)=−p(n+λ)Pk−1T

i, i = 1, ..., n (2.42d)

χ(i)

k−1will be on the form:

χ(i)

k−1=ˆxk−1ˆxk−1+p(n+λ)Pk−1T

ˆxk−1−p(n+λ)Pk−1T(2.43)

The scaling parameter λis deﬁned as in equation (2.44):

λ=α2(n+κ)−n, (2.44)

where αdetermines the spread of the sigma points around the mean ¯x= ˆxk−1, usually

set to a small positive value, e.g 1e-3. κis a secondary scaling parameter, usually set to 0.

Then a set of mean and covariance weights are deﬁned as in equation (2.45):

ω(m)

0=λ

n+λ(2.45a)

ω(c)

0=λ

n+λ+ (1 −α2+β)(2.45b)

ω(m)

i=ω(c)

i=1

2(n+λ), i = 1, ..., 2n(2.45c)

βis used to incorporate prior knowledge about the probabilistic distribution, e.g β= 2 for

Gaussian distribution. The different state, measurement and covariance estimates are now

found as:

ˆx−

k=

2n

X

i=0

ω(i)

mχ(i)

k(2.46a)

ˆyk=

2n

X

i=0

ω(i)

mγ(i)

k(2.46b)

P−

k=

2n

X

i=0

ω(i)

c(χ(i)

k−ˆx−

k)(χ(i)

k−ˆx−

k)T+Qk−1(2.46c)

Py=

2n

X

i=0

ω(i)

c(γ(i)

k−ˆyk)(γ(i)

k−ˆyk)T+Rk(2.46d)

Pxy =

2n

X

i=0

ω(i)

c(χ(i)

k−ˆx−

k)(γ(i)

k−ˆyk)T(2.46e)

The above changes are also applied to the a posteriori estimates. The observant reader

may notice that with λ= 0, equations (2.42)-(2.46) reduces to the equations from the

preceding subsection.

17

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

Adaptive update of model- and measurement error covariances

[34] proposes an adaptive update of the model- and measurement error covariance matri-

ces, in order to better respond to rapid ﬂuctuations and varying measurement noise. Let

Zk= ˆxk−ˆx−

k=Kk(yk−ˆyk) = ψ1kψ2kT(2.47)

The iteratively updated model error covariance matrix is then deﬁned as follows:

Qk=1

2(ψ2

1k+ψ2

2k)×I2×2(2.48)

It can be seen that a large error in one of the states will affect the whole model. The

adaptive measurement noise covariance matrix is given as:

Rk=ξRk−1+ (1 −ξ)|ek||ek−1|(2.49)

where ξis the forgetting factor between 0 and 1.

2.3.3 Hilbert Transform

The HT is an important tool in signal processing. It is a tool for projecting real signals

onto the imaginary axis, which further makes it possible to obtain instantaneous amplitude

and frequency. Let the HT of the function x(t)be deﬁned as in [36]:

y(t) = H[x(t)] = 1

πp.v Z∞

−∞

x(τ)

t−τdτ, (2.50)

where p.v indicates the Cauchy principal value. The original signal can now be expressed

in an exponential form as shown equation (2.51).

z(t) = x(t) + jy(t) = a(t)ejθ(t),(2.51)

where

a(t) = px2(t) + y2(t)(2.52a)

θ(t) = tan−1y(t)

x(t)(2.52b)

a(t)and θ(t)are the instantaneous amplitude and phase respectively. Knowing the instan-

taneous phase, the instantaneous frequency f(t)can then be found:

f(t) = 1

2π

dθ(t)

dt (2.53)

The notions of instantaneous amplitude and frequency for general signals are not well-

deﬁned [5, 37]. For a perfect sinusoid, the instantaneous frequency will be f=1

T. Figure

2.8 compares the HT and FFT applied to a signal with varying amplitude and frequency,

given as:

x(t) = (cos(2π3t),0≤t < 2.5

0.5·cos(2π6t),2.5≤t≤10 (2.54)

18

2.3 Frequency Identiﬁcation Methods

It can be seen that the Fourier transform struggles when analysing signals with time-

varying components, and is representing the signal energy as a leakage around 3Hz and

6Hz, whereas the instantaneous amplitude and frequency found from the HT quickly set-

tles to the correct values.

012345678910

Time [s]

-1

0

1Original signal

Hilbert transformed

012345678910

Time [s]

0

0.5

1

1.5

Amplitude

012345678910

Time [s]

2

4

6

Frequency [Hz]

(a) HT (b) FFT

Figure 2.8: Comparison between the HT and FFT.

2.3.4 Hilbert-Huang Transform

The HHT, in fact a NASA designated name, combines EMD and the aforementioned HT,

and is well suited for analysis of non-stationary signals. The use of HHT has proven

useful for obtaining instantaneous amplitude, frequency and power in power systems and

isolated microgrids [1, 5, 38, 39]. As will be outlined in the next subsection, the EMD

decomposes signals into monocomponents/IMFs. From the IMFs it is possible to obtain

instantaneous amplitudes and frequencies, as the monocomponents often can be regarded

as near periodic and near sinusoidal [5,37]. The amount of IMFs greatly varies depending

on the signal at hand. Knowing the IMFs of a signal one may reveal important information,

e.g oscillatory modes. EMD is originally an ofﬂine method, but there are also examples of

on-line EMD implementations [40–42]. To realize the HHT for real-time applications, a

FIR ﬁlter can be used to estimate the HT, as in [43–45].

Empirical Mode Decomposition - The Sifting Process

The EMD and sifting process aims to extract IMF from non-stationary and nonlinear data

in a systematic manner. [46] states that an IMF must satisfy the following conditions:

19

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

• The number of extrema and the number of zero crossings must either be equal or

differ at most by one

• At any point, the average value of the envelopes deﬁned by the local maxima and by

the local minima is zero.

The EMD starts by ﬁnding all the local maxima and minima of the signal x(t). The

extrema points are connected by cubic spline interpolation lines as shown in Figure 2.9.

The average of the upper and lower spline envelopes is computed and here denoted as m1.

The mean is subtracted from the original signal [46]:

h1=x(t)−m1(2.55)

Further, the extrema points of h1are identiﬁed and again connected by cubic spline in-

terpolation lines. The new mean is deﬁned as m11. This so called sifting procedure is

repeated k times until h1kis an IMF or the standard deviation, SD, computed from two

consecutive sifting is below a certain value, typically 0.2 or 0.3 [46] .

SD =

T

X

t=0 "|(h1(k−1)(t)−h1k(t)|2

h2

1(k−1)(t)#(2.56)

h1k=h1(k−1) −m1k(2.57)

The ﬁrst IMF is designated as

c1=h1k,(2.58)

and subtracted from the original signal, resulting in the residue r1.

r1=x(t)−c1(2.59)

The steps mentioned above are repeated until the residue is a monotonic function, or so

small that it is less than a predeﬁned value of substantial consequence. From the resulting

IMFs and the last residue the signal x(t)can be represented as [46]:

x(t) =

n

X

i=1

ci+rn(2.60)

To illustrate, the signal x(t) = cos(2π50t)+0.5 cos(2π250t)+0.3 cos(2π750t)is passed

through the HHT. Figure 2.10 clearly shows the steps of the sifting process for the three

ﬁrst IMFs, while Figure 2.11 shows the instantaneous amplitudes and frequency obtained

from the three ﬁrst IMFs. As can be seen, the highest frequency components are extracted

ﬁrst.

20

2.3 Frequency Identiﬁcation Methods

1.975 1.98 1.985 1.99 1.995 2

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

Signal

Maxima

Minima

Cubic spline interpolation

Cubic spline interpolation

Mean

Figure 2.9: Signal with spline interpolations and mean.

21

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

Figure 2.10: Steps of the EMD.

22

2.3 Frequency Identiﬁcation Methods

Figure 2.11: Instantaneous amplitude and frequency of the three ﬁrst IMFs.

2.3.5 Phase-Locked Loop

The PLL is the state-of-the-art method for extracting the phase angle of grid voltages

[47, 48]. Many versions of the PLL are implemented in the dq synchronous reference

frame, as can be seen in Figure 2.12a, which is based on [49]. The estimated d- and q-axis

voltages are low-pass ﬁltered with the cut off frequency ωLP . The inverse tangent of the

23

Chapter 2. State-of-the-art in Methods for Frequency Identiﬁcation in Microgrids

ﬁltered voltages is used as input to the Proportional-Integral (PI) controller [49], giving:

ωP LL =θv(kp·1 + Tis

Tis) + ωg,(2.61)

where ωgis the nominal grid angular frequency. A typical step response is showed in

Figure 2.12b. The Park-/dq transform is given as [50]:

vd

vq=r2

3cos(θ) cos(θ−2π

3) cos(θ+2π

3)

−sin(θ)−sin(θ−2π

3)−sin(θ+2π

3)

va

vb

vc

(2.62)

g

PLL

1

s

b

v

c

v

abc

dq

PLL

d

v

q

v

LP

LP

s

LP

LP

s

atan2

v

Low-pass

filtering

PI-controller

a

v

1i

pi

Ts

kTs

(a) Example of a PLL.

0 0.5 1 1.5

Time [s]

49

49.5

50

50.5

51

51.5

52

Frequency [Hz]

(b) Step response of the PLL.

Figure 2.12: PLL structure and step response.

24

Chapter 3

Summary of Previous Work

THIS thesis is a continuation of the specialization project carried out autumn 2016 at

the Department of Engineering Cybernetics [51]. The specialization project mainly

involved the development and testing of different types of Kalman ﬁlters for harmonics-

and frequency tracking in electric power systems. This chapter includes the main results

and ﬁndings of the specialization project.

3.1 The Kalman ﬁlter and the Adaptive Kalman ﬁlter

THE mathematical models for the KF, the adaptive Kalman ﬁlter (AKF) and the three-

phase voltages subject to harmonic pollution are given in section 4.1. The KF and

AKF were subjected to the experiment as given in table 3.1

As can be seen from Figure 3.1, the AKF outperformed the KF. This was to be expected as

the AKF was designed to quickly handle ﬂuctuations. Figure 3.2 shows the error of the KF

and AKF, and also how the tuning of the AKF impacted the error. The error was deﬁned

as in equation 3.1.

M agnitude errordB = 10 ·logsX

i∈hp∪hn

(|Vi,ref |−|Vi|)2(3.1a)

Angle errordB = 10 ·logsX

i∈hp∪hn

(∠Vi,ref −∠Vi)2(3.1b)

25

Chapter 3. Summary of Previous Work

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

Time [s]

-500

-400

-300

-200

-100

0

100

200

300

400

500

Magnitude [V]

Phase a

Phase b

Phase c

(a) Three-phase voltages in the abc frame

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

0

50

100

Magnitude [V]

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

Time [s]

-20

0

20

40

60

80

Angle [°]

(b) KF

(c) AKF

Figure 3.1: The regular KF and the AKF compared.

26

3.1 The Kalman ﬁlter and the Adaptive Kalman ﬁlter

Project experiment 1

Parameter Value

Simulation time 0.2 s

Sample time, Ts10−6s

Measurement noise, v=v1=v2, turn on 0.08 s

Noise mean, E[v] 0

Noise variance, var(v) = E[v2] 1

Positive sequence harmonics, hp[1,7,13]

Negative sequence harmonics, hn[5,11,17]

|Vi,ref |,0s≤t < 0.06 s[100,80,50]

|Vi,ref |,0.06 s≤t≤0.2s[50,40,25]

∠Vi,ref ,0s≤t < 0.12 s[0◦,45◦,60◦]

∠Vi,ref ,0.12 s≤t≤0.2s[0◦,22.5◦,30◦]

i∈hp

|Vj,ref |,0s≤t < 0.06 s[90,70,40]

|Vj,ref |,0.06 s≤t≤0.2s[45,35,20]

∠Vj,ref ,0s≤t < 0.12 s[−20◦,55◦,70◦]

∠Vj,ref ,0.12 s≤t≤0.2s[−10◦,27.5◦,35◦]

j∈hn

Table 3.1: Parameters for project experiment 1.

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

-50

-25

0

25

50

Magnitude error [dB]

KF

AKF

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

-20

0

20

40

Angle error [dB]

KF

AKF

(a) KF and AKF compared.

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

-40

-20

0

20

Magnitude error [dB]

R=5·I2

R=25·I2

R=0.5·I2

0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2

time [s]

-20

-10

0

10

20

Angle error [dB]

R=5·I2

R=25·I2

R=0.5·I2

(b) Different tunings of the AKF compared.

Figure 3.2: Comparison between the KF and the AKF.

Figure 3.3 shows the modular multilevel converter (MMC) impedance found by small-

signal perturbation in a MMC-diode bridge system. This was obtained by injecting shunt

currents of 0.01 pu between the MMC and the diode bridge. Figure 3.4 compares the

analytical impedance, and impedance obtained by FFT and KF at speciﬁed harmonics

present in the system.

27

Chapter 3. Summary of Previous Work

100101102103

Frequency [Hz]

100

101

102

103

104

Magnitude [ Ω]

MMC impedance

FFT

Analytical

100101102103

Frequency [Hz]

-360

-180

0

180

360

Angle [°]

FFT

Analytical

Figure 3.3: The analytical impedance of the MMC compared with impedance obtained by small-

signal perturbation.

100101102103

Frequency [Hz]

100

101

102

103

104

Magnitude [ Ω]

MMC impedance

KF

Analytical

FFT

100101102103

Frequency [Hz]

-360

-180

0

180

360

Angle [°]

KF

Analytical

FFT

Figure 3.4: The analytical impedance of the MMC compared with impedance obtained by KF and

FFT for selected harmonics.

28

3.2 The Extended Kalman Filter

3.2 The Extended Kalman Filter

THE equations for the model used by the EKF can be found in section 4.2. Figure 3.5

shows how the EKF was able to track the voltage magnitude and frequency as given

in table 3.2. At this point the author had had no luck tracking the phase angle. It was found

that the performance of the EKF was linked to the ratio between the diagonal elements of

the model error covariance matrix Q, deﬁned as λ=q1,1

q2,2.

Project experiment 2

Parameter Value

Simulation time 2 s

Sample time, Ts10−5s

Measurement noise, v, turn on 0 s

Noise mean, E[v] 0

Noise variance, var(v) = E[v2] 0.1

Positive sequence harmonics, hp[1]

Negative sequence harmonics, hn∅

|Vi,ref |,0s≤t < 0.2s[100]

|Vi,ref |,0.2s≤t≤2s[50]

∠Vi,ref ,0s≤t≤2s[45◦]

i∈hp

fn,0s≤t < 0.8s50 Hz

fn,0.8s≤t≤2s51 Hz

Table 3.2: Parameters for project experiment 2.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Time [s]

-150

-100

-50

0

50

100

150

Magnitude [V]

Phase a

Phase b

Phase c

(a) Three-phase voltages in the abc frame

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

40

60

80

100

Magnitude [V]

EKF Estimate

Reference

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Time [s]

-20

0

20

40

60

80

Magnitude [V]

EKF Estimate

Reference

(b) Magnitude and phase angle

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Time [s]

49

49.5

50

50.5

51

51.5

52

Frequency [Hz]

Reference

λ=1· 10-12

λ=1· 10-13

λ=1· 10-14

(c) Frequency

Figure 3.5: Simulations of the EKF.

29

Chapter 3. Summary of Previous Work

30

Chapter 4

Harmonics- and Frequency

Tracking Using Kalman Filters

INthis chapter two Kalman ﬁlter models will be developed, one for tracking of harmon-

ics and one for tracking of time-varying fundamental frequency. The models will be

validated by simulations.

The ﬁrst model is based on [26,52], and [25] for the adaptive approach. Here it is assumed

that the angular frequency ωis constant, and that the system is balanced. In addition a

nonlinear model suitable for the EKF and UKF, as in [27] and [34] is developed. This

model can be used to include tracking of the fundamental frequency.

4.1 Tracking of Three-Phase Harmonics Based on Linear

Kalman Filter

FOR now, ω(t) = ωnis assumed to be known and constant. It is also assumed that

the system is balanced, hence Va=Vb=Vc. Equation (4.1) represents three-phase

voltages in the abc frame with amplitudes Va, Vb, Vc, phase angles φa, φb, φc, and a

known angular frequency ωn. The angular frequency is given by ωn= 2πfn, where fnin

this case is the fundamental frequency at 50 Hz. The model to be developed also applies

for three-phase currents in the abc frame.

va(t) = Vacos(ωnt+φa)(4.1a)

vb(t) = Vbcos(ωnt+φb)(4.1b)

vc(t) = Vccos(ωnt+φc)(4.1c)

Let φb=φa−2π

3and φc=φa+2π

3, i.e the phases are aligned in the positive sequence. As

explained in section 2.2.6, any unbalanced systems can be transformed into three sets of

balanced phasors. The positive-, negative- and zero sequence will from now on be denoted

as p, n, 0, respectively.

31

Chapter 3. Summary of Previous Work

va(t) = va,p(t) + va,n (t) + va,0(t)(4.2a)

vb(t) = vb,p(t) + vb,n (t) + vb,0(t)(4.2b)

vc(t) = vc,p(t) + vc,n (t) + vc,0(t)(4.2c)

Furthermore we deﬁne Vp=[Va,p,Vb,p ,Vc,p]T,Vn=[Va,n ,Vb,n ,Vc,n]Tand V0=[Va,0,Vb,0,Vc,0]T

as in [26]. Equation (4.1) can be rearranged as in equation (4.3).

va(t)

vb(t)

vc(t)

=Vp

cos(ωnt+φp)

cos(ωnt+φp−2π

3)

cos(ωnt+φp+2π

3)

+Vn

cos(ωnt+φn)

cos(ωnt+φn+2π

3)

cos(ωnt+φn−2π

3)

+V0

cos(φ0)

cos(φ0)

cos(φ0)

,

(4.3)

where φp, φn, φ0are the phase angles for each sequence. Further the voltages in the abc

frame are transformed into the αβ0frame using the Clarke transform, where the transfor-

mation matrix Tis given in (4.4) and (4.5).

T=2

3

1−1

2−1

2

0√3

2−√3

2

1

2

1

2

1

2

(4.4)

By assuming we have a balanced system, the ”0”-component is omitted and we get:

T=2

31−1

2−1

2

0√3

2−√3

2(4.5)

Multiplying (4.5) with every part of (4.3) yields:

vαβ (t) = T vabc(t) = T Vpcos(ωnt+φp)

sin(ωnt+φp)+T Vncos(ωnt+φn)

−sin(ωnt+φn)(4.6)

To obtain a more convenient structure, the trigonometric theorem of addition and subtrac-

tion, as in (4.7) is used.

sin(a±b) = sin(a) cos(b)±cos(a) sin(b)(4.7a)

cos(a±b) = cos(a) cos(b)∓sin(a) sin(b)(4.7b)

Applying (4.7) to (4.6):

vα(t)

vβ(t)=cos(ωnt)−sin(ωnt)

sin(ωnt) cos(ωnt)Vpcos(φp)

Vpsin(φp)+cos(ωnt)−sin(ωnt)

−sin(ωnt)−cos(ωnt)Vncos(φn)

Vnsin(φn)

(4.8)

In (4.9) the model is restated as a discrete state-space model ﬁtting the KF, where itakes

the values of the positive harmonic set hpand negative harmonic set hn,xi,1and xi,2are

the αand βcomponents at harmonic i,ωnis the grid angular frequency, Tsis the sampling

period and subscript ”k” denotes the time instant. It is also assumed random walk for the

states.

32

3.2 The Extended Kalman Filter

xi,1

xi,2k+1

=1 0

0 1xi,1

xi,2k

+wi,1

wi,2k

(4.9a)

yk=vα

vβk

=X

i∈hpcos(iωnkTs)−sin(iωnkTs)

sin(iωnkTs) cos(iωnkTs)xi,1

xi,2k

+X

i∈hncos(iωnkTs)−sin(iωnkTs)

sin(iωnkTs) cos(iωnkTs)xi,1

xi,2k

+vi,1

vi,2k

(4.9b)

Let the number of harmonics in the set hpand hnbe npand nn, and furthermore the

total number of harmonics N=np+nn. The total number of states will be 2N. The

model error covariance matrix, Qk, will be a 2N×2Nmatrix. The measurement noise

covariance matrix, Rkwill be a 2×2matrix. The system matrix Ak, and measurement

matrix Ckwill be matrices with dimensions 2N×2Nand 2×2Nrespectively. The

amplitude and phase at harmonic iis found by:

|Vi|=qx2

i,1+x2

i,2(4.10a)

φi=tan−1xi,2

xi,1(4.10b)

The self-tuning AKF algorithm from [25] is adopted and slightly modiﬁed to include sev-

eral harmonics. The AKF is implemented so that the model error covariance matrix is

adaptively updated, to handle fast ﬂuctuations in the studied signal. The model error ˆwk

can be estimated as:

ˆwk= ˆxk−ˆx−

k= ˆx−

k+Kk(yk−Ckˆx−

k)−ˆx−

k

=Kk(yk−Ckˆx−

k).(4.11)

Inspired by the algorithm in [25], the diagonal terms of the model error covariance matrix

takes the value of the average of the sum of ( ˆw2

i,1+ ˆw2

i,2)for every harmonic iin the set

hp∪hn, as in (4.12) and (4.13):

qk=1

2NX

i∈hp∪hn

( ˆw2

i,1+ ˆw2

i,2)k(4.12)

Qk=qkI(4.13)

The AKF algorithm is given in Algorithm 1.

33

Chapter 3. Summary of Previous Work

Algorithm 1 Adaptive Kalman ﬁlter algorithm for time instant k= 0,1, ...

1: q−

k=Qk(1,1)

2: for i= 1 to Nmax iter do

3: Pk=AkP−

kAT

k+Qk

4: Kk=PkCT

k(CkPkCT

k+Rk)−1

5: ˆxk= ˆx−

k+Kk(yk−Ckˆx−

k)

6: ˆwk=Kk(yk−Ckˆx−

k)

7: qk=1

2NPi( ˆw2

i,1+ ˆw2

i,2)k, i ∈hp∪hn

8: Qk=qkI

9: if |√qk−qq−

k|< then

10: break

11: end if

12: q−

k=qk

13: end for

14: ˆx−

k+1 =Akˆxk

15: P−

k+1 = (I−KkCk)Pk

16: Qk+1 =Qk

34