Phasor Measurement Unit (PMU) – based system for event detection on synchronous generators

Nicholas Mark Randall

Thesis of 60 ECTS credits Master of Science (M.Sc.) in Sustainable Energy Engineering (Electrical)

September 2017 ii Phasor Measurement Unit (PMU) – based system for event detection on synchronous generators

by

Nicholas Mark Randall

Thesis of 60 ECTS credits submitted to the School of Science and Engineering at Reykjavík University in partial fulfillment of the requirements for the degree of Master of Science (M.Sc.) in Sustainable Energy Engineering (Electrical)

September 2017

Supervisor: Joseph Timothy, Foley, Supervisor Assistant Professor, Reykjavík University, Iceland

Ragnar Kristjánsson, ISE Advisor Assistant Professor, Reykjavík University, Iceland

Guðjón Hugberg Björnsson, Co-advisor System Operations, Landsnet, Iceland

Examiner: Dr. Magni Þór Pálsson, Examiner Program Manager for R&D, Landsnet, Iceland Copyright Nicholas Mark Randall September 2017

iv Phasor Measurement Unit (PMU) – based system for event detection on synchronous generators

Nicholas Mark Randall

September 2017

Abstract

Unusual generator events are sometimes seen in the Phasor Measurement Unit (PMU) data in the Icelandic power system, probably due to the small size. The use of PMU data with event detection algorithms, along with modeling, could be a method of capturing these events for analysis. The goals of this thesis are to develop an event detection algorithm and methods of modeling the power system, using events found in the PMU data, to simu- late generator behavior under the relevant operating conditions. There are two approaches used: Event Detection Analysis and Parameter Estimation. Event Detection Analysis em- ployed three methods. Method One used a digital filter, and fast Fourier transforms for analysis. Method Two used a matched filter algorithm. Method Three worked on the prin- cipals of machine learning, using the Gaussian Process Classifier (GPC) for identification of events in the PMU data. The Parameter Estimation approach used the method of time- series analysis for finding the necessary parameters of the generators and modeling them. These parameters were: the inertia of the generators, the speed regulation constant, and the time constant of the turbine-governor system. Axiomatic Design was used for developing the design protocol for Event Detection Analysis software. The results from the Event De- tection Analysis showed that out of the three methods tried the machine learning gave the best results for the Event Detection approach. Results from Parameter Estimation revealed that this method works but requires a lot of fine-tuning for better parameter estimates. The results from the two approaches showed that when tested they would meet the requirements of processing PMU data in real time. Therefore, these approaches have relevance for the Icelandic power system and will need further research.

Index Terms–Axiomatic Design, Hydro Power, Gaussian process classifier (GPC), Generator Modeling, Machine Learning, Parameter Estimation, Phasor Measurement Unit (PMU) Fasamælingar (Phasor Measurement Units) - aðferð til greiningar á óvenjulegum atburðum í rekstri rafals

Nicholas Mark Randall

september 2017

Útdráttur

Smæð íslenska raforkukerfisins er talin valda því að stundum sjást óvenjulegir atburðir í rekstri rafala í fasamælitækjum (PMU mælingum). Notkun þessara mæligagna ásamt líkana- gerð gæti verið leiðin til að vakta þessa atburði og skýra. Markmið þessarar ritgerðar er að þróa aðferð til þess að vakta þessa atburði og aðferðafræði við líkanagerð raforkukerfis, með notkun atburða sem fundnir eru í PMU mæligögnum, til að herma hegðun rafala undir þess- um óvenjulegu rekstrarskilyrðum. Tvær aðferðir eru notaðar: Greining á vöktun atburða og mat á breytum í líkanagerð. Greining á vöktun atburða styðst við þrjár aðferðir. Aðferð eitt notast við stafræna síu, og hraða Fouriervörpun við greiningu. Aðferð tvö notast við reiknirit mátsíu. Aðferð þrjú vinnur með meginreglur vélræns náms (machine learning), sem notast við Gauss ferlaflokkun (GPC) fyrir auðkenningu atburða innan PMU gagnanna. Nálgun við mat á breytum styðst við aðferð sem byggir á greiningu tímaraða til að finna nauðsynlegar breytur rafala við líkanagerð þeirra. Skoðaðar voru eftirfarandi breytur; tregða rafala, stuðull hraðareglunar, tímastuðull rafala og gangráðar. “Forsendu hönnun” (Axiomatic Design) var beitt við þróun hönnunar á hugbúnaði sem var notaður við greiningu á vöktun atburða. Nið- urstöður úr greiningu á vöktun atburða leiddi í ljós að af þeim þrem aðferðum sem skoðaðar voru, reyndist aðferð vélræns náms (machine learning) gefa bestar niðurstöður við vökt- un atburða. Niðurstöður úr mati á breytum í líkanagerð leiddu í ljós að aðferðin virkar en krefst mikillar fínstillingar fyrir ítarlegra mat. Niðurstöður úr prófunum á báðum aðferðum sýndu að þær myndu uppfylla kröfur um rauntíma greiningu á PMU gögnum. Af þessu má leiða að báðar þessar aðferðir eru áhugaverðar fyrir vöktun á þessum atburðum í íslenska raforkukerfinu og lagt er til að þær verði rannsakaðar frekar.

Viðeigandi hugtök– Axiomatic Design, Hydro Power (Vatnsafl), Gaussian process classifier (GPC), Generator Modeling (líkan af rafala) Machine Learning (Vélrænt nám), Parameter Estimation (breytur í líkanagerð), Phasor Measurmement Unit (PMU)

vi Phasor Measurement Unit (PMU) – based system for event detection on synchronous generators

Nicholas Mark Randall

Thesis of 60 ECTS credits submitted to the School of Science and Engineering at Reykjavík University in partial fulfillment of the requirements for the degree of Master of Science (M.Sc.) in Sustainable Energy Engineering (Electrical)

September 2017

Student:

Nicholas Mark Randall

Supervisor:

Joseph Timothy, Foley

Ragnar Kristjánsson

Guðjón Hugberg Björnsson

Examiner:

Dr. Magni Þór Pálsson viii The undersigned hereby grants permission to the Reykjavík University Library to reproduce single copies of this Thesis entitled Phasor Measurement Unit (PMU) – based system for event detection on synchronous generators and to lend or sell such copies for private, scholarly or scientific research purposes only. The author reserves all other publication and other rights in association with the copyright in the Thesis, and except as herein before provided, neither the Thesis nor any substantial portion thereof may be printed or otherwise reproduced in any material form whatsoever without the author’s prior written permission.

date

Nicholas Mark Randall Master of Science x I would like to dedicate this thesis work to my friends and family. xii Acknowledgements

This thesis would not have been possible without help from the following people: Alexander Moses for all the help with the python programming and machine learning on this thesis, Lee Colwill with the help on writing and editing my thesis, Dr. Ananya Sen Gupta for the help on signals and systems along with the matched filter, Keith Smithson for editing help, the Foley family for letting me say with them while I finished up my thesis work, and finally my boss Lucien Marini at INIRAM Precision Machinery working with me to say in Iceland while I finished up my thesis. I also had help from Landsvirkjun for financial support from energy research (Orku- rannsóknasjóður) scholarship and grant for 2017, this help pay for my living expenses in Iceland. Finally, Landsnet for providing me with the data needed for this thesis. xiv xv

Contents

Acknowledgements xiii

Contents xv

List of Figures xix

List of Tables xxiii

List of Abbreviations xxv

List of Symbols xxvii

1 Introduction 1 1.1 The Icelandic Power System ...... 1 1.1.1 The Challenge of Low Inertia Power Systems ...... 2 1.2 Thesis Overview ...... 4 1.2.1 The Thesis Objective ...... 4 1.2.2 Initial Thesis Plan ...... 5 1.2.3 Development of the Initial Thesis Proposal ...... 5 1.3 Background ...... 6 1.3.1 Overview of Power Systems ...... 6 1.3.2 Three-Phase Power ...... 10 1.3.3 Per-Unit System ...... 11 1.3.4 Power System Stability and Control ...... 12 Voltage Stability ...... 13 Frequency Control ...... 13 Rotor Or Power Angle Stability ...... 14 1.4 The Phasor Measurement Unit (PMU) ...... 16 The Importance of PMU Data ...... 19 1.5 Axiomatic Design ...... 22 1.6 Axiomatic Design Implementation ...... 22 1.6.1 Customer Needs ...... 22 1.6.2 Design Constraints ...... 23 1.6.3 Design Decomposition “Zig-zagging Approach” ...... 23 1.6.4 Design matrix ...... 25 1.7 Executive Summary ...... 25

2 Literature Review 27 2.0.1 Methods of Generator Parameter Identification and Validation . . . 27 The hybrid dynamic simulation method ...... 28 xvi

The LSE method with discrete input ARX model ...... 30 The Unscented Kalman Filter (UKF) method ...... 32 Using a digital filter for power quality parameter detection . . . . . 33

3 Methods 37 3.1 Key Assumptions ...... 37 3.1.1 General Assumptions Made ...... 37 3.1.2 Event Detection Assumptions ...... 38 The Definitions Events and Non-Events ...... 38 Software Feasibility Assumptions ...... 38 3.1.3 Modeling Assumptions ...... 39 3.2 Tools Used for the Thesis ...... 39 3.2.1 Principal Component Analysis (PCA) ...... 40 3.2.2 Gaussian Process Classification (GPC) ...... 42 Kernel Methods Overview ...... 42 Gaussian Processes for Classification ...... 44 3.2.2.0.1 Derivation Using Bayesian Statistics ...... 44 3.2.2.0.2 Laplace approximation ...... 45 3.2.3 Programming Environment ...... 46 Python Programing Language ...... 46 OpenModelica ...... 47 3.2.3.0.1 OpenModelica Software advantages over Simulink . . . . 47 3.2.4 PMU Data from Landsnet ...... 48 Data formats ...... 48 3.3 Section 1: PMU Data and Event Detection Analysis ...... 49 3.3.1 Method 1: Using a Digital Filter and FFT for Analysis ...... 50 PMU Data Frequency for Event Detection ...... 52 3.3.2 Method 2: Matched Filter Algorithm ...... 52 3.3.3 Method 3: Supervised Machine Learning ...... 53 Loading the event data into Python and preprocessing...... 54 The process of the supervised learning with a Gaussian process clas- sifier (GPC)...... 55 The Event Detection Algorithm Test ...... 55 3.3.4 Testing the Feasibility of These Methods ...... 57 Time Trail ...... 57 3.4 Section 2: PMU Data and Parameter Estimation ...... 57 3.4.1 Parameters Estimation ...... 57 3.4.2 Modelica Model ...... 58 3.4.3 Parameter Identification and Estimation From the Landsnet PMU Data 59 3.4.4 The Feasibility Testing of the Modelica Model ...... 62 3.4.5 Testing of the Feasibility of this Section 2: PMU Data and Parameter Estimation ...... 62

4 Results 65 4.1 Section 1: PMU Data and Event Analysis ...... 65 4.1.1 Method 1: Using Digital Filter and FFT for Analysis ...... 65 4.1.2 Method 2: Matched Filter Algorithm ...... 66 4.1.3 Method 3: Supervised Machine learning ...... 68 Moving Window Speed for the Data Stream and Feasibility . . . . . 75 xvii

4.2 Section 2 Results: Modelica Model and Parameter Estimation with PMU Data 76 4.2.1 Modelica Model ...... 76 4.2.2 Parameter Estimation of the Real PMU Data ...... 79 Testing the Feasibility of this Method ...... 85 Moving Window Speed for the Data Stream and Feasibility . . . . . 86

5 Discussion 89 5.1 Complications ...... 89 5.1.1 Challenges with PMU Data and Event Analysis ...... 89 Challenges with the Digital filter and FFT approach (Method 1) . . 90 Challenges with the Matched Filter Algorithm (Method 2) . . . . . 90 Challenges with the Supervised Machine Learning (Method 3) . . . 90 5.1.2 Challenges of PMU Data and Parameter Estimation ...... 90 Parameter Estimation With the Sliding Window Method ...... 91 5.2 Summary ...... 92 5.2.1 PMU Data and Event Analysis ...... 92 5.2.2 PMU Data and Parameter Estimation ...... 93 5.3 Future Work ...... 95 5.3.1 Physical Verification of Hysteresis Problems in Hydro-Turbines . . 95 5.3.2 Software Development for Landsnet ...... 96 5.3.3 Recommendations for Further Research ...... 96 5.4 Conclusion ...... 96 5.5 Discussion On the Axiomatic Design Process ...... 98

Bibliography 99

A Alternating Current 105 A.1 Alternating Current ...... 105 Root Mean Square Value of Voltage and Current ...... 108 Properties of AC power ...... 109 Complex Numbers and Notation ...... 110

B Code 113 B.1 Code ...... 113 B.1.1 Preliminary Event Finding Code ...... 113 Code: Method 2: Matched Filter Algorithm ...... 113 Code:The code preparing the PMU data ...... 114 Code:Loading the event data into Python and preprocessing . . . . . 114 Code:The process of the supervised learning with a Gaussian process classifier (GPC) ...... 116 Code:The Event Detection Algorithm Test ...... 116 Code:Parameter Identification and Estimation From the Landsnet PMU Data ...... 118

Index 121 xviii xix

List of Figures

1.1 The equations used for calculating power in an AC ciruit ...... 8 1.2 The power triangle ...... 9 1.3 a glass of beer [21] ...... 9 1.4 Three phase power sinusoidal waveforms [24] ...... 10 1.5 A flow diagram of classifications of power system stability [28] ...... 12 1.6 shows the instability in the power system by when it is underdamped by graph- ing the trajectory of rotor angle changes vs. changes in rotor speed...... 15 1.7 shows the instability in the power system by when it is underdamped by graph- ing the rotor angle change over time...... 15 1.8 The simplified setup of the PMU [33]...... 16 1.9 Process of collecting the PMU data [33]...... 18 1.10 SCADA method of measuring voltage compared with the PMU method of volt- age measurement [36]...... 19 1.11 Showing a one-line diagram of the two buses with different phasor angles in the power system [34], [35]...... 20 1.12 A graph of the Angular Separation of the Cleveland and West MI area in the power system during the August 14, 2003 blackout in the and Canada [33], [37] ...... 21

2.1 The block diagram model where H1(jω) denotes the transfer function found using the PMU data and the ARX method [13] ...... 32 2.2 A synchronous generator models [16] ...... 32 2.3 Types of voltage disturbances [18] ...... 35

3.1 Non-event data and event data ...... 38 3.2 The PMU data from Landsnet with a known event from samples 11000 to 18700. 50 3.3 Frequency response the filters ...... 51 3.4 Flowchart of the process used in training of the Machine Learning algorithm. . 53 3.5 Of the process used in event detection o the Machine Learning algorithm. . . . 54 3.6 Shows the setup of the event detection method 3 ...... 56 3.7 The graph of the PCA in one-dimension with the GPC divider line, showing the setup of the event detection method 3 with one-dimensional PCA ...... 56 3.8 Block diagram of the models used for parameter identification[16]...... 58 3.9 Filtered active power on the top and the filtered frequency on the bottom, filter by the pandas rolling mean filter...... 60 3.10 Fit of the found parameters x in Equation 3.28 on the top and the residuals (error) in the bottom plot...... 61 xx

4.1 Results of the first event detection algorithm using the Butterworth bandpass digital filter and FFT analysis...... 66 4.2 Result of running the data through the matched filter, along with a graph of the original PMU data and the differenced data...... 67 4.3 The windows that are shown here demonstrate how the matched filter uses a sliding window along an event if the window does not match perfectly with the event profile shown on left of the figure...... 68 4.4 The results from PCA process with three different views of the same data set from a three dimensional projection as shown in Figure 4.5. The red dots are events and the green dots are non-events...... 69 4.5 The results of the PCA process displayed in a three-dimensional form...... 70 4.6 The PCA project into one-dimensions with the event and non-event classification 71 4.7 Shows the event occurring and the supervised machine learning algorithm iden- tifying as an event...... 72 4.8 The results using a GPC for finding an event the PMU data with the use of a one dimensional PCA...... 72 4.9 Non-event occurring and the supervised machine learning algorithm identifying as a non-event on the first part of the non-event data using three-dimensional PCA 73 4.10 Using the one-dimensional PCA with the GPC on non-event data ...... 73 4.11 Non-event occurring and the supervised machine learning algorithm identifying as a non-event on the second part of the non-event data...... 74 4.12 The false prediction of an event in the PMU data...... 74 4.13 The graph response is the frequency with a change of power from 0 to 0.2 for the Modelica Model using the parameter found in “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” and displayed in Table 3.1...... 77 4.14 The result of the verification of the Python transfer function Equation 3.25 and the simulated code...... 77 4.15 A comparison of the Python simulation to the Modelica simulation ...... 79 4.16 This graph shows the two methods used for estimating the power system fre- quency responses compared with the real power system frequency response over approximately one hour...... 80 4.17 This graph magnifies the time period from 200 to 1000 in order to see how closely the calculated system frequency response matches the real system fre- quency response...... 81 4.18 The change in power from 0.08 p.u. to 0.04 p.u.. Showing models following the real frequency data. This event also exhibits characteristics of an second order response as shown in Figure 4.13 ...... 82 4.19 The plot of the power data and frequency data from the PMU data that was used for deriving the parameter plots shown in Figures 4.20, 4.21, and 4.22. . . . . 84 4.20 The T parameter is the time constant in seconds of the turbine-governor graph over the number of iterations...... 84 4.21 The R parameter is the speed regulation constant shown in p.u...... 85 4.22 The H parameter is the inertia constant. The H parameter shown in blue and the red line represents unrealistic values of H when the blue plot falls below the red line...... 85 4.23 The RMS error of the of the three methods used (Discrete Time Transfer Func- tion, Continuous Time Transfer Function, and State-Space) for the parameter estimation process...... 86 xxi

5.1 That changing the window and the step size on the ARX model resulted drasti- cally different parameter results ...... 91 5.2 The results of the ARX model during an event are shown in 5.2a and the results of non-event data are shown in 5.2b. The graphs show that during an event (5.2a) the simulated data closely follows the real data, but during non-events (5.2b) the simulated data has a harder time following the real data...... 94

A.1 Shows the voltage and current waveforms in phase with each other. They do not perfectly overlap as the voltage has a slightly higher magnitude than the current [74]...... 106 A.2 Shows the current out of phase with the voltage ...... 107 A.3 RMS value transforms ...... 108 xxii xxiii

List of Tables

2.1 The typical characteristics of the short-duration root-mean-square [49] . . . . . 34 2.2 The typical characteristics of the Waveform distortion [49] ...... 35

3.1 The parameters used in the first Modelica model simulation ...... 58

4.1 The results of the training data of by the percentage predicted events and non- events correctly and the percentage that they were mispredicted. Using both the one-dimensional and three-dimensional PCA methods...... 74 4.2 The results of the real data of by the percentage predicted events and non-events correctly and the percentage that they were mispredicted. Using both the one- dimensional and three-dimensional PCA methods...... 75 4.3 Time trials of the event detection methods ...... 76 4.4 The Result of the ARX model and least-squares method...... 78 4.5 A comparison of the generator constants found from the real PMU data at Land- snet to the constants presented in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16] . . . . . 79 4.6 The vector parameters found using the ZOH method ...... 79 4.7 The parameter found by using the real PMU from Landsnet for one generator. . 80 4.8 The percentage fit of the all the frequency data in this data set...... 80 4.9 The percentage fit using the three different simulations; ZOH, CT, and State- Space for the event data shown in Figure 4.17 ...... 81 4.10 The generator parameters found from the event data ...... 81 4.11 A comparison of the generator constants found from the real PMU data at Land- snet to the constants presented in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16] . . . . . 82 4.12 The percentage fit of change in power from 0.08 p.u. to 0.04 p.u. result shown in Figure 4.18 ...... 83 4.13 The generator parameters estimated from the change of power data from 0.08 p.u. to 0.04 p.u. of one generator in the station...... 83 4.14 A comparison of the generator constants found from the real PMU data at Land- snet to the constants presented in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16] . . . . . 83 4.15 The time trial result of the Parameter Estimation using the ZOH method.a . . . 87 xxiv xxv

List of Abbreviations

A Amperes AC Alternating Current AGC Automatic Generation Control ARX Autoregression and Exogenous Input CN Customer Needs COMTRADE Common format for Transient Data Exchange for power systems CSV Comma Separated Values or Character Separated Values CT Continuous Time DC Direct Current DP Design Parameters DT Discrete Time DS3b Delivering a Secure Sustainable DVAR Dynamic Volt-Amp Reactive EEA European Economic Area FFT Fast Fourier Transform FR Functional Requirements HVDC High Voltage Direct Current GA Genetic Algorithm GP Gaussian Process GPC Gaussian Process Classifier GPS Global Positioning System IEEE Institute of Electrical and Electronics Engineers LSE Least Square Estimation MATLAB Matrix Laboratory PCA Principal Component Analysis PDC Phasor Data Concentrator PSSe Power System Simulation for Engineering PMU Phasor measurement unit PT Potential p.u. Per Unit System RBF Radial Basis Function rms root-mean-square RoCoF Rate of Change of Frequency SCADA Supervisory Control and Data Acquisition SNSP System Non-Synchronous Penetration Continued on next page xxvi

SI International System of Units SVC Static Volt-Amp Reactive Compensator SVN Subversion UKF Unscented Kalman Filter V Volts VA Volt-Amperes VAR Volt-Amperes Reactive WACS Wide Area Control Scheme xxvii

List of Symbols

Symbol Description Units ∗ Complex Conjugate || magnitude of a value D Damping Factor d Dimensions ∆ Change δ Rotor Angle deg ω Angular frequency rad/s φ Phasor Angle deg C Capacitance F f Frequency Hz fn Frequency Hz H Inertia Constant s j Variable for representing imaginary part complex numbers I Current A i Current A = Imaginary Part of Complex Number P Power W Pe Electrical Power W Pm Mechanical Power W Pn Nominal or Rated Power W Q Reactive Power VAR R Speed Regulation Constant p.u. < Real Part of Complex Number |S| Apparent Power VA S Complex Power VA T Time Constant of the Turbine Governor s V Voltage V X Reactance Ω XL Inductive Reactance Ω XC Capacitive Reactance Ω Z Impedance Ω xxviii 1

Chapter 1

Introduction

1.1 The Icelandic Power System

Iceland is a beautiful country that is endowed with many natural resources for generat- ing from renewable sources like hydro-electric and . Hy- dropower makes up 75.5% and geothermal power makes up the remaining 24.5% of the electricity produced in Iceland [1]. Since hydropower is the most common resource for elec- tricity production in Iceland, there is much interest in how to produce it in the most efficient and economical manner [2]. This thesis looks at one of the challenges facing hydropower production in Iceland. This thesis is written in collaboration with, and assistance from Landsnet* and Lands- virkjun†, who also provided a source of funding for this thesis in the form of a scholarship grant. Landsnet operates and maintains the power grid, from controlling flow in the Ice- landic power system to maintaining the transmission power lines, and was established in June 2004 [3]. Landsnet and Landsvirkjun were one company until June of 2004 and then were split in order to comply with European Economic Area (EEA) regulations, in particular, their obligation to implement the directives in chapter IV of the original Electricity Directive (97/92), which has provisions regarding transmission system operation [3]. The Electricity Directive regulates the bundling and separation of electricity generation and supply from the operation and transmission networks. One such regulation states that the same company is not allowed both to own and operate the generation and transmission networks and to sell electricity, due to the potential conflict of interest. Without this separation, the power com- pany could be incentivized to obstruct a competitor’s access to the infrastructure, leading to a monopoly on electricity in the market. In order to prevent such a monopoly from forming and fulfill Regulation 96/92, the Minister of Industry and Commerce decided to establish an independent company that would own the transmission system assets (lines cables, sub- stations, and so forth) and also be responsible for any transmission system operation and maintenance. The idea of an independent company for the transmission system assets was then put before the Icelandic Parliament and approved, establishing the Electricity Act num- ber 65/2003. After this was adopted, the new company Landsnet was founded in June 2004 as a limited liability company. Landsnet did not start operations until January 1, 2005, and then assets were slowly transferred over from Landsvirkjun and other owners until Landsnet established ownership of all property related to the transmission system [3]. Landsvirkjun

*The Icelandic transmission and operation systems company http://english.landsnet.is/ †The national power company http://www.landsvirkjun.com/ 2 CHAPTER 1. INTRODUCTION is still the largest electricity producer in Iceland, operating sixteen power stations across Iceland [4].

1.1.1 The Challenge of Low Inertia Power Systems The inertia of the power system is the power system’ s ability to recover from any event in the electrical system, i.e., a change in load, short-circuit, phasor to phasor short, et cetera. The term inertia refers to the amount of rotational energy a generator has in the rotor. This amount of energy is important because of any changes in the rotation of the generator can be an indicator of problems in the power system. The larger amount of rotational energy means that when there is a change in power, for example, the system has less of an effect on the overall system frequency [5], [6]. Therefore, the first thing that needs to be considered when looking at the stability and strength of any power system is the inertia of that system. The of a power system is directly related to the stability and strength, this is because the system’s inertia is one of the compo- nents that controls the grid frequency. Power systems with large system inertia are able to withstand small disturbances better with less changes in the grid frequency. The problem of low inertia can be analogous to children playing on a merry-go-round, if there are many children pushing the merry-go-round and one child tries to slow it down by dragging their foot on the ground it does not slow down the merry-go-round significantly. This is like a power system with high inertia. If there are only two children on the merry-go- round and one pushing while the other one is dragging their feet. This is similar to a power system with low inertia [7]. The reason for low inertia in a power system can be caused by many factors such as too high of a mixture of instantaneous non-synchronous renewables like some wind turbines and solar photovoltaics and a grid that covers a large area with high industrial loads or some combination of both like Ireland [8]. Iceland does not have the renewable problem as in Ireland, but instead as the problem of high industrial loads where about 70% of the electricity product goes into aluminum industry as of 2013 [9]. Also Iceland as the problem of sparsity, meaning the there long transmission lines running through Iceland connecting the industries to the sources without many redundancies. These two countries have problems with low inertia are taking two different solutions for solving this problem. One main reason these two countries are approaching the problem of low inertia differently is they have two different objectives. Iceland is trying to strengthen the existing system, where Ireland is working on integrating renewables into their power system with a goal of 40% renewables by 2020 [10]. One of the ways Iceland trying to solving this problem through the use of Wide Area Control Scheme (WACS). This scheme works in Iceland using the following tools:

• Load Shedding

• Microgrids

• Smelter Load Control

• Intelligent Islanding

• Generator Fast Ramp

The WACS system should first use smelter load control during an event to slow down the changes in frequency. Then a fast generator ramp can be started. Next the system will split 1.1. THE ICELANDIC POWER SYSTEM 3 the ring around Iceland to two islands an (east and west) deciding where exactly is the best place to split the system. Then the system will be balanced and the WACS will have stabilize the system. The first step is being able to detect a change in frequency as fast as possible. Once a change is detected the dynamic load control is employed because it can react in 2 ms. The dynamic load control of smelters is either a ramps down or ramp up depending on the needs of the system. Then the smelters hold on to the new power level until the frequency begins to stabilize. Once the frequency as stabilized the level is allowed to return to the normal operating conditions. There are currently two smelters in Iceland participating in this program. Next is to load shed east Iceland this is done by sending a signal to a circuit breaker box in the east, this load is about 25 MW and can be shed in about 0.5 s. Another aspect is to look at the hydro fast ramp. The hydro fast ramp is another way of controlling a hydro plant because the hydro plant is difficult to control compared to the speed of events in the power system due to hydro’s slow response time compared to chang- ing the load at the aluminum smelter. Other challenges with hydro are the conventional con- trol mechanisms on the hydro-turbines can also contribute to frequency oscillations: other means of hydro-turbine control are being looked into such as supervisory control systems. These systems look for the rate of change of frequency then activates a fast ramp within the mechanical limits of the machine. This fast ramp is done until the frequency settles back down. Then the control system is put back into normal operation. This kind of setup allows Iceland to govern the power system without having to implement major equipment and new infrastructure in the power system [10]. Ireland’s approach to the low inertia problem is by setting up a program called DS3, which means Delivering a Secure Sustainable electricity system. This program has three distinct pillars: system performance, system policies, and system tools. One of the re- sults from this program was the idea of SNSP (System Non-Synchronous Penetration). The SNSP is the real-time measurement of the generation from non-synchronous sources as the percentage of total generation. The non-synchronous sources in Ireland are wind turbines and the HVDC . For Ireland to reach their goal of 40% renewables by 2020, they will need to increase their SNSP percentage from a maximum of 60% to be able to reach a maximum 75% by 2020. Some of the tools that will be used to meet the goal of increasing the SNSP percentage with when using are:

1 1. RoCoF (Rate of Change of Frequency), i.e., df/dt to 1 Hz over 500 ms ,i.e., 2 s2

2. Additional System Services e.g. PMU data monitoring and recording of frequency in real-time

3. Smart Voltage Control

4. Revised Operational Policies and Tools

All of these changes fall into the three pillars mentioned above. The RoCoF is important because it is used to determine when a system should be disconnected from the power net- work to restore the frequency. When a disturbance occurs in the system the system’s inertia is reduced which produces higher RoCoF and low dips in the frequency called nadirs. To combat the effects of the system having low inertia, to begin with, Ireland is working on a project where the two most important parts are, first is to test the durability of the generators with nadirs occurring in the system. 4 CHAPTER 1. INTRODUCTION

Secondly, is to check the distribution system settings when dealing with islanding* of the power network. This disconnection is controlled by the RoCoF relays, which monitors the system for high RoCoF and if not set correctly can cause further instability by disconnecting which would island the system prematurely [10]. The additional system services will provide tools such as synchronous inertial response, fast frequency responses, and fast post fault active power recovery. The synchronous iner- tial response will provide more inertia for the system when needed using an existing syn- chronous power plant. The fast frequency response is to be able to increase the power output quickly with the changes in load. The fast post fault active power recovery is an incentive of the power plant to work on getting active power recovery after a fault, if this is not done soon enough it can contribute to large frequency deviations [10]. The smart voltage control and revised operational policies and tools is a way of using technology and policies to control the power system, but in order to implement these policies they will need to be aligned with the appropriate technology. All of these methods will become more important shortly as the integration of renewables into the power system becomes more prevalent across Europe. It is expected to see the same issues of low inertia to appear in the following countries: Denmark, Spain, Portugal and the Balkan countries because of their location away from the area of high inertia systems in Europe. This is why the problem of low inertia is so important now [7].

1.2 Thesis Overview

The problem of monitoring power system stability has been a dilemma in power system since 1920, when it was first pointed out in "Power Control and Stability of Electric Gen- erating Stations" by Charles P. Steinmetz [11], [12]. Since then, there have been many different solutions for monitoring power system stability. The stability monitoring problem is becoming more apparent now because of the integration of diverse sources of energy like , which contribute to the problem of power system stability due to their unpredictability and low inertia as discussed in Chapter 1.1.1 [13].

