UPTEC F 15038 Examensarbete 30 hp Juni 2015

Active rectification and control of magnetization currents in synchronous generators with rotating exciters Implementation of the SVPWM algorithm using MOSFET technology

Tomas Johansson Abstract Active rectification and control of magnetization currents in synchronous generators with rotating exciters Tomas Johansson

Teknisk- naturvetenskaplig fakultet UTH-enheten This thesis aims to design and build a power electronics system for the rectification and control of magnetization currents in synchronous generators with rotating Besöksadress: exciters. Ångströmlaboratoriet Lägerhyddsvägen 1 Hus 4, Plan 0 The rotating exciter provides three-phase AC while the generator rotor needs DC with a high degree of control. The system needs to be able to rectify the three-phase Postadress: AC to a stable DC without unwanted harmonic content, neither on the DC or the Box 536 751 21 Uppsala AC side. For control purposes it is also important that the current in the rotor can be changed very swiftly, preferably by several amperes during a single revolution of Telefon: the machine. 018 – 471 30 03

Telefax: The system of choice is a synchronous bridge consisting of six MOSFET 018 – 471 30 00 switches operated using the Space vector pulse width modulation (SVPWM) algorithm. This method gives a stable and controllable DC voltage while it keeps the Hemsida: harmonic content of the input currents at a minimum. However the DC voltage will http://www.teknat.uu.se/student always be higher than the peak line-to-line voltage from the exciter. To be able to lower the voltage below this value a Buck-converter is placed after the rectifier bridge. To gain a higher degree of control of the current density in the rotor windings the windings have been subdivided into three parts. To provide individual control of the current in the three rotor parts each part have been outfitted with a Push and Pull H-bridge. The proposed system has been both simulated using MATLAB Simulink and built and tested in the laboratory with satisfactory results.

Handledare: Johan Abrahamsson Ämnesgranskare: Urban Lundin Examinator: Tomas Nyberg ISSN: 1401-5757, UPTEC F15 038 Sammanfattning

I detta examensarbete presenteras ett kraftelektroniksystem f¨orf¨orb¨attradkontroll av magnetiseringsst¨ommari vattenkraftsgeneratorer som ¨arutrustade med roterande matare. Generatorer anv¨andsf¨oratt konvertera energi fr˚anr¨orelseenergitill elektrisk energi. Detta g¨orsgenom att man uts¨atterspolar f¨orvarierande magnetf¨alt; d˚ainduceras sp¨anningi spolarna. I vattenkraftsgeneratorer anv¨andsoftast stora elektromagneter placerade i en rotor f¨oratt skapa dessa magnetf¨alt. F¨oratt magnetisera elektromag- neterna beh¨ovsstr¨omsom p˚an˚agots¨attm˚aste¨overf¨orasmellan den statiska och den roterande sidan i generatorn. Traditionellt g¨orsdetta med hj¨alpav sl¨apringar och kol- borstar som genom mekanisk kontakt ¨overf¨orelektriciteten. En roterande matare kan beskrivas som en liten generator som har sina elektriska utg˚angarp˚aden roterande sidan ist¨alletf¨orp˚aden statiska sidan. Genom att placera en roterande matare p˚asamma axel som den stora generatorn kan man ist¨alletalstra den elektricitet som beh¨ovsf¨oratt magnetisera generatorn direkt p˚aden roterande sidan. D¨aregenomundviks m˚angaproblem som ¨arassocierade med l¨osningenmed sl¨apringar. Den roterande mataren ger dock v¨axelstr¨ommedan magnetiseringsstr¨ommenm˚astevara likstr¨om. Det ¨arh¨arkraftelektroniken kommer in i bilden. Det finns flera s¨attatt ˚astadkomma likriktning av str¨om.I det h¨arprojektet har ett fullst¨andigtaktivt system byggts. Systemet ¨aruppbyggt av transistorer av MOSFET typ och kan kontrolleras tr˚adl¨ostmed hj¨alpav Bluetoothteknik. Systemet ger full kontroll ¨over str¨ommaroch sp¨anningarb˚adep˚av¨axelstr¨omssidanoch p˚alikstr¨omssidanoch ska anv¨andastill en testgenerator p˚aavdelningen f¨orell¨aravid Uppsala Universitet. D¨arska den ut¨okade kontroll som systemet ger f¨oruts¨attningartill anv¨andasf¨oratt unders¨oka hur den h¨artypen av system kan optimera de magnetiska krafterna inuti generatorn. En s˚adanoptimering kan minska vibrationerna i generatorn och d¨arigenomminska slitaget p˚alager och andra delar i maskinen. Contents

1 Introduction 1 1.1 Project background ...... 1 1.2 Project description ...... 2 1.3 Limitations ...... 2

2 Theory 4 2.1 Rotating exciter ...... 4 2.2 Power Electronics ...... 4 2.2.1 Devices ...... 4 2.2.2 Pulse Width Modulation ...... 7 2.2.3 ...... 7 2.2.4 Boost converter ...... 9 2.2.5 Three-phase Boost Rectifier ...... 9 2.2.6 Push-Pull H-Bridge ...... 10 2.3 Control system ...... 11 2.3.1 Space Vector Pulse Width Modulation ...... 11 2.3.2 PID - control ...... 13 2.3.3 Hysteresis control ...... 14

3 Method 15 3.1 Power electronics ...... 15 3.1.1 System topology ...... 15 3.1.2 Devices ...... 16 3.2 Simulations ...... 17 3.3 Control system ...... 18 3.3.1 Instrumentation ...... 18 3.3.2 Driver circuits ...... 19 3.3.3 FPGA-programming ...... 19 3.4 Mechanical assembly ...... 20 3.5 Measurements ...... 21 3.5.1 Three-phase rectifier ...... 22 3.5.2 Buck-converter ...... 22

4 Results 23 4.1 Simulations ...... 23 4.2 Measurements ...... 25 4.3 Mechanical assembly ...... 25

5 Discussion and Conclusions 28

6 Bibliography 29 A Component information 31 A.1 List of devices ...... 31 A.2 Driver auxiliaries ...... 31 A.2.1 Input side ...... 31 A.2.2 Output side ...... 33

B Labview program 34 B.1 Main program structure ...... 34 B.2 Angular frequency ...... 34 B.3 Switch sequence calculator ...... 35 B.4 Switch sequence control ...... 36 B.5 Buck converter control ...... 38 B.6 Measurement readings ...... 39 1 Introduction

Hydropower has been an important source for energy throughout history. In today’s society it is mainly utilized to produce electricity and in this capacity it still remains a crucial component of the energy systems in many modern countries. The benefits of hydropower are many: it is a renewable energy source, has a high efficiency and, probably most important, it has a high regulation capability. The last factor makes hydropower excellent to use as a stabilizer for the electrical grid. One of the main problems for hydropower is maintenance, it is very expensive, therefore any system that reduces the amount of necessary maintenance can significantly reduce the cost of power production. One of the driving factors for maintenance of a hydropower generator is the use of slip-rings and carbon-brushes to transfer the magnetization current for the rotor, from the stationary side to the rotating side. The brushes get worn down and needs to be replaced and as they wear down they generate carbon dust. This dust can get mixed up with the lubricant oil, and in the worst case scenario the electrically conductive dust can even cause short circuits in the electric system. A dusty environment is also a health issue for people working at the power plant. One way to avoid the use of slip-rings is to use a rotating exciter, it can be described as a small generator placed on the same shaft as the main generator, the small generator has its electrical output on the rotating side and this electricity is used to magnetize the main rotor.

1.1 Project background

An experimental salient pole synchronous generator, called Svante, located at the divi- sion for Electricity at Uppsala Universitet, was built to be able to test different aspects of electro-mechanical properties in a controlled environment. One of the main research aims was to investigate how rotor eccentricity, with regard to the stator, give rise to unbalanced magnetic pull (UMP) leading to varying mechanical loads throughout the generator structure. [22] The generator has now been outfitted with a permanent magnet rotating exciter provid- ing six-phase alternating current, AC, with a line-to-line voltage of 120 V (rms). It is also possible to connect it as a three-phase machine by connecting the poles in series. Since the exciter generates AC current while the main rotor needs direct current, DC, to operate, a rectifying process is needed. Prior to this project such a rectification has been achieved with a twelve-pulse thyristor bridge. While being a relatively efficient and simple solution it introduces harmonics in the current flow from the exciter which can lead to torque ripple in the exciter.

1 CHAPTER 1. INTRODUCTION 2

1.2 Project description

This project aims to create a system that rectifies the current from the exciter while keeping the input harmonics at a minimum. The rotor needs to be supplied with DC, at current levels up to 30 A. The current needs to have a low ripple and have a fast rise and fall regulation. In addition it is desirable to be able to control the rotor windings separately to achieve a higher degree of control during operation. To make this possible the twelve poles of the rotor have been divided into three parts, each containing four poles with individual current control for each part. The rotor windings have a total inductance of 0.5 H and a resistance of 3.3 Ω, and it is therefore to be considered as a highly inductive load. The control of the system needs to be managed at the stationary side, in order to enable this a parallel project has been conducted by Fredrik Evestedt [5]. His project deals with wireless communication with Bluetooth technology and with the sensor systems mounted on the rotating side. The requirements on the system can be summarized as: • Rectification from three phase AC to DC • No, or low, harmonic content on the input side • Current levels up to 30 A with low ripple (DC-side) • Regulating capabilities fast enough to overlay a sinus wave with amplitude 1 A and frequency 100 Hz • Individual control of three rotor sections

1.3 Limitations

The system needs to be fitted inside a hexagonal metal box to be mounted on top of the shaft of the generator. A schematic of the whole generator, including exciter and control system box is shown in Figure 1.1 and a close-up of the box is shown in Figure 1.2. When the generator turns at synchronous speed the centripetal force at the edge of the box become around 60 times the gravitational force. This has been taken into considera- tion when creating the layout of the components inside the box but no detailed analysis of the mechanical forces has been conducted. The same goes for the thermal situation inside the box; the components used will generate heat that need to be dissipated to the air. Here it is assumed that the rotation of the box will create enough airflow, around the surface and through the openings of the box, to keep the temperature inside the box within acceptable limits. CHAPTER 1. INTRODUCTION 3

Figure 1.1: Schematics of the generator setup with the shaft omitted. The box for the control system can be seen at the top.

The circuitry has been designed to be resistant to electromagnetic interference, however such considerations have been inferior to mechanical limitations regarding space and forces. At the moment Svante is disassembled for a refurbishing of the shaft, so no full scale tests of the system have been conducted.

Figure 1.2: CAD drawing of the box where the system is mounted.

This report deals with the design, mounting and control of the power electronics system for Svante. For information about the wireless communication and the instrumentation see [5]. 2 Theory

2.1 Rotating exciter

The rotating exciter used in the Svante setup is a permanent magnet generator with the power outtake on the rotating side. The permanent magnets are placed in the stator and provides a static magnetic field. The rotor has windings that move through the magnetic field inducing an electromotive force in the windings in accordance with Faraday’s law of induction. A thorough investigation of the exciter is outside the scope of this text but can be found in [15]. For our purposes it is enough to regard the exciter as a three-phase voltage source with roughly sinusoidal output.

2.2 Power Electronics

Power Electronics deals with the use of semi-conductor devices for control of electric power. In this section a brief introduction of the concepts and devices used in this project will be given.

2.2.1 Devices

There are many different devices available for power electronics applications. The most common ones today are based on semiconductor technology, a rapidly developing field where the limits of the devices are pushed further and further while their prices decrease. Below follows descriptions of the devices most commonly used in rectification processes. The choice of which devices to use is a trade off between efficiency, controllability, max- imum ratings and cost.

Diodes

The is the simplest of the semiconductor devices used in power electronics. It has the property that it only allow current to flow when the voltage over the device is forward biased. This property is achieved by a so called pn-junction; by doping a semiconductor with elements that have excess of negative charge carriers (n-type) on one side of the junction and with elements that have an excess of positive charge carriers (p-type) on the other side of the junction an isolating depletion layer is created. The positive and negative charge carriers in the depletion layer annihilate each other while leaving ions in the rest of the material leading to a build-up of potential. By applying an external

4 CHAPTER 2. THEORY 5 voltage in the opposing direction to this internal potential the depletion layer is removed and conduction is allowed. The magnitude of the voltage drop over a diode is material dependent, and stays almost constant with respect to the current flowing through the diode, making the power losses in the device approximately linear with the current [21] according to Pdiode ≈ VdiodeI. (2.1)

Thyristors

A thyristor share most of the properties of a diode with the addition that it blocks current, regardless of the polarity of the voltage, until it receives an activation pulse on its gate terminal. Once the thyristor receives the activation pulse it keeps conducting current until the current drops below a certain limit. It is not possible to make the thyristor turn off at will [14].

Transistors

There are mainly two types of transistors used in power electronics today: Metal Ox- ide Semiconductor Field Effect Transistors, (MOSFETs), and Insulated Gate Bipolar Transistors, (IGBTs). Both the MOSFET and the IGBT are voltage controlled transistor types. The MOSFET has a four-layer structure of p- and n-doped semiconductor material while the IGBT has five layers. To this structure three terminals are connected, they are called source, drain and gate (for IGBTs the terminals are usually referred to as; emitter, collector and gate, here the terminology for MOSFETs will be used for both devices). The structure is made so that no current can flow in any direction unless there is a positive voltage applied between the gate and the source terminal. Once a voltage is applied at the gate the device will conduct current in either direction. The transistors used in power electronics are basically the same as those used in signal electronics but the way they are utilized is different. In signal electronics they are often used as amplifiers by operating in the active region and varying the gate voltage and thereby controlling the amount of current passing through the device. In power electronics they are instead operated in the ohmic region and the gate voltage is applied in pulses between zero and the maximum. When operated like this the transistor can be regarded as a small resistor between source and drain, while being turned on and as an open circuit when turned off. The power dissipated in the transistor in the ON state can therefore be approximated as the power dissipated in a small resistor, ie.