1.2.1 The Thesis Objective The goal of this thesis was to determine the feasibility of using PMU data to investigate the following two questions: 1. Is it possible to develop analysis methods for the Icelandic power system that can predict or simulate the generator’s behavior for important operation conditions? 2. Can this method then be used as a valid method of analysis on known generator events for detecting malfunctions in the generator equipment?

This thesis explored two different strategies to answer these questions: 1. Develop a model for simulating PMU data and generating event data. Once the model could be used to simulate an event, then the real event data was plugged back into the simulation. This allowed the parameters of the generator to be found using the PMU data. Any changes from the original parameters were then detectable in the model. *Islanding is what happens when parts of the power network start to be disconnected from one another to regain system stability. 1.2. THESIS OVERVIEW 5

2. Apply signal processing techniques and machine learning to find “unusual events” or “abnormal events”* in the PMU data.

Both of these will be discussed further in Chapter 3. Before discussing the approach taken in detail, readers are recommended to read Appendix A if not familiar with AC power.

1.2.2 Initial Thesis Plan In order to understand the challenges that needed to be overcome, the following section will present the key tools and components used. This project uses phasor measurement unit (PMU) data. The PMU is an instrument that records current, voltage, and calculate the pha- sor of the power system with a high accuracy time source [14]. In order to synchronize event data with data from the rest of the system, it is important to know the time at which the event occurred, regardless of the geographical distance between the event and the PMU sensors, which are the Potential Transformer † (PT) and Current Transformer ‡.The PMU data was then run through an ARX (autoregression with exogenous input) model for generator pa- rameter identification, in order to detect generator malfunctions and generating conditions. An initial test was run on PMU data without any events. This provided a baseline test of the generator parameters also called a spectral fingerprint of that generator. This analysis would have been incorporated in a software program that would monitor incoming PMU data at Landsnet but this proved impossible due to time constraints§. Once a baseline was established it was stored in the system and the incoming PMU data from that generator was compared to the baselines data. If there were any significant deviations in the incoming data when compared to the baseline data, an event was flagged in the program letting the operator know that the generator was not performing within the predefined parameters. The second part of the project was to validate this method of predicting generator be- havior in order to detect malfunctions in generator equipment, by using IEEE and control system models of the generators. Although there are many different methods that can be used to accomplish the outlined goals, the methods that will be discussed in this feasibility study are the following¶:

• The hybrid dynamic system method [15]

• The least squares estimation method [13], [16]

• The unscented Kalman Filter method [17]

• The digital filter method [18]

1.2.3 Development of the Initial Thesis Proposal This thesis has changed significantly since its initial conception, due to time constraints and unforeseen challenges with the PMU data. One major change to the project was the

*In this thesis the word “event” is going to mean an “unusual event” or “abnormal event” because in power system an “event” could be something as simple as changing a load, but this is not what is meant unless otherwise stated in this thesis. †A transformer the steps down the voltage or potential for measurement purposes ‡A transformer the steps down the current for measurement purposes §See Chapter 5.3.2 ¶See Chapter 2 (The Literature Review) for further discussion. 6 CHAPTER 1. INTRODUCTION

software development, which will not be pursued anymore and will be discussed further in Chapter 5.3.2 under Future Work. Other changes were made to the models and the software being used for analysis of the PMU data. The main change was to use open source free, developing platforms such as Python and OpenModelica software. Using Python and Open Modelica for power system modeling allowed the use of preexisting models and libraries built for power system mod- eling and generator parameters. Using open source tools will also allow future work to be done on this thesis and allowing for greater advancements by anyone who was interested continuing this work. All the code from this thesis will be published on a GitHub reposi- tory*. The use of open source would also allow for more complex models to be used from the iTesla Project in the future.

1.3 Background

The electrical distribution network, also known as the power system, it is a network com- prised of many interconnected nodes, sources and loads. Such a complex system requires a lot of maintenance and constant monitoring of the system to keep everything running smoothly. One method for monitoring the power system is a network of phasor measure- ment units (PMU). However, before discussing this system, a more general overview of the electrical system and how it works needs to be explored†.

1.3.1 Overview of Power Systems Power systems is the study transferring of power over a system that is a network of compo- nents that either absorb or produce power. In the context of this thesis, the power system under discussion is the electrical system that distributes electrical energy from the source (a generator) to the consumer of the electricity. To simplify the power system networks, they are often shown as a one-line diagram, which is a simple circuit that can represent the part of the system of interest for analysis purposes. A similar technique will be employed here for explaining active power, reactive power, and apparent power. The power system is a vastly complex system with many components, and the focus of this thesis will be on the generating elements of the power system. Below is an overview of the relevant terminology. Each term is given in the format: Name (Symbol)(Description) (Units). There are four main types of AC power, which are listed below:

Active Power, Real Power, or True Power (P )(Real)(kW):

Active Power is the power used to do work. This is measured in Watts (W). The ac- tive power is fully transmitted when there is only a resistive component present, and therefore the current and voltage are in phase. See Figure A.1 for a visual representation of the current and voltage being in phase.

Reactive Power or Compensating Power (Q)(Losses)(kVAR):

Reactive Power is used for controlling voltages in the power system. Reactive power is also used in the magnetic fields used in motors and .

*https://github.com/nicholasr15/ThesisProject2017 †See Appendix A for further discussion of the electrical system. 1.3. BACKGROUND 7

The reactive is generated in any AC circuit by the alternating current causing a magnetic field to form and collapse at the frequency of the AC circuit. This formation and collapsing of the magnetic fields causes a voltage to be induced in the wire in the opposite direction know as the reactive current. The reactive current opposes the power causing an impedance in the wire. The reactive power is produced when there is a Leading Power Factor or Lag- ging Power Factor caused by capacitive and inductive loads respectively: • Leading Power Factor – current leads the voltage – voltage lags the current • Lagging Power Factor – current lags the voltage – voltage leads the current The power factor is defined by whether the current is lagging or leading the voltage, as shown in bold above, but can also be thought of as voltage leading or lagging the current. The production of reactive power can be seen in Figure A.2. The unit of measurement for reactive power is volt-amps reactive (VAR). The power factor always changes because of the properties of transmission lines and other equipment used in the power system, as well the do to loads applied in the power system. See Appendix A.1 for more information on capacitive and inductive loads.

Complex Power (S)(T otal)(kVA):

Complex Power is the power produced by true power (active power) and the reactive power. This is represented mathematically by equation 1.1,

∗ S = VrmsIrms = P + jQ (1.1)

Where “ ∗ ” is the complex conjugate of “I”, which has the opposite sign of the imaginary part. Complex power is measured in volt-amps (VA), the same as the Apparent Power. The complex power cannot just be added but is the sum of the two vectors of active power and reactive power. This is represented by the power triangle, which can be seen in Figure 1.2, and the beer power example, as shown in Figure A.1.

Apparent Power (|S|)(Magnitude)(|kVA|)

Apparent Power is the magnitude of the Complex Power (S). It is derived by mul- tiplying the voltage and current regardless of their phase and can be represented mathematically by the following equation 1.2,

|S| = |Vrms||Irms| (1.2)

Where the || is the magnitude of the voltage and current. The units are volt- amps (VA). The Apparent Power is used in doing calculations as shown in Fig- ure 1.1. 8 CHAPTER 1. INTRODUCTION

V 2 P = True Power P = I2RP = R Measured in Watts (W)

V 2 Q = Reactive Power Q = I2XQ = X Measured in Volt-Amps-Reactive (VAR)

p 2 2 |S| = Apparent Power |S| = P + Q |S| = |Vrms||Irms| Measured in Volt-Amps (VA)

|V |2 S = Complex Power S = |I|2ZS = S = VI∗ Z∗ Measured in Volt-Amps (VA)

Figure 1.1: The equations used for calculating Active, Reactive, Apparent Power, and Com- plex Power. P is the real power, R is the resistance, I is the current, V is the voltage, X is the reactance, Z is the impedance, and ∗ is the complex conjugate [19].

Figure 1.1 shows the equations used for calculating true power (P ), reactive power (Q), and apparent power (S). Figure 1.2 is a visual tool called the "Power Triangle," which shows how active, reactive, and apparent powers are related to one another. Figure 1.3 shows another way of visualizing the relationship between active, reactive, and apparent power. The relationship of these powers can be done through the analogy of beer in a glass, where the beer represents the Active power; the foam is the Reactive power and the beer and the foam combined is the Apparent Power. The beer analogy can be taken one step further by thinking of the head of the beer (the foam) as the CO2 produced in the fermentation process. Where CO2 is a byproduct of the yeast consuming the sugars in the Wort fermentation process to produce alcohol and if the alcohol is thought of as Active power. Then the beer analogy can be use to think of the CO2 as reactive power that is a byproduct that is produced when the active power is going through passive components such as capacitors and inductors. Active, Reactive, and Apparent Power are important in the electrical system, and ways of controlling them will determine how stable and reliable the power system is. It is also important to find a way of monitoring the types of power in the power system. One technique to do this is using the PMU data from many PMU spread out across the power system. The advantages of this type of system will be discussed in Chapter 1.4. 1.3. BACKGROUND 9

Figure 1.2: The power triangle is shows how the three types of power are related. [20]

Foam = Reactive Power

Glass Capacity = Appartent Power

Beer = Active Power

Beer Power Factor = Glass Capacity

Figure 1.3: Power Factor a glass of beer [21] 10 CHAPTER 1. INTRODUCTION

1.3.2 Three-Phase Power

One single person did not come up with the idea of three-phase power, but a collective of individuals was coming up with the same idea independently around the 1880’s to 1890’s. Some of these inventors were Galileo Ferraris, Charles Bradley, Friedrich August Haselwan- der, Mikhail Dolivo-Dobrovsky, and Nikola Tesla [22]. The reason for using three-phase power and not two-phase is because three-phase is a more efficient way of delivering power then one-phase or two-phase systems, as the number of phases increases the efficiency also increases. The increase in efficiency is because more phases the more power is being de- livered as shown in Figure 1.4. Figure 1.4 shows how with more phases that there is more power being produced at more times per-cycle by having more phases. Also since sinusoidal waves provide AC power than there is a part of each wave cycle that there is no power being delivered when the wave crosses the zero axis in Figure 1.4. The reasons for not increasing the number of phases is because when increasing to more phases the improvements in efficiency do not outweigh the costs of the equipment needed for dealing with the higher number of phases. The relationship to the number of phases is not linear to the amount of power being delivered; therefore three-phase power was considered to be the best economical and efficient balance of a power delivery system. The phases are known as Phase A, Phase B, and Phase C. Other reasons AC electricity is produced in a three-phase system has to do with the efficiency of producing electricity and the transport of the generated electricity. The main two advantages of using three phases over single-phase are:

1. Less metal can be used when constructing a generator for producing power in a three phase system than a single-phase system. The uses of less metal to deliver the same amount of power as in a single-phase system, the reduced use of less metal implies it is more economically efficient to generate power with a three-phase system [23].

2. The three-phase system has the advantage of providing a constant input to a load in the electrical system. This is because of the way there-phases are separated by 120°, as demonstrated in Figure 1.4 [23].

Phase 1 at 0° Phase 2 at 120° Phase 3 at -120°

0

0 120° 120° Figure 1.4: Three phase power sinusoidal waveforms [24] 1.3. BACKGROUND 11

Three-phase power also allows for easy starting of industrial equipment such as three- phase induction motors. This three-phase system works by having three single-phase gen- erators combined into one generator with the coils offset 120°, meaning each time the rotor spins it will produce three sinusoidal waveforms offset by 120°. Phase A will therefore be at 0°, Phase B will be at 120° from Phase A, and Phase C will be at 240°. The three-phase generator system can be created with two different wiring configurations, Delta or Wye*. The Delta and Wye are two wiring configurations used in three-phase power. These two types of connections allow for wiring between phase and ground or phase to phase. They get there name from the shape of the wiring diagram, the phase to the ground looks like the letter “Y”, where the phase to phase looks like the delta symbol (∆). The choice of a delta or Wye is chosen base on the desired characteristics of the load and source [25]. The type of configuration matters when calculating the voltage and current from the generator to the load [23]. This difference in phase means the phases have different voltage potential at any instant in time and could short against one another, causing a problem in the stability and control of the power system.

1.3.3 Per-Unit System The purpose of the per-unit (p.u.) system is to use a base unit in the power system being analyzed. Doing this allows for voltage, current, and impedances to be expressed as a per- centage or ratio of the base unit. Expression as a portion of the base unit is useful in power systems because it simplifies the complexities of working with numbers and dealing with transformers in the electrical system. The p.u. system works by first establishing two base units, the two most commonly used are bases voltage (Vbase) and complex power (Sbase). Current and impedance can also be expressed as (Ibase) and (Zbase), respectively. Next, the other bases have to be expressed regarding the two chosen bases, the bases selected for this thesis were voltage (Vbase) and complex power (Sbase) because the base power of the elec- trical system being analyzed for this thesis was known. The formula for converting to the p.u. system is shown in Equation 1.3.

actual quantity per-unit quantity = (1.3) base value of quantity Now solving for the rest of the bases in terms of the voltage and complex power, Equa- tions 1.4, 1.5, 1.6, and 1.7 are found.

Pbase = Qbase = Sbase (1.4)

Sbase Ibase = (1.5) Vbase

2 Vbase Vbase Zbase = Rbase = Xbase = = (1.6) Ibase Sbase 1 Ybase = Gbase = Bbase = (1.7) Zbase Once the bases are established and the equations found in order to use the per-unit sys- tem, there are two rules that have to be kept in mind when working in the p.u. system:

*The term Wye is used in North America but the term Star is used in Europe 12 CHAPTER 1. INTRODUCTION

1. When a base unit is established it has to remain the same through out the entire power system being analyzed.

2. When analyzing a system with a transformer, the voltage bases need to be selected such that they have the same ratio as the transformer voltage ratings.

This process of using the p.u. can be thought of as converting into uniform normalized bases [26] [27].

1.3.4 Power System Stability and Control One important aspect of a power system is the stability and control of the electrical system. Monitoring the power system stability is crucial because the power system has to be in bal- ance at all times to run smoothly and efficiently. The three most important parts of power system stability are: voltage stability , frequency control , and rotor or power angle stabil- ity [28]. These parts are represented visually as a flow diagram, as seen in Figure 1.5 [28]. Figure 1.5 shows the classifications of power system stability and they are also briefly dis- cussed in Subsections: Voltage Stability, Frequency Control, and Rotor Or Power Angle Stability.

Figure 1.5: A flow diagram of classifications of power system stability [28] 1.3. BACKGROUND 13

Voltage Stability Voltage stability is the ability for a power system to maintain all voltages and frequencies at all buses and loads, within the predefined parameters of the system. Equilibrium should be retained whether the system is operating under normal conditions or in the event of a disturbance affecting voltage stability. Such a disturbance could result in increases in load demand or changes to the system, leading to the continuous and uncontrollable decrease in voltage, which could result in voltage collapse if not corrected. Voltage collapse is caused mainly by the power system being unable to meet the demand for reactive power. Reactive power is controlled in the power line by adjusting the current and voltage in the line. It can also be consumed by loads at the other end of the line. Other causes of voltage instability due to reactive power control are loading character- istics and features of reactive compensation. Another way of compensating with reactive power is using a device such as a synchronous condenser*, SVC†, or DVAR‡. The syn- chronous condenser is a device similar to a synchronous motor in construction, but with no load placed on the output shaft. This device works by controlling the direct current for the field windings, thereby controlling the excitation of the field. If the field coils are underex- cited, then the synchronous condenser will absorb reactive power to maintain the momentum of the rotor spinning inside it. The converse is also true: if the field coil is overexcited, then the synchronous condenser will produce reactive power. Voltage stability is more of a problem now because the power lines are forced to operate closer to their limits due to greater demand for power without upgrading the transmission system. This means that if there is any disturbance in the power lines or power system now, it causes a more significant burden on the lines. Because the lines no longer have the extra capacity they used to have, due to increased demands on the power system, they no longer have the ability to help compensate for new disturbances. The main factors leading to voltage instability are [31]:

• The loading on the transmission line system is too high.

• Voltage being supplied too far from where the load is, meaning the transmission line impedance is too high.

• The voltage supply being too low for the system.

• Insufficient reactive power compensation. When there is not enough reactive power provided, then the problem is compounded by devices like induction motors requiring more reactive power than is available to the power system [31].

Frequency Control Frequency control is a method of maintaining the frequency in a power system when load changes and instability occur. This is important because if the system is not maintained at the correct value it will cause damage to the network or the customer’s equipment. One of the tools used in power system to maintained the frequency is the use of automatic generation control (AGC) [28]. Automatic generation control is a system used for frequency control

*Synchronous condenser not employed in Iceland, but one SVC and one DVAR are used. †A high voltage system that is used to dynamically control the power system’s voltage to keep it at set reference value [29]. ‡Is a mechanism that supplies reactive power to the grid through the use of electronic [30]. 14 CHAPTER 1. INTRODUCTION

under most operating conditions for small changes in the power system, so in order to un- derstand how frequency control works, it makes sense to look at the AGC system first. This system works by controlling the frequency of each generator tied to the frequency control system to regulate the overall frequency in the system to as close to the nominal frequency as possible. This can be represented by Equation 1.8.

∆Pm,i ∆f = −Ki (1.8) Pn,i fn

∆Pm,i: The change in mechanical power (W)

Pn,i: The nominal or rated power (W)

Ki: The actual gain from the governing system

∆f: The change in frequency (Hz) fn: The nominal or rated frequency (Hz) i: The indicator of the number of the generator

Equation 1.8 is the idealized hydro-turbine power–speed characteristics of the govern- ing system. When the frequency control is well tuned, it will ensure that with any load fluctuation there will be only a small change in the frequency [28].

Rotor Or Power Angle Stability Rotor or power angle stability is the ability for the generators to maintain synchronism with the mechanical and electrical torques. The mechanical torque is the torque generated by the mechanical prime mover, in this case a hydro turbine. The electrical Torque is the torque produced by the load on the generator, and it is caused by the rotating magnetic field in the generator’s stator. When under standard operating conditions, the rotor angle is minimal between the mechanical and electrical torque, depending on the demands of the generator, but if the generator is not able to either compensate when the prime mover speed is increased, or the prime mover speed is decreased compared to the stator rotating magnetic field, then the generator could loose synchronism with the rotating magnetic field. This can be caused by improper load sharing of the generators in the system, a fault in the system causing the need for more power that cannot be generated, or too much power being generated. This can be represented mathematically by the swing equation as seen in Equation 1.9 [32].

H d2δ = P − P (pu) (1.9) πf dt2 m e

H: The inertia constant (MJ/MVA)

f: The frequency (Hz) d2δ : The rotor’s acceleration (deg /s2) dt2

Pm: The mechanical power (W)

Pe: The electrical power (W) 1.3. BACKGROUND 15

Trajectory of rotor angle changes vs. changes in rotor speed Scenario Scenario with Damping ω rad/sec ∆

∆ δ degrees

Figure 1.6: shows the instability in the power system by when it is underdamped by graphing the trajectory of rotor angle changes vs. changes in rotor speed.

Rotor angle change over time Scenario Scenario with Damping [Degrees] δ Rotor Angle

Time [s]

Figure 1.7: shows the instability in the power system by when it is underdamped by graphing the rotor angle change over time.

Equation 1.9 is a simplified representation of how the mechanical (Pm) and electrical (Pe) power are related to the rotor angle (δ) and power angle stability. It can be seen from this equation that the inertia constant (H) plays a significant role in keeping the system stable, because if H is small then a slight change in frequency (f) has a bigger impact on the overall system. This is why it’s important to have an accurate monitoring system using PMU data. With this type of system, it is easier to monitor a parameter such as frequency (f), power (Pm,Pe), and eventually the inertia constant (H). The next sections will cover the PMU data and its advantages over previous monitoring systems. Some examples of stability and instability are shown in Figures 1.6 and 1.7. 16 CHAPTER 1. INTRODUCTION

Figure 1.8: The simplified setup of the PMU [33].

1.4 The Phasor Measurement Unit (PMU)

The key component in this feasibility study was the PMU data. This data was collected by using the following in this order:

Potential Transformer for collecting the voltage of the system.

Current Transformer for collecting the current of the system.

GPS for an accurate time stamp.

PMU that takes in the data from the potential and current transformers and applies the time stamp.

PDC for taking the PMU data compiling it into a usable format for storing in a data base.

Centrol Host Site for storing the PMU data at Landsnet.

Figure 1.8 shows a simplified setup of a PMU with the potential and current transformers. The following section gives a basic outline on what a PMU is and how it works to collect the data needed for the feasibility study in this thesis. The PMU is a device that is connected to the power system for measuring the power system’s quality in real time. This device works by sampling data from a piece of equipment called an instrument transformer. There are two kinds of instrument transformers: voltage or potential transformers and current transformers. They work in the same way as an ordinary transformer, but are made with a certain number of windings for the purposes of measuring current and voltage. The current and voltage can, therefore, be measured once they have been stepped down with electronics. That measured value is then multiplied by the turns ratio in the instrument transformers. This can be seen 1.4. THE PHASOR MEASUREMENT UNIT (PMU) 17 in Equations 1.10, 1.11, and 1.12. N V I T urns Ratio = P = P = S (1.10) NS VS IP

NP : The number of turns on the primary coil

NS: The number of turns on the secondary coil

VP : The voltage of the primary coil (V)

VS: The voltage of the secondary coil (V)

IP : The current of the primary coil (A)

IS: The current of the secondary coil (A)

NP VP = VMeasured (1.11) NS

VP : The voltage of the primary coil (V)

VMeasured: The voltage on the secondary coil, measured using a voltage transformer (V)

NP : The number of turns on the primary coil.

NS: The number of turns on the secondary coil.

NS IP = IMeasured (1.12) NP

IP : The current of the primary coil (A)

IMeasured: The measured current on the secondary coil using a current transformer (A)

NP : The number of turns of the primary coil

NS: The number of turns of the secondary coil Once the voltage and current are collected at the rate specified by the PMU parameter setting, usually ranging from 30 to 120 times per-second* [34], they are then given a time stamp from the PMU’s Global Positioning System (GPS). This time stamp allows for accurate recording of the PMU data and for comparison at a later point in time to data from other PMUs in the same power network after a disturbance or event is detected. The process by which a PMU collects data is the following: 1. The data is collected by the instrument transformer.

2. The data is matched with a synchronous time signal by a GPS in the PMU.

3. The data is sent to the Phasor Data Concentrator (PDC).

4. The data goes to a Central Host Site or computer where it can be accessed and recorded. The whole process of collecting the PMU data is illustrated in Figure 1.9.

*Iceland the rate for 50 times per-second, i.e., 50 Hz 18 CHAPTER 1. INTRODUCTION

Transmission One-Line GPS

GPS Antenna

PT Communcation Utility Host Site Central Utility Modem Utility Router RouterSwitch Host Circuit Wide area Site CT network Super PMU Wide area PDC network PDC s Router Router Local area network

Visualization Client (Host Site) Phasor (Web) Server Legend: Host Site Router PT = Potential Transformer CT = Current Transformer Wide area Router network Router S = Shunt Resistor (Utility 1) (Utility 3) Router (Utility 2) Note: Visualization Client (Utility 1) Visualization Client PMU -> PDC communication can (Utility 3) be either via modem or Ethernet Visualization Client (Utility 2) Figure 1.9: Process of collecting the PMU data [33]. 1.4. THE PHASOR MEASUREMENT UNIT (PMU) 19

The Importance of PMU Data Using PMU data to monitor the power system has several significant benefits over the pre- vious methods. These are as follows:

• Faster connection with the data being collected and sent to the control center.

• The data is timestamped by the GPS system as soon as it is gathered from the current transformer and Potential Transformer (PT) instruments.

• The PMU data contains more information than the older system.

The PMU data has a faster connection to the control center and other equipment, which means that the power system can be monitored with more accuracy and receive more data at one time. However, the more data produced by sampling, the greater the data management needs, which can present problems. This disadvantage is outweighed by the benefits of re- ceiving more data, which allows for faster sampling rates by the PT and current transformer. Figure 1.10 illustrates the importance of this by showing how the faster sampling rates pro- vide a higher resolution, giving more details of what is happening in the power system in real time [34], [35]. This data also has timestamps associated with it, allowing the data to be matched up with data from many substation feeds to the PDC at the control center. With the capability of matching up all this data with the same timestamps from different substa- tions, this allows the power system operator to see in real time stability of the network. The stability of the system is monitored by looking at the phase angles at different substations. The importance of this is demonstrated by Figure 1.11 and Equation 1.13. Equation 1.13 is mathematical simplification representing a lossless system of how much power flow is be- tween the two buses. If the φ1 = φ2 then the power flow between Bus 1 and Bus 2 becomes zero. The angles are good indicators of the power, showing whether the system is under stress. If the system is under stress then the angles will become further separated from one another at each bus [34], [35].

Figure 1.10: SCADA method of measuring voltage compared with the PMU method of voltage measurement [36]. 20 CHAPTER 1. INTRODUCTION

V1 sin(φ1) V2 sin(φ2)

P12

jXL

Bus 1 Bus 2 Figure 1.11: Showing a one-line diagram of the two buses with different phasor angles in the power system [34], [35].

V1V2 sin(φ1 − φ2) P12 = (p.u.) (1.13) XL

V1: The voltage at Bus 1 (p.u.)

V2: The voltage at Bus 2 (p.u.)

φ1: The phasor’s angle at Bus 1

φ2: The phasor’s angle at Bus 2

XL: The inductive reactance One real-world example of a problem that could have easily been prevented with PMUs and their data, if PMUs were in place at this time, was the August 14, 2003 blackout in the United States and Canada. There were no PMUs in place at this time in the location of the event. If there had been PMUs in place, and the angular separation had been calculated as shown in Figure 1.12, then it would not have been allowed to separate to over a 100° angle as it did in the event [34], [35]. Resulting in the largest blackout in American history and roughly $36 million an hour in losses for New York city [38], [39]. This black out was caused by a cascading effect of the power plant shutting down as they detected significant power spikes in the system. The over all result of this blackout was to implement new power regulation and equipment including a network of PMU across the US. 1.4. THE PHASOR MEASUREMENT UNIT (PMU) 21

Figure 1.12: A graph of the Angular Separation of the Cleveland and West MI area in the power system during the August 14, 2003 blackout in the United States and Canada [33], [37] 22 CHAPTER 1. INTRODUCTION

1.5 Axiomatic Design

For developing the design criteria for this thesis the Axiomatic design process was imple- mented. The Axiomatic Design is a design method developed by Dr. Suh at Massachusetts Institute of Technology in the early 90s [40]. A notable advantage of the Axiomatic Design process is that it is a design method based on only two axioms:

The Independence Axiom states that the functional requirements (FRs) design must be uncoupled from each other. A change in one functional requirement (FR) only affects the corresponding design parameter (DP) [41].

The Information Axiom states that the axiom that has the lowest information [42], [43]. Fulfilling the functional requirement (FRs), therefore the design as a lower informa- tion content.

Axiomatic Design allows for the design to be quantified mathematically for finding the optimal design. A good design should be able to satisfy both axioms. The idea of axiomatic design comes from the word axiom, which is a term from mathematics meaning a statement that cannot be proven but still is valid until proven wrong. So far these have not been proven wrong for design [40]. The result of the Axiomatic design process is shown by looking at the Customer Needs in Chapter 1.6.1, the Design Constraints and in Chapter 1.6.2, and the design decomposition, i.e., the zig-zagging approach in Chapter 1.6.3, employing the Functional Requirements (FRs) and Design Parameters (DPs). The Functional Requirements FRs are derived by focusing on the transformative or action verbs and can be verified by a result. On the other hand, the Design Parameters DPs are extracted from a noun that conceivably quantified or instantiated, leads to an explanation on the FRs that could be met [44]. Once the FRs and DPs have been developed by the methods of using transformative or action verbs for the FRs and nouns for the DPs, then the FRs and DPs are analyzed for coupling of each other. The coupling is important because the more the design as coupling the more delays are present [42]. The method of checking for coupling is done by using a design matrix in the form of a Cartesian product of the FRs and DPs and how they may depend on one another. In optimal designs the design matrix shows that only the FRs are that related to the DPs should depended on one another, i.e., FR1 is only depended on DP1 result in a diagonal design matrix.

1.6 Axiomatic Design Implementation

This method was chosen for this project to help find the best solution that meets the cus- tomer’s needs. To find the design parameters to best meet the Customer Needs, i.e., the needs of Landsnet, the Axiomatic Design process for this project was used and is laid out below as follows [41], [45]:

1.6.1 Customer Needs To come up with the Customer Needs for this project there were several meetings setup with Landsnet and Guðjón the third advisor on this thesis. The following statements were formed out of the discussions. These Customer Needs (CNs) are then used to develop Functional Requirements (FRs) and Constraints (Cs). 1.6. AXIOMATIC DESIGN IMPLEMENTATION 23

CN0: The client needs software that will notify them when an event happens in the power system that falls within predefined parameters for the event being looked at.

CN1: The software needs to able to run on the pre-existing computer in the power system, which are running Windows 7, 8, and 10.

CN2: The software needs to be able to run through the PMU data in real time to find the events.

CN3: Notify operator of an event in the PMU data by color map, where dark colors is important and light colors are standard.

CN4: Once an event has been found in the PMU data and classified as the right type of event, the PMU data should be recorded for later analysis.

1.6.2 Design Constraints The design constraints are thought of being in two categories the input constraints and the system constraints. The input constraints are appointed as part of the design criteria. The system constraints are established by the operating environment of the design. The following design constraints have been designated into the two categories of input constraints and system constraints. All of these constraints are followed by the word System or Input to indicate what type of constraint they are [42].

C1: The project must be completed by the defense date of this thesis. -Input

C2: Software must be able to run on pre-existing hardware and software, meaning that the software will run Windows 7, 8, and 10 on Dell computers at Landsnet. -System

C3: The software will need to operate at a rate faster than 50 data point per second so that it can take in live data and process it with algorithms. -System

C3: Notify the customer in a timely and intuitive manner. -System

C4: Record the event in a manner so that they can be easily accessed at the following data for further analysis if needed. -System

1.6.3 Design Decomposition “Zig-zagging Approach” Design decomposition is known as the zig-zagging approach, where you start from the top- level FR0 and DP0 then move down to the next level once the previous level is completed. The Functional Requirements (FRs) were developed from the customer needs, the functional requirements (FRs) need to start with a verb and can be tested. The design parameter (DP) are used for meeting the requirements of the Functional Requirements for the design. DP, are how the thing is done and the test for the DP starts with a noun and can be qualified or compared [42].

FR0: Find events in the power system by using PMU data from the power system, related to the particular problem that is being analyzed.

DP0: Python programming language with Machine learning. 24 CHAPTER 1. INTRODUCTION

The top level Functional Requirements FRs and Design Parameters DPs are known as FR0 and DP0.