2 Ptransistor = VdsI ≈ I Rds.on. (2.2)

A MOSFET typically has a larger ON resistance than an IGBT and therefore larger conduction losses. CHAPTER 2. THEORY 6

Another source of losses occurs during the actual switching of the device. When the gate voltage is applied the current through the device starts to rise while the voltage over the device falls, this happens during a finite time. As the gate voltage is removed the process is reversed. This is illustrated in Figure 2.1 where the upper curve shows the voltage and current and the lower shows the associated losses.

VD

ID

ID · Rds.on tsw.on tsw.off t

PSW

ID · VD switching loss switching loss t conduction loss

Figure 2.1: Ilustration of the switching losses of a transistor.

MOSFETs have shorter switching time than IGBTs and therefore lower switching losses. In order to keep the transistors from breaking at unwanted voltage spikes when trying to break current in an inductive load most IGBTs and MOSFETs used in power electronics needs to have a diode connected in parallel. This diode is usually included in the transistor modules available on the market. Figure 2.2 shows how an ideal switch is realized with a MOSFET and intrinsic diode.

Figure 2.2: A realization of an ideal switch using a MOSFET with intrinsic diode.

To summarize the differences between MOSFETs and IGBTs the lower ON resistance of the IGBTs makes them more suitable for high current applications (≥100 A) while the lower switching losses of the MOSFETs makes them more suitable for systems using CHAPTER 2. THEORY 7 high switching frequencies (≥50 kHz). IGBTs in general have higher max ratings for both voltages and currents. [14] [18]

2.2.2 Pulse Width Modulation

Pulse Width Modulation (PWM) is one of the most important concepts in the field of Power Electronics. The idea is that if a switch is operated between ON and OFF a pulse train is generated. The height of each pulse is defined by the voltage on the primary side of the switch and the width of the pulses is determined by the time the switch is in its ON state. By modulating the ratio between the ON time and the OFF time, usually referred to as the duty cycle, D, the average voltage level at the secondary side of the switch can be controlled. The duty cycle is defined as t t D = ON = ON (2.3) tON + tOFF Ts where Ts is called the switching time (its inverse is called the switching frequency, fs). There are two main types of DC-DC converters using switching devices with PWM, the Buck-converter and the Boost-converter. The Buck-converter lowers the voltage level at the secondary side while the Boost-converter rises the voltage [17].

2.2.3 Buck converter

A basic topology of a Buck-converter is shown in Figure 2.3. It consists of a voltage source, a two-way-switch, an inductor, a and a load. The switch needs to be two-way to prevent voltage spikes due to discontinuous currents through the inductor. The two way switch can be implemented by either a transistor and a diode or with two transistors operating in complementary mode.

iL L + + V in C load vout - -

Figure 2.3: Basic topology of a DC-DC Buck-converter, ideal switch representation.

The easiest way to describe the operation of the Buck-converter is by considering the pulse train generated by the switch as a square wave between 0 and vin that is run through a low-pass filter. The filter should ideally filter out all harmonics making the CHAPTER 2. THEORY 8 output identical to the mean value of the square wave. Assuming that the capacitor is large enough the output voltage can be approximated as constant in time. The relation between the output and input voltage under this assumption is given by

Z tON Z tOFF  1 tON vout ≈ Vout = Vin dt + 0 dt = Vin = DVin. (2.4) Ts 0 tON Ts

The operation of the converter can be described in two modes. In the first mode the switch is connecting the voltage source to the inductor. In this mode the current through the inductor can be described as di (t) V − V (1 − D)V L = in out = in . (2.5) dt L L

When the switch is in its other position vin is disconnected from the inductor and the corresponding equation for the current through the inductor becomes

di (t) −V −DV L = out = in . (2.6) dt L L

The current through the inductor will describe a triangular waveform with a mean value determined by the load current. The amplitude of the wave, usually referred to as the ripple ∆iL, depends on the inductance, the input voltage and the time the switch is in its upper position and can be found by integrating eq. 2.5,

Z tON 1 (1 − D)vin tON (1 − D)vin DTs(1 − D)vin ∆iL = dt = = . (2.7) 2 0 L 2L 2L Note that in steady state operation integration of eq. 2.6 yields the same result. The necessary size of the capacitor is determined by the maximum allowable voltage ripple, ∆vout. The voltage ripple can be approximated as the amount of extra charge the capacitor needs to handle as the current in the inductor varies. That is the amount of charge going through the inductor during the time period when the inductor current is larger than the average current ∆Q T ∆I ∆v = = s L . (2.8) out C 8C

As seen in equations 2.7 and 2.8 both the voltage ripple and the current ripple is linearly dependent on Ts, this means that by having a shorter switching time, i.e. a higher switching frequency, both types of ripple will be reduced.

Equations 2.4 - 2.8 are only valid when ∆iL is less than the average inductor current and when the capacitor is large enough to keep ∆vout  Vout. For further information and an analysis of the converter properties when these conditions are not fulfilled see for instance [14]. CHAPTER 2. THEORY 9

2.2.4 Boost converter

The Boost-converter is basically a Buck-converter run backwards, it consists of the same components but the inductor is now placed between the voltage source and the switch, as shown in Figure 2.4. The converter has two modes, in the first mode the inductor is short circuited and in the second mode it is connected to the capacitor and load.

iL L + +

vin C load vout - -

Figure 2.4: Basic topology of a DC-DC Boost-converter, ideal switch representation.

When the inductor is short circuited the current through it rises rapidly according to di v L = in , (2.9) dt L and since the current through an inductor cannot be discontinuous the high current keeps flowing even when the switch is flipped into the second mode. The current charges the capacitor that then discharges through the load. By this process the output voltage exceeds the input voltage with the relation [14] v 1 out = . (2.10) vin 1 − D

2.2.5 Three-phase Boost Rectifier

Conversion between three-phase AC and DC can be done using six switches in a bridge configuration as shown in Figure 2.5. The switches can be realized by the use of; , making it a passive rectifier bridge, thyristors, making it semi-active, or with transis- tors making it an active bridge. When using transistors it is important that the two transistors in each leg never conducts at the same time. The main idea with the rectifier bridge is that the switches are turned ON only when the voltage on the AC side is larger than the voltage over the capacitor, thereby always charging the capacitor. When diodes are used this is done automatically as the diodes become forward biased. The problem with a diode bridge is twofold, it doesn’t allow any control of the rectifying process and the current through the inductors have a high harmonic content. Implementing the bridge with transistors instead gives control over the output-voltage and it is also possible to reduce the harmonic content for the currents, however the control system can become rather complicated. CHAPTER 2. THEORY 10