FR1: Process the incoming PMU data from the PDC.

DP1: Computer with a processor and input/out speed that will be able to run through the data faster than 50 data point per second with Python programming.

FR2: Find the right events from the incoming PMU data.

DP2: Machine learning with principal component analysis and Gaussian process classifica- tion will be used to find events that are related to a particular problem.

FR3: Notify the customer promptly about the event and severity of the event on some pre- determined scale.

DP3: A heat map will display the severity of the event and percentage of probability that it is an event.

FR4: Flag the event data for further analysis.

DP4: Event data export to a date stamped separate file.

FR0, means that the program being designed will have to be able to extinguish between other events in the power system like changes in power from the abnormal event being looked for. One way of accomplishing this DP0 is to use machine learning because of the flexibility of the machine learning algorithms in being able to learn the different of the non- events, the abnormal events*, and power system events. FR1, is set into place because one of the customers needs CN2 states that the software needs to process the PMU data in real time from the PDC. To meet this need by the customer DP1 was stated to have a processor and input/out speed that will be able to process data faster than the incoming speed of 50 data points per second from the PDC. This speed requirement leads to coupling of DP1, DP2, FR1, FR2, FR3, and FR4 as shown in Equation 1.14. Due to the fact that the computer/processing speed is directly related to the performance of all the FRs and DP2 because they need to be able to finish their task before the next cycle of 50 data point from the PDC. FR2, is coupled with FR1, DP1, and DP2 because of the time it will take to find the right events that are in the incoming PMU data. DP2 solved FR1, FR2, and DP1 by using machine learning because it can tell the difference between the non-events, the events, and power system events in a short time frame. FR3, has to be coupled with DP1, and DP3 due to being able to notify the customer in a timely manner requires fast processing DP1. DP3 meeting the FR3 are done by displaying the event severity on a heat map as shown in Figure 3.6, along with the percentage of probability that is an event. FR4, is coupled with DP1, and DP4 as a result of the time it will take to flag the event data requiring fast processing DP1. DP4 fulfills the FR4 by export the event data from the program to a file were the information about the event can be stored for further analysis at a later date.

*In this thesis the word “event” is going to mean an “unusual event” or “abnormal event” because in power system an “event” could be something as simple as changing a load, but this is not what is meant unless otherwise stated in this thesis. 1.7. EXECUTIVE SUMMARY 25

1.6.4 Design matrix       FR1 XX 0 0 DP1     FR2 XX 0 0  DP2 =   · (1.14) FR3 X 0 X 0  DP3     FR4 X 0 0 X DP4 The matrix in Equation 1.14 is not a triangular matrix and therefore not decoupled or path- dependent matrix. The reason for the axiomatic design for this project not being decoupled is the coupling between FR1 and DP2, this coupling would need to be solved by decoupling them. The decoupling of the FR1 and DP2 is not easily done, but due to the processing speed of computers, it does not have as big of an effect on the design. The decoupled matrix which would be the ideal matrix for this thesis. The decoupled matrix means some elements of the project are dependent on other elements of the project, making it harder to change things without disturbing some other elements and that changes have to be done in a particular order to maintain the decoupled matrix. The reason for the decoupled matrix is because DP1 and DP2 both meet the requirements of FR1, also DP1 is required by all the FRs due to the speed of processing depending on the machine learning algorithm, being able to display the event, flagging the even, and storing the event for further processing at later dates. All of these processes need to be done before the next data set comes from the PDC. The design is a good design but not optimal. To make this an optimal design dependency of FR1 on DP2 and the dependences on the all the FRs on DP1 would need to be broken by having the program run fast enough that it is only depended on the processor speed of the computer and not the speed of the machine learning algorithm or some other way of breaking the dependences. The completely optimal solution in the design matrix in equation 1.14 is when the “X” form a complete diagonal across the matrix meaning that nothing in the design is dependent or coupled with anything else [41], [45]. When this happens, it means that the Independence Axiom has been satisfied and there is only one DP that will meet the requirements for one FR. In the case of this thesis, it was not possible to achieve the Independence Axiom com- pletely, therefore there is coupling present in this design. The presence of coupling means that there will be delays in the design process [44]. Delays in design process will be present when working on FR1, FR2, FR3, DP1, and DP2, see Chapter 5.5. Note, there may also be delays when working on FR4 but this one has not been implemented yet.

1.7 Executive Summary

The thesis is about the use of PMU data in the Iceland power system to help find and diag- nose events in the power system. To accomplish the task of finding and diagnosing events in the power system. The thesis was broken down into sections. Section one will cover the PMU data and event detection analysis. Section two goes through the PMU data and Parameter estimation, which could be used for event diagnostics. The introduction covers the basic theory of electrical power systems and how it relates to this thesis work. The next chapter goes over the literature review used for understanding the current work being done on the process of parameter estimation. Through the literature review, the method of using an ARX model was found. The method section starts with an overview of the tools used in this thesis. Then covers the two sections in detail on how the process was carried out for each section. Lastly, covering the criteria used from evaluating the methods and seeing 26 CHAPTER 1. INTRODUCTION how well they perform to what was expected. The results section covered the outcome of the methods performed in section one and two. This section also interprets the results into a meaningfully way so they can be discussed further in the discussion section. The discus- sion section explained the challenges with this thesis along with summary of the thesis and overview of the results. Also, covers the future work that could be done with the results of this project, ending with the conclusion of the thesis. 27

Chapter 2

Literature Review

Using PMU data for parameter identification and system analysis is of increasing importance as the power system ages and renewables are integrated. These two factors, the aging system, and integration of renewables cause problems with power grid stability, which the use of PMU data can help to identify [13]. Many papers deal with the subject of phasor measurement units and how to use PMUs and their data for system analysis. The focus of this thesis is to develop a tool that could be utilized in the Icelandic power system to help troubleshoot problems with hydropower plants and power production. The papers that were reviewed, therefore, focus mainly on using PMU data for troubleshooting, maintenance of the electrical system, and online gen- erator parameter identification. The use of PMU data as a way of analyzing the power system and as a parameter identification method for generators is a relatively new idea according to “PMU Based Generator Parameter Identification to Improve the System Planning and Op- eration” [46]. One method of doing this is a systematic identification process know as hybrid dynamic simulation, as discussed in the following papers “Practical Considerations to Cali- brate Generator Model Parameters Using Phasor Measurements”, “Simultaneous estimation of exciter, governor and synchronous generator parameters using phasor measurements”, “PMU Based Generator Parameter Identification to Improve the System Planning and Op- eration” [15], [17], [46], along with other techniques to improve the accuracy of the system model identification. Another way is to use an estimation of the power system’s transfer functions using the least squares estimation method with discrete autoregression and exoge- nous input (ARX) model, as proposed in papers “Estimation of Hydro Turbine-Governor System’s Transfer Function from PMU Measurements” and “Least Squares Estimation- Based Synchronous Generator Parameter Estimation Using PMU Data” [13], [16]. A third evaluation process is to use the Unscented Kalman Filter (UKF), outlined in the following article “Simultaneous estimation of exciter, governor and synchronous generator parameters using phasor measurements” [17]. The fourth method of parameter identification is using a multistage genetic algorithm (GA), as shown in “Simultaneous parameter identification of synchronous generator and excitation system using online measurements”[47]. Other uses of PMU data include system stability monitoring, as discussed in the paper Real Time PMU-Based Stability Monitoring [48].

2.0.1 Methods of Generator Parameter Identification and Validation The following methods have been developed concurrently in this field; all are currently in use to address the problem of generator parameter identification. One method that was considered for this type of analysis is the hybrid simulation method, as discussed in “PMU 28 CHAPTER 2. LITERATURE REVIEW

Based Generator Parameter Identification to Improve the System Planning and Operation”, Tsai, Lee, Nashawati, et al. and “Practical Considerations to Calibrate Generator Model Parameters Using Phasor Measurements”, Tsai, Chang-Chien, Chen, et al. [15], [46]. The hybrid simulation method uses PMU data to develop a dynamic simulation of the power system, along with other mathematical algorithms for better accuracy. Accurate simulation of the power system is important as this allows the power system operators to plan for maintenance and system stability. In the past, to find the dynamic simulation parameters for the electrical system, a field test had to be performed for each component, for which the generators had to be taken off-line, a time-consuming process which risks damage to the generators and when the generator is offline there are economic losses as well [46]. This paper proposes a new method, which is to use online-based identification using PMU data and other methods, for improving the accuracy of system parameter identification. The online identification involves a three-step process as outlined in “PMU Based Generator Parameter Identification to Improve the System Planning and Operation” [46]. The three steps are:

1. Implementing the hybrid dynamic simulation for finding the corresponding dynamic circuit of the power system to help with the computational time and improve the effi- ciency of the model.

2. Using trajectory sensitivities and parameter correlation analysis to develop the param- eters needed for enhancing the effectiveness of the design. The trajectory sensitivities is a way of being able to calculate small changes in the trajectory.

3. Using a minimum variance calibration strategy to find the parameters of the genera- tor “PMU Based Generator Parameter Identification to Improve the System Planning and Operation” [46]. The minimum variance calibration strategy also knows as Ward’s method is a method of finding the parameter with a solution that has a high accuracy.

This paper mainly focuses on large aggregate systems where the estimation of generator model parameters is harder to perform. Another method along the same lines, using hybrid dynamic simulation along with an artificial intelligence tool, is outlined in “Practical Con- siderations to Calibrate Generator Model Parameters Using Phasor Measurements”. The hybrid dynamic simulation is described in “PMU Based Generator Parameter Identification to Improve the System Planning and Operation” and “Practical Considerations to Calibrate Generator Model Parameters Using Phasor Measurements” [15], [46] is the process of dy- namically determining the parameters of the power system to model the system correctly.

The hybrid dynamic simulation method In the paper “PMU Based Generator Parameter Identification to Improve the System Plan- ning and Operation” the method used was called the hybrid dynamic simulation* The hybrid dynamic simulation can used one of two methods listed below:

Method 1: Voltage injection method, i.e., phase shift method

Method 2: Load injection method

*See citation [46] for more information on the hybrid dynamic simulation. 29

These methods need to be done at a boundary bus point to order to obtain the right re- sults [15]. The voltage injection method matches the voltage and angle to the data at the recorded point. The voltage injection has to be performed at the measuring point where the PMU is installed. The reason the voltage injection has to be done this way is that the sim- ulated data is matched to the real data by adding a virtual transformer and generator to the system at this point. Then the parameters of the generator and transformer can be estimated by using generalized models for both the transformer and generator. The initial conditions for these generalized models are determined as follows. First, the voltage setting for the generator is set to 1 per unit. Then the initial power output of the generator is fixed to the primary flow of the transmission line where the PMU is located. The original turn ratio (n) of the transform is set to the measured bus voltage (V ). Finally, the initial phase shifts (α) of the transformer is configured on the measured bus voltage angle (θ). By changing the transformer’s turn ratio variable (n) and the phase shift variable (α) at the time a simulation is performed, voltage and angle can be matched to the boundary bus and PMU data [15], [46]. The Load injection method works by converting the measured PMU data into the imped- ance equivalence. Unfortunately, this approach cannot be used directly in software simula- tions and therefore the measurements of the active power (P ) and reactive power (Q) on the boundary bus have to be changed to equivalence loads. This can be done by using equa- tion 2.1 for active power and equation 2.2 for reactive power [46].

Prec(t) 2 Psim(t) = 2 Vbase (2.1) Vrec(t)

Qrec(t) 2 Qsim(t) = 2 Vbase (2.2) Vrec(t)

Vrec(t) The recorded voltage from the PMU data.

Prec(t) The recorded active power from the PMU data.

Qrec(t) The recorded reactive power from the PMU data.

Vbase The base voltage of the bus where the PMU data is measured.

Psim(t) The corresponding active power load used for the simulation.

Qsim(t) The corresponding reactive power load used for the simulation.

It can be seen from equation 2.1 and equation 2.2 that at each time step the Psim(t) and Qsim(t) values change. This change is based on the synchronized measurements or PMU’s data. The goal for this type of method is to substitute the power system outside of the boundary bus with a dynamic load injection based on PMU measurements for each simulation time step [46]. This method of load injection works well for estimating both the active and reactive power but does not determine the angle well according to [46]. This mismatch in the angle representation will cause problems in sensitivity calculations. For this reason, this method was discarded in the paper “PMU Based Generator Parameter Identification to Improve the System Planning and Operation” [46]. One way of checking the accuracy of the hybrid dynamic simulation method is to make a comparison of the curves of active and reactive power known as the PQ curves. A PQ curves of the PMU data would be compared to a curve of the data obtained using the hybrid 30 CHAPTER 2. LITERATURE REVIEW dynamic simulation method. If the PQ curves are mismatched, this means there is a problem with how the subsystem parameter was found. A good set of parameters can be found by using optimization algorithms.

The LSE method with discrete input ARX model The Least Square Estimation (LSE) method with discrete autoregression and exogenous in- put (hereafter referred to as the ARX model) works by using PMU data to estimate such elec- tromechanical parameters as inertia constant (H) and primary frequency control droop [16]. The estimation of the electromechanical parameters is performed by using the ARX model along with the PMU data. The PMU data provides the input and output used in modeling the parameter identification process [13]. The ARX model is considered to be a single input single output (SISO) and noise free system in “Estimation of Hydro Turbine-Governor Sys- tem’s Transfer Function from PMU Measurements”[13]. This system has an input of u(k) and an output of y(k) with discrete-time data. This can be represented by Equations 2.3 or 2.4. y(k+n)+a1y(k+n−1)+···+any(k) = b0u(k+m)+b1u(k+m−1)+···+bmu(k) (2.3)

y(k) = −a1y(k − 1) − a0y(k − 2) + b1u(k − 1) + b0u(k − 2) + e(k) (2.4) y(k): The output of the equation u(k): The input of the equation bm, an: The coefficients of the equation e(k): The error Equations 2.3 and 2.4 are considered to be an overestimated problem and can be solved by the following matrices and equations:

      y(k) −y(k − 1) −y(k − 2) u(k − 1) u(k − 2) a1 y(k + 1)  −y(k) −y(k − 1) u(k) u(k − 1)  a   =    0 + eB (2.5)  .   . . . .  b   .   . . . .   1  |{z}e y(N) −y(N − 1) −y(N − 2) −u(N − 1) u(N − 2) b0 | {z } | {z } | {zx } b A u(k): The sampled input in the system y(k) : The sampled output in the system bm, an: The coefficients of the equation eB: The error

The matrix can be written in a simplified form as b = Ax + e, as indicated in matrix 2.5. The matrices can be redefined into Equations 2.6 and 2.7.

u(k) = [u(1), u(2), . . . , u(N)] (2.6)

y(k) = [y(1), y(2), . . . , y(N)] (2.7) 31

Then plugged Equation 2.6 and 2.7 into Equation 2.3, obtaining Equation 2.8:

y(1 + n) + a1y(n) + ··· + any(1) = b0u(1 + m) + b1u(m) + ··· + bmu(1) y(2 + n) + a1y(1 + n) + ··· + any(2) = b0u(2 + m) + b1u(1 + m) + ··· + bmu(2) ········· y(N) + a1y(N − 1) + ··· + any(N − n) = b0u(N − n + m) + b1u(N − n + m − 1) + ··· + bmu(N − n) (2.8) Equation 2.8 then can be broken down into the three matrices that can be used to solve the overdetermined equations shown in Equation 2.8, demonstrated in Equation 2.9.

a1 a2      .  y(1 + n) −y(n) · −y(1) u(1 + m) · u(1)  .   .  y(2 + n)  −y(n + 1) · −y(2) u(2 + m) · u(2)  a    =    n  .   ......  b   .   ......   1    y(N) −y(N − 1) · −y(N − n) −u(N − n + m) · −u(N − n) b2  | {z } | {z }  .  y φ  .  bn | {z } θ (2.9) Equation 2.9 can be simplified into Equation 2.10.

y = φθ (2.10)

Then the parameters of θ or x, depending on Equation 2.5 or 2.9, can be found using the least squared method as shown in Equations 2.11 and 2.12 respectively.

θ = (φT φ)−1φT y (2.11)

x = AT (AAT )−1b (2.12) These equations will reveal the parameters (a,b in Equation 2.13) needed for finding the transfer function, as shown in Equation 2.13.

−1 −2 m m−1 y(z) b1z + b0z b0z + b1z + ··· + bm = H(z) = −1 −2 = n n−1 (2.13) u(z) z + a1z + a0z z + a1z + ··· + an

This transfer function (H(z)) i.e. H1(jω) is then used for modeling the system behavior in the turbine-governor block in the block diagram model shown in Figure 2.1. Figure 2.1 is a very generalized model, which only gives the parameters for the a and b coefficients for the transfer function in the z − domain, i.e., the discrete time domain. This method was presented in the paper “Estimation of Hydro Turbine-Governor System’s Transfer Function from PMU Measurements” [13] and a more detailed method is shown in paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16], where the a and b parameters are used in a further analysis to find the generator parameters, such as the inertia constant H, the damping factor D, the speed regulation constant R, and the time constant T . These parameters are then fed back into a more detailed synchronous generator model, as shown in Figure 2.2, where the parameters are compared to real data to see how accurately the model simulates the actual data. 32 CHAPTER 2. LITERATURE REVIEW

Turbine-Governor System Generator fref ∆f ∆Pm ∆Pe H1(jω) H2(jω) + −

Power System

H3(jω) Speed/Frequency

Figure 2.1: The block diagram model where H1(jω) denotes the transfer function found using the PMU data and the ARX method [13]

∆Pe − ∆Pref + 1 ∆PM + 1 ∆ω 1 ∆δ − T s+1 2Hs+D s

1 R

Figure 2.2: A synchronous generator models [16]

The Unscented Kalman Filter (UKF) method The Unscented Kalman Filter (UKF) is a method of parameter prediction for both the syn- chronous generator and its control systems. Using a UKF requires PMU data from a PMU directly installed at the generator terminals. An advantage of this type of Kalman Filter is that it does not need the linearization step, making it far less computational then other Kalman Filters like the Extended Kalman Filter, which requires the use of Jacobian or Hes- sian matrices for the linearization process before hand. The step of not using the Jacobian or Hessian matrices makes the whole process of finding the parameters more accurate because there are fewer computations performed, thereby reducing the chance for error [17]. The Unscented Kalman Filter works by logically selecting a collection of data points which captures the mean and covariance of the state vector while still maintaining a non- linear function. The process of using the Unscented Kalman Filter can be further used to extract the unknown parameters of the system. The non-linear model can be represented by equation 2.14 and 2.15.       xk+1 F (xk, θk, uk) 0 Zk+1 = = + (2.14) θk+1 θk qk

yk = H(xk, θk, uk) + rk (2.15)

θk: Parameter vector

xk : System state vector

k: iteration

z: n-dimensional vector

uk: System input 33

F : non-linear model

H: measurement function qk: process noise as Gaussian variables rk: measurements noise as Gaussian variables

The first step in using the Unscented Kalman Filter is to estimate the initial values of the state variables (x) and the system parameters variables (θ), along with the covariance matrix (p0). Step two uses the iterative variable (k) to obtain information in the last itera- tion. Step two is then updated using the new measurement information found in the current iteration of the process. This process is outlined in the paper “Simultaneous estimation of exciter, governor and synchronous generator parameters using phasor measurements” [17] and will not be covered in detail here. In step three, the procedures used in steps one and two are continued until the change in the two-time steps is minuscule or comes to a convergence for each parameter. This parameter convergence algorithm is shown in the paper “Simulta- neous estimation of exciter, governor and synchronous generator parameters using phasor measurements” [17] as a general solution for a synchronous generator, governor, and exci- tation system for parameter estimation scheme. To carry out this type of network analysis and parameter estimation, the following information is needed. First, the system response measurements from a small system disturbance are required, containing the voltage and current phasors, as well as the active and reactive powers. PMU data is the type of measure- ment for this method of parameter estimation because of its high sample rates and accuracy. Measurements of the rotor speed are also needed for this process.

Using a digital filter for power quality parameter detection Another tool for parameter estimation and power system health is using a digital filter for power quality detection. This tool works by analyzing the PMU data from several different power stations and then comparing them. The comparison is possible because of the time stamp on all the PMU data. Once all the PMU data was collected, it is then run through a digital filter, where the data can be classified by the digital filter depending on which characteristics are found. The method of using a digital filter works because the power disturbances change the waveform of the power in many different ways. They are divided into the following categories of disturbances: transients, short period changes, extensive period changes, voltage asymmetries, waveform distortion, changes in voltage, and power frequency changes [18], [49]. Transients are events that happen in a short period and can divide into two categories: Impulsive and Oscillatory. Impulsive have a typical spectral con- tent of 5 ns rise to 0.1 µs rise, with a typical duration of less then 50 ns to greater then 1 µs and typically do not have an effect on the voltage magnitude. Oscillatory have a common spectral signature of less then 5 kHz to 5 MHz, common duration of 0.3 ms to 5 µs, and common voltage magnitude from 0 p.u. to 8 p.u.. The short-duration rms, i.e., short period changes are offend caused by fault circumstances, activation of massive loads which, need a high in rush current, a bad/loose connection in the wiring. This can lead to depending on the circumstances this result in the voltage sags, voltage swells, and voltage interruptions as illustrated in Figure 2.3. Further, the short-duration rms can be divided into Instantaneous, Momentary, and Temporary with each having the sub categories sag and swell. Where Mo- mentary and Temporary have the third sub category as well called Interruption. The typical duration and the voltage magnitude of these events is written in Table 2.1 The long dura- 34 CHAPTER 2. LITERATURE REVIEW

Table 2.1: The typical characteristics of the short-duration root-mean-square [49]

Short-duration root-mean-square (rms) Typical duration Typical voltage magnitude Instantaneous Sag 0.5-30 Cycles 0.1-0.9 p.u. Swell 0.5-30 Cycles 1.1-1.8 p.u. Momentary Interruption 0.5 Cycles - 3 s < 0.1 p.u. Sag 30 Cycles - 3 s 0.1 - 0.9 p.u. Swell 30 Cycles - 3 s 1.1-1.2 p.u. Temporary Interruption >3 s - 1 min < 0.1 p.u. Sag >3 s - 1 min 0.1 - 0.9 p.u. Swell >3 s - 1 min 1.1 - 1.2 p.u.

tion (extensive period changes) are typically caused by load deviations on the power system and switching operations on the power system. The long duration is split into the follow- ing categories Sustained Interruption, Undervoltages, Overvoltages, and Current Overload. Sustained Interruption has the following characteristics a typical duration longer than one minute to be classified as long duration and typically a 0.0 p.u. for voltage magnitude. The Undervoltages are again longer than a minute and a voltage magnitude of 0.8 − 0.9 p.u.. Overvoltages have greater then a minute durations and a voltage magnitude of 1.1 − 1.2 p.u.. Current Overload as a time duration of longer than a minute and no voltage magnitude. The voltage asymmetries or Imbalance (unbalance) is the ratio of the magnitude of the neg- ative and positive sequence components* has expressed in Equation 2.16 as a percentage in a three phase system. |V | %Imbalance = neg × 100% (2.16) |Vpos| %Imbalance: the percentage of imbalance

|Vneg|: the magnitude of the negative sequence component

|Vpos|: the magnitude of the positive sequence component The imbalance is divided up into the following two categories Voltage and Current. For the voltage, the time duration is steady state, and the voltage magnitude is from 0.5 to 2 %. The current as a duration of steady state too and the voltage magnitude is from 1.0 to 30 %. Waveform distortion is deviation from steady-state frequency sinusoid and characterized by the spectral fingerprint of the distortion. These distortions are divided up into five different types of waveforms which are shown in Table 2.2. The voltage fluctuation are a change in the voltage that does not exceed the voltage range of 0.95 p.u. to 1.05 p.u. and are cause by devices like arc furnaces. Voltage fluctuation has a typical spectral content of less than 25 Hz, a duration of intermittent, and voltage magnitude of 0.1% to 7%. Lastly, power frequency variations are the change of the frequency from 50Hz, and changes are caused by any imbalance in the system of the load and generation. Power frequency variations tend to

*The negative, positive, and zero sequence components, are components used in a mathematical method in power system analysis 35

Table 2.2: The typical characteristics of the Waveform distortion [49]

Waveform distortion Typical spectral Typical Typical voltage content duration magnitude DC offset Steady State 0-0.1% Harmonics 0-9 kHz Steady State 0-20% Inter-harmonics 0-9 kHz Steady State 0-2% Notching Steady State Noise Broadband Steady State 0-1%

Voltage Sag 1.0 1.0

0.5

0.0

0.8 0.5

1.0 0 2 4 6 8 Voltage Swell 1.5 0.6 1.0

0.5

0.0

0.5 Voltage(p.u.)

1.0 0.4 1.5 0 2 4 6 8 Voltage Interruption 1.0

0.5 0.2

0.0

0.5

1.0 0.0 0.00 0.2 2 0.44 0.6 6 0.88 1.0 Samples (n) Figure 2.3: Types of voltage disturbances [18] have the following characteristics, typical duration of less then 10 s, and a typical voltage magnitude of ±0.10 Hz [49]. These types of disturbances in the power system can cause problems such as discharge lamps not working properly, motor speed variations, computer system crashes, and other equipment failures. The power disturbances can be divided further into voltage sags, swells, and interruptions. These are shown in Figure 2.3, where it can be 36 CHAPTER 2. LITERATURE REVIEW seen that a voltage sag is when the power drops 10 to 90% below the nominal voltage. A voltage interruption can be thought of as a voltage sag that goes to zero. A voltage swell is when the voltage goes above nominal voltage or RMS value [18]. All these types of voltage disturbances can be detected by different types of digital filters, and therefore a voltage signal will have to go through an array of digital filters. This collection of digital filters consists of digital filters that are tuned to different ranges of frequencies depending on the type of phenomena that they are trying to detect. The high-pass digital filters will be turned to look for such disturbances as transients that are caused by power system faults or sudden changes in the system voltages. Low-pass digital filters would be tuned to look for steady state disturbances for example power system harmonics. This type of filtering process is illustrated in equation 2.17.

filter 1   filter 2   Power Signals   Evaluation of ⇒  .  =⇒ (2.17) for Analysis  .  Power Quality filter n

The last step, as shown in equation 2.17, is the evaluation of the power quality. This infor- mation can then be used to help identify the problem causing the oscillation or disturbance in the power system. One type of system disturbance identification is the method of using a band-pass filter that was designed to be used with PMU data. The problem with using this kind of system for disturbance identification with PMU data is that it has to be tuned for each PMU and threshold to work properly This method will also only work for event detection and not provide any information on the system parameters [50]. 37

Chapter 3

Methods “Essentially, all models are wrong, but some are useful" — George E. P. Box, Statistician (1919-2013)

The project was divided up into two main sections. Section One, entitled Section 1: PMU Data and Event Detection Analysis, focused on methods of detecting events with PMU data when they occur in the power system. Sections Two, titled PMU Data and Parameter Estimation, concentrated on developing models in Python and OpenModelica for parameter identification. These two sections were originally going to be combined into a single section on event detection and parameter identification software, as will be discussed further in Section 3.4. In the Section 1: PMU Data and Event Detection Analysis, events were first classified by looking at known occurrences in the PMU data. The initial classification was done manually, with events identified from the control room in real time. Then an event was classified according to the definition in Section 3.1.2. The next stage of classification was carried out automatically by the code found in Appendix B.1.1 to save time and speedup the process of obtaining data. Once all events were received, a program was written that could further classify the events with higher accuracy. The classification was accomplished by using machine-learning algorithms and frequency analysis. In Section Two, the first steps were to create a simple model based on the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16], to create a baseline parameter identification code. Once this model was running sat- isfactorily, the next step was to use this model on real PMU data to identify the parameters in the data. Once these parameters were determined, the parameters were put into a transfer function, and the graph of the real PMU data and the graph produced by the transfer function were compared to determine the validity of the model.

3.1 Key Assumptions

The assumptions made in this project have been broken down into the following categories: • General in Chapter 3.1.1 • Event detection process in Chapter 3.1.2 • Modeling process in Chapter 3.1.3.

3.1.1 General Assumptions Made There were some general assumptions made in this project starting with normalizing the PMU data in the power system to the per-unit system. To do this, a base system had to be 38 CHAPTER 3. METHODS

Event Data Power [MW] Power

Samples Non-Event Data Power [MW] Power

Samples

Figure 3.1: The top figure is of event data and the bottom figure is of non-event data, even though it looks like event data at first glance. established. This was first assumed to be 100 MVA, but it was subsequently found to be 55 MVA at the station where the data was collected from.

3.1.2 Event Detection Assumptions

The Definitions Events and Non-Events

One key assumption that needed to be made in this Chapter 3.1.2 was a definition of an event. This assumption of defining an events was done by talking with Guðjón Hugberg Björnsson a System Operations Operator at Landsnet and a supervisor on this thesis. The definition of an event comes from Guðjón’s experience as Power Systems Operator at Landsnet. He defined an event as a patterns of oscillation that repeated themselves multiple and had a amplitude of more then one mega watt while the rest of the power system is otherwise stable, an example of an event versus a non-event can be seen in Figure 3.1. Due to the nature of the events it is hard to come up with an exact definition numerically. This is because of the complexity of the power system and the events.

Software Feasibility Assumptions

To determine the feasibility of the event detection software, there were several assumptions made regarding the equipment used at Landsnet. To find the time-trial of the event detection software and whether it would meet all the requirements, laid out in the Axiomatic Design (Chapter 1.6.3), some assumptions had to be made because there was not enough time to test the event detection software on the live data at Landsnet. 3.2. TOOLS USED FOR THE THESIS 39

The first assumption was that the live data would be coming into Landsnet around 50 samples per second from the PDC based on the previous data sets received from Land- snet. Then the algorithms were tested on a computer with the specifications* and the time found that it took the algorithms. Once this time was found, it was assumed that computers at Landsnet running the software with these event detection algorithms would have better specifications† than that used in the trial. A further assumption made that the sample size was limited and that a greater variety of events existed than were represented in our samples. This was a key assumption in deciding how to write the code for the detection algorithm because otherwise, the matched filter algorithm would have been adequate with only a few modifications. An algorithm that could incorporate machine-learning was, therefore, necessary to deal with categorizing non-events and events accurately.

3.1.3 Modeling Assumptions To model the generators, it was assumed that the PMU sensors potential transformer and current transformer were connected up close to the generators. The assumption that the generator and PMU sensors were close to one another was made because information on the exact distance and location of the PMU sensors was unavailable. The closer the PMU unit is to the generator the less likely it is to pick up other noise in the system like, from load switching, transformers, and other system equipment. The next assumption was to treat all three generators as one as they feed into one PMU unit. Landsvirkjun currently has only one PMU unit measuring at the station the data was collected from. This PMU unit was set up to measure the combined voltage and current from one of the three generators before the common bus. The generators were frequency tied and participated in load sharing, meaning they acted as one generator in the system, such that if the there were a change in frequency or an increase in load, all the generators would respond at the same time and distribute the load evenly among them. This is why it was all right just use the PMU data from one generator. The model of the one generator only used three parameters. These parameters, T , R and H, will be explained in detail in Chapter 3.4.1. This was done to simplify the modeling process and understand the generator, behavior in the model. The more complex the model, the greater the possibility of error, and the harder it is to determine where that error origi- nates in the model. Looking at the three parameters gives a general idea of the generators’ performance and allows the results to be more easily interpreted. The final assumption in the modeling process was to treat the part of the power system outside of the generator of interest as an infinite bus so that any change in the power (∆Pe) would not change the system frequency a significant amount [13]. This results in a very low-speed regulation constant R around 0.05 when testing the model [16].