+

C load vout -

Figure 2.5: Three-phase rectifier bridge, ideal switch repre- sentation.

As the name implies the rectified voltage level can be controlled but will always be higher than the peak line-to-line voltage. This is due to the parallel diodes of the transistors which makes it possible to charge the capacitor as long as the capacitor voltage is lower than the line-to-line voltage. The boost effect is achieved by short circuiting the inductors by setting all of the top (or bottom) switches ON at the same time. The effect is analogous to the one discussed in section 2.2.4.

2.2.6 Push-Pull H-Bridge

Current control for an inductive load can be achieved in different ways. The most common and easy is voltage control. It is based on the fact that no load can be purely inductive, there is always a resistive element in the circuit, for instance the wire resistance in a coil. To control the current one then applies the voltage needed to drive the current through the resistance and waits for the current to reach the right level. For highly inductive loads with low resistance this can take a considerable time. One way to get around this problem is to use a push-pull H-bridge configuration as shown in Figure 2.6.

The switches of each leg in the H-bridge is operated in complementary mode and the upper left switch is turned ON together with the lower left one and vice versa. In this way one can change the polarity of the voltage over the inductor at will. To keep the current stable the duty cycle is set to D = 50%, this generates a triangular current shape. To increase the current the duty cycle is adjusted so that the time that the voltage over the inductor is positive is longer than the time it is negative and the current rises. The further from 50% the faster the rise, once the wanted current level is reached the duty cycle is turned back to 50%. It is also possible to quickly reduce and even reverse the CHAPTER 2. THEORY 11

+ L vin + vL − -

Figure 2.6: H-bridge in push-pull configuration. load current. This kind of control becomes faster at higher applied voltage. [7]

2.3 Control system

In order to control the different components of the system a control system is needed. This section covers the theory of the control system used and also discusses some of the crucial hardware needed for its implementation.

2.3.1 Space Vector Pulse Width Modulation

The control of the three-phase rectifier bridge can be done with an algorithm called Space Vector Pulse Width Modulation, SVPWM. The basis of the SVPWM is the Clarke transform (a.k.a. αβ-transform), which is a mathematical transformation mapping the three-phase system to a complex vector plane. In a balanced three-phase system the sum of the voltages in the phases is zero, i.e.

va(t) + vb(t) + vc(t) = 0 (2.11) since the phases are shifted 2π/3 rad from each other. This relationship makes it possible T to transform the three variables to a two dimensional space where the vector [va 0 0] is T T aligned with the horizontal axis, the α-axis, and the vectors [0 vb 0] and [0 0 vc] are rotated 2π/3 rad from each other around the origin as shown in Figure 2.7. [3] The phase voltages can be written as

va = V cos(ωt)

vb = V cos(ωt − 2π/3) (2.12)

vc = V cos(ωt + 2π/3) respectively, where V is the peak value of the voltage. By constructing a vector, called the space vector, 2 ~v(t) = [v + v ej(2π/3) + v e−j(2π/3)] (2.13) 3 a b c CHAPTER 2. THEORY 12

vb

120◦ α

va

vc

Figure 2.7: Relation between three-phase voltages in αβ- coordinates that describes a circle in the complex plane, all three phase voltages can be described simultaneously. Inserting eq. 2.12 in eq. 2.13 yields ~v(t) = V ejωt (2.14) i.e. a vector, with a length that represents the magnitude of the voltage, rotating at a constant speed. Since the six switches of the three-phase bridge has to be switched in complementary mode to avoid short circuits they can be regarded as three two-way switches (Si, i = 1, 2, 3). This means that there are 8 possible switch states to choose from, for convenience they can be represented as binary values where a 1 represents that the upper switch in the leg is ON and the lower is OFF. For example the state (1 0 0) would represent the situation where the top left switch in Figure 2.5 is ON while the other two of the top switches are OFF. The states (1 1 1) and (0 0 0) can be regarded as zero states since no current will flow to the capacitor in these states. The six non-zero switch states can be used as base vectors in the αβ-plane where the vector [1 0 0] is aligned with the α-axis (and va), [0 1 0] is aligned with vb and [0 0 1] is aligned with vc, as shown in Figure 2.8.

As the vector ~v(t) rotates it can be represented as a linear combination of the different switch states. The zero states are used to modulate the length of the vector while the ratio between the two closest states are used to define the angular position. If the space vector is projected onto the two closest state vectors the time that the specific switch state should be used is given by T π  1 = M sin − ωt T 3 s (2.15) T 2 = M sin (ωt)) Ts CHAPTER 2. THEORY 13

Ts Ts Tz/2 T1 T2 Tz/2Tz/2 T2 T1 Tz/2 jβ

[0 1 0] [1 1 0] S1

~v ωt α [0 1 1] [0 0 0] [1 1 1] [1 0 0] S2

[0 0 1] [1 0 1] S3

[000][100][110][111][111][110][100][000]

Figure 2.8: The different switch-states shown as a hexagon in the αβ-plane along with an example of the switching se- quence that minimizes the amount of switching needed for implementation.

where T1 is the time for the switch state closest to the right of the space vector and T2 is the time for the switch state closest to the left. M is called the modulation index and ranges from 0 to 1, the remainder of the switching time Ts is to be in one of the zero-states. In the right part of Figure 2.8 a switching sequence that only requires the individual switch to operate once during each switch period is shown, by using the two different zero-states the number of switchings have been reduced. [17]

2.3.2 PID - control

One of the most widely used control techniques is the PID regulator (even though the D part is usually omitted). PID stands for Proportional Integrative Derivative and it is a feedback control system. By measuring a quantity, comparing it with the desired value and feeding the error into the PID equation a control signal for the regulator is achieved. For example if the PID control is used to regulate the output voltage of a Buck converter the desired voltage would be compared with the measured voltage and the regulator would adjust the duty cycle of the converter so that the desired value is achieved. The PID equation has, as the name implies, three parts

Z t de(t) ut = KP e(t) + KI e(τ) dτ + KD , (2.16) t0 dt here u(t) is the control signal and e(t) is the error of the measurement, KP , KI and CHAPTER 2. THEORY 14

KD are parameters that needs to be properly set in order to make the system behave as desired. A simple way to adjust the parameters is by testing. Starting with all parameters at 0 one starts increasing KP until the system starts to oscillate with a constant amplitude, measure the period of the oscillations and set KP to around half of the value that gives the oscillations. KI is then set to around the inverse of the oscillation period and KD is set at about 1/8 of the oscillation period. This adjustment is rather rough but it gives a starting point around which the parameters can be fine tuned. [6] 3 Method