3.2 Tools Used for the Thesis

The main tools in this thesis used were programming environments for coding algorithms that would detect events in the PMU data and for coding for simulations to finding the parameters. Other tools that were used were a subversion (SVN) for a code version-control system, meaning all the code used and documents were uploaded to a server at Reykjavík

* Dell Precision M4700 with Intel Core i7-3840QM CPU @ 2.80 GHz with 16 GB of memory (RAM) †See footnote * 40 CHAPTER 3. METHODS

University. This was done to back up all files needed for the thesis and to store the PMU data. The SVN also allowed for sharing of the thesis while it was still being written. Also, a GitHub repository* was used to post the full code for this thesis on the Internet. This was done so that the appendices would not be too long and would only have parts of the code that were necessary for explaining the thesis work.

3.2.1 Principal Component Analysis (PCA) One of the tools the was used in the event detection in the machine learning method was the Principal Component Analysis (PCA). The principal component analysis was employed in the process of reducing the PMU data’s FFTs dimensionality from 49 to 3 or 1. The impor- tance of the dimensionality reduction with be discussed further in Chapter 3.3.3, where an overview of the Principal Component Analysis is going to be covered. The PCA as the fol- lowing uses; dimensionality reduction, feature extraction, and data visualization. PCA can be characterized as a method of orthogonally projecting data with a higher dimensionality into a lower dimensionality or subspace in such away that the projection data maintains the maximum variance and does not lose the data’s information. Using the PMU data as will be shown in Chapter 3.3.3 as a dataset of x1, x2, x3, ... , xn, where xn is the matrix of the FFTs of the PMU data and n index of the number of dimensions d or dimensionality of the matrix. In the context of this thesis x1, x2, x3 . . . , x49, to used this data in the machine learning algo- rithm and visualize the data, it had to be reduced to three dimensions using the PCA process, where D represents the 49 dimensions being projected into a subspace of three dimensions represented by M or lesser dimensions M < D that is where D = 49 and M = 3. This process was also tried where M = 1 for the one-dimension PCA in Figure 3.7. To do this, the covariance matrix had to be considered, meaning how each vector xn is related to one another or importance of the redundancy of each vector xn. This can be done by fining the covariance square using Equation 3.1 [51]. 1 σ2 = ~a~b (3.1) ab n − 1

σ: is the covariances of the data vector xa and xb n: is the index within the vector xa: is the vector of one frequency in the matrix that is different than xb xb: is the vector of one frequency in the matrix that is different than xa

1 n−1 : is the a unbiased estimator or scaling factor Using Equation 3.1 with the PMU data and taking the mean, transforming from a vector to a matrix, and summing the results from 1 to n, the Equation 3.2 is obtained.

N 1 X S = (x − x¯)(x − x¯)T (3.2) N n n n=1

S: is the covariance matrix, meaning how strongly points in the different vector are related to one another

*https://github.com/nicholasr15/ThesisProject2017 3.2. TOOLS USED FOR THE THESIS 41

N: is the number of samples x¯: is the mean of the PMU data ()T : is the transpose

Then the covariance was formulated onto a D dimensional unit vector u1 so that the maxi- mum variance could be projected onto the vector. The problem of maximizing the variance T must be bound by u1 u1 = 1, which is controlled by a proportionality constant called the La- grange multiplier (λ1), therefore the equation for maximizing is represented by Equation 3.3. T T u1 Su1 + (1 − u1 u1) (3.3) T u1 : the transpose of the unit vector S: is the covariance matrix u1: unit vector

Next rearranging Equation 3.3 with respect to u1 which is done by having the derivative go to zero, giving Equation 3.4. Su1 = λ1u1 (3.4) S: is the covariance matrix u1: is now the first eigenvector of the covariance matrix S

λ1: is the proportionality constant called the Lagrange multiplier or the first eigenvalue, also 2 λi = σ from Equation 3.1

In Equation 3.4, shows that the unit vector (u1) now is the first eigenvector of the covariance matrix (S) or also known as the first principal component. Then λ1 represents the first eigenvalue or the variance of the data when it is projected onto u1, the first eigenvector of the covariance matrix S. This method can be reapplied to get the first principal subspace components (M). In summary, the PCA starts with calculating the covariance matrix of the PMU data (xn). Then finding the first eigenvectors or first principal subspace components (M). Next projecting the PMU data xn onto those principal subspace components (M). This process can be shown by the simplified Equation 3.5

T XPCA = XU (3.5)

XPCA: result of the performing the PCA on the data set X X: data set of PMU data U: matrix with dimensions M and D or M by D matrix of the principal component vectors. M: number of principal components D: number of dimensions This method of PCA has demonstrated the theory of PCA and may not be exactly how it is performed in the Python code in Appendix B.4, because the computer uses more ef- ficient ways of finding the eigenvectors as shown in “Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompositions” [51], [52]. There are other methods of making dimensionality reduction such as the T-SNE (T- Distributed Stochastic Neighbor Embedding) algorithm that could be used, but this will have to be tried in the future work [53], [54]. 42 CHAPTER 3. METHODS

3.2.2 Gaussian Process Classification (GPC) The GPC was used after the PCA was done in the event detected algorithm using machine learning. The GPC is a method of classifying the event from the non-events. To understand the GPC, first, have to look at the graussian process (GP). The GP is a principally general- ized graussian probability distribution to multi-dimensional space. Meaning that it allows for an infinite number of real valued variables or functions and places them into graussian distribution or normal distribution [55]. This is impossible to visualize with more than three dimensions but can be thought of with matrices. In particular using an 00X00 matrix where the rows are a sample and the columns are features* or dimensions of the data set. In other words, the graussian process takes the data set 00X00 finds a graussian distribution that can describe the data set 00X00 regarding an infinite number of functions or real valued variables. This is done by the use of the kernel method that makes a matrix called the Gram matrix. Each element of the Gram matrix shall consist of a kernel function. The kernel function is what samples the data set of the 00X00 matrix. The samples are taken at two samples at a time from the 00X00 matrix for the kernel function. Then the two samples are compared using a basis function.

Kernel Methods Overview The GPC is considered to be a kernel method; therefore it is necessary to explain the mean- ing of this method. The kernel method is a way of making a comparison of data points. The kernel method works by using a basis function (φ(x)), which can be in the form of any function. This works by using the inner product or dot product. The kernel function can be represented by Equation 3.6 k(x, x0) = φ(x)T · φ(x0) (3.6) x: are points in the sample set. x0: different points same sample set.

φ(x): basis function

Equation 3.6 is used to compute all the kernels resulting in the Gram matrix K, which contains an N by N matrix with each element containing a kernel function, which can be given by Equation 3.7. T Knm = φ(Xn) φ(xm) = k(xn, xm) (3.7) Next looking at the error function which is shown in Equation 3.8

N 1 X λ J(w) = (wT φ(X ) − t )2 + wT w (3.8) 2 n n 2 n=1 w: are the weights

N: number of training samples

tn: target or label n λ: weight regularization constant (λ applies pressure on the weights w to keep the weights from getting too large, this protects against over-fitting).

*Features in a data set are parameters or characteristics of that data set 3.2. TOOLS USED FOR THE THESIS 43

The kernel method can demonstrate the error function (Equation 3.8) by the Gram Matrix and a new vector a, shown by Equation 3.9

1 a = − (wT )φ(x − t ) (3.9) n λ n n

Now once vector a is defined, an equivalent equation to Equation 3.8 can be shown as Equation 3.10 in terms of vector a.

1 1 λ J(a) = aT KKa − aT Kt + tT t + aT Ka (3.10) 2 2 2 In order to minimize the losses on vector a, the gradient of J(a) is set to zero and the derivative of Equation 3.10 with respect to a, the result obtains Equation 3.11.

−1 a = (K + λIN ) t (3.11) a: Vector a

K: Gram Matrix

λ: Weight Regularization Constant

IN : Identity Matrix t: Target

Then substituting Equation 3.11 into the linear regression model, the Equation 3.12 is ob- tained. T T −1 y(x) = w φ(x) = k(x) (K + λIN ) t (3.12) y(x): Predict output of the new input vectors x w: Weights

φ(x): Basis Function, which can be any function k(x): Vector with elements kn(x) = k(xn, x)

K: Gram Matrix

λ: Weight Regularization Constant

IN : Identity Matrix t: Target

Equation 3.12 will be used to predict y(x) given any new inputs (x). Once the building of a kernel function and the Gram matrix is done, the loss function is derived. The parameters of the loss function can be optimized. This allows for the prediction of the output y(x) of new input vectors x. This provides the framework needed for the regression model [56]. 44 CHAPTER 3. METHODS

Gaussian Processes for Classification The Gaussian Processes for Classification (GPC) is an expansion of the kernel method de- scribed in Chapter 3.2.2. This enlargement of the kernel methods is for doing probabilistic discriminative models. The kernel will arise unencumbered in a Bayesian setting, allowing for the kernel to be re-derived with probability. The development of the Gaussian Process (GP) will allow for modeling the space of probable solution instead of the parametric solu- tions. This is done using the Gram matrix, which can give the covariance of the probability density function of the solution space. In other words, GP is a method of abstracting one layer beyond an individual parametric model, giving a distribution of probable models. The GP for classification is based on the GP for regression, which is loosely described by the kernel method is provided as an overview in Chapter 3.2.2. This works by building the GP regression model and the output of this model is run through a nonlinear activation function like the sigmoid function, Equation 3.13 [56], [57].

1 σ(x) = (3.13) 1 + ex Equation 3.13 the sigmoid function takes in the input and squeezes it into the continuous range from 0 to 1. Before going further into this, first a derivation using the Bayesian statistics needs to be cover in Chapter 3.2.2.0.1.

3.2.2.0.1 Derivation Using Bayesian Statistics

Starting with the training data in vectors form using the variables x1, . . . , xn and correspond- T ing the targets (1 or 0), therefore t = (t1, . . . , tn) . A test point xN+1 is used with target tN+1, were utilized for this derivation. The purpose of this derivation is to determine the predictive distribution represented by p(tN+1|t). To do the predictive distribution with the GP first, a GP prior is defined to project the input of xn on to tn. This is presented as a(x1), . . . , a(xN+1), and defined by the Gaussian distribution i.e. the normal distribution as shown in Equation 3.14.

P (aN+1) = N (aN+1|0,CN+1) (3.14)

P : Probability a: Vector a

N : Gaussian distribution or Normal distribution

CN+1: Gram Matrix, possibly combined with a term ν to provide a positive semidefinite (meaning the matrix is invertible). CN+1 is made up of elements defined by Equa- tion 3.15.

C(xn, xm) = k(xn, xm) + ν (3.15)

C(xn, xm): Gram Matrix k(xn, xm): Kernel function

ν: term making the kernel function a positive semidefinite matrix 3.2. TOOLS USED FOR THE THESIS 45

The kernel function can be any function that can provide a positive semidefinite Gram ma- trix. Next, knowing that a binary classifier is only needed because it is only being classified as an event or non-event. The classes can be defined as events being true and non-events being faults. Uses of this definition of true and faults then the predictor of the probability distribution can be defined if the class is true (P (tN+1) | tN ) by Equation 3.16. Z P (tN+1 | tN) = P (tN+1 = 1 | aN+1)P (aN+1 | tN )daN+1 (3.16)

Where P (tN+1 = 1 | aN+1) = σ(aN+1), is known, but P (aN+1tN ) is unknown. Since this part of the equation is unknown, then the equation is considered to be intractable or unsolv- able. To make the equation solvable the Laplace approximation is used. The Laplace ap- proximation works by letting an approximate of the probability distribution of the Gaussian posterior of aN+1 by using a different Gaussian process. This method of Laplace approxi- mation is outlined in Chapter 3.2.2.0.2

3.2.2.0.2 Laplace approximation The process of the Laplace approximation uses Bayes theorem to derive the approximation of the posterior distribution of aN+1 used for solving Equation 3.16. The use of Bayes theorem and Equation 3.16 results in Equation 3.17 Z P (aN+1 | tN ) = P (aN+1 | aN )P (aN | tN )daN (3.17)

Two distributions are needed to solve the integral. First is the P (aN+1 | aN , the dis- tribution of aN+1 accustomed to the known values of aN and the posterior to P (aN | tN ). Equation 3.18 defines the meaning of P (aN+1 | aN )

T −1 T −1 P (aN+1 | aN ) = N (aN+1 | k CN aN , c − k CN k) (3.18)

T −1 (aN+1 | k CN aN ): Expected value of a new point xN+1. k: Variable is the covariance vector found by the kernel function.

T −1 c − k CN k: Variance of the new point xN+1. T −1 T −1 The derivation of (aN+1 | k CN aN ) and c − k CN k is in Pattern Recognition and Ma- chine Learning (Chapter 6.4.6) [57]. Second is the P (aN | tN ) or posterior of a is required for the evaluation of Equation 3.17. Next is where the Laplace approximation is used. First, the Gaussian prior is applied to aN , then this distribution goes through a conditioning process based on the known targets tN , by using the maximum log-likelihood function. The maximum log-likelihood function is calculated over the vector aN Then using the Taylor expansion of the logarithm of P (aN | tN ), then is simplified to obtain Equation 3.19.

N 1 N 1 X Ψ(a ) = − aT C−1a − ln(2π)− ln | C | +tT a − ln(1+ean )+const. (3.19) N 2 N N N 2 2 N N N n=1 Then the Equation 3.19 is maximized using the Newton-Raphson method, which re- quires the second derivative i.e. the Hessian of Ψ(aN ). The optimization is done and yields 46 CHAPTER 3. METHODS

∗ ∗ a new vector aN . Now the Hessian is evaluated at aN resulting in Equation 3.20 More infor- mation on using the Newton-Raphson method used in this process can be found in Pattern Recognition and Machine Learning in Chapter 4.4 The Laplace Approximation [56], [57].

−1 H = WN + CN (3.20) H: Hessian matrix

∗ WN : Diagonal matrix with elements σ(an)(1 − σ(an)), evaluated using vector aN .

−1 CN : Gram matrix inverse

Next defining the posterior distribution P (aN | tN ) approximated by a Gaussian in Equa- tion 3.21

∗ −1 q(aN ) = N (aN | aN , H ) (3.21) Equation 3.21 gives all the required elements to evaluate Equation 3.17, which will yield the predictive distribution of any new samples of xN−1 [56], [57]. In summary, the purpose of the GPC model in this thesis is to use the posterior proba- bility of the target variable i.e. event versus non-events and map them on to the range from 0 to 1. The process of using the posterior probability of the target variable and mapping them on to the range from 0 to 1 is done using the nonlinear activation function as shown in Equation 3.13. The posterior is found from the training data.

3.2.3 Programming Environment The programming environment and workspaces used were Python and Modelica. Python is a programming environment that was used extensively in this thesis for coding the algorithms and simulations. The Modelica software package was used for simulating the power system and generating PMU data for testing.

Python Programing Language The programming environment used for developing the detection algorithms and parame- ter identification was done in Python 3.x with the use of Jupyter Notebook* and Eclipse Programming Environment.† The Jupyter Notebook provided a method of testing code and troubleshooting that was more intuitive to the author of this project than other Python pro- gramming environments. The Eclipse Programming Environment was used in the initial stages of this project before learning about the Jupyter Notebook. The libraries that were mainly used in this project were the NumPy,‡ SciPy§ and Mat- PlotLib¶ libraries. NumPy is an open-source Python package that allows for faster comput- ing of data arrays using the integration of C/C++ and Fortran. The NumPy library was used for carrying out many of the significant data and matrices calculations in Python. SciPy is an open-source library for Python that provides a scientific library for doing complex math- ematical calculations and transfer functions under the signals and systems package. SciPy

*http://jupyter.org/ †http://www.pydev.org/ ‡http://www.numpy.org/ §https://scipy.org/ ¶https://matplotlib.org/ 3.2. TOOLS USED FOR THE THESIS 47 was used for the data analysis and programming of transfer functions and state-space. Mat- PlotLib is a package that allows for graphical representations of data. MatPlotLib was used as a graphical plotting tool. This provided a way of visualizing the data and methods used for this project. Two other tools that were used were Pandas* and IPyWidgets.†. Pandas is an open- source data analysis library that makes it easier to work with large datasets in Python. Pandas provided a way of importing large datasets for analysis. IPyWidgets is an interactive tool that can be used in the Jupyter Notebooks for creating variables with slider inputs. IPyWidgets provided a method of interaction for generating testing data in Python.

OpenModelica OpenModelica‡ is a software developed for modeling and simulations. It was developed by the Open Source Modelica Consortium and created on December 4th 2007 [58]. OpenMod- elica is a programing language developed for mathematical modeling complicated systems in the various fields of engineering [59]. OpenModelica is a free and open-source project with many libraries being developed for use in many fields to solve complicated problems in mathematical modeling. It was utilized in this project as a free, open-source alternative to MATLAB’s Simulink. This aligned with a tertiary goal of this project, which was to develop the project using all open-source and freely available software. The results and work could, therefore, be easily replicated and would not require expensive commercial software, such as MATLAB. It was possible to use Modelica for this project because of the pre-existing libraries in OpenModelica, which imported models from some of the expensive software packages, like Siemens’ Power System Simulation for Engineering (PSSe) software, § which is used in many power stations and by power system operators including at Landsnet. The first step in this project was to develop a simple mathematical model in Modelica for testing and verification of the algorithms used in the Python code. The model that was used was based on that developed by Mogharbel, Fan, and Miao in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16]. This model can be seen in Figure 3.8. The method used in the above paper was based on the MATLAB software and therefore had to be reworked into Modelica. Once this was done, the results from this model were compared to the previous model found in the above paper and found to be identical.

3.2.3.0.1 OpenModelica Software advantages over Simulink For this thesis project, the OpenModelica software had several advantages. The main advan- tage was that OpenModelica is a free open-source programming environment. It also has the library called “iTesla Power System Library” of the PSSe models¶. There is also the Open- Modelica Python Interface and PySimulator|| that could be used for PMU data integration

*http://pandas.pydata.org/ †https://ipywidgets.readthedocs.io/en/latest/ ‡https://openmodelica.org/ §http://w3.siemens.com/smartgrid/global/en/products-systems- solutions/software-solutions/planning-data-management-software/planning- simulation/pages/pss-e.aspx ¶More information about the iTesla power system library can be found here https://github.com/ itesla/ipsl ||https://www.openmodelica.org/doc/OpenModelicaUsersGuide/latest/ ompython.html 48 CHAPTER 3. METHODS

and PMU simulation in OpenModelica along with the models in the “itesla project”*. Due to time constraints, it was impossible to pursue all these options, but they will be discussed in the Future Work Chapter 5.3.

3.2.4 PMU Data from Landsnet The data used for this thesis was collected from Landsnet. The data was all from the same in Iceland, and this power station’s data was chosen in particular by one of the advisors of this project because of the events that keep showing up from this power station. The project started off with a small set of data from Landsnet showing the events that were occurring in the PMU data. Once a technique was found for looking at the data and performing a rudimentary analysis of the events therein, then more data was obtained from Landsnet in larger intervals up to a month of data. All the data sets were sampled at 50Hz because the data came from the PDC, not from the PMUs. One issue that occurred was that obtaining data from Landsnet was an extremely labo- rious and tedious process. This was because event data was initially collected manually by personnel at Landsnet who were in the control room when the event was detected. The time of the event was then marked and the data exported from the PDC in two different formats, CSV and COMTRADE. These formats will be discussed further in Chapter 3.2.4. To speed up the process, it was decided to export only the CSV data and to export all the data for the month at once. It was possible to work on a whole month’s worth of data because, by this point, enough analysis of existing event data had been undertaken to write a crude pro- gram to identify events within a larger dataset. However, obtaining so much data at once created the further issue of finding sufficient storage space. It was eventually stored on the Reykjavik University server. Once enough data and events had been collected, analysis of the data and events was performed to figure out the best ways of coding an event detection algorithm.

Data formats There were two main types of data received from Landsnet. These were the character- separated value (CSV) i.e. comma-separated value and Common format for Transient Data Exchange for power systems (COMTRADE) formats. Both were used at the start of this project, but the COMTRADE format was later discontinued due to the problem with scaling the data and exporting the data from the PDC in the COMTRADE format. The CSV format was used for the frequency analysis, and the COMTRADE format was going to be used for data verification, but due to the problem of scaling the CSV data was used instead. The CSV format works by exporting all the data to a file where each variable of the data is separated by a punctuation mark, traditionally a comma. This was then uploaded into the software that was developed using a library in Python called Pandas. This library allows for the separation of the variables. The voltage, current, and voltage and current angles could, therefore, be separated and specified into their variables for later uses in calculating the power. To separate the data correctly, the variables had to be loaded into parameters that were predefined in the program, for example, V1VPM Magnitude. These parameters could be later called in the program and used as variables for calculating power. The power was calculated using Equation 3.22 √ P = 3IV cos(φ − θ) (3.22)

*http://www.itesla-project.eu/ 3.3. SECTION 1: PMU DATA AND EVENT DETECTION ANALYSIS 49

P : Real Power (W)

I: Current (A)

V : Voltage (V)

φ: Voltage Angle

θ: Current Angle

The COMTRADE format was developed based on the COMTRADE standard for electrical engineering (C37.111-2013). This standard provides a method of separating the PMU data based on its analog or digital channel. This works by first loading a config file. This file is labeled by the power station name and PMU identification number, followed by .cfg. This file contains all the variable names and parameters, which are then matched up with the data in the Python COMTRADE package/library. There is also a scaling factor in the COMTRADE code for scaling the data because the data is stored as an integer instead of a float value to make the data file smaller and conserve space in the computer’s memory when processing the file. This means there has to be a scaling factor applied to the data when doing calculations. This package was developed by Miguel Moreto and then further modified by Dr. Joseph Timothy Foley of Reykjavík University in October 2016 to follow Python conventions and work with non-binary data. Dr. Foley also modified the code to run on Python 3.x instead of Python 2.7. Python 3.x is the version of Python being used in this project. Once these modifications were made, the data could be loaded and parsed into the different variables: voltage, current, and voltage and current angles. One of the main differences between the two formats is that the angles were measured in radians in the COMTRADE format and degrees in the comma-separated value format. Other differences are in the way the files are read into the programs and how the data is stored in the data files, as mentioned above. These small differences caused problems with working with the data and files. This will be discussed in Chapter 5.1 later in this paper.

3.3 Section 1: PMU Data and Event Detection Analysis

The first part of event analysis and detection was to run a detection algorithm on a set of PMU data where the event’s time-stamp was known. This event data is shown in Figure 3.2, where the event is between samples 12, 000 and 18, 000. Method 1 was used to detect the events in the data by the utilization of a digital Butterworth bandpass filter and FFT (Fast Fourier Transform) for analysis. This method is laid out in detail in Chapter 3.3.1 and the results of this approach will be discussed further in Chapter 4.1.1. Method 2, the matched filter, was the next method tried for event detection analysis. The matched filter method was proposed by Dr. Ananya Sen Gupta at the University of Iowa in the Electrical and Computer Engineering Department. Dr. Ananya Sen Gupta was contacted about this project by Dr. Joseph Foley because of challenges with finding ways to detect events in the PMU data. The matched filter worked by using a matching algorithm, which takes an event profile and the PMU data and compares them to see if they match. This method will be covered in more detail in Chapter 3.3.2 and the results will be discussed in Chapter 4.1.2 The last method, Method 3, used supervised machine learning algorithms. The specific application of these algorithms as used in this thesis was developed by Alexander Moses, a student at Reykjavík University, who also created the programming tools needed [60]. 50 CHAPTER 3. METHODS

45

40

35

30 Real Power 25 Reactive Power Apparent Power 20 Power [MW,MVA,MVAR] Power 15

10

5 0 2500 5000 7500 10000 12500 15000 17500 20000 Samples Figure 3.2: The PMU data from Landsnet with a known event from samples 11000 to 18700.

This method used Principal Component Analysis (PCA) and a Gaussian Radial Basis Func- tion (RBF) for classifying the possible anomalies into non-events and events. The use of the PCA and Gaussian RBF produced the most promising results for a method of continuously detecting events in the PMU data out of all the methods tried in Chapter 3.3. For further details on the setup and result see Chapters 3.3.3 and 4.1.3 respectively.

3.3.1 Method 1: Using a Digital Filter and FFT for Analysis When considering how to flag events in the PMU data, the first approach was as follows: Once the data was loaded into the program, the program then separated the data into the relevant variables, depending on which format was being used. Then the three different types of power (real, reactive and apparent power) were calculated. The data was then plotted using MatPlotLib to visualize the behavior of the power and manually determined which parts of the data required further analysis by the digital bandpass filter. An example of this plot is shown in Figure 3.2. Figure 3.2 demonstrates the variations in the data where the anomalies were prominent. The detection algorithm used a Butterworth bandpass filter, i.e., maximally flat filter in Python to filter the PMU data. The Butterworth bandpass filter was chosen based on the fact that it has a flat frequency response compared to other types of filters such as Chebyshev type 1 and 2, and Elliptic this is demonstrated in Figure 3.3. The flat response means that the Butterworth filter is enhanced for its dependability in the band-pass, meaning it conserves the amplitude of the frequency [61]. The disadvantage of the Butterworth filter is that the frequency response is slow, as is also shown in Figure 3.3 by the shallow slope of the curve in the Butterworth figure. This process filters out other oscillatory frequencies and finds only the primary oscilla- tions in the data, which are required for the FFT. Once this is done, the cleaned-up signal can then be passed through an FFT. The FFT was first performed on the samples from 5, 000 to 10, 000 to get a baseline FFT of the signal. Once the baseline was established, the FFT was performed on the samples from 12, 000 to 18, 000, which is where the data has a significant, 3.3. SECTION 1: PMU DATA AND EVENT DETECTION ANALYSIS 51

Butterworth Chebyshev type 1

1.0 1.0

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

0.0 0.0 0 1 2 3 0 1 2 3

Chebyshev type 2 Elliptic

1.0 1.0

0.8 0.8

0.6 0.6

0.4 0.4

0.2 0.2

0.0 0.0 0 1 2 3 0 1 2 3

Figure 3.3: Frequency response of the filters that were considered for filtering the PMU data. The Butterworth filter was chosen because of the little-to-no distortion of the original signal, and it was decided that the slow time of the frequency response not be as important as the integrity of the PMU data [62]. unexpected oscillation or, in other words, an event. The results of the two FFT’s were then compared, and the threshold for the detection algorithm determined. This process, when repeated over many different anomalies in the data, will allow for a database of frequencies to be built up over time and eventually programmed into the software to make a program that will detect any unwanted anomalies in the data. The next step was to run different sets of data through this program to determine the various thresholds needed to develop the detection software. This was unsuccessful because each data set was so different that it was hard to find the right filter parameters required for developing the threshold values needed for the software. A paper published partway through this project, Understanding and Counteracting Real Power Oscillations by Zhao, Torre, Wells, et al. [50], Torre, Wells, et al., confirms that this method is too time-consuming to be effective. The original goal of this project was to develop a method to find the set of operating parameters of synchronous generators based on the PMU data. As discussed above, this was first done by feeding the PMU data through a digital filter to determine whether the data was satisfactory and could be used for further analysis for parameter identification. All this data was analyzed using Python and Python-associated libraries. The code used for this analysis can be found in the GitHub repository * for this project. The digital filter worked by taking in the data in one of two formats: either comma-separated value (CSV) or COMTRADE. The COMTRADE format was later discontinued due to problems with scaling the data and exporting the data from the PDC.

*https://github.com/nicholasr15/ThesisProject2017/blob/master/ FirstEventDetectionCode.py 52 CHAPTER 3. METHODS

PMU Data Frequency for Event Detection When an event occurred in the power data, frequency data for the same time period was also examined. There were no significant changes in the frequency data that would correspond with events in the power data, and when there was a change, it did not follow any identifiable pattern. The frequency data was therefore not used in the event identification process.

3.3.2 Method 2: Matched Filter Algorithm Dr. Ananya Sen Gupta developed the method utilized for the matched filter at the Univer- sity of Iowa in the Electrical and Computer Engineering department. She derived Equa- tions 3.23 and 3.24[63]. P n∈Γ xi[n] · r[n] MFi = , (3.23) pP 2pP 2 n∈Γ(xi[n]) n∈Γ(r[n]) Equation 3.23 will work for all real signals, where the template or event profile of the known signal is represented by xi[n] and contains all non-zero numbers within the event profile. r[n] is the set of all non-zero numbers from −∞ to ∞ [63].

−→ T −→ r [n] x i[n] MFi[n] = (3.24) p−→ T −→ p−→ T −→ x i[n] x i[n] r [n] r [n]

MFi: the matching filter

n: the discrete sample size of the discrete time signal at a given time instant.

xi[n]: the profile of an event i

r[n]: the observed signal in the PMU data at a discrete time step n for the length of the continuous data coming in from the PMU.

∈: an element of the set, data or parameter

Γ: is the window of the PMU data

This method used Equation 3.24, as with this equation the matched filter can be com- puted in real-time across a sliding window as shown here: First let N = |Γ|, which is the −→ total number of samples of the event profile (xi[n]). Next let the signal r [n] = r[n]r[n − 1] . . . r[n − (N − 1)] be the vector of samples that is time indexed at n samples, and going −→ from the earliest at n samples to the last N samples. Finally let xi [n] = xi[0]xi[1] . . . xi[N − 1], assuming the event profile (xi[n]) is defined as non-zero values from n = 0 to n = N −1. Running Equation 3.24 will then give the matched filter output (MFi[n]) [63]. Due to the requirements of the matched filter, the PMU data had first to be differenced in the Python program. The NumPy function diff was used for the difference of the PMU data. It was found that simply differencing the raw PMU data did not give a usable result. It was decided to use the function from the panda’s library called pandas.DataFrame. rolling to get a moving average of the PMU data first. Once the moving average of the data was found, the difference was taken again, this time producing results that could be used. Then the event profile was extracted from the PMU data by looking at the plot of the difference data and one period of the event was used for the event profile. 3.3. SECTION 1: PMU DATA AND EVENT DETECTION ANALYSIS 53

Next Equation 3.24 was put into the code shown in Appendix B.1.1 in Listing B.2. This was done using a For Loop in Python and a window size of the event profile. The full code can be found at Github * for this project.† The full code also contains several testing methods for verifying that the matched filter works, as suggested by Dr. Gupta [63]. The results from matched filter method will discussed in Chapter 4.1.2.