In this section the method of choice for creating a system that fulfils the project require- ments will be discussed. The different choices regarding system topology, component selection and methods of control will be presented along with arguments as to why this particular solution has been chosen.

3.1 Power electronics

3.1.1 System topology

In order to create a system that fulfils the requirements of the project, as defined in section 1.2, a combination of a three-phase Boost rectifier, a Buck converter and three Push-Pull H-bridges has been used. The topology of the system is shown in Figure 3.1. Each of the H-bridges are used to control the current through one third of the rotor windings.

Lbuck C1 L/3 L/3 L/3 C2

Figure 3.1: Full system realization with ideal switch repre- sentation.

A rectifier bridge consisting of transistors are chosen since it has the possibility to give a stable DC-link voltage while it keeps the harmonic content of the currents on the AC side at a minimum. However since the output voltage of the rectifier will always be higher than the line-to-line voltage of the 3-phase source which in this case is 120 Vrms i.e. 170 Vpp the DC-side voltage will be very high compared to the voltage necessary to drive a 30 A current through the rotor. The rotor windings have a resistance of 3.3 Ω when connected as a single unit. When split up into three parts connected in parallel, the equivalent resistance is only 0.37 Ω which means that a voltage of around 11 V would be sufficient to drive the current (this reasoning does not take into account the

15 CHAPTER 3. METHOD 16 parasitic resistances of connectors and other components of the system and should only be regarded in a qualitative sense). The high voltage can lead to unwanted effects: it will lead to a high current ripple in the operation of the push-pull H-bridges and there is an increased risk of damage in the insulation of the rotor windings [11]. To reduce these factors, and also to gain a higher level of control, a Buck-converter is placed between the rectifier bridge and the push- pull H-bridges. This configuration makes it possible to choose the voltage on capacitor C2 from 0 up to several hundred volts. The high degree of control of the voltage level makes it possible to use the same system to test the properties of many different control parameters.

3.1.2 Devices

The ideal switches used to describe the system in Figure 3.1 have to be realized using existing components. For this system transistor switches of MOSFET type have been used. The reasons for choosing MOSFET technology and not IGBT are twofold, the most important factor is the possibility to use higher switching frequencies which means that the necessary size of the of the system decreases. In addition to this the MOSFET technology has a more rapid development right now and predictions has it that MOSFETs will surpass IGBTs in all areas in the near future. The switching frequency used is 50 kHz which is an order of magnitude higher than would have been possible with IGBTs. The high switching frequency makes it possible to use thin-film capacitors instead of electrolytic capacitors. Using thin-film capacitors have the advantage of higher reliability, reduced weight and longer lifetime compared to electrolytic ones. Electrolytic capacitors also contain fluids which might be problematic with the high accelerations they will have to endure as the system rotates. The MOSFETs used must be able to handle the voltage and current levels, the device chosen is rated for voltages up to 500 V and continuous currents of 90 A. A total of six thin-film capacitors with a capacitance of 250µF and voltage rating of 500 V has been used to achieve the necessary capacitance for the system and a 200 µH inductor has been realized by winding two coils with 15 turns each around a PM ferrite core. To ensure that the currents from the exciter does not exceed the limits of the devices each of the three phases is fused with 80 A fuses. (for more information on the devices see Appendix A.1) CHAPTER 3. METHOD 17

3.2 Simulations

The simulations of the system have been done with MATLAB Simulink. From the graphically defined circuit, shown in Figure 3.2, Simulink derives the differential equa- tions governing the system, then the equations are solved using a variable step implicit Runge-Kutta method called ode23tb. A convergence study using smaller and smaller step-sizes and a control test using the Dormand-Prince algorithm ode45 have been done to verify the results. In the simulations the exciter has been modeled as an ideal voltage source with a series inductance and resistance. The rectifier bridge is controlled by a SVPWM-generator (a model of this was available in the Simulink libraries) having a fixed modulation index, M, of 0.8 and using the phase of the voltage source to determine ωt. The Buck-converter is controlled by a PWM generator using a PID-controller to determine the duty cycle, D, the reference voltage is set to 80 V. The H-bridges are also controlled with PID-control having a reference current of 25 A with a superimposed sinus wave with amplitude 1 A and frequency 100Hz to test if the system responds fast enough.

Figure 3.2: The model used for the simulations. The sub- system to the right contains the three H-bridges.

The different blocks in Figure 3.2 represents, from left to right: 1. Three-phase voltage source 2. Measurements of voltages and currents from the source 3. Phase locked loop to determine the phase angle of the voltage source 4. Series inductance and resistance to model the exciter 5. Measurements of voltages and currents at the terminals of the exciter model 6. SVPWM-generator CHAPTER 3. METHOD 18

7. Three-phase boost rectifier using MOSFETs 8. PID-controlled PWM generator for control of the Buck converter 9. Buck converter using MOSFETs 10. Three H bridges for current control in rotor

3.3 Control system

In order to control the system during operation the control signals have to be transferred from the stationary to the rotating side of the generator. This will be done wirelessly using Bluetooth technology. The Bluetooth has some latency making it unsuited for relaying the information needed for all the control, instead it will be used to relay measurement information and reference values to a realtime input output module (RIO) placed on the rotating side. The RIO is of the type NI sbRIO 9606 [8] and it is outfitted with a Field Programmable Gate Array (FPGA), a powerful calculating device that has the ability to simultaneously process numerous threads which makes it perfect to use for implementing the necessary control systems. The RIO is connected to a NI 9683 mezzanine card [9] that gives it 16 analog input channels with fast analog to digital converters, ADCs and 13 digital outputs suited for sending the control signals to the driver circuits. For more details see [5].

3.3.1 Instrumentation

The input signals needed for the control system are measurements of the two different DC voltage levels, current measurements for the three rotor parts and the phase-angle of the voltage from the exciter. The voltage levels are determined with differential voltage measurement sensors based on the Hall effect from the current through a very large resistor (40kΩ), the sensors are of the model LEM LV 25-P. The current drawn through the voltage sensors will over time discharge the capacitors making them safe to touch a couple of minutes after operation. The currents are measured with Hall effect sensors of the model LEM LA 55-P. The phase angle of the exciter will be measured and calculated from measurements of the magnetic fields at the exciter windings. This method has the drawback that the magnetic fields will be shifted due to the opposing field generated by the induced currents in the exciter, how large this effect will be is depending on the amount of current flowing, therefore the currents from the exciter are measured using the same sensor type as the currents in the main rotor. For more details see [5]. CHAPTER 3. METHOD 19

3.3.2 Driver circuits

The MOSFETs performance is highly dependent on the voltage applied between the gate terminal and the source terminal. The correct voltage needs to be applied and withdrawn fast and it needs to be kept stable even though the source voltage changes. The digital signal output from the RIO is not sufficient to ensure proper operation, a so called driver circuit is necessary. The driver circuit is used as an amplifier making sure that the gate voltage is reached fast. The gate terminal can be regarded as a small capacitor that needs to be charged before the switch opens, this means that a considerable current needs to flow from the driver to the switch at turn ON and back again at turn OFF. The drivers used in the system is of the type SCALETM2SC0108T, this driver has some additional features. It drives two switches, either individually controlled or run in com- plementary mode, i.e. when one is on the other is off. Since all switches in this system should be operated in complementary mode this mode is selected. The driver also has inbuilt protection for over voltages and currents in the switch, and when an error occurs it sends back a signal to tell the program about it. To adjust the parameters of the driver to the specific MOSFET device some external circuitry is needed (see Appendix A.2). The main reason for choosing this particular driver was that it has been used by the department before and therefore the necessary interface PCB (Printed Circuit Board) already existed.

3.3.3 FPGA-programming

The programming of the FPGA has been done in the program Labview. Labview has a graphical programming interface that makes it easy to keep track of the different threads running in the FPGA. It is also very easy to create graphical interfaces to let the user interact with the program while it is running. When programming a FPGA it is necessary to keep track of the timing between different parts of the program, otherwise the thread that calculates the control signal to be sent might not have finished when the signal is sent. This would lead to the wrong signal being sent which can reduce the controllability of the system. Thankfully Labview is able to tell how many ticks (i.e. internal time units, for this FPGA 1 tick = 2.5×10−8s) each operation takes, and it is also possible to create timed loops to ensure compatibility. Another important factor to keep in mind is that the FPGA doesn’t handle continuous numbers and that each number representation has to be defined by how many bits that should be used for it. Since the available space on the FPGA is limited it is advised to use as few bits as possible. Keeping these things in mind the implementation of the algorithms described in section 2.3 is rather straight forward. For more details of the program see Appendix B. CHAPTER 3. METHOD 20

3.4 Mechanical assembly

As stated in the introduction the system have to fit inside a hexagonal metal box attached to the shaft of the generator. The box measures 405 mm from side to side and the shaft that runs through it has a diameter of 165 mm, the space available for mounting the system is shown in a CAD drawing in Figure 1.2 Since the box is electrically conductive it will act as a shield for electromagnetic fields, both protecting the components on the inside from outside fields and the outside from the fields created inside the box. The electrical conductivity also means that care has to be taken not to accidentally short circuit any of the components. For this reason a number of plastic fixtures have been designed and manufactured for the PCBs of the driver circuits and the measurement devices. The fixtures are needed to attach the devices to the surface of the box in a safe way. Figure 3.3 shows the driver PCB inside its fixture. The fixtures were designed in SolidWorks and manufactured in ABS-plastic using a 3D-printer.

Figure 3.3: One of the driver PCBs inside its fixture of ABS plastic.

When the generator is operating at synchronous speed the shaft rotation is ca. 50/6 turns per second, this means that the centripetal acceleration at the edges of the box reaches just below 60 times the gravitational force on Earth. This makes it very important to distribute the components with a high degree of symmetry to avoid unbalances. The components that need to fit inside the box are: - 8 MOSFETs - 4 driver circuit boards - 3 capacitors - 2 inductors - RIO card with mezzanine card CHAPTER 3. METHOD 21

Figure 3.4: The plan for the layout of the components in the box, the gray cylinders represents the inductors.

- 3 fuses - connectors between all components A power supply is also needed to provide the power for the RIO, the Bluetooth, driver circuits and the instrumentation. The inductors are the heaviest of the components and are therefore placed in opposing corners from each other. The weight of the RIO and the power supply are placed on opposite sides as well. The MOSFETS are placed in opposing corners and the capacitors are placed as symmetrically as possible. The layout, without all the wires that will be attached to the central hub by means of terminal sockets, is shown as a CAD drawing in Figure 3.4. The restricted space in the box along with its placement on top of the shaft makes it impractical to place the push-pull H-bridges inside the box. By instead placing them directly on top of the main rotor the number of cables that needs to go from the box to the rotor is reduced from six to two. Three of the capacitors of the system will also be placed at the rotor instead of inside the box to reduce the distance the charges will have to travel as the H-bridges change their switch-state.

3.5 Measurements

The generator is currently disassembled due to a refurbishing of the shaft, this makes it impossible to conduct full scale tests of the system. Therefore the system has been tested on a test-bench where each part of the system has been investigated separately. CHAPTER 3. METHOD 22

3.5.1 Three-phase rectifier

For the control of the three-phase rectifier the phase-angle of the input voltage needs to be determined. Since this is supposed to be done via measurements of the magnetic fields in the exciter there is no means to test the rectification operation. However, the rectifier can be connected in reverse, turning it into a three-phase inverter instead. By connecting the bridge to a DC voltage source and running the SVPWM algorithm a three-phase current can be generated through an external inductive load to test if the algorithm is working properly.

3.5.2 Buck-converter

The buck-converter is also tested in reverse mode, i.e. it acts as a boost-converter. By supplying a DC voltage at the range corresponding to the output voltage to capacitor C2 the voltage on capacitor C1 is boosted to a level corresponding to the input from the exciter. 4 Results

4.1 Simulations

The simulations have been iterated until satisfactory results were achieved. Figures 4.1 to 4.4 shows the final results from the simulations at different stages of the system. The component values used in the simulation are:

• C1 = 500µF

• C2 = 1000µF

• Lbuck = 200µH with the names defined in Figure 3.1. The simulation time is 0.3 s and the simulations start from an uncharged state. Figure 4.1 shows how the voltages and current on the AC side changes with time. The top curve shows the voltage from the ideal source, the middle one shows the currents entering the rectifier bridge and the bottom curve shows the voltages just before the rectifier. The colorful areas in the bottom curve represents a switched voltage, the voltage at the switches changes between 0 V and 150 V with a frequency of 50 kHz making it look like an area in the figure. The transient behavior that lasts for approximately 0.07 s is the time it takes for the system to reach a steady state operation with 25 A running through the rotor windings.

Figure 4.1: Simulated values for the voltages and currents on the AC-side of the rectifier. The top part shows the volt- age from the ideal sources, the middle one shows the current through the inductors and the bottom part shows the voltage at the switches.

23 CHAPTER 4. RESULTS 24

Figures 4.2 and 4.3 shows the simulated DC voltages before and after the Buck-converter. Note that the PID-control of the Buck-converter keeps the voltage level steady at 80 V even though the input voltage varies heavily in the beginning.

Figure 4.2: Simulations of the voltage on the DC-side of the rectifier.

Figure 4.3: Simulations of the voltage on the low DC-side of the Buck-converter.

The current through one part of the rotor windings is shown in Figure 4.4. From the start the control system is set to reach 25 A as quickly as possible, this is reached after around 0.7 s. At time 0.15 s the control system is set to superpose a sinus wave with an amplitude of 1 A and a frequency of 100 Hz, the curve follows this control nicely. CHAPTER 4. RESULTS 25