3.3.3 Method 3: Supervised Machine Learning Method 3 took the approach of supervised machine learning because the problem was for- mulated in the context of supervised learning by labeled data sets, used for training the Gaussian Process Classifier (GPC). This was because the PMU data and the challenge of finding events in the PMU data fit the machine learning requirements:

• Having a sufficient amount of data that can be used as training for the supervised machine learning [64].

• A task that is complicated and has no apparent relationship or formula that can be applied to the data, and which cannot be solved by conventional methods [64].

Since these requirements could easily be met, it was worthwhile approaching the challenge of event detection in the PMU data with the tools of machine learning [64]. Although it was just enough PMU data and events for the machine learning to be tried. The PMU data was first run through the FFT, by the labels given to the PMU data based on whether the PMU data was event PMU data or non-event PMU data. For the training process the event and non-event PMU data were categorized as event and non-event by Landsnet as defined in Chapter 3.1.2 then fed into the training model separately. For the training part of the process as Figure 3.4, the procedure was as follows: The first step to separate events from the non-events in the PMU data sets by identifying the event locations in the PMU data. The data was then preprocessed using an FFT, this FFT was done similarly to the FFT process mentioned in Chapter 3.3.1 in Method 1. The main difference was that the FFT function was put into a For Loop with a variable window size for processing all the event and non-event and extracting the FFT features of the PMU data, this is explained in more detail in Chapter 3.3.3. The FFT transformed the PMU data into the frequency domain. This was done by doing the FFT and characterizing the event and non-event separately, resulting in the event and non-event data in separate feature matrices. Then the resulting feature

*https://github.com/nicholasr15/ThesisProject2017/blob/master/Matched_ filter.ipynb †Note: this code will not run without the data and is just provided as a reference.

Process for Training the Algorithm

Model Supervised Preprocess b b b Learning b b b b b Data bb b b b b b b b b b b Data b b b b Classification b Filters b b b b b b b b b b PCA b b b b b b

Figure 3.4: Flowchart of the process used in training of the Machine Learning algorithm. 54 CHAPTER 3. METHODS

Process for Event Detection

Model Event Detection Preprocess b b b b b b b b Data bb b b b b b b b b b b Data b b New b b Filters b b b b b b b b b b PCA b b b b b b b

Figure 3.5: Of the process used in event detection o the Machine Learning algorithm. matrices were inputted into the PCA*. The result of the PCA reduces the dimensionality from the FFT and characterization to three dimensions that could be visualized and used for classification using Gaussian RBF. Once this was completed, the supervised learning began. The supervised learning was done using the Gaussian RBF. This process resulted in a mathematical algorithm, which was later used in the event detection process. This process is presented in Figure 3.5. The event detection process procedure is as follows: The new data is loaded, and the same preprocessing of the data is done. Then preprocessed data is run through the GPC model, and the PMU data is classified as the class of highest probability of being an event. The procedures outlined above were implemented in python.

Loading the event data into Python and preprocessing. The code used by the machine learning algorithm for finding events started by categorizing events versus non-events in the PMU data from different sources in the power system’s data†. Once the categorization of the PMU data was done, the event and non-event of the PMU data were separately run through the FFT and characterization. The FFT using a sliding window with different window sizes each one overlapping the previous window. The overlapping is important to mention because it means the PMU data put into the frequency domain by the FFT are not entirely independent of one another. Meaning that there are redundancies that will need to be eliminated by the PCA process as discussed in Chapter 3.2.1. This method of the FFT was done again basely the same way as in Method 1 in Chapter 3.3 by using the window to step through the data. The main difference was there were multiple window sizes tried and average of the windows sizes was used. The reason PMU data had to be transformed into the frequency domain was that the original PMU data (time series data) could not be compared in a useful way due to the very kinds of events in the event data. Therefore looking at the PMU data in the frequency domain provided a method of characterizing the data into dimensions of 1Hz vectors. The characterization of the events and non-events into the frequency domain and then into the 1Hz vectors was done separately with the events first then the non-events‡. A log filter was then used, and the data was differenced. This result was then run fitted to the PCA§ process. Resulting in a three-dimensional space that could be visualized and used for the Gaussian Process Classifier (GPC)¶ process. Also a one dimensional reduction was tried and the results will be Chapter 4.1.3. The importance of reducing the dimensionality is

*For an explanation of the theory of PCA see Chapter 3.2.1 †To see on the event and non-event were categorized from the PMU data see Chapter 3.1.2 ‡See Chapter 3.1.2 for how the event and non-events were separated §For an explanation of the theory of PCA see Chapter 3.2.1 ¶The GPC process is explained in Chapter 3.2.2 3.3. SECTION 1: PMU DATA AND EVENT DETECTION ANALYSIS 55 because at such a high number of dimensions the problem of the “curse of dimensionality” occurs, which is when there are many dimensions in the data set so that this creates sparsity meaning that the data points are far apart, therefore, making it difficult to do probabilistic fit and correlations of the data set [60]. This is because the methods of classification and correlation are statistical methods and work by looking at how many positive or negative events are in one region [65]. The dimensions were reduced to three dimensions, and the data was plotted as shown in the results Chapter 4.1.3. The code for loading the event data into Python is in Appendix B.1.1 in Listing B.4.

The process of the supervised learning with a Gaussian process classifier (GPC). The supervised learning process of machine learning has two methods: classification, and regression. For this thesis, the classification method was chosen because the PMU data was being classified into events and non-events. Then the data was put into the GPC. The GPC works using the process described in Chapter 3.2.2, and was implemented in python using scikit-learn*, a machine learning library for Python. This library was built on the work from Gaussian processes for machine learning by Rasmussen and Williams. The Gaussian Process Classifier was chosen based on information from Alexander Moses and information the scikit-learn website [60], [67], [68]. The Gaussian Process Classifier is a classification that works on the Laplace approximation [66]. The results from the use of the Gaussian Process Classifier were a model that could be used to detect events in the PMU data these results will be discussed further in Chapter 4.1.3. The Python code for the process of the supervised learning with a Gaussian Process Classifier, which can be seen in Appendix B.1.1 in Listing B.5.

The Event Detection Algorithm Test The event detection algorithm was tested with the Gaussian Process Classifier model. This was done by using a sliding window through some PMU data with a known event. The sliding window was to simulate data coming into Landsnet and running through the PMU data. This process used all the same steps as outlined for preparing the data. Then all the prepared data was run through, the found GPC model and used to find the events in the PMU data. This was represented visually as a red dot moving over a color map with the different regions, and probabilities mapped out in gray scale heat map with the probability of event displayed above the map, see Figure 3.6 for a setup of the procedure described above. The results and figures are in Chapter 4.1.3. The code for the event detection algorithm that was tested with the model found by the Gaussian Process Classifier is shown in Appendix B.1.1 under Listing B.6.

*http://scikit-learn.org/stable/modules/generated/sklearn.gaussian_ process.GaussianProcessClassifier.html#sklearn.gaussian_process. GaussianProcessClassifier 56 CHAPTER 3. METHODS

Sliding Window Probaility of Event: 0.05 Event Data PMU Data

Events

Non-Events

FFT Results

Event Indicator

Figure 3.6: Shows the setup of the event detection method 3

Didver Line Events Non-events 1.0

0.8

0.6

0.4

0.2

0.0 3 2 1 0 1 2 3 Figure 3.7: The graph of the PCA in one-dimension with the GPC divider line, showing the setup of the event detection method 3 with one-dimensional PCA 3.4. SECTION 2: PMU DATA AND PARAMETER ESTIMATION 57

3.3.4 Testing the Feasibility of These Methods The last part of this Section 1: PMU Data and Event Detection Analysis. Was to run a feasibility test the methods tried in this section. The feasibility test was done based on time trials on the methods running and finding the events in the PMU data.

Time Trail The time trail for all the methods was done using the time function in Python. The function was put at the start of the loop that is going to be time. Then the function is placed again at the end of the loop and the two times subtracted from one another. The result of the time trail are shown in Table 4.3 and discussed on the feasibility of these methods in given in Chapter 4.1.3.

3.4 Section 2: PMU Data and Parameter Estimation

Another part of this feasibility study that was worked on in parallel with the event detection was the development of parameter identification using transfer functions and state-space methods. This meant that the core generator parameters could be estimated and identified through the use of PMU data. There are many ways and types of software that can be used for performing this sort estimation and identification with PMU data. The method utilized for this project was the one found in “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data”[16]. This method used the ARX model, zero order hold (ZOH), and least squares estimation (LSE) methods. These methods will be discussed in more detail in the following Chap- ters. Chapter 3.4.1 will cover the four basic generator parameters, of which only three were used. Chapter 3.4.2 will cover the Modelica model that was used for the base parameter verification.

3.4.1 Parameters Estimation The parameters that were identified in this project are the parameters that are connected to various parts of the generator and maintenance. They are the H, the inertia constant (sec- onds), D, the damping factor, R, the speed regulation constant (p.u.), T , the time constant of the turbine-governor (seconds), Pm, the mechanical power input (p.u.) and Pe, the electrical power (p.u.). The damping factor D was left out to make the model simpler as it was found by the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estima- tion Using PMU Data” not to have much of an overall effect on the model. This method used a simplified transfer function model of a hydropower plant. This served two purposes in this project. One was to provide model parameter identification through the use of PMU data. The second was to use these models to generate PMU data by changing the model parameters. Model parameter identification was performed by using PMU data along with the dis- crete autoregression with exogenous input (ARX) model, the zero-order hold (ZOH) method, and the least squares estimation method. This was first done by identifying the transfer func- tion model and state-space models. For simplification purposes, the transfer function model was represented by the Equation 3.25. ∆ω T s + 1 H(s) = = (3.25) 2 1 ∆Pe 2HT s + 2Hs + R 58 CHAPTER 3. METHODS

Input Power

Change in omega

startTime=1 Rotor Sum Block Input and Power Reference Power Change Load Inertia Integrator Sum Block Feedback Governor -1 1 1 Change +1 + in 1 s delta + +1 2Hs+D Ts+1 k=0 -1

Speed droop 1 R

Figure 3.8: Block diagram of the models used for parameter identification[16].

Table 3.1: The parameters used in the first Modelica model simulation

Inertia Constant Damping Factor Time Constant Speed Regulation Constant Electrical Power (H) (D) (T ) (R ) (∆Pe) (seconds) (unitless) (seconds) (per unit ) (per unit) 2.5 0 0.5 0.05 0.2

To perform this analysis, the transfer function was determined based on the block diagram shown in Figure 3.8, and broken down into the individual transfer functions and blocks, which are labeled in Figure 3.8. To develop the model for generating PMU data, the pa- rameters specified in “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” Mogharbel, Fan, and Miao [16] were used. These parameters are shown in Table 3.1. These parameters were plugged into Equation 3.25. This was done in Python, using the Control 0.7.0 package. * This library contains functions that allow for representation of transfer functions in Python. Once the transfer functions were programmed, a step function was generated in Python as an input to the transfer function. Then the control.matlab .lsim function was used from the control library. This function allowed for Equation 3.25, to be tested using a step function as an input. The output of the control.matlab.lsim function was then graphed using MatPlotLib. The graph was verified against the graph shown in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Es- timation Using PMU Data”. Once the model was determined to match the graph shown in the article, then the ARX model could then be tested to determine whether the parameters as shown in Table 3.1 could be recovered. The next step, to simulate incoming PMU data, was to use Modelica to generate PMU data with those parameters. This will be discussed in more detail in Chapter 3.4.2.

3.4.2 Modelica Model The next step in this process was to use the method presented in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data”, which was to develop a model in a program like MatLab to generate data for the least squares estimation process and ARX model with a set of known parameters† [16].

*https://pypi.python.org/pypi/control/0.7.0 †The paper cited uses MatLab, but in this project, Modelica was used. 3.4. SECTION 2: PMU DATA AND PARAMETER ESTIMATION 59

Once this model was developed, it was used to generate the data, which was fed back into the ARX model and least squares method. The parameters that were used to generate the data should be recoverable through the ARX and least squares methods. These parameters are outlined in Chapter 3.4.1. The first time this was tried, the results were not found to be adequate; the method was then compared back to a Simulink model, and a problem was found with how the Modelica model was set up. The constant input parameter at the beginning of the model should have been set to zero but was instead set to 0.2. Once this was fixed, the data retrieved from this model was closer to what was expected. These challenges will be discussed further in the Results Chapter (Chapter 5.1.2) The Modelica model was generated using the building blocks found in Modelica. It was designed based on a model used in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” by Mogharbel, Fan, and Miao [16]. The initial parameters were taken from the above paper and used to develop the model in its early stages. These parameters are shown in Table 3.1. The results from this model were compared to those found in the paper as mentioned earlier, as well as those of other models used in this thesis. Once the results were verified against these two sources, the model was then used to generate data, and the data was exported in a CSV format from Modelica. Once the data was exported, it was loaded into a Python program. The Python program was de- signed using the methodology presented in Mogharbel, Fan, and Miao’s paper, as mentioned above. The data was run through this program and the recovered parameters compared to the original. This comparison was done in two different ways: First, the resulting transfer functions that were produced through the use of the zero order hold method and ARX model were compared to the original transfer functions. Secondly, the transfer functions were used to generate a graph, and this was compared to the initial graph. These resulting graphs will be shown in Chapter 4.2.1 of the Results Chapter. There will also be a table showing the estimated parameters and coefficients from these processes, again shown in Chapter 4.2.1 of the Results Chapter. Once this method was determined to produce the correct results, the process was repeated with real PMU data from Landsnet. This procedure will be discussed in more detail in Chapter 3.4.3

3.4.3 Parameter Identification and Estimation From the Landsnet PMU Data

The process of parameter identification and estimation of the real PMU data from Landsnet began with importing the PMU data into Python. Next, the active power was calculated by Equation 3.22 The frequency was stored in a variable called “frequency” and the power was stored in a variable called “power”. Once the PMU data was imported, both the frequency and active power were converted into the equivalent per-unit values for the ARX model. The active power and frequency were then filtered by using the panda’s function rolling in the Python code. This function removed inconsistencies and smoothed out the data to prevent the raw data from causing errors in the ARX model, as seen in Figure 3.9. The processes are shown in code in Appendix B.1.1, in Listing B.3. This data was then put into the zero order 60 CHAPTER 3. METHODS

Figure 3.9: Filtered active power on the top and the filtered frequency on the bottom, filter by the pandas rolling mean filter. 3.4. SECTION 2: PMU DATA AND PARAMETER ESTIMATION 61

Model Fit

Figure 3.10: Fit of the found parameters x in Equation 3.28 on the top and the residuals (error) in the bottom plot. hold method starting with Equation 3.26.       y(1 + n) −y(2) −y(1) u(2) u(1) a1 y(2 + n)  −y(3) −y(2) u(3) u(2)  a   =    0 +e (3.26)  .   . . . .  b   .   . . . .   1  y(N) −y(N − 1) −y(N − 2) −u(N − 1) −u(N − 2) b0 | {z } | {z } | {zx } b A Equation 3.26 can be simplified by having the matrices stored as variables resulting in Equation 3.27 as shown in Chapter 2.0.1 [13], [16]. b = Ax + e (3.27) Then Equation 3.27 is rearranged to solve for parameter vector x, resulting in Equation 3.28. x = AT (AAT )−1b (3.28) Solved for, using Equation 3.28 to obtain parameters x. Once this was done, the x parameters were plugged into Equation 3.27, which solves for the matrix b. Checking matrix b against the output PMU data verified the results. This verification involved graphing the PMU data and the result of matrix b as shown in Figure 3.10. Once the fit was confirmed, the derived parameters for the zero order hold method a1, a0, b1 and b0, were plugged into the Equations 3.29, 3.30, 3.31, and 3.32, to solve for the generator parameters. −h T = (3.29) ln(a0) 62 CHAPTER 3. METHODS

b1 + b0 R = −h (3.30) 1 + e T + a1 2T H = (3.31) R + 4RT 2ω2

 h  −1 −a1e 2T cos 2 ω = (3.32) h Once the generator parameters were recovered, two different methods were employed. The first of these was to plug the results from Equations 3.29, 3.30, 3.31, and 3.32 into a Continuous Time (CT) transfer function as seen in Equation 3.33, which is a transfer function in the S − domain. T s + 1 H(s) = (3.33) 2 1 2HT s + 2Hs + R This transfer function was then graphed and that graph was compared to the graph of the original frequency data. The second method was to plug the a1, a0, b1, and b0 parameters into a Discrete Time (DT) transfer function in the Z − domain, shown in Equation 3.34, with a delta time (dt) or time differential of 0.02 because of the sampling was at 50 Hz.

b1z + b0 H(z) = 2 (3.34) z + a1z + a0 This was also graphed against the real data, the continuous time transfer function and the zero-order hold transfer function were all compared. Finally, the transfer function used in the Z − domain was converted into a state-space model, resulting in matrices A, B, C and D. This state-space model was then graphed and compared with the frequency of the real data. The results from all these methods are shown in Chapter 4.2.2, along with the plots. The last method that was tried in the parameter estimation and identification process was to create a moving window, i.e., a sliding window over the data and see how the parameters changed when the window moved along the data. This resulted in a graph of the T , R and H parameters. This was done to see the variation in the parameters from the PMU data. These graphs are given in Chapter 4.2.2. The code used for this method is shown in in Appendix B.1.1 under Listing B.7.

3.4.4 The Feasibility Testing of the Modelica Model The feasibility testing of the Modelica model was done by comparing the Python simu- lated model to the Modelica simulated model using Equation 4.2 on the data. This was the same method used in the paper “Estimation of Hydro Turbine-Governor System’s Transfer Function from PMU Measurements”[13]. The result of the test is shown and discussed in Chapter 4.2.1.

3.4.5 Testing of the Feasibility of this Section 2: PMU Data and Parameter Estimation The testing of the feasibility of Chapter 3.4 was done by finding the Root-Mean-Square deviation (RMS error) of the actual frequency to the simulated frequency. Then the RMS 3.4. SECTION 2: PMU DATA AND PARAMETER ESTIMATION 63 error was then graphed for the methods used, i.e., the discrete transfer function, continuous transfer function, and the state-space model. The results for these methods will be presented in Chapter 4.2.2. 64 65

Chapter 4

Results

This chapter will cover the results of the computer simulations done in Python and Modelica. This chapter gives the results from the event detection methods described in Chapter 3.3, using a matched filter algorithm, and machine learning. The results from the parameter estimation methods are covered in Chapter 3.4, including those from the Modelica model and those from the Landsnet PMU data, are also given. Any assumptions that were made will be restated in the appropriate results chapter. This chapter is intended only as an overview of the results obtained; detailed discussion of the results may be found in Chapter 5 of this thesis.

4.1 Section 1: PMU Data and Event Analysis

This chapter will give the results from the three methods used for the event analysis, follow- ing the order in which these methods were discussed in Chapter 3.3.

4.1.1 Method 1: Using Digital Filter and FFT for Analysis The plot that was first obtained for data analysis and finding events, Figure 4.1, shows the result of the first code that was written for finding events in the PMU data. The figure shows the PMU data in blue and the detector line in orange. The power data from the PMU was scaled from −3 to 3 on the y − axis to display it on the same plot as the Boolean event detection process, i.e., the number 1 for when an event is detected and the number 0 for no event being detected. The x − axis is measured in the number of samples. The code developed for this method was also used in the machine-learning procedure to find events for the training data, as discussed in Chapter 3.3.3. The results are shown in Figure 4.1, demonstrated that using a Butterworth bandpass filter tuned to the right frequency will result in a very primitive detection method. The main problem with this approach was that it had to be tuned.* It can also be seen that the threshold does not always work, as Figure 4.1 shows the detection algorithm missing the event around sample 9471. Due to the time-consuming nature of tuning for each event and the problem of this method’s occasional failure to detect events, this method was not an ideal solution for this project. Instead, this method was only used when a new set of PMU data was received from Landsnet. The event detection threshold was set to a low value to flag all possible events.

*“Tuned” meaning every events’ FFT would have had to be calculated as well as the event detection threshold for that FFT and would also have to be done on each PMU [50] 66 CHAPTER 4. RESULTS

3 PMU data with event Detector Line 2

1

0 9471

Scaled PMU Data PMUScaled 1

2

3 0 2500 5000 7500 10000 12500 15000 17500 Samples Figure 4.1: Results of the first event detection algorithm using the Butterworth bandpass digital filter and FFT analysis.

This method detected many other non-events, such as changes in power, loads coming on and off the power system, and other power disturbances. The person running the program then would have to manually sort through all flagged “events” to find the real events that were relevant to training data for the other methods used in the event detection algorithms. Lastly, a time trial was performed for testing the time it took for looking the PMU data and finding an “event”. The results of this trial showed that it took about (3.0 × 10−5 s) * on av- erage, this result is shown in the Table 4.3 with the other methods used for event detection. For the reasons mentioned above, this method was not tested further. The code for this first program can be found in Appendix B.1.1 under Listing B.1.

4.1.2 Method 2: Matched Filter Algorithm Figure 4.2 first, shows the real power calculated from the original PMU data. The next graph is the real power differenced, meaning it is centered on zero. The last graph is the output of the matched filter with spikes where the event occurs. The result is shown in the last graph of Figure 4.2, demonstrated that this method of using the matched filter works, but that it would be hard to use because of the difficulty of finding the correct threshold values for the PMU data events. As can be seen in the matched filter output graph in Figure 4.2, the amplitude of the spike at the beginning of the data is very similar to that of the spikes which denote an actual event in the PMU data. As demonstrated in Figure 4.3, another potential problem with this method was that unless the event profile used for detection were perfectly aligned with the actual event, the filter would not recognize the event as existing. One solution was to break up the event profile into several pieces so that the event and the event profile had a better chance of matching. However, this solution also presented a further problem, since smaller pieces of the event profile were also more likely to match non-event data due to their having fewer distinguishing characteristics from the rest of the PMU data.

*The time tests were performed on a Dell Precision M4700 with Intel Core i7-3840QM CPU @ 2.80 GHz with 16 GB of memory (RAM). 4.1. SECTION 1: PMU DATA AND EVENT ANALYSIS 67

The Original Real Power Data

50.0

47.5

45.0

42.5

40.0 Power (MW) Power 37.5 3000000 3020000 3040000 3060000 3080000 Samples The Real Power Data Difference 0.010

0.005

0.000

0.005

0.010

Scaled Power Scaled 0.015

3000000 3020000 3040000 3060000 3080000 Samples The Matched Filter Output

0.5

0.0

0.5

0 20000 40000 60000 80000 Samples Figure 4.2: Result of running the data through the matched filter, along with a graph of the original PMU data and the differenced data. 68 CHAPTER 4. RESULTS

The event profile Window 1 Window 2 Window 3 Window 4 Window 5 Window 6 Window 7 Window 8 The part of event profile

Figure 4.3: The windows that are shown here demonstrate how the matched filter uses a sliding window along an event if the window does not match perfectly with the event profile shown on left of the figure. For example in the windows labeled Window 1, 2, 4, 5, 7, and 8 the sliding window does not line up with the event profile. On the right of the figure is a part of an event profile, to shown how it could easily be mistaken as non-event like a change in power in the PMU data.

This can be seen in Figure 4.3, breaking the profile down into smaller pieces would also have required an extensive database to contain the data, again raising the problem of data storage and retrieval.

4.1.3 Method 3: Supervised Machine learning

This method used supervised machine-learning for event detection. The first step in the supervised machine-learning was to run the data through the PCA process, and the results of that process are shown in Figures 4.4, 4.5, and 4.6 for the one-dimensional PCA. Then the GPC is used to obtain the probability of an event. Figure 4.7 shows three different views of the PCA in three-dimensions. For another visualization of the same data, Figure 4.5 shows a three dimension plot from the view that shows the separation of the event and non-event. This define separation can be lost when a three-dimensional projection is put into three different one-dimensional views as seen in Figure 4.4. Figure 4.6, is the result of the one-dimensional projection of the PCA using a histogram plot, from the same data has used for making the three-dimensional scatter-plot in Figure 4.5. As can be seen from Figure 4.6 it is harder when using a one-dimensional projection to have a clear separation of the event and non-event data. This method is shown in Figures 4.7, 4.9, 4.11, 4.12, and Figures 4.8, 4.10 for the one-dimensional PCA. These figures are made up of three different graphs. The first in the left corner shows the unfiltered real power data. This graph also has the indicator window represented by two red vertical lines, showing which part of the data is under analysis. The window moves along unfiltered real power data, and the data in the window is displayed as several FFTs in the plots below, with the red line representing the average FFT. The graph on the right plots the current point of the GPC on a gray scale heat map, where the darker places on the heat map show a higher probability of the event occurring. The results from the PMU data being run through the machine learning algorithm are shown in Table 4.1 the results from the training data used for the GPC and 4.1. SECTION 1: PMU DATA AND EVENT ANALYSIS 69

PCA events vs non-events View 1 3 Events Non-events

2

1

0

1

2

4 2 0 2 4 6

PCA events vs non-events View 2

Event Non-event 4

3

2

1

0

1

2

3

4 2 0 2 4 6

PCA events vs non-events View 3

Event Non-event 4

3

2

1

0

1

2

3

2 1 0 1 2 3

Figure 4.4: The results from PCA process with three different views of the same data set from a three dimensional projection as shown in Figure 4.5. The red dots are events and the green dots are non-events. 70 CHAPTER 4. RESULTS

Figure 4.5: The results of the PCA process displayed in a three-dimensional form. 4.1. SECTION 1: PMU DATA AND EVENT ANALYSIS 71

Events Non-events 50

40

30

20

10

0 2 1 0 1 2 3 Figure 4.6: The PCA project into one-dimensions with the event and non-event classification 72 CHAPTER 4. RESULTS

Figure 4.7: Shows the event occurring and the supervised machine learning algorithm iden- tifying as an event.

Figure 4.8: The results using a GPC for finding an event the PMU data with the use of a one dimensional PCA.

Table 4.2 shows the result of real PMU data with the new algorithm found by the training data. Figure 4.7, is the result of the supervised machine learning algorithm finding an event in the PMU data. The event is identified by the placement of the red dot on the heat map and by the “Probability of Event” shown at the top right of the figure. The likelihood of the event being 1.00 meaning that the machine learning is saying that it is 100 % confident that it found an event. Figure 4.8, shows the result of the one-dimensional PCA with the GPC on the event detection. The black line shows the result of the detection of an event on the right graph and again the “Probability of Event” on the top right. Figure 4.9 along with Figure 4.11 shows three-dimensional PCA detecting a non-events on both parts of the non- 4.1. SECTION 1: PMU DATA AND EVENT ANALYSIS 73

Probability of Event 0.00

Figure 4.9: Non-event occurring and the supervised machine learning algorithm identifying as a non-event on the first part of the non-event data using three-dimensional PCA

Figure 4.10: Using the one-dimensional PCA with the GPC on non-event data event data. The one-dimensional PCA for a non-event detection is shown in Figure 4.10 and is again indicated by a black vertical line on the right graph. The machine learning algorithm had one problem with some of the non-event data as seen in Figure 4.12, this is also indicated in Table 4.2 by the 3.7 %. The results shown in Table 4.1 are from the training data of the GPC. The results show how well the GPC model was trained when learning what an event is versus a non-event. This is part of the machine learning algorithm process as discussed in Chapter 3.3.3. The result for the real PMU data after the training as been done is presented in Table 4.2. 74 CHAPTER 4. RESULTS

Figure 4.11: Non-event occurring and the supervised machine learning algorithm identifying as a non-event on the second part of the non-event data.

Figure 4.12: The false prediction of an event in the PMU data.

Table 4.1: The results of the training data of by the percentage predicted events and non- events correctly and the percentage that they were mispredicted. Using both the one- dimensional and three-dimensional PCA methods.

The Results from the training data model Predicted Event Predicted Non-event Actual Event 3D PCA: 99.0% 1.0% Actual Event 1D PCA: 94.7% 5.3% Actual Non-event 3D PCA: 3.8% 96.2% Actual Non-event 1D PCA: 6.9% 93.1% 4.1. SECTION 1: PMU DATA AND EVENT ANALYSIS 75

Table 4.2: The results of the real data of by the percentage predicted events and non-events correctly and the percentage that they were mispredicted. Using both the one-dimensional and three-dimensional PCA methods.

The Results from the real data model Predicted Event Predicted Non-event Actual Event 3D PCA: 98.7% 1.3% Actual Event 1D PCA: 94.7% 5.3% Actual Non-event 3D PCA: 3.7% 96.3% Actual Non-event 1D PCA: 6.3% 93.8%

Moving Window Speed for the Data Stream and Feasibility To test the feasibility of these methods, the moving window was used to simulate incoming data from the PDC unit. The incoming data to Landsnet from the PDC is at 50 samples per second. The result in Table 4.3 are based on the 50 samples per second coming into Landsnet, i.e., 0.02 seconds per sample. The program for machine learning takes about 0.2 second to run a window size of about 3000 data points by using Equation 4.1*. TML 0.2s Data Points NC = = = 10 (4.1) DS 0.02s Cycle NC: Number of data points processed in a cycle

TML: Time the machine learning takes to run one Cycle †

DS: The data speed of the PMU data coming into Landsnet from the PDC.

Stated another way only about 10 new data points would come into Landsnet while the machine learning algorithm is processing PMU data. This means that only 0.3 % of the window size will be used by the incoming data on a live stream. That would provide Landsnet with a fast enough data processing with room for error for example if Landsnet has a slower computer then this speed was calculated for or room for improvements on bandwidth and data speed for future upgrades from the PDC to Landsnet. Also the speed of the program could be improved by disabling the visualization as shown in Figures 4.7 4.9,4.11, and 4.12 and replacing it with a simple light indicator to let the operator know that the program has detected an potential event.

*This test was run on an Dell Precision M4700 with Intel Core i7-3840QM CPU @ 2.80 GHz with 16 GB of memory (RAM). †See Footnote * 76 CHAPTER 4. RESULTS

Table 4.3: The time trial results of the both the one and three dimensional PCA with GPCa. The Mean Time is the average time of each cycle in the program. The Standard Deviation is the deviation of each of the Cycle times. The Window Size indicates the number of data points that will be processed by the program, due to how different each program is the number of points for the window size is different.

Time Trials Mean Standard Window Time (s) Deviation Size Digital Filter: 3.00E-05 6.80E-04 1000 Matched Filter: 5.76E-04 2.87E-03 500 Cycle time for 3D PCA: 0.1995 0.0203 3000 Cycle time for 1D PCA: 0.1951 0.0169 3000 a The time tests were perform on a Dell Precision M4700 with Intel Core i7-3840QM CPU @ 2.80 GHz with 16 GB of memory (RAM).

4.2 Section 2 Results: Modelica Model and Parameter Estimation with PMU Data