Figure 4.4: Simulations of the current in one of the parts of the rotor windings.

4.2 Measurements

Since Svante is currently disassembled no full scale measurements have been possible. To test the system in the lab the system has to be run backwards, i.e. a DC source is connected to the low level DC output, the buck converter works as a boost converter instead and an inductive Y-connected load is connected where the three phase voltage input would be. In Figure 4.5 the voltage level of the high level DC is shown in green and the othe colors shows the currents through the inductive load. The DC source has a voltage of 60 V, is boosted up to 200 V and run through a load with 20 mH and 58 Ω. The SVPWM algorithm is run to generate a three-phase sinus with a frequency of 50 Hz. The sample measurement shown in Figure 4.5 is noisy but by taking a 16 sample average measurement, shown in Figure 4.6, the three-phase sinusoids become apparent. Note that the scaling of the vertical axis is different between the two figures.

4.3 Mechanical assembly

Figure 4.7 shows the hexagonal box with all components and wires. It is a tight fit and the assembly is slightly heavier on the left side of the figure, this unbalance needs to be corrected by adding some weight on the opposing side. CHAPTER 4. RESULTS 26

Figure 4.5: Measurement on the system when run backwards using a 60 V DC source and a Y-connected load of 20 mH and 58 Ω.

Figure 4.6: 16 samples average measurement on the system. CHAPTER 4. RESULTS 27

Figure 4.7: Picture of the box with the system mounted. The control system box is missing but can be mounted on the right side of the picture. 5 Discussion and Conclusions

According to the simulations made of the system it should be able to fulfil all the requirements. The measurements that has been done supports the simulated results to a high degree except for the noise seen in Figure 4.5. The most likely reason for this noise is called ringing. This phenomenon occurs when the time it takes to open or close a switch is very short which gives rise to discontinuities in the current. Since every part of the circuit has some parasitic inductance these discontinuities gives rise to voltage spikes. One way to reduce this problem is the use of snubber circuits, usually a kind of RC-filter placed in parallel with the switch. Optimization of such circuitry will need to be done in the future if the measured noise appears to have any considerable effects on the operation of the system during full scale operations. The H bridges planned for the current control to the main rotor parts have not been tested but the principle has been thoroughly tested in other systems at the division, see for instance [7]. The full system realization is a bit more complex than an equivalent system for com- mercial uses would be. This makes it less efficient and more difficult to control. It also makes the system less reliable since there are more components with the possibility to fail. However the system is also more versatile than a commercial system needs to be. This versatility makes this system an excellent starting point in the developing process of systems to use at real hydropower plants. Hopefully the results from measurements on the generator performance using different parameters for control of this hardware will give a better knowledge about what parts of the system that should be used in the future. As seen in Figure 4.6 the current from the exciter follows a sinusoidal shape in a much better way than a thyristor bridge is able to do it (see for instance [15]). This should reduce the torque ripple in the exciter leading to less wear in the bearings and support structure of the generator. Even if the control system for the three-phase bridge would fail the intrinsic body diodes of the MOSFETs will still rectify the current making it possible to keep operation with only a loss of efficiency. This gives the system some redundancy which is important to reduce the maintenance costs.

28 6 Bibliography

[1] EPCOS AG. PolarhvTMhiperfet . http://en.tdk.eu/inf/80/db/ fer_13/pm_87_70.pdf, 2013. [2] Bussmann. Iec cylindrical fuse system. http://www.farnell.com/datasheets/ 353858.pdf, 2002. [3] Edith Clarke. Circuit analysis of AC power systems, volume 1. Wiley, 1943. [4] PHOENIX CONTACT. Terminal block ut 16 bu. http://www.farnell.com/ datasheets/1514102.pdf, 2011. [5] Fredrik Evestedt. Wireless control and measurement system for a hydro power generator with brushless exciter. 2015. [6] Torkel Glad and Lennart Ljung. Reglerteknik : grundl¨aggandeteori. Studentlitt., Lund, 1981. [7] Janaina Goncalves de Oliveira, Johan Abrahamsson, and Hans Bernhoff. Battery discharging power control in a double-wound flywheel system applied to electric vehicles. International Journal of Emerging Electric Power Systems, 12(1), 2011. [8] National Instruments. Oem operating instructions and specifications ni sbrio- 9605/9606. http://www.ni.com/pdf/manuals/373378d.pdf, 2013. [9] National Instruments. User guide and specifications ni 9683. http://www.ni.com/ pdf/manuals/375960b.pdf, 2013. [10] IXYS. PolarhvTMhiperfet power mosfet. http://ixdev.ixys.com/DataSheet/ 99497.pdf, 2006. [11] Martin Kaufhold, H Aninger, Matthias Berth, Joachim Speck, and Martin Eber- hardt. Electrical stress and failure mechanism of the winding insulation in pwm- inverter-fed low-voltage induction motors. Industrial Electronics, IEEE Transac- tions on, 47(2):396–402, 2000. [12] LEM. Current transducer la 55-p. http://www.lem.com/docs/products/la% 2055-p%20e.pdf, 2009. [13] LEM. Voltage transducer lv 25-p. http://www.lem.com/docs/products/lv% 2025-p.pdf, 2012. [14] Ned Mohan, Tore Marvin Undeland, and William P. Robbins. Power electronics : converters, applications and design. Wiley, Hoboken, N.J., 2003. [15] Jonas N¨oland.Electromagnetic analysis of rotating permanent magnet exciters for hydroelectric generators, 2013.

29 CHAPTER 6. BIBLIOGRAPHY 30

[16] Power Integrations, inc. SCALETM-2 and SCALETM-2+2SC0108T Preliminary Description Application Manual, 2015. [17] M. H. Rashid, Narendra Kumar, and Ashish R. Kulkarni. Power electronics : devices, circuits, and applications. Pearson Education Limited, Harlow, 2014. [18] Muhammad H. Rashid. Power electronics handbook: devices, circuits, and applica- tions handbook. Elsevier, Burlington, MA, 2011. [19] Vishay Roederstein. Mkp1848c dc-link. http://www.vishay.com/docs/26015/ mkp1848cdclink.pdf, 2013. [20] MERSEN / FERRAZ SHAWMUT. Mersen t331079 fuse holder. http://www. farnell.com/datasheets/1670690.pdf, 2010. [21] Neil. Storey. Electronics : a systems approach. Pearson/Prentice Hall, Harlow, England, 4th ed. edition, 2009. [22] Mattias Wallin, M Ranl¨of,and Urban Lundin. Design and construction of a syn- chronous generator test setup. In Electrical Machines (ICEM), 2010 XIX Interna- tional Conference on, pages 1–5. IEEE, 2010. A Component information

A.1 List of devices

Table A.1 lists the names of the main devices used in the system. Not included in the list is the wires used and the small components used on the PCBs for the drivers and measurement interface. The wires are 16 mm2 insulated copper wires and are rated for currents up to 100 A.