To carry out the parameter estimation, a test and verification model was set up in Model- ica. Chapter 4.2.1 goes over the result of the Modelica model and testing of the Python code. After the Python code was tested and validated with Modelica, then the real PMU data parameters were estimated. The results of the parameter estimation are covered in Chapter 4.2.2. Chapter 4.2.2 covers the viability of the parameter estimation method used.

4.2.1 Modelica Model The Modelica model was used for verification of the Python transfer function given in Equa- tion 3.25 and the code needed to plot the response of the Python simulation. The first step in using Modelica as a verification method was to obtain the result of the Modelica model using the Modelica software. This method ran into challenges which will be discussed in more detail in Chapter 5.1.2 in the Discussion chapter. The result of this model is shown in Figure 4.13. This result illustrates the response of a simple step input function from 0 to 0.2 as laid out in “Least Squares Estimation-Based Synchronous Generator Parameter Esti- mation Using PMU Data”, performed using the Modelica software and the model shown in Figure 3.8. Once the model had been verified in Modelica, the next step was to export the Modelica time series data into a CSV file, which could then be read by the Python program for testing the imported data from a CSV file. The data then was graphed to verify that it matched the Python simulation, as shown in Figure 4.14. Once it was verified that the mod- els produced the same results, by looking at the graphs in Figure 4.13 and comparing it to the graphs in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” a fit calculation was made to compare the graphs using Equa- tion 4.2, as shown in “Estimation of Hydro Turbine-Governor System’s Transfer Function from PMU Measurements” [13], which was based on the work by Ljung in “Experiments with identification of continuous time models”.  ||y(t) − yˆ(t)|| F it = 100 1 − (4.2) ||y(t) − y¯(t)|| 4.2. SECTION 2 RESULTS: MODELICA MODEL AND PARAMETER ESTIMATION WITH PMU DATA 77

Change_in_omega 0

-0.005

-0.01

-0.015

-0.02 0 2 4 time [s] 6 8 10 Figure 4.13: The graph response is the frequency with a change of power from 0 to 0.2 for the Modelica Model using the parameter found in “Least Squares Estimation-Based Syn- chronous Generator Parameter Estimation Using PMU Data” and displayed in Table 3.1.

Step Response

0.0000 Modelica Model Data Simulated Python Response

0.0025

0.0050

0.0075

Amplitude 0.0100

0.0125

0.0150

0.0175 0 2 4 6 8 10 Time (sec) Figure 4.14: The result of the verification of the Python transfer function Equation 3.25 and the simulated code. 78 CHAPTER 4. RESULTS

Table 4.4: The Result of the ARX model and least-squares method.

Generator Constants Inertia Speed Regulation Time Constant Constant Constant HRT Input Parameters: 2.500 0.05 0.5 Found Parameters: 2.499 0.05 0.5 Error Percentage: 0.0268% 0.0008% 0.0099%

F it: The percentage fit of the simulated data compared to the real data.

y(t): The measured or real data.

yˆ(t): The simulated or calculated data.

y¯(t): The mean of y(t).

||: The norm of the data as seen in Equation 4.3 v u N uX 2 ||y|| = t |yk| (4.3) n=1 The result of this fit calculation showed that the Modelica model fit the Python model 89.45% (to two significant figures). This was considered to be a good fit based on the results found in “Estimation of Hydro Turbine-Governor System’s Transfer Function from PMU Measurements” [13]. The next step was to test the ARX model and code. This was done by taking the data produced by the Modelica model and feeding it into the ARX model and least-squares method. The results of this test are shown in Table 4.4 and Figure 4.15. The error percentage in Table 4.4 was calculated by Equation 4.4.

(Theoretical − Measured) Error% = × 100 (4.4) (Theoretical)

Since the percentage error of all the parameters was found to be under 1%, the code was validated and the fit of Figure 4.15 was calculated using Equation 4.2. The result this calcu- lation was found to be 99.97%. This shows that the Modelica model was able to validate the Python code was that was used for the ARX model and least squares method. 4.2. SECTION 2 RESULTS: MODELICA MODEL AND PARAMETER ESTIMATION WITH PMU DATA 79 Step Response

0.0000 ARX Model and Least Squares Method Response Python Simulation Response

0.0025

0.0050

0.0075

Amplitude 0.0100

0.0125

0.0150

0.0175 0 2 4 6 8 10 Time (sec) Figure 4.15: A comparison of the Python simulation to the Modelica simulation

4.2.2 Parameter Estimation of the Real PMU Data First the whole dataset was examined as shown in Figure 4.16 and the parameters estimated and presented in Table 4.7 along with the percentage data fit in Table 4.8. The result of Ta- ble 4.7 are much higher then expected based on the work done by Mogharbel, Fan, and Miao in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data”. A comparison of the two sets of parameters in shown in Tables 4.5, 4.11, and 4.14. Next, looking at Table 4.6, which shows the parameters calculated using the ZOH method that are used for calculating the H, R, and T , using Equations 3.29, 3.30, 3.31, and 3.32. Table 4.7 shows that results from these calculations, the inertia constant (H), speed regulation (R), and time constant (T ). These results were calculated over one hours worth of PMU data. Figure 4.16 was obtained, but was too densely packed and hard to see how well

Table 4.5: A comparison of the generator constants found from the real PMU data at Land- snet to the constants presented in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16]

Comparison of Generator Constants Inertia Speed Regulation Time Constant Constant Constant HRT Found Parameters for the System: 121.1 0.015 22.694 Parameter from other paper: 13.9 0.232 0.453

Table 4.6: The vector parameters found using the ZOH method

Vector Parameters Using ZOH b b a a Coefficient: 1 0 1 0 4.70 × 10−5 −4.69 × 10−5 −1.999 0.999 80 CHAPTER 4. RESULTS

Power: real, filtered

0.08

0.06

0.04

Power (p.u.) Power 0.02

0.00

0.02

0 500 1000 1500 2000 2500 3000 3500 Time (s) Frequency Output

Real PMU data Frequency ZOH Transfer Tunction 0.006 CT Tansfer Function State Space 1 State Space 2

0.004

0.002 Frequency(p.u.)

0.000

0.002

0 500 1000 1500 2000 2500 3000 3500 Time (s) Figure 4.16: This graph shows the two methods used for estimating the power system fre- quency responses compared with the real power system frequency response over approxi- mately one hour.

Table 4.7: The parameter found by using the real PMU from Landsnet for one generator.

Generator Constants Inertia Speed Regulation Time Constant Constant Constant HRT Parameters of the System: 121.050 0.015 22.693

Table 4.8: The percentage fit of the all the frequency data in this data set.

Results of the Fit Equation CT State Space ZOH -4.13% -2.83% -2.83% 4.2. SECTION 2 RESULTS: MODELICA MODEL AND PARAMETER ESTIMATION WITH PMU DATA 81

Power: real, filtered

0.08

0.06

0.04 Power (p.u.) Power

0.02

0.00

200 300 400 500 600 700 800 900 1000 Time (s) Frequency Output

0.004 Real PMU data Frequency ZOH Transfer Tunction 0.003 CT Tansfer Function State Space 1 State Space 2 0.002

0.001

0.000 Frequency(p.u.)

0.001

0.002

200 300 400 500 600 700 800 900 1000 Time (s) Figure 4.17: This graph magnifies the time period from 200 to 1000 in order to see how closely the calculated system frequency response matches the real system frequency re- sponse.

Table 4.9: The percentage fit using the three different simulations; ZOH, CT, and State- Space for the event data shown in Figure 4.17

Results of the Fit Equation CT State-Space ZOH 9.86 % 28.60% 28.60%

Table 4.10: The generator parameters found from the event data

Generator Constants Inertia Speed Regulation Time Constant Constant Constant HRT Found Parameters for the System: 101.93 0.01 25.067 the calculated frequencies followed the real frequency data. Next, all the data was checked to the simulation model using Equation 4.2, resulting in Table 4.8. The results were neg- ative percentage shown in Table 4.8*, it was decided to use a smaller datasets. For these reasons, the simulation of the parameters was rerun with fewer sample points over specific points of interest, resulting in Figures 4.17 and 4.18. The results in Figure 4.17 show that the calculated frequencies from the ARX model, least squares estimation, and the transfer functions follow the real data (the blue line) more precisely during the period of an event in the data†. This can be seen in Figure 4.17 by comparing the colored lines of the simulated data to the blue line of the real frequency data. Table 4.9, shows the results, fit percentage

*The negative percentages means the models failed to simulate the real frequency data according to “Ex- periments with identification of continuous time models”[69]. †Between time of 350 and 700 seconds in Figure 4.17, 460 and 600 seconds for Figure 4.16 82 CHAPTER 4. RESULTS

Table 4.11: A comparison of the generator constants found from the real PMU data at Land- snet to the constants presented in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16]

Comparison of Generator Constants Inertia Speed Regulation Time Constant Constant Constant HRT Found Parameters for the System: 101.9 0.014 25.0698 Parameter from other paper: 13.9 0.232 0.4534

Power: real, filtered 0.08

0.06

0.04 Power (p.u.) Power 0.02

0.00

1600 1650 1700 1750 Time (s) Freqency 0.004 Real PMU Data 0.003 CT Transfer Function ZOH Transfer Function 0.002 State Space

0.001

Freqency(p.u.) 0.000

0.001

0.002

1600 1650 1700 1750 Time (s) Figure 4.18: The change in power from 0.08 p.u. to 0.04 p.u.. Showing models following the real frequency data. This event also exhibits characteristics of an second order response as shown in Figure 4.13 from real data calculated using Equation 4.2. According to “Experiments with identification of continuous time models”, any percentage of 0.0 % means that the simulation model does not predict any better then just taking the average of the original data. A percentage of 100 % says the simulation model’s output matches the real frequency measured [69]. Thus the result in Table 4.9 shows that the CT model does better at 9.86 % than just predicting the mean of the real data. The State-Space and ZOH models are the most accurate model but still only has a fit of 28.60 % for the event data selected. The fit of the models for the event can be seen visually by looking at Figure 4.17. Figure 4.16 shows that the simulated model data does not appear to follow the actual frequency data well, except for in two places. First place is shown in the Figure 4.17, where the model follows the real data about 28.60 % using the State-Space and ZOH models. The second place is shown in Figure 4.18 and is where the power changes from 0.08 p.u. to 0.04 p.u.. Figure 4.18 also demonstrates the response of an second order transfer function with an step input as shown in the Modelica model in Figure 4.13. The result of the second place that showed the models following the actual frequency data is shown in Table 4.12, along with the results for the parameter estimation shown in Table 4.13. The estimated parameters shown in Table 4.14 show the close result in the parameters found in the paper “Least Squares 4.2. SECTION 2 RESULTS: MODELICA MODEL AND PARAMETER ESTIMATION WITH PMU DATA 83 Table 4.12: The percentage fit of change in power from 0.08 p.u. to 0.04 p.u. result shown in Figure 4.18

Results of the Fit Equation CT State-Space ZOH -18.50% 36.61% 36.61%

Table 4.13: The generator parameters estimated from the change of power data from 0.08 p.u. to 0.04 p.u. of one generator in the station.

Generator Constants Inertia Speed Regulation Time Constant Constant Constant HRT Found Parameters for the System: 52.44 0.02 22.69

Table 4.14: A comparison of the generator constants found from the real PMU data at Land- snet to the constants presented in the paper “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” [16]

Comparison of Generator Constants Inertia Speed Regulation Time Constant Constant Constant HRT Found Parameters for the System: 52.44 0.021 22.6937 Parameter from other paper: 13.9 0.232 0.4534

Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data”, but are still a ways off, for a reason that may be causing the large parameters found in this PMU data from Landsnet see Chapter 5.1.2. The results in Table 4.12, show that in the change in power that the ZOH and State Space methods are better then the CT method. Next, the parameter H, R, and T were graphed for 800 iterations as shown in Figures 4.20, 4.21, and 4.22. Figure 4.19 is the plot of the PMU power and frequency data during an event that was used in deriving the plots showing each parameter over the iterations as shown in Figures 4.20, 4.21, and 4.22. These figures are plotted by taking both the power and frequency data to use in the ARX model. The figures were found doing several simulations using the following assumptions. They were to use dataset of 50, 000 data-points with a windows size of 10, 000 data-points and a step size of 50 data-points to emulate the data coming from PDC to Landsnet. These assumptions resulted in the parameter graphs being done with 800 iterations. The initial goal of using this dataset with an event and calculating a graph of the parameter over 800 iterations was to see how the event data would affect the parameters. It was calculated that the event should show up in between the 200th and 400th iterations in the plots of the parameters. Figure 4.20 shows a plot of the time constant of the turbine-governor over 800 iterations. The y − axis shows the fluctuation in the time constant. This figure did not show any major changes in the iterations calculated during the period of the event. The only fluctuation in the T parameter data is in between the 700th and 800th iterations. The fluctuations at the end of the iterations maybe cause by poor sliding 84 CHAPTER 4. RESULTS

Power

0.08

0.06

0.04 Power (p.u.) Power

0.02

0.00

0 10000 20000 30000 40000 50000 Number of Samples Freqency

0.003

0.002

0.001

Amplitude(p.u.) 0.000

0.001

0 10000 20000 30000 40000 50000 Number of Samples

Figure 4.19: The plot of the power data and frequency data from the PMU data that was used for deriving the parameter plots shown in Figures 4.20, 4.21, and 4.22.

Parameter: T

90

80

70

60

50

Time Constant (s) ConstantTime 40

30

20

10 0 100 200 300 400 500 600 700 800 Number of Iterations Figure 4.20: The T parameter is the time constant in seconds of the turbine-governor graph over the number of iterations. 4.2. SECTION 2 RESULTS: MODELICA MODEL AND PARAMETER ESTIMATION WITH PMU DATA 85

Parameter: R

0.14

0.12

0.10

0.08

0.06

Speed Regulation(p.u.) SpeedConstant 0.04

0.02

0 100 200 300 400 500 600 700 800 Number of Iterations Figure 4.21: The R parameter is the speed regulation constant shown in p.u..

Parameter: H

Parameter: H 140 Crossing Line

120

100

80

60 Inertia Constant (s) Constant Inertia

40

20

0

0 100 200 300 400 500 600 700 800 Number of Iterations Figure 4.22: The H parameter is the inertia constant. The H parameter shown in blue and the red line represents unrealistic values of H when the blue plot falls below the red line. window size selection, but more testing would be needed to determine this. Figure 4.21 is a plot of the speed regulation constant (R) over 800 iterations. The R value is measured in p.u. system. Unfortunately due to no direct correlation between the event data and the real world it is hard to tell what affect are causing these changes in the parameter. The changes see in the R value in Figure 4.21 maybe cause by the sliding window size selection. More testing would be needed to determine if these changes in the R parameter are valid or the changes are just artifacts from the poor window size selection. Figure 4.22 shows a plot of the inertia constant over the number of window iterations. Results shown this figure again could be the result from poor window size selection and more testing would be needed to see what happens when changing the sliding window size. The reasons for these anomalies will be discussed in Chapter 5.1.2. The reason for the two plot lines on this figure that the red line represents the limit of H, because when calculating the H value the inverse cosine is used, which has limits between 1 and −1. The Equations 3.32 and 3.31 show how the H value is calculated using the T , R, and a1 parameters.

Testing the Feasibility of this Method The Feasibility of this Method will be tested using the PMU data and comparing it to the simulated data. Also, a plot of the RMS error is shown in Figure 4.23, which indicates that the greatest error in the method is in the CT transfer function. The State-Space1, method uses initial conditions of the previous time step in the simu- lation. The State-Space2 is when the initial conditions were set to zero for each time step. 86 CHAPTER 4. RESULTS

RMS Error

DTF CTF 0.0035 State Space1 State Space2

0.0030

0.0025

0.0020 RMS Error RMS

0.0015

0.0010

0.0005

0 100 200 300 400 500 600 700 800 Simulation Iteration Figure 4.23: The RMS error of the of the three methods used (Discrete Time Transfer Func- tion, Continuous Time Transfer Function, and State-Space) for the parameter estimation process.

The plot in Figure 4.23 has the RMS difference of the real PMU data frequency from the simulated frequencies on the y−axis and 800 iterations on the x−axsi. Then looking at the data it can be seen that the DT transfer function follows the same path as the State-Space2 this is to be expected State-Space2 data is derived from the DT transfer function. The reason for the State-Space1 not following the same path as State-Space2 and DTF is because it gets a new initial condition every time step, resulting in a slightly lower RMS error. The RMS is found by using the following Equation 4.5.

r n P (ˆy − y )2 RMSErrors = i=1 i i (4.5) n

yˆi: is the simulated frequency data

yi: is the measured frequency data n: is the sample size

Moving Window Speed for the Data Stream and Feasibility For testing the feasibility of speed for the data stream the same method was used as discussed in Chapter 4.1.3. Again, the moving window speed test is to simulate the incoming PMU data from the PDC into Landsnet. The incoming PMU data with come into Landsnet from PDC at a rate of 50 samples per second. Now, looking at the results in Table 4.15, the time for each cycle is 1.44 seconds. TML 1.44s Data Points NC = = = 72 (4.6) DS 0.02s Cycle NC: Number of data points processed in a cycle

TML: Time the machine learning takes to run one Cycle * *This test was run on a Dell Precision M4700 with Intel Core i7-3840QM CPU @ 2.80 GHz with 16 GB of memory (RAM). 4.2. SECTION 2 RESULTS: MODELICA MODEL AND PARAMETER ESTIMATION WITH PMU DATA 87 Table 4.15: The time trial result of the Parameter Estimation using the ZOH method.a

Time Trials Mean Time (s) Standard Deviation Parameter Estimation: 1.4397 0.0578 a The time tests were perform on a Dell Precision M4700 with Intel Core i7-3840QM CPU @ 2.80 GHz with 16 GB of memory (RAM).

DS: The data speed of the PMU data coming into Landsnet from the PDC.

The result from Equation 4.6 demonstrated that 72 data points would come into Landsnet while the software was processing the size of a window of 10, 000 data points. This means that only 0.7 % of the data comes into Landsnet while the software is processing the previous windows. Allowing for the data to be processed in real time at Landsnet with a computer that had similar specifications as shown in footnote*.

*See footnote * 88 89

Chapter 5

Discussion

The discussion will first cover the complications and challenges of this thesis in Chapter 5.1. It will then summarize the thesis and results in Chapter 5.2. Possible future work based on the results of this project will be discussed in Chapter 5.3. Finally, a conclusion of the whole thesis and the extent to which it conformed to the original goals (as given in Chapter 1.2.1) will be given in Chapter 5.4.

5.1 Complications

One of the issues, that first had to be solved was with using the two different data formats, as they used two different units for angle-measurements. The problem of two separate units for angle-measurements was later resolved by using a single data format, which was the Comma Separated Value (CSV). The reasons for using this format are explained in Chapter 3.2.4. The next challenge was the problem of detecting an event in the PMU data which will be discussed in Chapter 5.1.1. Then figure out the best method of parameter detection using the ARX as shown in Section 5.1.2.

5.1.1 Challenges with PMU Data and Event Analysis

The main challenges with using the PMU data for event analysis was first developing a def- inition of an “event” and subsequently detecting that event*. Determining what constituted an event or non-event was difficult due to the nature of the data. Because of this, and to clarify the client’s precise requirements for the project, a meeting was set up with Landsnet to develop a mutually agreed definition of an “event”. Once this was done a crude program was written, that would look through the PMU data and try to find events. This program was considered to be crude because it found hundreds of so-called “events” that then had to be manually examined. Those that were found to be events were saved for training data for the machine-learning algorithm, as discussed in Chapter 3.3.3. Once it was determined what constituted an event and non-event, the next challenge was how best to find them in the incoming PMU data to Landsnet. Three primary methods were tried: the digital filter, the matched filter, and machine-learning. Each of these methods had their challenges that needed to be overcome.

*A description of an event can be found in Chapter 3.1.2 90 CHAPTER 5. DISCUSSION

Challenges with the Digital filter and FFT approach (Method 1) The primary difficulty with the digital filter and FFT approach was finding the right filter parameters and thresholds for detecting events. This was solved using an FFT of the event data to obtain a rough estimate of what filter parameters were needed. Once the data had been roughly filtered, the process was further fine-tuned through trial-and-error, with the visual aid of the graph seen in Figure 4.1, to determine the parameters which applied to events but not to non-events. It was also found, as mentioned in Chapter 3.3.1, that this method was not very robust and would have to be fine-tuned to for each new setup or if any changes were made to the equipment.

Challenges with the Matched Filter Algorithm (Method 2) Ultimately, the challenges involved in implementing this method proved too hard to be feasi- ble, and this method was abandoned in favor of the machine learning approach. As discussed in Chapter 3.3.2, finding ways of matching the event with the profile of the event stored in the program at different points of the event was difficult because of the way in which the sliding window moves through the data this is illustrated in Figure 4.3. A further challenge would have been to store all the possible events using a Python dictionary.

Challenges with the Supervised Machine Learning (Method 3) The main challenge was understanding the supervised machine-learning and how to apply it to the challenges finding events in the PMU data. Once this was done, then the next challenge was to figure out how to display the result in a understandable approach. It was decided to first look at all of the results for the PCA using three two-dimensional graphs as shown in Figure 4.4, but it was hard to see a clear separation between the event and non- event data. Then a three-dimensional graph was constructed as shown in Figure 4.5, which show the event and non-event data separated. After this was done it was suggested by Dr. Joseph Foley to simplify the graphing on the PCA data into a one-dimensional graph as shown in Figure 4.6, to see how it affected the PCA and eventually the GPC results. It was found that this one-dimensional method of the PCA had a lower predicted event detection percentage with only a slightly faster cycle time as shown in Tables 4.2 and 4.3, therefore it would be recommended to use the three-dimensional method in future work.

5.1.2 Challenges of PMU Data and Parameter Estimation One of the other major challenges was a problem in the work done in Chapter 3.4.1. The Modelica model initially produced inaccurate results because the power reference block was set to 0.2 instead of 0 and the parameter T was set at 1 rather than 0.5. Under these conditions, the data produced by the Modelica model had a much higher percentage error than should have been the case for this type of system analysis. A good rule of thumb for closed-form solutions is that the error should be around 1%, which the Modelica model ini- tially substantially exceeded. Once this problem was resolved, the Modelica graph matched the model presented in “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data” with less than a 1% error. When carrying out a comparison of the transfer function H(s) in Python to the model developed in Modelica, a problem was found with a negative sign. This was caused by not properly inputting the data with the correct sign. The data was generated by a step function, and the step function in the Modelica model went from 0 to 0.2 but was fed into the model 5.1. COMPLICATIONS 91 with a negative sign, so the actual input was from 0 to −0.2. This −0.2 was not taken into account when feeding the data into the Python model, which resulted in a graph in the opposite direction than the Modelica model graph. Once this problem was found, it was easily fixed by adding a negative sign to the step function in the Python model, telling it to go from 0 to −0.2. When this was done, the two models matched relatively closely. This also fixed the problem with matching the two discrete transfer functions.

Parameter Estimation With the Sliding Window Method

The reason for the fluctuations in the parameter plots shown in Figures 4.20, 4.21, and 4.22 was cause by the assumptions made for the sliding window. The assumptions causing fluc- tuation in the parameters plots was proven by plotting the parameters again with a different window and step size, this is demonstrated in Figure 5.1. Figure 5.1 shows how the pa- rameter found from the same dataset but with a different window and step size can result in

Power

0.08

0.06

0.04 Power (p.u.) 0.02

0.00

0 10000 20000 30000 40000 50000 Number of Samples

Freqency 0.003

0.002

0.001

0.000 Amplitude (p.u.)

0.001

0 10000 20000 30000 40000 50000 Number of Samples

Parameter: T 100

80

60

40

Time Constant (s) 20

0 0 100 200 300 400 500 600 700 800 Number of Iterations

Parameter: R 0.4

0.3

0.2

0.1

Speed Regulation Constant (p.u.) 0.0 0 100 200 300 400 500 600 700 800 Number of Iterations

Parameter: H 400 Parameter: H Crossing Line 300

200

100 Inertia Constant (s)

0 0 100 200 300 400 500 600 700 800 Number of Iterations

Figure 5.1: That changing the window and the step size on the ARX model resulted drasti- cally different parameter results 92 CHAPTER 5. DISCUSSION drastically different plots with the parameter value going as low as −15000. The result of a negative value makes no sense regarding time, showing that there are problems with the ARX model and choosing the window and the step size correctly. The sliding window works by moving the window using a For Loop to step through the predefined “A” matrix as shown in Equations 3.26 and 3.28. This method of the sliding window with the ARX and LSE recalculates the parameters T , H, R every new iteration of the For Loop. Due to the sliding window step size and the size of the window, there is an overlap of the each sliding window. The amount of overlap depends on the window size and step size. When the window size and step size are equal, then there is no overlap of the windows. Other things that may need to be considered when picking window and step sizes is the window size needs to be big enough for the ARX model and LSE methods to work correctly. Lastly, the step size that was chosen was a step size of 50 data points because that was the rate at which PMU data came from the PDC to Landsnet.

5.2 Summary

The thesis was divided up into two main sections. Section 1 covered the process of using the PMU data for event analysis. Section 2 discussed the use of PMU data for parameter estimation. This thesis was originally envisioned with parameter estimation as simply one part of the event detection process, but once work began on the event detection section, it was found that parameter estimation was a broad and complex enough topic to merit its section in the thesis. Having two sections gave the thesis a clearer structure and allowed the individual challenges associated with each topic to be addressed separately. Once this was done, the background Chapter 1.3 could focus on event detection methods, whereas the literature review could focus more on parameter detection. As event detection is often extremely case-specific, little literature was found that addressed the specifics of a similar situation to what was happening in Iceland. The summary of the two sections is given in more detail in Chapters 5.2.1 and 5.2.2.

5.2.1 PMU Data and Event Analysis The PMU data and event analysis were first addressed using the simplest method, which was to look at the problem from the perspective of a signal and systems engineer. This led to the use of digital filters and FFT for analysis of the events. The first step before any of these techniques could be applied, was to categorize events versus non-events in the PMU data from Landsnet. The categorization was done in a meeting at Landsnet, looking at data that Landsnet had already categorized as an event*. Once this was done, a digital filter could then be designed to meet all the requirements of the events. This method was found to be inadequate in the paper Understanding and Counteracting Real Power Oscillations by Zhao, Torre, Wells, et al., after the some more research was done. The paper by Zhao, Torre, Wells, et al. discusses how this approach has to be fine-tuned to each PMU, which is not practical in a power system with many PMUs. This method still produced some useful code that was adopted later on in this thesis to find oscillations and changes in the PMU data. Once these variations were found in the PMU data, they were then graphed into a series of plots that were compared to actual events manually.

*A description of an event can be found in Chapter 3.1.2 5.2. SUMMARY 93

Since the digital filter method did not work for detecting events in real-time, another method that was looked at was the use of a matched filter. This was suggested after consult- ing with Dr. Ananya Sen Gupta, Assistant Professor of Electrical and Computer Engineering at the University of Iowa. The matched filter worked, but the results were not as prominent as expected, making it hard to tell the difference between events and other noise in the data. The matched filter would also have required more time and data processing to run than was desired for real time event detection. Implementing this method would have required know- ing all of the event profiles before hand to create the event profile needed for the matching to work properly. The last method was recommended by Alexander Moses, a fellow student at Reykjavik University with machine learning experience, who thought the problem of event detection could be solved with machine learning. The approach of supervised machine-learning was used. This method of machine-learning worked the best for real-time detection of events in the PMU data from Landsnet. Machine-learning allowed several sets of training data to be run through the algorithm for the machine-learning algorithm to gain an understanding of what events and non-events were. Once the training was complete, the algorithm was able to detect an event in a simulated data stream. The machine learning algorithm also allowed for new training data to be inputted into the algorithm when new events were discovered.

5.2.2 PMU Data and Parameter Estimation The challenge of the parameter estimation problem was first tackled by carrying out a lit- erature review in Chapter 2. The literature review revealed several possible approaches to this issue, and the methods that were chosen were: using a simplified model from the pa- per “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data”, using an ARX model, and the least squares estimation method. The first step of the modeling method was to program the model in Python using the control library and transfer functions. The transfer functions then had to be tested using PMU data generated by the same model programmed into Modelica. Next, the PMU data had to conditioned to work with the ARX model. Once the PMU data was conditioned for the ARX model, it was plugged into the model, and the parameters recovered using the least squares method. These a1, a0, b1, and b0 parameters were used to solve for H, the inertia constant (seconds), R, the speed regulation constant (p.u.), and T , the time constant of the turbine-governor (seconds) parameters. Once the parameters were found, they were verified by graphing the new transfer func- tion made from the estimated parameters. This chart was then plotted against the real fre- quency data to see how well the model would predict the frequency. The result of these mod- els are shown in Figure 5.2, this shows that the models fit the real frequency data when there is an event as seen in Figure 5.2a. The models have a hard time following the real frequency data when there is a non-event and the fitting process does not work here as illustrated in Figure 5.2b. The outcome makes sense because when an event occurs the Frequency and power PMU data tend to exhibit similar behavior to one another as seen in the top graph in Figure 5.2a, also the fact that the event has defined shapes with little to no noise. Where the non-event is very noisy and has a lot of high-frequency artifacts that the ARX model can not deal with, in an ideal world the non-event data would be a flat line with no noise. This is also supported in the following paper “Estimation of Hydro Turbine-Governor System’s Trans- fer Function from PMU Measurements” by Duong, Uhlen, and Jansson. The reason for the Continuous Time (CT) transfer function being the worst fit is because the CT is derived from the following Equations 3.29, 3.30, 3.31, and 3.32 using the values from the ZOH method 94 CHAPTER 5. DISCUSSION

Power and Frequency: real, filtered

Power 0.05 0.003 Frequency

0.04 0.002

0.03

0.001

0.02 Power (p.u.) Power Frequency(p.u.) 0.000 0.01

0.00 0.001

300 350 400 450 500 550 600 650 Time (s) Frequency Output

Real PMU data Frequency ZOH Transfer Tunction 0.004 CT Tansfer Function State Space 1 State Space 2

0.002

0.000 Frequency(p.u.)

0.002

300 350 400 450 500 550 600 650 Time (s) (a)

Power and Frequency: real, filtered 0.0025 0.030 Power Frequency 0.0020 0.025

0.0015 0.020

0.0010

0.015 0.0005 Power (p.u.) Power

0.010 Frequency(p.u.) 0.0000

0.005 0.0005

0.000 0.0010

0 50 100 150 200 250 300 350 Time (s) Frequency Output 0.0025

0.0020

0.0015

0.0010

0.0005

0.0000 Frequency(p.u.)

0.0005 Real PMU data Frequency 0.0010 ZOH Transfer Tunction CT Tansfer Function State Space 1 0.0015 State Space 2

0 50 100 150 200 250 300 350 Time (s) (b)

Figure 5.2: The results of the ARX model during an event are shown in 5.2a and the results of non-event data are shown in 5.2b. The graphs show that during an event (5.2a) the simulated data closely follows the real data, but during non-events (5.2b) the simulated data has a harder time following the real data. 5.3. FUTURE WORK 95 to generate the following Transfer Function 5.1, which is then used in the simulation. For more information on this procedure see Chapter 3.4.3. T s + 1 H(s) = (5.1) 2 1 2HT s + 2Hs + R

Where the parameters found from the ZOH method i.e. a0, a1, b1, b0 are included directly in the following Transfer Function 5.2.

b1z + b0 H(z) = 2 (5.2) z + a1z + a0 The Transfer Function 5.2 is used is in the simulation, resulting in a model with far less computation and therefore more accurate results as demonstrated in Figure 5.2, by how well the ZOH Transfer Function and State-Space models* follow the real frequency data.

5.3 Future Work

The work done in this thesis provides the basic foundation for many more applications of methods using PMU data for parameter estimation and event detection. One idea for this thesis to be continued would be to combine the two sections into a software package that would be able to detect an event and then run post-analysis on the event to tell the power system operator what happened in the power system. To do this in the future, data would have to be collected on the generating equipment during an event to verify the real-world cause of the event. One such verification process is described in Chapter 5.3.1. Another possible application of the methods outlined in this thesis would be to used them to make a program that could examine the generator parameters to determine when an event is about to occur by seeing when the parameters deviate by a certain amount from the baseline parameters of the generator.

5.3.1 Physical Verification of Hysteresis Problems in Hydro-Turbines One potential method to verify that the problems experienced by Landsnet are caused by hysteresis in the hydraulic rams when changing the angle of gates is to install a monitoring system with sensors in the hydraulic lines. This system would work by monitoring the pres- sure in the hydraulic lines to see what happens when there is a command sent to the hydro unit for a set-point change in the gate angle. If the hypothesis of hysteresis in the hydraulic rams is correct, then a fast oscillatory signal will be logged by the system. This is because, when the hydraulic rams have trouble finding the right set-point, they tend to carry out a be- havior called “seeking” or “hunting.” This means that the ram continues to move back and forth in a rapid sequence, causing a change in the hydraulic pressure, which will be logged by the sensors in the system. If this happens then, this will confirm the hypothesis. Other- wise, this behavior in the PMU data may be caused by some other unknown phenomenon in the system. The “seeking” or “hunting” is thought to be caused by the hydraulic rams being held in the same positions too long, therefore creating a spot of the rams that is worn out. Then when the rams are asked to move out of those positions they are stuck, and more pres- sure is applied then they are able to free them selfs. With the extra pressure they over shoot the target position, this is when the “seeking” or “hunting” occurs, while they are trying to find the correct target. *The State-Space model are derive from the ZOH Transfer Function and therefore are identical. 96 CHAPTER 5. DISCUSSION

5.3.2 Software Development for Landsnet Unfortunately, due to time constraints and lack of experience with software development, this part of the thesis was not completed. The original idea was to develop a software package that would be loaded on to Landsnet’s computers and run through the PMU data to look for events and notify the power system operator of the problem. As mentioned above, this was not done, but all the algorithms were completed, and a feasibility test was carried out. This feasibility test proves the concepts presented in this thesis. In the future, it would be possible to take the methods used in this thesis and develop them into a software package that could be utilized at Landsnet. One part of this software package was the use of the FR4 and DP4, which were the design and functional requirements about having the software being able to record the event data if so desired by the power system’s operator as discussed in Chapter 1.5.

5.3.3 Recommendations for Further Research There are many ways this research could be used in the future. One recommendation as mentioned above in Chapter 5.3.1, would be to collect data on the physical components of the power system to confirm what is happening when an event occurs in the PMU data. This would allow for further software development to be able to draw correlations between the PMU data event and the real world. Another possible avenue of research based on this thesis is to further develop the gener- ator model used in this thesis by using the OpenModelica software and the resources from the iTesla project, which provides more complex generator models for finding more gen- erator parameters through the use of the e iTesla Power Systems Library (iPSL) [70]. The other advantage of using a Modelica model is it can be implemented in Python using the OpenModelica Python Interface (OMPython). More work that could be done as suggested by Dr. Ragnar Kristjánsson would take the parameters, i.e., T , R, and H, found by the ARX model and Least Square Estimation. These parameters would need to be found on filtered PMU data with that has no events in it. Then plugging the parameters into a transfer function, the resulting transfer function would be the baseline of the generators. Once the baseline transfer function was established then the event PMU data could be used and run through the baseline transfer function while the parameters are being observed.

5.4 Conclusion

The original goals of this thesis were:

• To develop analysis methods for the Icelandic power system that can predict or simu- late the generator’s behavior for critical operating conditions.

• To validate this method of analysis using known generator events to ensure it detects malfunctions in the generator equipment.

• To create a software package for Landsnet to allow real-time detection of events in the power system.

As the thesis developed, it turned into a feasibility study of methods that could be used for PMU data event analysis and parameter estimation, but it still largely met the original goals. 5.4. CONCLUSION 97

As demonstrated in this thesis, it is possible to develop analysis methods for the Icelandic power system that can predict generator behavior. This part of the thesis used a simplified model of the generator, as shown in Figure 3.8. This model was programmed in Python and Modelica, and tests were run on the PMU data received from Landsnet. The results of these tests proved that it was feasible to perform this type of analysis on the PMU data from Landsnet. To simulate generator behavior, Python code and an ARX model with least squares es- timation were used. This was proven to be feasible but still needed much work to be suffi- ciently accurate for use in the power system, this is shown in Figure 5.2. As it was proven in Chapter 5.1.2 that the result of the models and parameter predictions is depended on the window size and step size used for the ARX model. The problems with the window size and step size, i.e., sampling rate was not mentioned to be varying in the two papers on parameter estimation with the ARX model, but they both mention a fixed window size of 40 s was used [13], [16]. The step size of the window for each paper was not explicitly mentioned but was assumed to be a step size of 50 data points. Also, the step size is important because it needs to be base on the event data that is being looked for, for example, if the event being looked for is a low-frequency event such as a second order event as shown in Figure 4.18, then the step size of 50 data points is suitable. For higher frequency event a step size of 50 data points may not work for the ARX model because it would be too much data for model- ing that type of event. This also means that the window size will vary on the kind of event being examined because the window size should be set based on the duration of the event. If the ARX model is not size to the event correctly, it could give the wrong information for estimating the parameters. Therefore, more investigation and testing would be needed to determine whether this method is valid for analysis of generator events. Data should be collected on what is happen- ing in the real world during the events. The model should also be tested on other software, such as MatLab, SimuLink, Maple, and others. Also, more work is needed for the event detection algorithm using machine learning as there are so many possibilities of where to go from here, as this thesis has just scratch the surface of the machine learning world. As previously discussed, time constraints made it impossible to complete the software package for Landsnet, but this would be a good next step of this thesis work. The results from Section 1 show that the machine learning has the best result for event detection. The PCA with three dimension gave a prediction of when there is an event of 98.7 % correct when tested on the real PMU data. Where when looking at the non-event data if found a percentage of 96.3 % correct in the real PMU data. The machine learning method could not be compared in terms of the percentage of correct to the digital filter and the matched filter methods because all three methods are so different to one another. The other comparison that could be made is the time that the PMU data took to process in one cycle*, this result demonstrated that the digital filter took the shortest at per cycle but was not to accurate, the matched filter was the next fastest but again had problems with accuracy, the one-dimensional PCA was slightly faster then the three-dimensional PCA but had a lower percentage of correctness. Table 4.3 shows the result of the time trials for the digital filter method, the matched filter, three-dimensional PCA, and one-dimensional PCA.

*A cycle being the time that it look to process the number of data point in the sliding window† †It was not possible to run program with the same size windows because the program are so different and require different window sizes to work properly 98 CHAPTER 5. DISCUSSION

5.5 Discussion On the Axiomatic Design Process

The design of the event detection software using the axiomatic design process followed most of the design criteria as presented in Chapter 1.5. The only design requirement (FRs) and design parameters (DPs) that were not met are the FR4 and DP4, which was to make an option in the software to have the operator record the live data when an event was found in the PMU data coming into Landsnet from the PDC. The other FRs and DPs were met in the following ways:

FR1 and DP1: The PCA and GPC were tested and run on the following computer a Dell Precision M4700 with Intel Core i7-3840QM CPU @ 2.80 GHz with 16 GB of mem- ory (RAM). These results are shown in Table 4.3 and the data per cycle calculated in Equation 4.1.

FR2 and DP2: The requirements were met by the use of the machine learning with PCA and GPC, which allow of finding of the events with a 98.7 % correct identification.

FR3 and DP3: This was met using the heat map as shown in Figure 4.11 and calculating the probability of the event with the GPC.

FR4 and DP4: Will not be implemented in this thesis, but could be implemented in the future work.

As predicted in the design matrix in Equation 1.14 there were delays in the design process of finding an optimal solution for event detection. There were three methods tested in this process; method one was using a digital filter and fast Fourier transform for analysis, method two used a matched filter algorithm, and method three worked on the principals of machine learning using the Gaussian process classifier (GPC) for identification of events in the PMU data. The best results were found in the machine learning which met all the FRs. 99

Bibliography

[1] Orkustornun National Energy Authority, Hydro Power Plants In Iceland, Online, 2017. [Online]. Available: http://www.nea.is/hydro- power/electr ic-power/hydro-power-plants/. [2] B. Heimisson, “Improved frequency control strategies for geothermal power plants”, Master’s thesis, Chalmers University of Technology, Department of Energy and Envi- ronment Division of Electric Power Engineering Chalmers University of Technology SE–412 96 Göteborg Sweden Telephone +46 (0)31–772 1000, 2014. [Online]. Avail- able: http://publications.lib.chalmers.se/records/fulltext/ 202528/202528.pdf. [3] G. A. Guðjónsson, Information the establishment of Landsnet, private communica- tion, Apr. 2017. [4] Landsvirkjun, Power Stations, Website, Apr. 2017. [Online]. Available: http:// www.landsvirkjun.com/company/powerstations. [5] L. P. Jordan Wirfs-Brock, IE Questions: What Keeps Our Electric Grid Humming?, Inside Energy, Jul. 2015. [Online]. Available: http://insideenergy.org/ 2015/07/10/ie- questions- what- keeps- our- electric- grid- humming/ (visited on 09/09/2017). [6] ——, IE Questions: What Is Inertia? And What’s Its Role In Grid Reliability?, Inside Energy, Jun. 2015. [Online]. Available: http://insideenergy.org/2015/ 06/15/ie-questions-what-is-inertia-and-whats-its-role- in-reliability/ (visited on 09/09/2017). [7] J. Khoo, The Power Of Data: How Software Is Helping Keep Iceland’s Lights On, GE Website, May 2017. [Online]. Available: http://www.ge.com/reports/ power- data- software- helping- keep- icelands- electricity- flowing/ (visited on 08/04/2017). [8] EirGrid, The DS3 Programme: Delivering a Secure, Sustainable Electricity System, Website EirGrid, 2016. [Online]. Available: http : / / www . eirgridgroup . com/site- files/library/EirGrid/DS3- Programme- Brochure. pdf. [9] Orkustofnun, Electricity Generation, Website, 2013. [Online]. Available: http:// www.nea.is/geothermal/electricity-generation/. [10] National Grid, NIC EFCC Dissemination Event | National Grid, Website, Mar. 2017. [Online]. Available: http://www2.nationalgrid.com/UK/Our- comp any / Innovation / NIC / EFCC / NIC - EFCC - Dissemination - Event / ?utm_source=%C2%A3nhanced+Frequency+Control+Capability& utm_campaign=68195570c7- EMAIL_CAMPAIGN_2017_02_01&utm_ 100 BIBLIOGRAPHY

medium=email&utm_term=0_e2e471a5c1- 68195570c7- 56917397 (visited on 08/06/2017). [11] Y.-H. Song and X.-F. Wang, Operation of market-oriented power systems. Springer Science & Business Media, Sep. 1, 2003, ISBN: 978-1-85233-670-7. DOI: 10.1007/ 978-1-4471-3735-1. [12] C. P. Steinmetz, “Power Control and Stability of Electric Generating Stations”, Trans- actions of the American Institute of Electrical Engineers, vol. XXXIX, no. 2, pp. 1215– 1287, Jul. 1920, ISSN: 0096-3860. DOI: 10.1109/T-AIEE.1920.4765322. [13] D. T. Duong, K. Uhlen, and E. A. Jansson, “Estimation of Hydro Turbine-Governor System’s Transfer Function from PMU Measurements”, in Power and Energy Society General Meeting (PESGM), 2016, IEEE, Nov. 2016, pp. 1–5. [Online]. Available: http://ieeexplore.ieee.org/abstract/document/7741673/. [14] B. Singh, N. Sharma, A. Tiwari, K. Verma, and S. Singh, “Applications of pha- sor measurement units (PMUs) in networks incorporated with FACTS controllers”, International Journal of Engineering, Science and Technology, vol. 3, no. 3, pp. 64–82, 2011. [15] C.-C. Tsai, L.-R. Chang-Chien, I.-J. Chen, C.-J. Lin, W.-J. Lee, C.-C. Wu, and H.-W. Lan, “Practical Considerations to Calibrate Generator Model Parameters Using Pha- sor Measurements”, IEEE Transactions on , no. 99, pp. 1–11, Feb. 2016. DOI: 10.1109/tsg.2016.2519528. [Online]. Available: http://ieeexpl ore.ieee.org/abstract/document/7401126/. [16] B. Mogharbel, L. Fan, and Z. Miao, “Least Squares Estimation-Based Synchronous Generator Parameter Estimation Using PMU Data”, in Power & Energy Society Gen- eral Meeting, 2015 IEEE, IEEE, IEEE Xplore, Oct. 2015, pp. 1–5. [Online]. Avail- able: http://ieeexplore.ieee.org/abstract/document/7286559/. [17] J. C. N. Pantoja, A. Olarte, and H. Diaz, “Simultaneous estimation of exciter, gover- nor and synchronous generator parameters using phasor measurements”, in and Supply Reliability Conference (PQ), 2014, IEEE, IEEE Xplore, Jul. 2014, pp. 43–49. DOI: 10.1109/PQ.2014.6866781. [18] Z. Chen and P. Urwin, “Power quality detection and classification using digital fil- ters”, in 2001 IEEE Porto Power Tech Proceedings (Cat. No.01EX502), vol. 1, 2001, p. 6. DOI: 10.1109/PTC.2001.964610. [19] T. R. Kuphaldt, Lessons In Electric Circuits, Volume II — AC. The full Design Science License, Jul. 2014, vol. II. [Online]. Available: https://www.allaboutcircu its.com/assets/pdf/alternating-current.pdf. [20] J. Oakwood, What does it mean for reactive power to be delivered / consumed?, Stack Exchange, May 2015. [Online]. Available: https : / / electronics . stack exchange . com / questions / 169957 / what - does - it - mean - for - reactive-power-to-be-delivered-consumed. [21] Public Energy Advisers, Power Fundamentals and the SP1000, Website, 2015. [On- line]. Available: http://publicenergyadvisers.com/power-fundame ntals-and-the-sp1000/. [22] Edison Tech Center, AC Power History, Website, 2014. [Online]. Available: http: //www.edisontechcenter.org/AC-PowerHistory.html (visited on 08/03/2017). BIBLIOGRAPHY 101

[23] S. Chapman, Electric machinery fundamentals, 5th. Tata McGraw-Hill Education, 2012, ISBN: 978-0-07-352954-7. [24] SiriusA, File:3-fas-spänningar.svg, Website, Oct. 2011. [Online]. Available: https: / / upload . wikimedia . org / wikipedia / commons / 0 / 0c / 3 - fas - sp%C3%A4nningar.svg. [25] A. Von Meier, Electric power systems: a conceptual introduction. John Wiley & Sons, Jul. 11, 2006, ISBN: 978-0-471-17859-0. [26] J. D. Glover, M. S. Sarma, and T. Overbye, Power System Analysis & Design, SI Version, H. Gowans, Ed. Cengage Learning, 2011, ISBN: 978-1-111-42579-1. [27] NPTEL, Section VI: Per Unit Representation, online, 2009. [Online]. Available: htt p://nptel.ac.in/courses/108104051/chapter_1/1_20.html. [28] J. Machowski, J. Bialek, and J. Bumby, Power system dynamics: stability and control, 2nd. John Wiley & Sons, 2011, ISBN: 978-0-470-72558-0. [29] Siemens, Static Var Compensator (SVC "Classic"), Wiebsite, 2017. [Online]. Avail- able: https://www.energy.siemens.com/hq/en/power-transmiss ion/facts/static-var-compensator-classic/. [30] Power Engineering, Dynamic Voltage Control Stabilizes Wind-generated Electricity to the Grid, Website, Nov. 2001. [Online]. Available: http : / / www . power - eng . com / articles / print / volume - 105 / issue - 11 / field - not es / dynamic - voltage - control - stabilizes - wind - generated - electricity-to-the-grid.html. [31] C. W. Taylor, Voltage Stability for Undergraduates, online, Jul. 2008. [Online]. Avail- able: http://www.ece.umn.edu/groups/power/month_sem/pres_ 11.pdf. [32] D. P. Kothari and I. Nagrath, Modern power system analysis, 3rd. Tata McGraw- Hill Education, 2003, ISBN: 978-0-07-049489-3. [Online]. Available: https:// books.google.is/books?id=eTr78ZAPZ_sC&lpg=PR1&ots=OtAql yoWq3&dq=Modern%20Power%20System%20Analysis&lr&pg=PP1#v= onepage&q=Modern%20Power%20System%20Analysis&f=false. [33] J. Eto, Consortium for Electric Reliability Technology Solutions, Website, Feb. 2006. [Online]. Available: http://www.phasor-rtdms.com/phaserconcepts/ phasor_adv_faq.html. [34] S. S. Biswas, A Collaborative Educational Program on Synchrophasor Applications for the Smart Electric Grid, Website, Jul. 2014. [Online]. Available: http://eecs .wsu.edu/~hlee3/DOEProject/DOE_Project_active.html. [35] ——, Synchrophasor Technology Tutorial, YouTube, Jul. 2014. [Online]. Available: https : / / www . youtube . com / watch ? v = 4OQUzSeVIjA & list = PL - 17ZGzkgCeugqivp722QYOAs12uxhiqz. [36] U.S. Energy Information Administration, New technology can improve electric power system efficiency and reliability, EIA.gov, Mar. 2012. [Online]. Available: https: //www.eia.gov/todayinenergy/detail.php?id=5630#. [37] North American Electric Relability Council, The Role of Software in the August 14, 2003 Blackout and Subsequent Investigation, Online, Jan. 2006. [Online]. Available: https://www.ece.cmu.edu/~electricityconference/2006/Alle n_CMU-Software081403.pdf. 102 BIBLIOGRAPHY

[38] J. Barron, The Blackout of 2003: The Overview; Power Surge Blackout Northeast, Hitting Cites in 8 States and Canada: Midday Shutdown Disrupt Millions, The New York Times, Aug. 2003. [Online]. Available: http : / / www . nytimes . com / 2003/08/15/nyregion/blackout-2003-overview-power-surge- blacks-northeast-hitting-cities-8-states.html?mcubz=3. [39] D. Teather, Blackout cost New York 36 million dollars an hour, The Guardian, Aug. 2003. [Online]. Available: https://www.theguardian.com/business/ 2003/aug/20/usnews.internationalnews. [40] G.-J. Park, “Axiomatic Design”, in Analytic Methods for Design Practice, N/A, Ed. London: Springer London, May 31, 2007, ch. 2, pp. 17–105, ISBN: 978-1-84628-473- 1. DOI: 10.1007/978-1-84628-473-1_2. [41] N. P. Suh, The Principles of Design. Oxford University Press, 1990. [42] ——, Axiomatic Design - Advances and Applications. Oxford University Press, 2001. [43] E. M. Benavides, Advanced Engineering Design: An Integrated Approach. Woodhead Pubishers, Dec. 11, 2011, 282 pp., ISBN: 9780857090935. [44] F. Y. Ómarsdóttir, R. B. Ólafsson, and J. T. Foley, “The axiomatic design of Chess- mate: a chess-playing robot”, Procedia CIRP, vol. 53, pp. 231–236, 2016. [45] J. T. Foley, Introduction to Axiomatic Design, Class Lecture, Oct. 2015. [46] C.-C. Tsai, W.-J. Lee, E. Nashawati, C.-C. Wu, and H.-W. Lan, “PMU Based Gener- ator Parameter Identification to Improve the System Planning and Operation”, IEEE Power and Energy Society General Meeting, 2012. DOI: 10.1109/pesgm.2012. 6344984. [47] B. Zaker, G. B. Gharehpetian, M. Karrari, and N. Moaddabi, “Simultaneous param- eter identification of synchronous generator and excitation system using online mea- surements”, IEEE Transactions on Smart Grid, vol. 7, no. 3, pp. 1230–1238, Oct. 2016. DOI: 10 . 1109 / tsg . 2015 . 2478971. [Online]. Available: http : / / ieeexplore.ieee.org/abstract/document/7293226/. [48] C.-C. Liu, U. Vaidya, and A. P. S. Meliopoulos, Real Time PMU-Based Stability Mon- itoring, Internet, Oct. 2014. [Online]. Available: http://pserc.wisc.edu/ documents/publications/reports/2014_reports/S-50_Final- Report-Oct-2014.pdf. [49] J. C. Smith, G. Hensley, and L. Ray, “IEEE recommended practice for monitoring electric power quality”, IEEE Std, pp. 1159–1995, 1995. [50] X. Zhao, W. Torre, C. Wells, and R. A. de Callafon, “Understanding and Counter- acting Real Power Oscillations”, University of California, San Diego, 9500 Gilman Drive La Jolla, CA 92093-0411, USA, Tech. Rep. CSI RD&D4 Task 4.3 Final Re- port, Oct. 2016. [Online]. Available: http://calsolarresearch.ca.gov/ images / stories / documents / Sol4 _ funded _ proj _ docs / UCSD4 _ Kleissl / CSIRDD _ Sol4 _ UCSD _ Task4 - 3 _ BatteryOptimization _ FinalTaskRpt_2016-10-20.pdf. [51] Applied Mathematics University of Washington, Lecture: Principal Componenet Anal- ysis (PCA), Youtube, Feb. 2016. [Online]. Available: https : / / youtu . be / a9jdQGybYmE. BIBLIOGRAPHY 103

[52] N. Halko, P.-G. Martinsson, and J. A. Tropp, “Finding structure with randomness: Probabilistic algorithms for constructing approximate matrix decompositions”, SIAM review, vol. 53, no. 2, pp. 217–288, 2011. DOI: 10.1137/090771806. [53] saurabh.jaju2, Comprehensive Guide on t-SNE algorithm with implementation in R & Python, Website, Jan. 2017. [Online]. Available: https://www.analyticsvid hya.com/blog/2017/01/t-sne-implementation-r-python/. [54] A. Moses, Summary of PCA, Jul. 2017. [Online]. Available: https://github. com/nicholasr15/ThesisProject2017/blob/master/Documents/ PCA/Summary%20of%20PCA.pdf. [55] J. Cunningham, MLSS 2012: J. Cunningham - Gaussian Processes for Machine Learn- ing (Part 1), Youtube, Jul. 2012. [Online]. Available: https://www.youtube. com/watch?v=BS4Wd5rwNwE (visited on 07/26/2017). [56] A. Moses, Summary of Gaussian process classification (GPC), Jul. 2017. [Online]. Available: https://github.com/nicholasr15/ThesisProject2017/ blob/master/Documents/GPC/GaussianProcessSummary.pdf. [57] C. M. Bishop, Pattern Recognition and Machine Learning, B. S. Michael Jordan Pro- fessor Jon Kleinberg, Ed. Springer, Aug. 17, 2006, ISBN: 0-387-31073-8. [58] RISE Research Institutes of Sweden, Open Source Modelica Consortium, Online, 2017. [Online]. Available: https://www.sics.se/projects/open-sour ce-modelica-consortium. [59] Open Source Modelica Consortium, Welcome to OpenModelica, Online, 2017. [On- line]. Available: https://openmodelica.org/index.php. [60] A. Moses, Machine learning: Supervised learning algorithms, private communica- tion, Jun. 2017. [61] J. E. Carryer, M. Ohline, and T. Kenny, Introduction to Mechatronic Design, 1st ed., N. D. Tacy Quinn, Ed. Pearson, 2010, ISBN: 978-0-13-143356-4. [62] A. Damato, File:Electronic linear filters.svg, Wikipedia, Nov. 2005. [Online]. Avail- able: https://commons.wikimedia.org/wiki/File:Electronic_ linear_filters.svg. [63] A. S. Gupta, The matched Filter, personal communication, May 2017. [64] S. Prasanna, Machine Learning Made Easy, Online video, 2015. [Online]. Available: https://se.mathworks.com/videos/machine-learning-with- matlab-100694.html?form_seq=YQ6cFtgE. [65] V. Lavrenko, PCA 1: curse of dimensionality, YouTube video, Jan. 2014. [Online]. Available: http://bit.ly/PCA-alg. [66] C. E. Rasmussen and C. K. Williams, Gaussian processes for machine learning. MIT press Cambridge, 2006, vol. 1, ISBN: 026218253X. [Online]. Available: http:// www.gaussianprocess.org/gpml/chapters/RW.pdf. [67] L. Buitinck, G. Louppe, M. Blondel, F. Pedregosa, A. Mueller, O. Grisel, V. Niculae, P. Prettenhofer, A. Gramfort, J. Grobler, R. Layton, J. VanderPlas, A. Joly, B. Holt, and G. Varoquaux, “API design for machine learning software: experiences from the scikit-learn project”, in ECML PKDD Workshop: Languages for Data Mining and Machine Learning, 2013, pp. 108–122. 104 BIBLIOGRAPHY

[68] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blon- del, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Courna- peau, M. Brucher, M. Perrot, and E. Duchesnay, “Scikit-learn: Machine Learning in Python”, Journal of Machine Learning Research, vol. 12, pp. 2825–2830, 2011. [69] L. Ljung, “Experiments with identification of continuous time models”, IFAC Pro- ceedings Volumes, vol. 42, no. 10, pp. 1175–1180, 2009. DOI: https://doi. org/10.3182/20090706-3-FR-2004.00195. [70] L. Vanfretti, T. Rabuzin, M. Baudette, and M. Murad, “iTesla Power Systems Li- brary (iPSL): A Modelica library for phasor time-domain simulations”, SoftwareX, vol. 5, pp. 84–88, 2016. [Online]. Available: http : / / ac . els - cdn . com / S2352711016300097/1-s2.0-S2352711016300097-main.pdf?_tid =5947bc48-89ab-11e7-b3d8-00000aacb361&acdnat=1503675648_ c9d2b2ef91254645f7919a9ae2443159. [71] Energy.Gov, The War of the Currents: AC vs. DC Power, Website, Nov. 2014. [On- line]. Available: https://energy.gov/articles/war-currents-ac- vs-dc-power. [72] W. McAllister, Sign convention for passive components, Khan Academy, May 2016. [Online]. Available: https://www.khanacademy.org/science/elec trical - engineering / ee - circuit - analysis - topic / circuit - elements/v/ee-passive-sign-convention (visited on 03/18/2017). [73] HyperPhysics, AC Power, Website, Aug. 2000. [Online]. Available: http://hype rphysics.phy-astr.gsu.edu/hbase/index.html. [74] K. Daware, Understanding the Power Factor, Website, 2014. [Online]. Available: ht tp://www.electricaleasy.com/2015/11/understanding-power- factor.html. [75] R. P. Johnson, Using Complex Numbers in Circuit Analysis and Review of the Algebra of Complex Numbers, Jul. 2014. [Online]. Available: http : / / scipp . ucsc . edu/~johnson/phys160/ComplexNumbers.pdf. [76] J. D. Irwin and R. M. Nelms, Basic Engineering Circuit Analysis, 10th, V. A. Vargas, Ed. John Wiley and Sons, Inc., 2011, ISBN: 9780470633229. 105

Appendix A

AC Current and AC Power

A.1 Alternating Current

AC (alternating current) power is the most prevalent type of electricity used for household power today. This is due to the “War of the Currents” back in the late 1880s, between Thomas Edison and Nikola Tesla [71]. With the state of technology at the end of the 1800s, it was easier to transport power over long distances using AC power [25]. Therefore, AC power is still used today in the households and industry. The “alternating” in alternating current means that the current travels in one direction then goes in the opposite direction. This happens every 0.02 seconds or 50 Hz in Europe, and about every 0.0167 seconds or 60 Hz in other parts of the world, such as North America. In conventional circuit analysis, the positive sign convention is that current going into a com- ponent is positive and current coming out is negative. However, in AC circuits, the current is constantly changing polarity, forming a sinusoidal waveform. In AC circuit analysis, it is therefore impossible to know the direction of the current at a given point in the circuit [72]. Another method is therefore employed, which uses phases to relate the relative timing of the current and voltage to each other. In AC power this is represented mathematically by a sinusoidal function or wave and is shown by the Equation A.1 [73] and Figure A.1 for power in phase, which will be explained below.

P (t) = VmaxImax sin(ωt) sin(ωt − φ) (A.1)

P (t): The power (W) at an instant in time or the instantaneous power.

Vmax: The maximum voltage (V) in the sinusoidal function of the power.

Imax: The maximum current (A) in the sinusoidal function of the power. ω: The angular frequency (rad/s), ω = 2πf, f is the frequency (Hz). t: The instantaneous time (s). φ: The phase shift of the sinusoidal function (rad).

Equation A.1 is the instantaneous power, meaning the power at a instant in time along the sinusoidal wave. Since AC power is measured along a sinusoidal waveform, the time is ex- pressed as the angle in radians or degrees. This is due to the criteria of a sinusoidal function being amplitude, frequency, and phase. Amplitude is the maximum power or the crest of the curve measured from the abscissa (x − axis). Frequency is the a number of oscillations 106 APPENDIX A. ALTERNATING CURRENT

Current in Phase in With the Voltage Voltage

Resistor

AC

Circuit Diagram

ϕ = 0 ϕ = 0 Phasor Diagram

Current

Figure A.1: Shows the voltage and current waveforms in phase with each other. They do not perfectly overlap as the voltage has a slightly higher magnitude than the current [74]. completed in a specified time, and, phase gives an angular difference between the voltage sinusoidal wave and the current sinusoidal wave, as shown in Figures A.1 and A.2 [25]. In Figure A.2 the voltage can lead the current too, but this will be discussed in Chap- ter A.1. Although Figures A.1 and A.2 show a smooth sinusoidal waveform, in reality this is not the case. This is because the generators cannot produce a precise sinusoidal waveform due to their structure, and because of the harmonic disturbances caused by loads switching and power system equipment. For this reason, the calculations for instantaneous power is too accurate in practice and would not be suited for real-world calculations; therefore, the calculations are performed using the average power equation instead. Average power or equivalent DC power is calculated by Equation A.2

PAverage = VrmsIrms cos(φ) (A.2)