Table A.1: The main devices of the system

Device type Device Name Value Maximum ratings Quantity Reference Voltage Current Power MOSFET IXFN100N50P 500 V 90 A 20 [10] Capacitor MKP1848C72550JY5 250 µF 500 V 6 [19] Inductor FERRITE CORE PM 87 N87 120 µH 2 [1] Voltage transducer LEM LV 25-P 2 [13] Current transducer LEM LA 55-P 6 [12] Driver SCALETM2SC0108T 10 [16] Fuses BUSSMAN C22M80 500 V 80 A 3 [2] Fuse holder MERSEN T331079 3 [20] Terminal block PHOENIX CONTACT UT 16 BU 8 kV 101 A 21 [4]

A.2 Driver auxiliaries

As stated in section 3.3.2 the Scale 2 drivers have some special properties that needs to be adjusted by external circuitry. The driver have a 18 pin interface where 8 pins are designated inputs and the other 10 are divided into two groups containing five pins for each of the two transistors that the driver is designed to control.

A.2.1 Input side

The recommended circuitry for the input side of the driver is shown in Figure A.1. The Schmitt-triggers and diodes shown in Figure A.1 are used to make sure that the input signals are strong enough to trigger the driver. The resistor named Rb is used to define how the driver shall act if it detects an error. If Rb = 0Ω the driver will stop its

31 APPENDIX A. COMPONENT INFORMATION 32

Figure A.1: The recommended circuitry for the input side of the driver. operation for a minimum time, somewhere around 9 µs this time then increases linearly with the resistor value and reaches a maximum of 130 ms. For our purpose a blocking time of 20 ms is chosen by adding a resistor of 71.5 Ω.

The resistor named Rm defines if the driver should operate with individual signals for the different transistors or if it shall use a complimentary mode. In complementary mode the operation of the transistors is visualized in Figure A.2, the dead time defined in the figure is determined by the value of the resistor Rm.

Figure A.2: The principle of complementary mode operation of the driver.

The dead time and the resistance of Rm is related by

Rm[kΩ] = 33 · Td[µs] + 56.4 (A.1) where 73 kΩ < Rm < 182 kΩ. Since the MOSFETs the driver is supposed to control APPENDIX A. COMPONENT INFORMATION 33

Figure A.3: The circuitry to be used on the output side of the driver. have a very short switching time the dead time is set as low as possible.

A.2.2 Output side

Figure A.3 shows the recommended circuitry for the output side of the driver. The resistors Rg,offX and Rg,onX are used to regulate how fast the gate potential of the MOSFET will change between the ON and OFF potentials. Smaller resistors makes the response faster. The Schottky diodes are used to enable the so called active clamping. When the diodes starts to conduct backwards the potential at the gate terminal rises slightly opening the switch into its active region to let a small current run through the device. This circuit protects the transistor from transient over voltages. The other components are used to detect if the current through the transistor rises to fast. The driver will then close the switch to protect it. [16] B Labview program

This appendix describes the functions of the Labview program used to control the power electronics system during the experiments.

B.1 Main program structure

The program is built up around four parallel while-loop structures as shown in Figure B.1. Each of the loops run independently from the others and information is passed between the loops by the use of local variables.

Figure B.1: Main structure of the program.

Here the different loops will be described one by one.

B.2 Angular frequency

To describe the angular position of the space vector of the SVPWM algorithm a sawtooth wave is generated. This is done by creating an additive function that raises its value by one for each turn of the loop and then resets to zero once it reaches a set value. This is achieved by the loop in the middle of the top row in Figure B.1. A closeup of the loop is found in Figure B.2.

34 APPENDIX B. LABVIEW PROGRAM 35

Figure B.2: Ramping function to give the angular position for the space vector.

The wait function (represented by the hourglass) enables control of how many ticks each loop-iteration takes. Each tick is 2.5 · 10−8 s and to make the frequency of the sawtooth wave be 50 Hz the nuber of loop iterations before reset times the number of ticks the iteration takes should be equal to 800 000. This part of the program is needed for the measurement setup used in the lab but will be replaced by a Phase Locked Loop based on the magnetic field measurements when the system is mounted on the generator. Such a loop will return the angular position. As long as the angular velocity is constant the angular position measurements will be analogous to the synthetic sawtooth wave.

B.3 Switch sequence calculator

Once the angular position is determined, either by synthesising a sawtooth wave or by measurements, the suitable switching frequency needs to be determined. By dividing the SVPWM hexagon into six sectors, as shown in figure B.3, one can determine which two switch states that are closest to the space vector by dividing the angular position value with one sixth of its peak value.

[0 1 0] 2 [1 1 0] 3 1 ~v ωt [0 1 1] [0 0 0] [1 1 1] [1 0 0] 4 6

[0 0 1] 5 [1 0 1]

Figure B.3: Definition of the different sectors of the SVPWM algoritm. APPENDIX B. LABVIEW PROGRAM 36

This is done in the sub VI in the middle of Figure B.4. This sub VI returns which sector the space vector is in and the remainder after the division. This remainder is then normalised to lie between zero and one third.

Figure B.4: Determines which of the sectors the space vector is in and the angular position with respect to the state vector closest to the right.

The second sub VI in Figure B.4 is calculating the times the different switch state should be used by calculating eq. 2.15. The sine function blocks returns the sine of π times the input number.

Figure B.5: Calculates the switching times depending on the angular position of the space vector.

B.4 Switch sequence control

The loop in the bottom left corner of Figure B.1 controls the switches. The loop contains one conditional structure inside which there is a stacked sequence. The conditional APPENDIX B. LABVIEW PROGRAM 37

Figure B.6: Stacked sequence, each switch state is activated for a certain time. structure takes input values between 0 and 5 and defines which switch state that should be active for T1 and which that shall be active for T2. The stacked sequence implements the switching sequence shown in Figure 2.8.

Figure B.7: Definition of what switch to activate in each switch-state. APPENDIX B. LABVIEW PROGRAM 38

Figure B.8: Output port definition

Figure B.9: Generation of the PWM signal for the Buck- converter

The sub VI inside the stacked sequence defines what switches to use for each of the switching states, this is done by the logical network shown in Figure B.7. The sub VI in the Figure B.7 in turn calls a sub VI that defines which of the output ports of the RIO that should be activated, this process is shown in Figure B.8.

B.5 Buck converter control

The loop shown in close up in Figure B.9 contains the control for the Buck converter.

The wait function in the top left corner is used to define the switching time and the wait function in the left part of the flat sequence defines how long for each period the switch shall be ON. The duty cycle is simply the ratio between the two wait times. APPENDIX B. LABVIEW PROGRAM 39

B.6 Measurement readings

Figure B.10 shows how to obtain the measurement values from the different sensors in the system.

Figure B.10: Acquiring readings from the voltage and cur- rent measurements.