PAverage: The average power or the mean power, which is used in most AC power calcula- tion.

Vrms: The Root Mean Square value of the voltage.

Irms: The Root Mean Square value of the current. cos(φ): The power factor in the power system. A.1. ALTERNATING CURRENT 107

Current Leads Voltage

Voltage

Capacitor AC

Circuit Diagram ϕ

ϕ

Phasor Diagram

Current

Figure A.2: Shows the current out of phase with the voltage. This is also known as current leading the voltage, because the current comes before the voltage in a clockwise direction in the phasor diagram shown to the right of the graph. The angle φ is the difference in phase between the two waveforms, known as a phase shift [74]. 108 APPENDIX A. ALTERNATING CURRENT

Root Mean Square Value of Voltage and Current The root mean square (RMS) is a method for calculating an equivalent DC voltage or current value of an AC circuit for use in AC power calculations. The average value of the voltage and current would be zero, as the AC voltage and current fluctuates between positive and negative. Therefore, using the RMS will just take the positive number of the sinusoidal waveform and an approximate DC equivalent of the voltage or current. The RMS works by first squaring the whole function, then taking the average or mean, and then taking the square root. Equations A.3 and A.4 describe the calculations for RMS voltage and current respectively. √ Vrms = 1/ 2Vmax (A.3) √ Irms = 1/ 2Imax (A.4)

√The result of this is explained by Figure A.3, where the RMS voltage is approximately 1/ 2 = 0.707 times, the amplitude of the sine wave, and the same for current values. The RMS value is the most commonly utilized method when talking about voltage and current. In a household in the United States, the voltage given is 120 voltage RMS; in Europe, this value is 230 voltage RMS. In practice, when talking about household voltage, the label “RMS” is assumed to be present and is rarely explicitly stated. RMS values are utilized because when the RMS current and RMS voltage are used to calculate the power, as in Equation A.2, the appropriate amount of power is calculated when using passive loads, passive devices and loads are discussed in the Sub-chapter on Properties of AC power in more detail [25].

Figure A.3: Shows the voltage transformed to the RMS value. The larger sinusoidal wave- form (labeled V (t)) is the original voltage waveform. The smaller sinusoidal waveform (V 2(t)) is the transform of the voltage waveform by the RMS function. This type of RMS transform also holds true for waveforms of current [25]. A.1. ALTERNATING CURRENT 109

Properties of AC power To understand AC power more, we first have to look at AC power features, as well as how AC power affects passive devices such as resistors, capacitors, inductors, and transformers. To understand this further, some new terminology needs to be introduced here:

Reactance (X): The forces opposing the current flow in an AC circuit generator by the inductive and capacitive components in the circuit. This is measured in ohm (Ω).

Inductance (XL): The part of reactance caused by inductive components in an AC circuit. Inductance is measured ohm (Ω).

Capacitance (XC ): The part of the reactance produced by the capacitive components in an AC circuit. Capacitance is measured ohm (Ω).

Impedance (Z): The combination of the resistance (R) and reactive components (jX) writ- ten in complex number form (Z = R + jX) ohm (Ω).

Admittance (Y ): The reciprocal of an impedance, is found by the following equation, Y = 1 siemens ( ). Z f Reactance is a way of measuring and predicting the effect of the alternating voltage and current on a device, meaning that when alternating voltage and current go through individ- ual devices, the timing of the current sinusoidal waveform relative to the voltage sinusoidal waveform changes, or the phase shifts. This is demonstrated in Figures A.1 and A.2. Since the timing is measured in angles, not time, the phase change is represented in an angular variation in the two sinusoidal waveforms, voltage and current. There are two main kinds of reactances: inductive reactance (XL) and capacitive reactance (XC ). Both inductance and capacitance cause the sinusoidal voltage and current waveform to shift or move apart, in opposite directions. This means that the inductance and capacitance can be used to counter- act one another. Therefore, if there is too much capacitive reactance in the system, it can be neutralized by adding more inductive reactance to the network [25]. The inductive reactance (XL) is caused by devices called inductors or solenoids, whose primary form is a coil of wire around a core material. When an AC is run through the coil, a magnetic field in the coil is built up, as when a DC is run through a coil, but unlike a DC, the AC is always changing polarity. This constant change of polarity causes a voltage to be produced which opposes the first current and in a sense impedes the flow of electrons. The impedance from the opposing current causes the timing of the sinusoidal waveform of the current to lag behind that of the voltage, known as a phase change or shift. In an ideal inductive device, meaning one with no resistance, we would see a phase shift of a quarter cycle (90°). The inductive reactance can be calculated using the Equation A.5. It mostly depends on the value on the frequency and the value of the inductor.

XL = ωL (A.5)

XL: The inductive reactance in Ω ω: The angular AC frequency, which can be found using ω = 2πf, where f is the frequency of the AC power.

L: The inductance, which is measured in henrys (H). 110 APPENDIX A. ALTERNATING CURRENT

The capacitive reactance CL is caused by capacitive devices, such as capacitors. These consists of two parallel plates with opposing charges and some dielectric between them. With DC power, one of the plates charges up until it has enough energy to cross the dielectric barrier. With AC power, a capacitive device works differently because alternating current passes through the dielectric without having to build up a charge on the capacitive plates. The reason this is possible is that the constant switching causes changes in the electric field, which allow the current to flow. These changes in the electric field allow more current to flow the more frequent they become; the higher the frequency, the higher the current.* This phenomenon is represented by equation A.6. A capacitor stores its energy in an electric field and releases it at a different time in the AC cycle, causing the phase shift with the current to lead the voltage by 90°, which is in the opposite direction to an inductive phase shift [25].

1 X = − (A.6) C ωC

XC : The inductive reactance in Ω

ω: The angular AC frequency, which can be found using ω = 2πf, where f is the frequency of the AC power.

C : The capacitance, which in measured in farads (F).

The importance of capacitance and inductance becomes relevant in transmission lines too. The reason for the inductance and capacitance in a transmission line has to do with the geometry of the line and the way the line was constructed. The inductance is prevalent in the transmission system due to the bundling of wires. The wires being bundled together mean that the magnetic fields produced by the AC running the through the wire cause inter- ference in one another resulting in an increase of inductance in the transmission lines. The capacitance comes into play by the electric field generated by the AC in the wires. The im- portance of the capacitance is due to the distance of different phase lines from one another; this causes the electric field to interfere with one another causing an increase of capacitance in the transmission lines. These increases in the inductance and capacitance result in an increase of reactive power in the transmission lines if not controlled.

Complex Numbers and Notation Before proceeding, it is important to understand how complex numbers are used in power system, and their notation in electrical engineering. Complex numbers in power systems and electrical engineering are used to show two different aspects of the electrical power system in one complex number. Complex numbers are essential for describing reactance and resistance (representing impedance) in power system engineering. Impedance is represented as a complex number form where the real numbers are the resistance, and the imaginary part represents the reactance in the AC circuit. The real number is any standard number and measures a physical quantity like resistance. The imaginary part of the complex number is an abstract idea for making the mathematics in complex power work suitably. Imaginary numbers are used to characterize oscillatory behavior [25]. In AC circuit analysis, complex numbers can be thought of as a tool for simplifying a set of linear differential equations into a set of algebraic equations. The use of complex numbers is only possible in power

*For more information on this phenomenon see Chapter 3.2.2 Capacitance in reference: Electric power systems: a conceptual introduction [25]. A.1. ALTERNATING CURRENT 111 systems because all the components used in power system analysis are considered to be passive components like inductors and capacitors [75]. In order to show this mathematically, we first need to start with Euler’s equation, which is given in Equation A.7. ejωt = cos(ωt) + j sin(ωt) (A.7)

Real(ejωt) = cos(ωt): The real part of Euler’s equation.

Imaginary(ejωt) = sin(ωt): The imaginary part of Euler’s equation.

ω: The angular AC frequency, which can be found using ω = 2πf, f where is the frequency of the AC power. t: The time at point t in the equation. √ j: The variable to represent the imaginary part of a complex number, j*= −1.

Euler’s equation can then be rewritten in terms of v(t) and i(t), where v(t) and i(t) are the voltage and current at some time t respectively, shown in Equations A.8 and A.9.

v(t) = VMax cos(ωt + θ) + jVMax sin(ωt + θ)V (A.8) v(t) The voltage at some time t.

VMax The maximum voltage of the sinusoidal waveform or the amplitude of the wave. θ The phase angle of voltage sinusoidal waves.

i(t) = IMax cos(ωt + φ) + jIMax sin(ωt + φ)A (A.9) i(t) The current at some time t.

IMax The maximum current of the sinusoidal waveform or the amplitude of the wave. φ The phase angle of current sinusoidal waves.

Equations A.8 and A.9 can be further simplified by using Equation A.7, resulting in Equa- tions A.10 and A.11. jωt+θ v(t) = VMaxe V (A.10) j(ωt+φ) i(t) = IMaxe A (A.11) These can then be rewritten in phasor or polar notation as Equations A.12 and A.13:

V = VMax∠θ V (A.12)

I = IMax∠φ A (A.13) These can also be rewritten in rectangular notation as Equations A.14 and A.15:

V = < + j= V (A.14)

I = < + j= A (A.15)

*In other disciplines outside of electrical engineering, this is represented as the variable i but in electrical engineering i is often confused with the i for representing current, so therefore j is used. 112 APPENDIX A. ALTERNATING CURRENT

<: The real number in the complex number in the rectangular form.

= : The imaginary number in the complex number in the rectangular form.

The reason for using both polar and rectangular notation is because it is easier to multiply and divide the complex numbers in polar form. In rectangular form is it simpler to add and subtract complex numbers [76]. For a fuller discussion of the use of complex numbers in electrical engineering see Basic Engineering Circuit Analysis [76]. 113

Appendix B

Code

B.1 Code

B.1.1 Preliminary Event Finding Code

1 # Put data througha butterworth bandpass filter b, a = signal.butter(N=2, Wn = (0.001, 0.01), btype=’bandpass’) 3 y = signal.lfilter(b, a, power) ytest = y 5 thresh = 300 w = 1000 7 detector = np.zeros((len(ytest), 1)) fori in range(w, len(ytest)): 9 z = fftpack.fft(ytest[i − w:i]) out = np.absolute(z)[:25] 11 if any(out > thresh): detector[i] = 1 13 flag = 0 indicies = [] 15 fori in range(len(y)): if detector[i]: 17 if flag == 0: indicies.append([i]) 19 flag = 1 else: 21 if flag == 1: indicies[−1].append(i) 23 flag = 0 %matplotlib inline 25 #plt.max_open_warning for i, v in enumerate(indicies): 27 plt.figure(i) plt.grid(True) 29 plt.plot(power[v[0]−1000:v[1]+1000]) Listing B.1: The code used for fing the events in the PMU data when the location of the event was unknown

Code: Method 2: Matched Filter Algorithm

1 signal = pd.DataFrame(power[Start:End])# The PMU data being run through the matched filter. 114 APPENDIX B. CODE

signal_ma = signal.rolling(window=500).mean()# The moving average filter witha window of 500 ←- ,→samples. 3 signal_ma_diff = signal_ma.diff()# The results of the moving average filter being differenced. MF = []# The creation of an empty data set for the results of the matched filter. 5 w = len(event_ma_diff_iso)# Find the length of the the event profile. fori in range(w,len(signal_ma_diff)):# Initiating the For loop for iterating the signal through matched ←- ,→filter from beginning of the PMU 7 #data to the end of the PMU data witha windows of the length of the event profile(w). r = signal_ma_diff[i−w:i]# Defining the signal or PMU data(r[n]) 9 num = np.matmul(r.T, event_ma_diff_iso)# Equation 3.2 in Python code with the moving window. denom = np.sqrt(np.matmul(event_ma_diff_iso.T, event_ma_diff_iso)) * np.sqrt(np.matmul(r.T, r)) 11 MF.append(float(num/denom))# The result of the matched filter being stored in the"MF" variable. Listing B.2: The code used for coding the Matched filter in Python

Code:The code preparing the PMU data

1 filenames = sorted(glob.glob(’C37118−*.csv’))# Finds all the files with the data. df = pd.DataFrame()# Loads the data intoa dataframe. 3 for name in filenames:# indexes the data to the different variables # Pandas method to read data from.csv intoa dataframe 5 temp = pd.read_csv(name, delimiter=’,’,skiprows=2,names=[’Date’,’Time(GMT)’,’Status’,’Frequency’,’ ←- ,→V1VPM Magnitude’,’V1VPM Angle’,’I1YPM Magnitude’,’I1YPM Angle’]) df = df.append(temp, ignore_index=True) 7 Frequency=df[’Frequency’]# stores the frequency data intoa frequency variable # calculates the real power 9 Phi = df[’V1VPM Angle’] − df[’I1YPM Angle’] power = ( np.sqrt(3) * df[’I1YPM Magnitude’] * df[’V1VPM Magnitude’] * np.cos(np.radians(Phi)) )/1e6 11 fig, ax = plt.subplots(1,1) ax.plot(power)# graphs the power over time 13 ax.grid(True) # Converting the data to the per−untit system 15 start = 3020000 end = 3200000 17 d_power = (power[start:end] − power[start])/np.mean(power[start:end]) d_freq = (Frequency[start:end] − Frequency[start])/50 19 # Filter the Active power to remove PMU error d_power_filt = d_power.rolling(window = 500, center = True).mean() 21 d_freq_filt = d_freq.rolling(window = 100, center = True).mean() # Cut data to remove NANs 23 d_freq_cut = d_freq_filt[300:−300] d_power_cut = d_power_filt[300:−300] Listing B.3: The code preparing the PMU data

Code:Loading the event data into Python and preprocessing

1 def transform_and_plot(data, start, end, window, ax1, ax2, ax3, p=1): 2 features = [] fori in range(start, end −window, 100): 4 # Plot the raw data within window ax1.clear() 6 ax1.plot(data[i:i+window]) # Plot the log(fft) of range of window sizes 8 ax2.clear() out_all = [] B.1. CODE 115

10 for ii in range(−100, 100, 10): f, out = do_fft(data[i:i+window+ii], 1) 12 out = np.log(out) out_all.append(out) 14 if p: ax2.plot(f,out) # Plot mean fft result 16 if p: ax2.plot(f,np.mean(out_all, axis=0), color=’r’, linewidth=3.0) ax2.get_axes() 18 plt.ylim([0, 10]) # Difference the result to stationarize 20 ax3.clear() feat = np.diff(np.mean(out_all, axis=0)) 22 features.append(feat) if p: ax3.plot(feat, linewidth = 3.0) 24 ax3.get_axes() plt.ylim([−5, 5]) 26 if p: fig.canvas.draw() return features 28 # Visualize data set of freqency spectrums import warnings 30 warnings.filterwarnings("ignore") %matplotlib notebook 32 fig = plt.figure(figsize=(12,8)) ax1 = fig.add_subplot(311) 34 ax2 = fig.add_subplot(312) ax3 = fig.add_subplot(313) 36 plt.ion() fig.show() 38 fig.canvas.draw() ranges1 = [[power,3037000,3052100], 40 [power,909000,917000]] ranges2 = [[event1,4500,11000], 42 [event2,2500,22500]] col = [’r’,’y’,’m’,’orange’] 44 window = 3000 # Extract features from event 46 features_1 = [] features_2 = [] 48 count = 0 forr in ranges1: 50 features_1.append(transform_and_plot(r[0], r[1], r[2], window, ax1, ax2, ax3, 1)) forr in ranges2: 52 features_2.append(transform_and_plot(r[0], r[1], r[2], window, ax1, ax2, ax3, 1)) # Principal component analysis(PCA) 54 from sklearn.decomposition import PCA pca = PCA(n_components=3) 56 pca.fit( np.concatenate((event_train, nonevent_train), axis=0) ) 58 print(pca.explained_variance_ratio_) event_pca = pca.transform(event_train) 60 nonevent_pca = pca.transform(nonevent_train) %matplotlib inline 62 fig = plt.figure(figsize=(10,20)) ax1 = fig.add_subplot(311) 64 ax2 = fig.add_subplot(312) ax3 = fig.add_subplot(313) 66 ax1.scatter(event_pca[:,0], event_pca[:,1], c =’r’) ax1.scatter(nonevent_pca[:,0], nonevent_pca[:,1], c =’g’) 68 ax1.grid(True) 116 APPENDIX B. CODE

ax1.set_title(’PCA events vs non−events View1’) 70 ax1.legend([’Events’,’Non−events’]) ax2.scatter(event_pca[:,0], event_pca[:,2], c =’r’) 72 ax2.scatter(nonevent_pca[:,0], nonevent_pca[:,2], c =’g’) ax2.grid(True) 74 ax2.set_title(’PCA events vs non−events View2’) ax2.legend([’Event’,’Non−event’]) 76 ax3.scatter(event_pca[:,1], event_pca[:,2], c =’r’) ax3.scatter(nonevent_pca[:,1], nonevent_pca[:,2], c =’g’) 78 ax3.grid(True) ax3.set_title(’PCA events vs non−events View3’) 80 ax3.legend([’Event’,’Non−event’]) plt.savefig(’PCA3D.pdf’) Listing B.4: Loading the event data into Python and preprocessing

Code:The process of the supervised learning with a Gaussian process classifier (GPC)

1 # Do classification using gaussian RBF from sklearn.gaussian_process import GaussianProcessClassifier 3 from sklearn.gaussian_process.kernels import RBF # Establish feature set and targets 5 X = np.concatenate((event_pca[:,1:], nonevent_pca[:,1:]), axis=0) y = np.concatenate((np.ones(shape=np.shape(event_pca)[0]), 7 np.zeros(shape=np.shape(nonevent_pca)[0])), axis=0) # Fit an rbf model 9 kernel = 1.0 * RBF([1.0]) gpc_isotropic = GaussianProcessClassifier(kernel=kernel).fit(X, y) 11 # Prediction and classifier visualization # createa mesh to plot in 13 h = .1 x1_min, x1_max = X[:, 0].min() − 1, X[:, 0].max() + 1 15 x2_min, x2_max = X[:, 1].min() − 1, X[:, 1].max() + 1 xx1, xx2 = np.meshgrid(np.arange(x1_min, x1_max, h), 17 np.arange(x2_min, x2_max, h)) xx1_flat = np.reshape(xx1, [−1,1]) 19 xx2_flat = np.reshape(xx2, [−1,1]) X_flat = np.concatenate((xx1_flat,xx2_flat),axis=1) 21 Z = gpc_isotropic.predict_proba(X_flat) Z2 = np.reshape(Z[:,1], np.shape(xx1)) 23 # Plot plt.figure(figsize=(12,6)) 25 plt.subplot(111) plt.imshow(Z2, extent=(x1_min, x1_max, x2_min, x2_max), origin="lower", cmap=’binary’) 27 plt.colorbar() # Plot the training points 29 plt.scatter(event_pca[:,1], event_pca[:,2], c=’r’) plt.scatter(nonevent_pca[:,1], nonevent_pca[:,2], c=’g’) 31 plt.xlim(x1_min, x1_max) plt.ylim(x2_min, x2_max) 33 plt.title(’Gaussian process classifier’) plt.legend([’Event’,’Non −event’]) Listing B.5: The process of the supervised learning with a Gaussian process classifier (GPC)

Code:The Event Detection Algorithm Test B.1. CODE 117

1 # Visualize real time operation of classifier 2 import time %matplotlib notebook 4 fig = plt.figure(figsize=(14,7)) # ax1= fig.add_subplot(311) 6 # ax2= fig.add_subplot(312) # ax3= fig.add_subplot(313) 8 ax1 = plt.subplot2grid((2, 4), (0, 0), colspan=2) ax2 = plt.subplot2grid((2, 4), (1, 0), colspan=2) 10 ax3 = plt.subplot2grid((2, 4), (0, 2), colspan=2, rowspan=2) # Plot Classifier 12 ax3.imshow(Z2, extent=(x1_min, x1_max, x2_min, x2_max), origin="lower", cmap=’binary’) # Plot also the training points 14 # ax3.scatter(feat_pca_1[:,1], feat_pca_1[:,2],c=’m’) # ax3.scatter(feat_pca_2[:,1], feat_pca_2[:,2],c=’r’) 16 # ax3.scatter(feat_pca_0[:,1], feat_pca_0[:,2],c=’g’) ax3.set_ylim([−4,5.5]) 18 ax3.set_xlim([−3,4.5]) plt.ion() 20 fig.show() fig.canvas.draw() 22 window = 3000 ax1.plot(power[3010000:3080000]) 24 t_store = []#Timing fori in range(3010000, 3080000 − window, 500): 26 # Lines show window location line1, = ax1.plot((i,i),(0,100),’r −’) 28 line2, = ax1.plot((i + window,i + window),(0,100),’r −’) ax1.set_ylim([min(power[3030000:3053000])−1, max(power[3030000:3053000])+1]) 30 start = time.time()#Timing # Plot the log(fft) of range of window sizes 32 ax2.clear() out_all = [] 34 for ii in range(−100, 100, 10): f, out = do_fft(power[i:i+window+ii], 1) 36 out = np.log(out) out_all.append(out) 38 ax2.plot(f,out) # Plot mean fft result 40 m = np.mean(out_all, axis=0) d = np.diff(m) 42 ax2.plot(f, m, color=’r’, linewidth=3.0) ax2.get_axes() 44 ax2.set_ylim([0, 10]) # Plot the current point PCA 46 pca_transform = pca.transform(d)[0] dot = ax3.scatter(pca_transform[1], pca_transform[2], c=’r’, s=100) 48 z = gpc_isotropic.predict_proba(pca_transform[1:])[0] ax3.set_title(’Probability of Event: %.2f’ % z[1]) 50 fig.canvas.draw() # For timing the program 52 end = time.time() t_store.append(end−start) 54 print(end−start) # clearing up the graphs after each step 56 line1.remove() line2.remove() 58 dot.remove() 118 APPENDIX B. CODE

Listing B.6: The Event Detection Algorithm Test

Code:Parameter Identification and Estimation From the Landsnet PMU Data

1 # Track parameters over time −− Test on event data 2 # TODO: recreate theA matrix every iteration, so that the input # and output data is fixed to zero every time... or change the initial 4 # conditions of the tf #t_store=[] 6 #start= time.time() #end= time.time() 8 #t_store.append(end−start) #print(np.mean(end−start)) 10 %matplotlib notebook fig = plt.figure(figsize=(8,12)) 12 ax1 = fig.add_subplot(611)# Power ax2 = fig.add_subplot(612)# Freq 14 ax3 = fig.add_subplot(613)# Freq sim ax4 = ax3.twinx() 16 ax5 = fig.add_subplot(614)# Params ax6 = fig.add_subplot(615) 18 ax7 = fig.add_subplot(616) ax8 = ax7.twinx() 20 plt.ion() fig.show() 22 fig.canvas.draw() win = 10000 24 step = 2000 Time = np.linspace(0, 0.02*win − 0.02, win) 26 Time_all = np.linspace(0, 0.02*len(inp) − 0.02, len(inp)) t_store = [] 28 T_store = [] R_store = [] 30 H_store = [] fail_store = [] 32 rms_z_store = [] rms_c_store = [] 34 rms_ss_store = [] rms_ss2_store = [] 36 xout = np.array([[0,0],[0,0]]) ax1.plot(Time_all, inp) 38 ax1.set_xlim([Time_all[0], Time_all[−1]]) ax1.set_title(’Active Power’) 40 ax2.plot(Time_all, out) ax2.set_xlim([Time_all[0], Time_all[−1]]) 42 ax2.set_title(’Frequency’) fori in range(0,len(inp) −win −1, step): 44 start = time.time() # Lines show window location 46 line1, = ax1.plot((Time_all[i],Time_all[i]),(−100,100),’r −’, linewidth = 3) line2, = ax1.plot((Time_all[i + win],Time_all[i + win]),(−100,100),’r −’, linewidth = 3) 48 ax1.set_ylim([min(inp)−0.01, max(inp)+0.01]) line3, = ax2.plot((Time_all[i],Time_all[i]),(−100,100),’r −’, linewidth = 3) 50 line4, = ax2.plot((Time_all[i + win],Time_all[i + win]),(−100,100),’r −’, linewidth = 3) ax2.set_ylim([min(out)−0.01, max(out)+0.01]) 52 # DeriveDT tf parameters B.1. CODE 119

x = (A[i:i+win,:].T*A[i:i+win,:]).I*(A[i:i+win,:].T)*y[i:i+win] 54 a1 = x.item(0) a0 = x.item(1) 56 b1 = x.item(2) b0 = x.item(3) 58 # DeriveCT tf parameters try: 60 T=−h/np.log(a0) R=(b1+b0)/(1.0+math.exp(−h/T)+a1) 62 w=math.acos(−a1*math.exp(h/(2.0*T))/2.0)/h H = 2.0*T/(R+4.0*R*T**2.0*w**2.0) 64 fail_store.append(0) except: 66 fail_store.append(1) print(’Could not deriveCT tf parameters’) 68 T_store.append(T) R_store.append(R) 70 H_store.append(H) #DT tf 72 NUM_z = [b1,b0] DEN_z = [1,a1,a0] 74 Hz = tf(NUM_z,DEN_z, h) #CT tf 76 NUM_s = [T, 1] DEN_s = [2*H*T, 2*H, 1/R] 78 Hs = tf(NUM_s, DEN_s) # State space representation 80 Hss = tf2ss(Hz) # Simulate response to real power data(currently using state space and initializing state) 82 yout_z, Time, xout1 = lsim(Hz, U = inp[i:i+win], T = Time) yout_c, Time, xout2 = lsim(Hs, U = inp[i:i+win], T = Time) 84 if i <= 0: yout_ss, Time, xout = lsim(Hss, U = inp[i:i+win], T = Time, X0 = [0,0]) 86 else: yout_ss, Time, xout = lsim(Hss, U = inp[i:i+win], T = Time, X0 = xout[:,step−1]) 88 yout_ss2, Time, xout = lsim(Hss, U = inp[i:i+win], T = Time, X0 = [0,0]) # Calculate error 90 rms_z_store.append(np.sqrt(np.mean(np.square(yout_z.T − out[i:i+win])))) rms_c_store.append(np.sqrt(np.mean(np.square(yout_c.T − out[i:i+win])))) 92 rms_ss_store.append(np.sqrt(np.mean(np.square(yout_ss.T − out[i:i+win])))) rms_ss2_store.append(np.sqrt(np.mean(np.square(yout_ss2.T − out[i:i+win])))) 94 # Plot the frequency window and tf results f1, = ax3.plot(Time, out[i:i+win],’b −’, linewidth=3) 96 f2, = ax3.plot(Time, yout_z.T,’r −−’) f3, = ax3.plot(Time, yout_c.T,’g −−’) 98 f4, = ax3.plot(Time, yout_ss.T,’k −−’) f5, = ax3.plot(Time, yout_ss2.T,’c −−’) 100 ax3.set_title(’Frequency Output’) ax3.set_ylim([−max(abs(out[i:i+win])), max(abs(out[i:i+win]))]) 102 # ax4.set_ylim([−max(abs(yout_z.T)), max(abs(yout_z.T))]) # Plot the parameters 104 param1, = ax5.plot(T_store,’g −’) ax5.set_xlim([0, int((len(inp)−win)/step)]) 106 ax5.set_title(’Parameter:T’) param2, = ax6.plot(R_store,’m −’) 108 ax6.set_xlim([0, int((len(inp)−win)/step)]) ax6.set_title(’Parameter:R’) 110 param3, = ax7.plot(H_store,’c −’) ax7.set_xlim([0, int((len(inp)−win)/step)]) 120 APPENDIX B. CODE

112 ax7.set_title(’Parameter:H’) paramf, = ax8.plot(fail_store,’r −’) 114 ax8.set_xlim([0, int((len(inp)−win)/step)]) ax8.set_ylim([−1,2]) 116 fig.tight_layout() fig.canvas.draw() 118 if i != len(inp)−win −1 − (len(inp)−win −1) % step: line1.remove() 120 line2.remove() line3.remove() 122 line4.remove() f1.remove() 124 f2.remove() f3.remove() 126 f4.remove() f5.remove() 128 param1.remove() param2.remove() 130 param3.remove() paramf.remove() 132 end = time.time() t_store.append(end−start) Listing B.7: The Event Detection Algorithm Test 121

Index

Abnormal Events, 5, 24 Landsnet, 1, 48, 92, 93 Active Power, 6 Landsvirkjun, 1 Admittance, 109 Laplace Approximation, 45, 46, 55 AGC, 13 LSE, 30, 57–59, 92, 96 Apparent Power, 7 ARX, 5, 30, 57–59, 81, 92–94, 96, 97 Machine-Learning, 5, 53–55, 93 Axiomatic Design, 22, 98 Matched Filter, 52 Mechanical Torque, 14 Butterworth Bandpass Filter, 49 Modelica, 46, 47, 58, 59, 62, 90

Capacitance, 109, 110 Nadirs, 3 Complex Power, 7, 110 OpenModelica, 6, 47 Continuous Time, 62, 93 Control System, 3, 5, 14 PCA, 40, 42, 50, 54, 90, 97 CSV, 48, 51, 59, 89 PDC, 16, 17, 19, 48, 51, 92 Current Transformers, 5, 16 Per-Unit, 11, 59 Curse of Dimensionality, 55 PMU, 5, 16, 17, 40, 50, 53, 57–59, 61, 92, 93, 95, 96 Data Formats, 48 Potential Transformers, 5, 16 Design Constraints, 23 Power Factor, 7, 9, 106 Design Matrix, 25 Power System, 6 Design Parameter, 23 Python, 46, 47, 49, 59, 96 Discrete Time, 31, 62 DVAR, 13 RBF, 50 Reactance, 109 Electrical Torque, 14 Reactive Power, 6 Event Profile, 52 RMS, 108 RMS Error, 62, 63, 85, 86 Feature, 42, 53 Rotor or Power Angle Stability, 12, 14 FFT, 40, 49, 51, 53, 54, 90, 92 Frequency Control, 12, 13 Scikit-Learn, 55 Functional Requirements, 22–25, 98 Sliding Window, 52, 54, 55, 62, 91, 92 Stability, 4, 12 GPC, 42, 44, 46, 53–55 State-Space, 47, 57, 62, 63, 80–83, 85, 86, 95 Iceland, 1, 2, 48 Step Size, 92 Impedance, 7, 109 SVC, 13 Inductance, 109, 110 Inertia, 2–4, 14, 15, 93 Three-Phase Power, 10 Instrument Transformer, 16 Transfer Functions, 27, 31, 32, 46, 47, 57– Ireland, 2, 3 59, 62, 63, 90, 91, 93, 95, 96 122 INDEX

Voltage Stability, 12, 13 Voltage Transformers, 16

Window Size, 53, 54, 92

ZOH, 57, 59, 61, 62, 80–82, 95

School of Science and Engineering Reykjavík University Menntavegur 1 101 Reykjavík, Iceland Tel. +354 599 6200 Fax +354 599 6201 www.ru.is