EXAMENSARBETE INOM ELEKTROTEKNIK, AVANCERAD NIVÅ, 30 HP STOCKHOLM, SVERIGE 2017

Construction of an Active Rectifier for a Transverse-Flux Wave Power Generator

OLOF BRANDT LUNDQVIST

KTH SKOLAN FÖR ELEKTRO- OCH SYSTEMTEKNIK 1 Sammanfattning

Vågkraft är en energikälla som skulle kunna göra en avgörande skillnad i om- ställningen mot en hållbar energisektor. Tillväxten för vågkraft har dock inte varit lika snabb som tillväxten för andra förnybara energislag, såsom vindkraft och solkraft. Vissa tekniska hinder kvarstår innan ett stort genombrott för våg- kraft kan bli möjligt. Ett hinder fram tills nu har varit de låga spänningarna och de resulterande höga effektförlusterna i många vågkraftverk. En ny typ av våg- kraftsgenerator, som har tagits fram av Anders Hagnestål vid KTH i Stockholm, avser att lösa dessa problem. I det här examensarbetet behandlas det effekte- lektroniska omvandlingssystemet för Anders Hagneståls generator. Det beskriver planerings- och konstruktionsprocessen för en enfasig AC/DC-omvandlare, som så småningom skall bli en del av det större omvandlingssystemet för generatorn. Ett kontrollsystem för omvandlaren, baserat på hystereskontroll för strömmen, planeras och sätts ihop. Den färdiga enfasomvandlaren visar goda resultat under drift som växelriktare. Dock kvarstår visst konstruktionsarbete och viss kalibre- ring av det digitala kontrollsystemet innan omvandlaren kan användas för sin uppgift i effektomvandlingen hos vågkraftverket.

2 2 Abstract

Wave power is an energy source which could make a decisive difference in the transition towards a more sustainable energy sector. The growth of wave power production has however not been as rapid as the growth in other renewable energy fields, such as wind power and solar power. Some technical obstacles remain before a major breakthrough for wave power can be expected. One obstacle so far has been the low voltages and the resulting high power losses in many wave power plants. A new type of wave power generator, which has been invented by Anders Hagnestål at KTH in Stockholm, aims to solve these problems. This master’s thesis deals with the power electronic converter system for Anders Hagnestål’s generator. It describes the planning and construction process for a single-phase AC/DC converter, which will eventually be a part of the larger converter system for the generator. A control system based on hysteresis current control is planned and assembled. The finished single-phase converter shows agreeable results working as an inverter, generating a distinctly sinusoidal AC voltage. However, some additional construction and calibration in the digital control system remain, before the converter can be used in the power conversion for a wave power plant.

3 3 Acknowledgements

To my parents and to my brother I want to express my appreciation for their love and support throughout my life.

To Anders Hagnestål for letting me be part of the development in his inno- vative research project, which is contributing to the technical development and future prospects of wave power.

To Aliro Cofre Osses for his good contribution to the project work and for being a good friend.

To Nicholas, Matthijs, Rudi, Keijo, Panos, Dieter, Stefanie and the other friendly people in the electrical laboratory for the good company and the - ful assistance during the practical work with the converter construction.

To captain Gregor, first mate Willy Wonka and the other sailors on the At- lantic Cartier cargo ship who meet the power in the waves everyday.

To all the people working towards an expansion of renewable energy. It is certainly an exciting time to enter the work life within electric power engineering, considering the important difference that clean electrical energy can make in building a sustainable future. It is my sincere wish to be a part in the work towards this goal.

4 4 Table of contents

1 Sammanfattning 2

2 Abstract 3

3 Acknowledgements 4

4 Table of contents 5

5 Nomenclature 10

I Introduction 11

6 Background 11

7 Summary of the technical work 12

8 Goals and scope limitations 12

9 Method 13

II Literature review 14

10 Technical theory review 14 10.1 Electrical machines ...... 14 10.1.1 Electric generators ...... 14 10.1.2 Rotating generators and linear generators ...... 14 10.1.2.1 Rotating generators ...... 15 10.1.2.2 Linear generators ...... 15 10.1.3 Electrical machine types by magnetic flux direction . . . . 15 10.1.3.1 Radial-flux machines ...... 15 10.1.3.2 Axial-flux machines ...... 15 10.1.3.3 Transverse-flux machines ...... 15 10.2 Power electronics ...... 15 10.3 Power semiconductors ...... 16 10.3.1 Power diodes ...... 16 10.3.2 Power transistors ...... 16 10.3.2.1 Power MOSFETs ...... 16 10.3.2.2 Insulated-gate bipolar transistors ...... 17 10.3.2.3 Silicon carbide power MOSFETs ...... 17 10.3.2.4 Comparison between SiC MOSFETs and Si IGBTs 17 10.4 Switch-mode converters ...... 17 10.4.1 Pulse-width modulation ...... 17 10.4.2 DC-DC converters ...... 18 10.4.3 DC/AC converters and AC/DC converters ...... 18 10.4.4 Single-phase voltage-source converters ...... 18 10.4.5 Active rectifiers ...... 18 10.4.6 Three-phase voltage-source converters ...... 19

5 10.4.7 Total harmonic distortion ...... 19 10.5 PWM control algorithms for voltage-source converters ...... 20 10.5.1 Control of single-phase voltage-source converters . . . . . 20 10.5.1.1 Sinusoidal pulse-width modulation ...... 20 10.5.1.2 Hysteresis current control ...... 21 10.5.2 Bipolar and unipolar PWM ...... 21 10.5.2.1 Bipolar voltage switching mode ...... 22 10.5.2.2 Unipolar voltage switching mode ...... 23 10.5.3 Frequency modulation index ...... 23 10.5.4 Amplitude modulation index ...... 24 10.6 Microcontroller applications for control of voltage-source converters 24 10.7 MOSFET gate driver circuits ...... 24 10.8 Snubber circuits ...... 24 10.9 The DC-link and its function ...... 25 10.9.1 Polarity of electrolytic capacitors ...... 25 10.9.2 Bleeder resistors ...... 25 10.10Back-to-back coupling of voltage-source converters ...... 25 10.11Level shifters ...... 26

11 Electric power generation from sea waves 26 11.1 The power in the waves ...... 26 11.2 Challenges in the design of wave power generators ...... 27 11.3 Current status of wave power generation in the world ...... 27 11.4 Future potential for the field of wave power ...... 28

12 Characteristics of the wave power generator of Anders Hagnestål 28 12.1 Generator characteristics ...... 28 12.2 Reducing the resistive losses ...... 29 12.3 Active power factor correction ...... 30 12.4 Power level in the generator ...... 30 12.5 Cogging in the generator ...... 30

III Planning 31

13 Dimensioning the generator’s power electronic converter sys- tem 31 13.1 Overview of the power electronic converter system ...... 31 13.2 AC/DC-converter characteristics ...... 31 13.2.1 Active power factor correction ...... 32 13.3 DC/AC-converter characteristics ...... 32 13.4 BeagleBone Black microcontroller ...... 32 13.5 Sizing of the converter’s electrical components ...... 33 13.5.1 Selection of power transistors ...... 33 13.5.2 Selection of the converter’s voltage levels ...... 33 13.5.2.1 DC-link voltage level ...... 34 13.5.2.2 Generator side voltage level ...... 34 13.5.3 Selection of the converter’s current levels ...... 34 13.5.4 Maximum power flow through the power converter . . . . 34 13.5.5 Selection of MOSFET drivers ...... 34

6 13.5.6 PWM switching frequency ...... 35 13.5.7 Sizing of a filter circuit on the generator side ...... 35 13.5.8 Sizing of the snubber circuits ...... 35 13.5.9 Sizing of the DC-link filter capacitor ...... 36 13.6 Electrical components for the initial laboratory test setup . . . . 36 13.6.1 DC-link capacitor for the initial lab testing ...... 36 13.6.2 Bleeder resistor for the initial lab testing ...... 37 13.6.3 Snubber circuits for the initial lab testing ...... 37 13.6.4 Level shifters ...... 38 13.7 Electrical isolation paper ...... 39 13.8 Heat sinks ...... 39

14 Planning for the control system of the power electronic con- verter 39 14.1 Beaglebone Black and the choice of the Python ...... 39 14.2 Development of a SPWM control Python code ...... 40 14.3 Development of a hysteresis control Python code ...... 40 14.3.1 Flow chart for the bipolar hysteresis control code . . . . . 41 14.3.2 Flow chart for the unipolar hysteresis control code . . . . 41 14.4 Hysteresis control simulations for different sampling frequencies . 43 14.4.1 Switching frequencies for different sampling frequencies . 43 14.4.2 Current deviation from the reference current for different sampling frequencies ...... 43 14.4.3 Conclusions about the necessary sampling frequency for unipolar PWM hysteresis control ...... 44

15 Planning for the construction of the active rectifier 44 15.1 Laboratory setup with machines and two converters ...... 45 15.2 Two modules instead of four during the initial testing phase . . . 45 15.3 Circuit diagrams ...... 45 15.3.1 Simplified block diagram for the final laboratory setup with two machines ...... 46 15.3.2 Simplified circuit diagram for one single-phase converter with four phase-legs ...... 46 15.3.3 Simplified circuit diagram for one single-phase converters with two phase-legs ...... 47 15.3.4 Detailed circuit diagram for one single-phase converter with two phase-legs ...... 48 15.3.5 Circuit diagram for the connection of the current sensor . 48 15.4 Practical design aspects to take into account ...... 50 15.4.1 Copper plate dimensions ...... 50 15.4.2 Elevation of the copper plates above the DC-link capacitor 50 15.4.3 Mechanical and electrical connection of the power modules 50 15.4.4 Placement of electrical cables ...... 50 15.4.5 Attachment of the heat sinks ...... 51 15.5 Safety aspects ...... 51 15.5.1 Position of the positive voltage DC-link copper plate . . . 51 15.5.2 Electrolytic DC-link capacitor polarity ...... 51 15.5.3 Limiting the charging current for the DC-link capacitor . 51

7 15.5.4 Protection against an eventual capacitor explosion . . . . 52 15.6 CAD model for the final design ...... 52 15.6.1 Plastic boxes for containing the snubber circuits . . . . . 52 15.7 CAD model for the laboratory setup of the converter ...... 54

IV Practical work 55

16 Construction of the active rectifier 55 16.1 Construction of the DC-link ...... 55 16.2 Construction of a wooden suspension for the copper plates . . . . 56 16.3 Preparation of the power modules ...... 56 16.4 DC-link capacitor connection ...... 58 16.5 Connecting the power modules, snubber capacitors and high- voltage cable connections ...... 58 16.5.1 Choice of cable colors for marking out the different nodes 58 16.6 Connecting the PWM control system ...... 59 16.6.1 Beaglebone Black pins ...... 59 16.6.2 Conversion of the PWM signal voltage levels ...... 59 16.6.3 MOSFET driver input signals ...... 59 16.6.4 MOSFET driver output signals ...... 60 16.7 Supply voltages for the control system ...... 61 16.8 Connecting the current sensor ...... 61 16.8.1 Amplifying the sensor’s measurement signal ...... 61

17 How to use the Beaglebone Black in Microsoft Windows 62 17.1 Logging in to Putty ...... 62 17.2 Calibration of the current sensor ...... 63

18 Electrical experiments 64 18.1 Word of caution about the capacitor charging current ...... 64 18.2 Inverter mode, unipolar sinusoidal PWM ...... 64 18.2.1 Inverter, no load ...... 65 18.2.2 Inverter, resistive load of 24 Ohm ...... 65 18.3 Rectifier mode, hysteresis control with unipolar PWM ...... 66 18.3.1 Word of caution about the reference current ...... 66 18.3.2 Initial evaluation of the microcontroller’s sampling fre- quency ...... 66 18.3.3 Active rectifier with active power factor correction . . . . 67

V Analysis 69

19 Experimental results 69 19.1 Inverter mode, unipolar sinusoidal PWM ...... 69 19.1.1 SPWM, gate pulses ...... 69 19.1.2 Inverter, no load ...... 69 19.1.2.1 Frequency analysis ...... 70 19.1.2.2 Switching frequency ...... 70 19.1.3 Inverter, 24 Ohm load ...... 71

8 19.2 Measurement of the Beaglebone Black’s sampling frequency . . . 71 19.3 Rectifier mode, hysteresis control with unipolar PWM ...... 72

20 Discussion 72

21 Future work 74 21.1 Increase the microcontroller’s sampling frequency ...... 74 21.2 Implement hysteresis control ...... 74 21.3 Connection of two more power modules for the single-phase VSC 75 21.4 Holes for the MOSFET drivers in the copper plates ...... 75 21.5 Acquisition of film capacitors for the DC-link ...... 75 21.6 Holes in the plates for more DC-link capacitors ...... 75 21.7 Connection of the snubber capacitors beneath the copper plates . 75 21.8 Acquire better understanding of the MOSFET driver signal pins 76 21.9 Connect all power modules and set up their control systems . . . 76 21.10Increase the voltage ...... 76

22 Conclusion 76

VI References 77

VII Appendix 80 22.1 Total electrical energy consumption in the Nordic countries . . . 80 22.2 Python simulation results ...... 80 22.2.1 Unipolar SPWM simulation results ...... 80 22.2.1.1 Unipolar SPWM with a high switching frequency, ma=0.6 and mf=25 ...... 80 22.2.1.2 Unipolar SPWM low Hz switching frequency, ma=0.6 and mf=25 ...... 81 22.2.1.3 Unipolar SPWM 2800 Hz switching frequency, ma=1 and mf=12.5 ...... 81 22.2.2 Hysteresis control, bipolar switching, simulation results . 82 22.2.2.1 1 kHz sampling frequency ...... 82 22.2.2.2 4 kHz sampling frequency ...... 83 22.2.2.3 10 kHz sampling frequency ...... 84 22.2.2.4 50 kHz sampling frequency ...... 85 22.2.3 Hysteresis control, unipolar switching ...... 86 22.2.3.1 1 kHz sampling frequency ...... 86 22.2.3.2 4 kHz sampling frequency ...... 87 22.2.3.3 10 kHz sampling frequency ...... 88 22.2.3.4 50 kHz sampling frequency ...... 89 22.3 Python codes for the Beaglebone Black Microcontroller . . . . . 90 22.3.1 Unipolar SPWM ...... 90 22.3.2 Hysteresis control ...... 92

9 5 Nomenclature

Symbol Unit Description ε V EMF induced voltage N - Number of windings Ψ Wb Flux linkage Φ Wb Magnetic flux h m Peak-to-peak amplitude of a sea wave rad ωwave s Angular frequency of a sea wave fwave Hz Frequency of a sea wave I A Electric current V V Voltage P W Active electric power Q VAr Reactive electric power R Ω Resistance ρ Ωm Resistivity φ rad Current phase angle Va V Phase voltage LS H Stator winding inductance γ - Switching state of a voltage-source converter VO V Output voltage from a switch-mode converter VDC V DC-link voltage m cg s Group velocity of sea waves kg ρwater m3 Density of water m g s2 Standard acceleration due to gravity Hm0 m Significant wave height of sea wave f0 Hz Fundamental frequency component of voltage signal fk Hz Frequency component of order k for a voltage signal

10 Part I Introduction 6 Background

Wave power has good possibilities of becoming a significant energy source in the future. The water masses in the ocean transport enormous amounts of energy. Imagining a scenario where this energy could be harvested effectively, it may seem strange that it has not yet been done to a larger extent. It is certainly necessary to look for new sustainable energy sources, which do not rely on de- pletable resources and do not contribute to climate change significantly. The sea along the coasts of the Nordic countries, for example, have been estimated to contain energy twice as high as the annual electricity consumption in Sweden, Norway, Denmark and Finland together. Possibly we are just seeing the start of the rise of wave power. The wind and solar energy sectors have certainly grown tremendously during only the last ten years: 734 % for the globally installed wind power capacity and an increase of 4451 % in the globally installed solar PV power (2005-2015) [33].

Before wave power can become the fruitful energy source that it seemingly could be, quite a few technical challenges have to be tackled. The challenge that is the background for this master’s thesis is the low amplitudes in the voltages generated in today’s wave power generators. These low voltages are caused by the slow motion of the waves in the ocean. In order to extract high power at a low voltage level, it is necessary to work with high electrical currents, which typically causes high power losses. This is a problem which may have a solution, which will be presented in this master’s thesis.

This master’s thesis describes the planning and the construction of a power electronic converter system. The project was carried out as a group work to- gether with Aliro Cofre Osses at the Royal Institute of Technology (KTH) in Stockholm. The converter shall later be used in laboratory work, testing a new wave power generator, which has been designed by Dr. Anders Hagnestål, a researcher in electric power at KTH.

This thesis is divided into a technical theory part, describing the background theory about the generator and the converter, and a practical part which de- scribes the construction process of the converter. Finally, results are presented from the electrical experiments performed on the constructed converter in the laboratory, and conclusions are drawn about the results.

The proposed rectifier design relies on a previous master’s thesis, written by Gustaf Falk Olson in 2016 and supervised by Anders Hagnestål. In the thesis of Falk Olson, called Power Electronic Stages for a TFPMSM in Wave Power Applications, the rectifier was dimensioned, hardware components were chosen and a control system was planned.

Figure 1 shows an artistic depiction of the roaring energy in the ocean by

11 the 19th century Japanese painter Katsuhika Hokusai.

Figure 1: 19th century depiction of ocean waves by Katsuhika Hokusai.

7 Summary of the technical work

The wave power generator of Anders Hagnestål is a linear electric generator, which can be attached to a buoy, oscillating together with the waves in the ocean. The power electronic converter is intended to convert the AC power from the generator into DC power and then back to AC power again. The converter built during this master’s thesis deals with the first conversion stage - from AC to DC. It is called an active rectifier. This type of rectifier can control the wave shape and phase of the current in the generator. Thanks to the active rectifier, the reactive power in the generator can be reduced by forcing the current’s phase angle to be zero degrees and thereby forcing the power factor to one. 8 Goals and scope limitations

The goal of this master’s thesis was to build an active rectifier. Eventually, a laboratory setup will be used, with two converters distributing electrical en- ergy to both a generator and a motor. Both these electrical machines have three phases, making the total number of phases six for the converter system. Therefore six identical single-phase voltage-source converter will eventually be built for this system. Due to the limited amount of time available for a mas- ter’s thesis, however, the task for this thesis is to build one of the single-phase voltage-source converters. Even though the whole converter system will not be finished during the work with this thesis, the final converter will be planned for

12 and partly prepared. The size of the DC-link copper plates will be dimensioned based on the future topology with six phases and the CAD model is made so that it illustrates the final converter. The remaining necessary work steps are presented in the Future work section in the end. 9 Method

The following steps were followed in the process of planning and building the single-phase voltage-source converter: 1. Acquirement of information about how the generator works and the special characteristics of the power electronic converter system.

2. Review on the already dimensioned electrical parameters for the power electronic system, done by Gustaf Falk Olson in 2016. 3. Review on relevant technical theory about the components and algorithms to be used for implementing the power electronic system. 4. Development of codes and performing of software experiments with the algorithms sinusoidal pulse-width modulation and hysteresis current con- trol. 5. Design of a CAD model for the physical converter system to be built, making sure that the chosen components are compatible with each other and fit together geometrically.

6. Ordering of all necessary components for the construction. 7. Construction of the DC-link and connection of all electrical components. 8. Performing of electrical experiments and verification of the system’s proper function.

13 Part II Literature review 10 Technical theory review

This section intends to give a review of the technical background theory neces- sary for building the converter. The theory mainly deals with electrical machines and power electronics.

10.1 Electrical machines Electrical machines are machines which convert mechanical energy to electrical energy, or vice versa. Examples of electrical machines are electric motors and generators, but it is often convenient to use the term electrical machine instead of electric motor or generator. This is because an electric motor can be used as an electric generator and a generator can be used as a motor [14, p. 183].

10.1.1 Electric generators Electric generators are electrical machines used for producing electric power. Generators typically consist of a stationary part, called the stator, and a mov- ing part termed rotor or actuator. If the moving part is rotating it is called a rotor. If it is instead moving linearly it is called an actuator [14, p. 1] or a translator.

The stator is made up of electrical conductors wound as coils, typically around laminated pieces of a magnetic material, such as electrical steel [14, p. 26]. The moving part of the generator either has permanent magnets creat- ing a magnetic field, or windings supplied by electrical currents. Voltages are induced in the stator coils as the rotor is moving, according to Faraday’s law of electromagnetic induction in Eq 1. If a load is connected to the stator coils, current will flow through the load. The magnitude of the electric power pro- duced is determined by the magnitude of the mechanical torque or force applied to the rotor or actuator.

Typically electric generators are three-phase generators, which means that three-phase power is produced. Three-phase power has the benefit of being con- stant, as opposed to single-phase power which is pulsating in time [36, p. 13].

dΨ dΦ ε = − = −N (1) dt dt

10.1.2 Rotating generators and linear generators Two different types of electric generators are rotating generators and linear generators. They are characterized by the type of motion which generates the electric power. These generators will now be described briefly.

14 10.1.2.1 Rotating generators Rotating electric generators use a stator and a rotor. The rotor is rotating inside the stator. Examples of rotating generators are squirrel-cage induction generators and permanent magnet synchronous generators [14].

10.1.2.2 Linear generators A linear generator produces electric power from a linear motion. A translator is moving linearly inside the stator. This induces voltages in the stator windings [14, p. 234].

10.1.3 Electrical machine types by magnetic flux direction If electrical machines are categorized based on the direction of their magnetic flux, there are three types of electrical machines: radial-, axial- and transverse- flux machines. A short review of these types will now be given.

10.1.3.1 Radial-flux machines In a radial-flux machine, the magnetic flux has a direction which is radial out the from the rotor axis. In cylindrical coordinates it can be expressed as the direc- tion of the unit vector ~erc . Examples of such electrical machines are squirrel-cage induction machines and radial-flux brushless DC machines.

10.1.3.2 Axial-flux machines In an axial-flux machine, the magnetic flux has a direction which is axial, i.e. parallel to the rotor axis [27]. In cylindrical coordinates this is along the unit vector ~ez.

10.1.3.3 Transverse-flux machines The magnetic flux in a transverse-flux machine has a direction which is clock- wise around the machine’s axis, along the unit vector ~eφ if expressed in cylin- drical coordinates [41]. The transverse-flux generator type is the one to be used in the wave generator of Anders Hagnestål. This will be explained further in Section 12.

10.2 Power electronics Power electronic converters are used for conversion of electric power from one form to another. For example an inverter converts power from DC to AC. A rectifier converts power from AC to DC. There are also DC-DC converters, converting a DC voltage to a DC voltage with different amplitude [24, p. 10]. An important part of power electronic converters are power semiconductors, which will be described in the sections below.

15 10.3 Power semiconductors Semiconductors are electronic components with an ability to be either current- conducting or not conducting, depending on the situation [22]. Examples of semiconductors for high electric power are power diodes and power transistors. These components will be described briefly below.

10.3.1 Power diodes A diode is a semiconductor which allows currents to flow in only one direction. Current will flow through a diode if the voltage at its anode is higher than the voltage at its cathode. This state is termed that the diode is forward-biased. If the voltage at the anode is lower than the cathode voltage, the diode prevents current from flowing. This current blocking state of the diode is called that the diode is reverse-biased [9].

A power diode works like a standard diode in its function, but is character- ized by its high power ratings. That means it can handle high voltages and high currents [24, p. 529].

10.3.2 Power transistors A transistor is a component which can also be either current conducting or non- conducting, similar to a diode. While the diode has two terminals, however, a transistor generally has three terminals; two of them giving path for currents to flow and one acting as a control terminal which decides how much current should be let through. Two common categories of transistors are bipolar junction tran- sistors (BJTs) and field-effect transistors (FETs). The BJT has terminals called base, collector and emitter, whereas a FET has terminals called gate, drain and source [38].

Transistors are semiconductors with a high importance in contemporary elec- tronics. Personal rely on billions of microscopic transistors, set up to communicate in binary code. Transistors are also important in analogue elec- tronics, e.g. in the field of amplifier design [44]. There are also power transistors used in power electronics. These transistors have the ability to withstand sev- eral hundreds of volts and amperes [32]. Power transistors will be of importance during the practical part of this master’s thesis, i.e. the construction of an ac- tive converter. Therefore topology and function of transistors will now be given a brief presentation.

10.3.2.1 Power MOSFETs A metal-oxide-semiconductor field-effect transistor, or MOSFET, is a type of field-effect transistor. By manipulation of the electric field inside the transistor, the behaviour of the MOSFET can be controlled [24, p. 578].

A power MOSFET is a MOSFET with high power ratings. A typical ap- plication of power MOSFETs in power electronics is using them as switches in

16 switch-mode converters. It is possible to control whether a MOSFET is con- ducting a current or not by applying a voltage to its gate terminal. If a gate voltage of sufficient amplitude is applied, current flows from the drain terminal to the source terminal. With no gate voltage applied, the transistor acts like an open circuit and no current flows through the transistor [38].

10.3.2.2 Insulated-gate bipolar transistors An insulated gate bipolar transistor (IGBT) is a type of transistor which com- bines the features of a bipolar junction transistor and the features of a field-effect transistor [24, p. 626]. Similar to power MOSFETs, IGBTs are often used as switches in power electronic applications. The IGBT has traditionally been the switch transistor of choice for power conversion [34].

10.3.2.3 Silicon carbide power MOSFETs MOSFETs and IGBTs have traditionally both been made using substrates of silicon (Si). Recently however, it has shown very promising to use silicon carbide (SiC) substrates instead of silicon substrates. Silicon carbide is a compound of silicon and carbon. SiC semiconductors have shown to have higher power capabilities, much lower power losses, as well as better thermal properties [4].

10.3.2.4 Comparison between SiC MOSFETs and Si IGBTs When SiC MOSFETs have been compared with Si IGBTs it has been discov- ered that it is favourable to use SiC MOSFETs operating at high switching frequencies [34]. MOSFETs in general have good performance at high switch- ing frequencies. A high switching frequency can be beneficial, as smaller filter circuits can be used for filtering out switching harmonics. SiC MOSFETs can handle even higher power levels than Si MOSFETs, making SiC MOSFETs an excellent choice as power transistors. The topologies of different power convert- ers and switching algorithms will be explained in the theory sections 10.4 and 10.5 below.

10.4 Switch-mode converters Switch-mode converters are power electronic converters relying on the use of pulse-width modulation control [13]. There are different types of switch-mode converters, such as DC-DC converters and DC-AC converters. These types of converters will further be presented in this theory section.

10.4.1 Pulse-width modulation Pulse-width modulation (PWM) is a common way of controlling power elec- tronic converters. When PWM is used, a control voltage is fed to the gates or bases of power transistors. This control voltage has a square waveform of a certain frequency. A transistor’s drain-source voltage can be controlled by sending voltage pulses to its gate terminal. The duty cycle for a PWM signal

17 is the percentage of the switching period when the control voltage is high. [24, p. 162].

10.4.2 DC-DC converters DC-DC converters are used for changing the amplitude of a DC voltage to an- other DC amplitude. PWM is used for adjusting the average value of the output voltage from the DC-DC converter. The type of DC-DC converter which lowers the DC voltage amplitude is called a buck converter or step-down converter. Other examples of DC-DC converters are boost converters, buck-boost convert- ers, SEPIC converters and Cuk- converters [24].

10.4.3 DC/AC converters and AC/DC converters DC/AC converters, also called inverters, are used for converting DC power to AC. AC/DC converters, or rectifiers, convert from AC to DC. Some rectifiers, such as diode rectifiers and thyristor rectifiers, can only be used as rectifiers. The so-called voltage-source converter, however, can be used both as an inverter and as a rectifier. Voltage-source converters exist both for single- and three-phase systems [24, p. 243]. A voltage-source converter will be constructed in this master’s thesis. The theory behind it will now be described further.

10.4.4 Single-phase voltage-source converters A single-phase voltage-source converter (VSC) is a type of switch-mode con- verter. When it runs as a rectifier it can convert single-phase AC power to DC power. It can also be operated as an inverter for DC-AC conversion. This inverter operation mode will first be described.

In the simplest application, single-phase VSCs are made up of two converter phase-legs; each phase-leg consisting of two switching power transistors, for ex- ample MOSFETs or IGBTs. A PWM control voltage is fed to each transistor’s gate or base terminal, yielding the transistor to turn on or off.

The single-phase VSC is known by many names. It is also called an H- bridge - referring to that the circuit diagram of the single-phase VSC resembles the shape of the letter H [18]. The circuit diagram of a VSC can be seen in Fig 2.

10.4.5 Active rectifiers Single-phase VSCs can be operated as rectifiers, transforming power from AC to DC. When a VSC is used in the rectification mode it can be called an active rectifier [21]. It is called active because it uses power transistors. The rectifier’s output voltage level can therefore be controlled using PWM. This stands in contrast to diode rectifiers, or line-commutated rectifiers, which lack this con- trol possibility [8]. When the single-phase VSC operates as a rectifier, it can be controlled in the same way as during inverter mode: using the bipolar or unipolar voltage switching. However, the phase angle of the current’s active (real) component is phase shifted 180 electrical degrees, compared with inverter

18 Figure 2: Single-phase voltage-source converter [35]. mode. This reverses the flow of electrical energy through the converter, so that power is converted from AC to DC [24, p. 243].

10.4.6 Three-phase voltage-source converters A three-phase voltage-source converter (VSC) is another type of switch-mode converter. It can be used as an inverter or rectifier for circuits with three phases on the AC side. In the simplest type of implementation, three-phase VSCs are made up of three phase-legs, with two power transistors per phase-leg. A circuit diagram for this type of three-phase VSC can be seen in Fig 3.

Rectifier operation mode can be achieved by control of the currents’ phase angles. If each of the three currents is shifted 180 degrees, it results in a re- versed flow of electrical energy so that the three-phase VSC acts as a rectifier [24, p. 244].

10.4.7 Total harmonic distortion Total harmonic distortion (THD) is a concept in electrical engineering, used for describing the purity of a signal. It is desired to have signals with low THD, because a high THD indicates a distorted signal. One type of THD calculation method is weighted total harmonic distortion THDW . The benefit of weighted THD is that it puts less importance on high frequency harmonics. This is reasonable, since these harmonics are easier to filter out. The expression for THDW is given in Eq 2 below [35, p. 60], where V1 signifies the voltage signal’s fundamental component and Vk the signal’s higher harmonics.

v 2 u ∞ V uP ( k,RMS ) − V 2 t k=1 k 1,RMS THDW = 2 (2) V1,RMS

19 Figure 3: Topology of a three-phase voltage-source converter [35].

10.5 PWM control algorithms for voltage-source converters In this section some different PWM control algorithms will be presented, which can be used for controlling voltage-source converters - both single-phase and three-phase converters.

10.5.1 Control of single-phase voltage-source converters A PWM control system is necessary for making the single-phase VSC obtain the right output voltage. There are several PWM algorithms for this, generating different types of gate voltage signals for the MOSFETs in the converter. A more detailed description on the SPWM and hysteresis control algorithms will be presented in the next section.

10.5.1.1 Sinusoidal pulse-width modulation A common technique for generating sinusoidal voltages from an inverter is sinu- soidal pulse-width modulation (SPWM). The inverter uses SPWM for generat- ing a sinusoidal voltage on its AC side. In order to decide the correct switching state at a given moment, a sinusoidal reference voltage is compared with one or two triangular carrier voltages. One carrier voltage is used for bipolar PWM and two carrier waves for unipolar PWM (more about bipolar and unipolar switching in Section 10.5.2). If the instantaneous amplitude of the carrier voltage is lower than the sinusoidal reference voltage, a positive DC voltage is returned on the AC side of the phase-leg. If it is lower, a zero voltage is returned. This results in a series of voltage pulses on the AC side of the converter. In the frequency spectrum, this pulsed voltage signal consists of a fundamental sine component, superposed with higher frequency harmonics. If these harmonics are successfully filtered out, the remaining signal is a fine sinusoidal AC voltage.

20 10.5.1.2 Hysteresis current control Hysteresis current control is a technique which can be used for controlling the current in a voltage-source converter. The phase current in the converter on the AC side is measured with a current sensor. The instantaneous value of the current is compared with a reference current. Based on the reference current it is decided whether the phase current should be increased or decreased. If the current should be increased, a positive DC voltage pulse is sent through the converter from the DC-link. If it instead should be decreased, a negative pulse is sent. The result is a phase current which has a triangular wave shape, oscil- lating around the reference current’s wave shape. The derivative of the phase dIa current dt on the AC side is dependent on the AC side’s inductance L and on the amplitude of the DC pulse VDC from the converter, according to Eq 3. The so-called tolerance bands set limits to how much the phase current is allowed to deviate from the reference current. As the phase current goes outside of the allowed interval set by the hysteresis bands, a new voltage pulse is sent from the converter, causing a change in the phase current’s derivative. Similar to si- nusoidal pulse-width modulation, both bipolar and unipolar switching schemes can be used for hysteresis control. dI V a = DC (3) dt L

Figure 4: An example of bipolar hysteresis current control, with the sinusoidal reference current and the triangular phase current oscillating around the refer- ence.

10.5.2 Bipolar and unipolar PWM The concepts of bipolar and unipolar PWM concern the number of voltage levels in the pulsed DC signal, sent from the converter to the AC side. This is relevant since it affects the total harmonic distortion (THD) in the generated AC signal

21 on the converter’s output. The topic of bipolar and unipolar switching is hence important to analyse, in order to achieve appropriate quality in the converted electric power [26].

10.5.2.1 Bipolar voltage switching mode Bipolar voltage switching or two-level driving mode is a type of PWM control method for switch-mode converters. When bipolar switching is used for the single-phase VSC operating as an inverter, the AC output voltage alternates between two voltage values [35, p. 57]. The switching state γ is either 1 or -1. The states of the power transistors, depending on the switching state, can be seen in Eq 4 below. The converter’s output voltage VO as a function of the switching state and the DC-link voltage can be seen in Eq 5.

Figure 5 shows the generated AC voltage on the VSC’s output, when bipolar switching is used for sinusoidal PWM. The output AC voltage has a wave-shape which is not a pure sinusoid. In the frequency spectrum, the AC voltage consists of a sine wave fundamental mixed with multiple harmonics [24, p. 204]. This sine wave fundamental, which is plotted with a dotted line in the lower graph, Vˆcontrol VDC has a peak amplitude of VˆO,1 = [24, p. 206]. Vˆtri 2

( ( 1 if S1 ON and S3 ON +VDC , γ = 1 γ = VO(γ) = -1 if S2 ON and S4 ON −VDC , γ = −1 (4) (5)

Figure 5: Graph showing an AC voltage signal generated by bipolar PWM.

22 10.5.2.2 Unipolar voltage switching mode The unipolar voltage switching mode or three-level driving mode is another type of PWM method. If a single-phase VSC is operated as an inverter with unipolar switching, the AC output voltage has three voltage levels. The output voltage also takes the value 0, in addition to taking the values VDC and −VDC . The unipolar switching mode hence uses one more switching-state, compared with the bipolar switching mode. These three switching-states can be seen in Eq 6 below. The converter’s output voltage, as a function of the switching-state and the DC-link voltage, can be seen in Eq 7. The fundamental sine component has Vˆcontrol a peak amplitude of VˆO,1 = VDC [24, p. 216]. One benefit of choosing Vˆtri unipolar switching over bipolar switching is that unipolar switching has a lower weighted THD, compared with bipolar switching [35].

  1 if S ON and S ON +V , γ = 1  1 3  DC γ = 0 if S1 and S4 ON or if S2 and S3 ON VO(γ) = 0, γ = 0   -1 if S2 ON and S4 ON −VDC , γ = −1 (6) (7)

Figure 6: Graph showing an AC voltage signal generated by unipolar PWM.

10.5.3 Frequency modulation index The frequency modulation index, used in SPWM, is the quota between the frequency of the triangular carrier voltage and the frequency of the sinusoidal reference voltage. The formula for mf can be seen in Eq 8. The higher the

23 frequency modulation index is, the lower the THD is in the AC output voltage from the converter [24, p. 219].

ftri mf = (8) fref

10.5.4 Amplitude modulation index The quota between the reference voltage’s amplitude and the triangular carrier voltage’s amplitude is called the amplitude modulation index. The formula for ma can be seen in Eq 9 [24, p. 219].

vˆref ma = (9) vˆtri 10.6 Microcontroller applications for control of voltage-source converters A microcontroller is a small in a single integrated circuit. It is a compact device which can be programmed in order to carry out different com- putational tasks [5]. For power electronics, microcontrollers are useful for the implementation of control, as they can be used for producing suitable control signals. Microcontrollers typically have input and output ports. An input port has an analog-digital-converter (ADC) which samples an analog voltage and converts it to a digital signal [29]. The microcontroller can then process the information carried by this digital signal. A microcontroller output pin can be analog or digital. An analog output pin uses a digital-analog converter (DAC). A digital output pin can only give two different discrete voltage levels. These digital pins are suitable for generating the PWM voltages fed to power transis- tors [23].

10.7 MOSFET gate driver circuits The gate electrode of a MOSFET requires a certain gate current in order for the MOSFET to be turned on. When the switching frequency is high, it is important that a sufficiently high current is fed to the MOSFET’s gate terminal, so that the turn-on and turn-off transitions do not take too long. The PWM signal generated from a microcontroller’s output pin is however typically low in power. Therefore, it is often necessary to connect a power amplifier which amplifies the voltage and current from the microcontroller, in order to turn on the MOSFET. This type of amplifier circuit is called a MOSFET gate driver [31].

10.8 Snubber circuits Undesired overvoltage spikes can occur during a power transistor’s switching, typically due to stray inductances in electrical components and conductors. This can result in both energy losses and electrical stress on the circuit components. If the normal operation voltage of a converter is chosen to a level close to the maximum voltage of the transistor, the transistor may break from the stress of

24 the transient overvoltage [24, p. 680]. Snubbers are circuits which are added in combination with the power electron- ics in order to reduce or eliminate overvoltage and overcurrent spikes. There are several types of snubber circuits for transistors; for instance turn-on snub- bers, turn-off snubbers and overvoltage snubbers. During on- and off-switching, electrical energy is discharged from the stray inductances, causing currents to flow reversely towards the transistor. The turn-on and turn-off snubbers direct these currents into a resistor instead of into the transistor. Overvoltage snub- bers limit transient overvoltages by connecting a resistor in parallel with the transistor [24].

10.9 The DC-link and its function The DC-link is the electrical node placed on the DC side of an AC-DC or DC- AC converter; for example a VSC. There is typically a filter capacitor in the DC-link, which has the task of reducing the amplitude of the DC-voltage ripple, i.e. the variation of the voltage around the desired constant DC value. A DC- link with a capacitor can be seen in between the voltage-source converters in Fig 7.

10.9.1 Polarity of electrolytic capacitors During the experimental work in this master’s thesis, an electrolytic DC-link capacitor will be used. With electrolytic capacitors it is very important to connect them to the circuit with the right polarity. If the wrong polarity is used, the capacitor may explode, which is very dangerous if a high amount of electrical energy is stored in the capacitor.

10.9.2 Bleeder resistors A so-called bleeder resistor is often connected between the terminals of a DC-link capacitor. This is a safety measure, which helps with discharging the capacitor in a controlled way when the converter system is turned off. This way, there will not be a high voltage in the DC-link when the converter is not being used. The bleeder resistor reduces the risk of injury for people in the converter’s proximity [42].

10.10 Back-to-back coupling of voltage-source con- verters A so-called back-to-back connection of two voltage-source converters means that two VSCs are interconnected with a DC-link in between. The back-to-back coupling is useful as a way of interconnecting two asynchronous AC systems. These two AC systems can be either operating at different AC frequencies or at the same frequency but with different phase. The back-to-back coupling will become relevant in this master’s thesis, as a way of setting up a wave power generator for delivering power to the electric grid. The electric grid has a fixed frequency and the generator’s frequency is variable, but this issue can be solved by a back-to-back coupling of a rectifier and an inverter via a DC-link.

25 Figure 7: Back-to-back connection of two MOSFET-based three-phase voltage- source converters.

10.11 Level shifters A level shifter, or voltage level translator, is an electronic circuit which can be used for changing one voltage level to another one [40]. A level shifter will be used in the practical part of this thesis, changing the PWM signal voltage levels in the control circuit. Level shifters often come in the form of integrated circuit chips, which will be seen in Section 16.6.2. 11 Electric power generation from sea waves

Wave power is a field in renewable energy which has not yet been extensively de- veloped. There have been ambitions to build wave power farms in many places across the world, but the breakthrough of wave power still awaits [39]. In this section a short theoretical introduction to the energy in sea waves will be given, as well as on how this energy can be converted into electricity. Challenges ac- quainted with the power conversion are discussed. Finally, a short presentation is given to the current status of wave power across the world and its future potential.

11.1 The power in the waves The energy flux per area for sea waves is defined in Eq 10 and the surface power flux J in Eq 11. The quantity Hm0 signifies the significant wave height [20]. 1 kW h E = ρgH2 [ ] (10) S 16 m0 m2

kW J = E [ ] (11) g S m2 An example of the average power flux J in the waves is given in Eq 12, based on the average wave parameters at the 44011 station [28]. These parameters are listed in Table 1.

2 g ρgHm0 kW J = ≈ 11.51[ 2 ] (12) 2 · 2πfwave 16 m

26 Quantity Expression Unit Comment g m cg Group velocity of the sea waves [37] 2ωwave s m g 9.82 s2 Gravitational acceleration 1 fwave 6 Hz Frequency of sea waves [28] kg ρ 1000 m3 Density of water Hm0 2 m Significant wave height [28]

Table 1: Average wave parameters at buoy 44011.

11.2 Challenges in the design of wave power gen- erators

1 The frequencies of sea waves are low: typically around 6 Hz according to wave period measurements along the North American Atlantic coast [28]. These low frequencies of waves bring along problems for the design of wave power genera- tors. This relates to Faraday’s law (Eq 1). Faraday’s law says that the voltage induced in a conductor is equal to the negative of the derivative of the flux link- age Ψ(t). Equation 13 shows the expression for the flux linkage in a linear wave power generator [12, p. 4]. It can be seen in Eq 14 that the EMF (t) is depen- dent on the angular velocity ωwave of the waves. If the sea waves oscillate slowly, causing a low speed for the translator, it will result in a low EMF amplitude in the stator windings. This in its turn means that high electric currents have to flow through the phase conductors, based on the relation between current, power and voltage, as seen in Eq 15. If the phase conductors are long, and have high resistance, it results in significant power losses along the conductors. The generator design of Anders Hagnestål offers a solution to the problems with the low amplitude EMF. More about this will be explained in Section 12. 2π Ψ(t) = Ψˆ sin( z(t)) (13) λ

dΨ(t) πh ε(t) = −N = Ecosˆ (ω t)cos( sin(ω t)) = dt wave λ wave (14) Ψˆ hπ πh = ω cos(ω t)cos( sin(ω t)) λ wave wave λ wave P |I~| = (15) |U~ |cos(φ)

11.3 Current status of wave power generation in the world Different types of wave power plants have been built and tested around the world. The variation is large in the designs. Some concepts use buoys, oscillating together with the ocean’s surface, causing a translator to move up and down inside a stator. Other designs use the energy from the waves for moving air or water streams, in its turn causing a turbine to rotate. These are just two examples, and many other power generation solutions exist [19]. The first wave farm in the world was the Aguçadoura wave farm, situated outside the northern

27 coast of Portugal. This wave farm was however closed down permanently only two months after its opening, due to technical and economic problems [6].

11.4 Future potential for the field of wave power Even though wave power is still in an early stage of its technical development, it is clear that the ocean transfers immense quantities of energy. The theoretical wave energy resources along the Norwegian Atlantic coast have been estimated to about 600 TWh per year [20, p. 5]. This is just an example of the potential for wave power in the Nordic countries. The total electrical energy consumption in Sweden, Norway, Denmark and Finland together is 384 TWh, as calculated in Section 22.1. It shall however be noted that the value for the Norwegian coast above refers to the kinetic energy flux along the coastline. That is not the same as the amount of energy which can be extracted from a technical point of view [20, p. 17]. 12 Characteristics of the wave power gen- erator of Anders Hagnestål

The wave power generator invented by Anders Hagnestål will be explained in this section. Also, the converter topology proposed by Gustaf Falk Olson will be presented. Later in this thesis the task will be to construct this converter system.

12.1 Generator characteristics The generator of Anders Hagnestål is a transverse-flux permanent-magnet syn- chronous machine (TFPMSM). It consists of a stator and a translator. The translator is moving linearly up and down inside the machine, surrounded by the stator windings. The translator is driven by the forces applied by the sea waves to a buoy, which is floating on the sea surface [17].

The translator can be divided into three segments, each containing stapled blocks of iron (electrical steel), separated by blocks of an isolating material (G-10 fiberglass epoxy laminate). The stator has two segments, each containing blocks of permanent magnets, separated by the stator windings. When the iron blocks in the translator move, the magnetic circuit in the generator is changed, and the stator windings are exposed to an alternating magnetic flux. This results in voltages being induced in the stator windings. Figure 8 shows the segments of the stator, surrounded by the segments of the translator. In the figure there are four and three translator and stator segments, respectively. However, the number of segments have later been changed to three for the translator and two for the stator. A more detailed description of the generator’s mechanical and electrical topology is available in the master’s thesis Mechanical design of trans- verse flux linear generator for wave power, written by Erling Guldbrandzén and Manthan Shah.

It has been estimated by Anders Hagnestål that the translator will typically be moving at speeds lower than 2 m/s in the lab setup. As was explained in

28 Section 11.2, low speeds such as these can be a problem for generators, because of the low voltages induced. The voltage amplitude will be somewhat raised by the introduction of multiple poles in the stator, but the voltage will still be relatively low, with high currents as a result. These high currents often bring along high losses for wave power generators, but not in Anders Hagnestål’s generator system. This is what the power electronic converter is intended to solve. It enables high currents to be used, without bringing along high losses.

Figure 8: Illustration of the inside of the linear generator, depicting the segments of translator and stator. The figure shows four translator segments, but recently the number has been changed to three. The figure has been borrowed from the master’s thesis of Erling Guldbrandzén [16].

12.2 Reducing the resistive losses In order to reduce the resistive power losses in the stator windings, exception- ally short windings are used in Anders Hagnestål’s generator. This is a way of lowering the winding resistance, which is proportional to a conductor’s length `cond according to Eq 16. The lowered resistance in its turn reduces the resis- tive power losses, which are proportional to the resistance, according to Eq 17.

29 ρ 2 R = `cond (16) P = RI (17) Acond 12.3 Active power factor correction Stator windings have a resistive-inductive character, as illustrated in the gener- ator’s single-phase equivalent in Fig 9. The reactance in the windings is usually much higher than the resistance [14, p. 256]. As a result of this, reactive power is typically high in electrical machines. Reactive power Q is defined in Eq 18. It can be seen that it is proportional to sin(φ), where φ is the phase angle between the voltage and current. If it is possible to adjust the phase angle to zero, the reactive power can be eliminated. This can be achieved using Active power factor correction (APFC), which is the main idea for reducing the reactive power in Anders Hagnestål’s wave power generator. The principles for active power factor correction will be presented in Section 13.2.1. The development of a Python code for implementing APFC will be described in Section 14.3.

Q = UIsin(φ) (18)

Figure 9: Single-phase equivalent for the TFPMSM during steady-state.

12.4 Power level in the generator Anders Hagnestål has estimated that the generator’s production of electric kW power will be around 200 m/s . The power production hence varies significantly, depending on the vertical velocity of the sea waves.

12.5 Cogging in the generator Cogging is a type of torque ripple in a generator, which means that the me- chanical torque is oscillating around an average value [30]. In the generator of Anders Hagnestål, this cogging effect will occur during the transitions, when the iron pieces move from facing a permanent magnet to facing a stator winding [16].

The cogging in the generator both results in mechanical stress and vibrations in the generator. The problems from the cogging can be greatly reduced by the three-phase layout of the generator, but a ripple of 1-3 % in the rated force still remains [17].

30 Part III Planning 13 Dimensioning the generator’s power elec- tronic converter system

The power electronic system for the wave power generator should force the AC current to be in phase with the AC voltage, making the power factor equal to one. The power electronic system should also convert the variable frequency power from the generator into fixed frequency power, suitable for the grid. The individual parts of the converter system will be described in this section of the report.

13.1 Overview of the power electronic converter system The electrical frequency is variable on the generator side, because of the varia- tion in the angular velocity of the sea waves. The AC power from the generator first has to be converted to DC power, in order to remove the variable frequency. The power is then converted once again back to AC; this time with a fixed and controlled frequency and a fixed voltage amplitude. This AC power is suitable for feeding into the electrical grid. A block diagram describing the conversion system from generator to grid can be seen in Fig 10 below.

Figure 10: Topology of the whole converter system for the eventual generator, with two three-phase converters connected back-to-back.

13.2 AC/DC-converter characteristics The conversion from AC power to DC power is performed using three single- phase active rectifiers, which are controlling the current and the power factor in each phase. The power factor is controlled using hysteresis current control. The reason for not using a standard dq-controller is that the voltages in the phases

31 do not make up a symmetrical three-phase system. This asymmetric character of the generator phase voltages comes from the cogging effect in the generator, described in Section 12.5.

13.2.1 Active power factor correction The three single-phase voltage-source converters should be used as active recti- fiers, performing active power factor correction. They have the task of shifting the phase angle of the current, so that it is in phase with the phase voltage. The goal is to make the power factor cos(φ) = 1, which increases the power rating and efficiency of the generator. The current control is performed using a unipolar hysteresis current control algorithm, which measures the current con- tinuously and tells the converter to change it when necessary.

Since it is a unipolar hysteresis control, two tolerance bands are used for the current. If the current exceeds the first tolerance band, the value of the generator’s EMF voltage is first examined, before any switching is done. If for example the phase current is too high, but the EMF is negative, the EMF will be contributing to the reduction of the current. Therefore the converter will wait with switching. If the EMF is however positive, the converter will switch. Also, if the current is outside the second tolerance band, the converter will always switch. Flow charts describing both unipolar and bipolar hysteresis control will be presented in Section 14.3, as part of explaining the development of the Python codes for hysteresis control.

13.3 DC/AC-converter characteristics The DC/AC-converter between the DC-link and the AC grid is a standard three-phase VSC, using dq-control. In contrast to the three-phase system on the generator side, the three-phase system on the grid side is symmetrical. This makes possible the use of this type of three-phase converter. Since it is a stan- dard converter which can be bought from many manufacturers, it is not the task of this thesis to build the converter.

13.4 BeagleBone Black microcontroller A BeagleBone Black Rev C microcontroller is used for the purpose of producing the PWM control voltages for the MOSFETs in the active rectifiers. Beagle- Bone Black is a microcontroller with the specifications listed in Table 2 below. An image of the Beaglebone Black can be seen in Fig 11.

32 Parameter Value CPU 1 GHz RAM 512 MB DDR3 Flash memory 4 GB I/O pins 65 I/O pins 8 Figure 11: The Bea- Analog input pins 7 glebone Black micro- Table 2: Some important hardware characteris- controller which is to tics for the Beaglebone Black microcontroller [2]. be used during the practical work in this thesis.

13.5 Sizing of the converter’s electrical compo- nents The sizing of the converter system’s components has largely been performed in 2016 in the master’s thesis of Gustaf Falk Olson. The values of the components chosen by Falk Olson will now be presented in this section.

13.5.1 Selection of power transistors Power modules CAS300M12BM2 from Cree were chosen by Falk Olson as power transistors. One module corresponds to one phase-leg in a two-level voltage- source converter. Each module contains two silicon carbide (SiC) power MOS- FETs with power ratings as listed in Table 3. As was discussed in Section 10.3.2.3, SiC MOSFETs have very good capabilities of dealing with high switch- ing frequencies at high currents. This in its turn helps with reducing the power losses. Each of the power modules has a maximum current rating of 300 A. In order to make maximum current for the converter higher, it was decided by Anders Hagnestål to use two power modules in parallel for each of the converter’s phase- leg. This makes the number of power modules per phase equal to four. For an illustration of this, see Fig 21. A photograph of a Cree CAS300M12BM2 power module can be seen in Fig 12 below. Parameter Value Drain-source blocking voltage 1200 V Current rating 300 A On-state resistance 4.2 mΩ Size 106 x 62 x 30 mm Material Silicon carbide Figure 12: Cree CAS300M12BM2 Table 3: Some important properties for the Cree power module. CAS300M12BM2 power modules.

13.5.2 Selection of the converter’s voltage levels The voltage levels in the converter should preferably be set high, since a higher voltage gives a higher power for the same current, as was discussed in Section

33 11.2. There is however an upper limit for the voltage level, set by the voltage ratings of the power modules.

13.5.2.1 DC-link voltage level The voltage in the DC-link was chosen by Falk Olson to 900 V [12, p. 34]. Since the maximum voltage for the power modules is 1200 V, there is a margin of 300 V from the maximum voltage. The reason for this margin is that overvoltage spikes may occur when the transistors are switching under load. If the voltage over the modules exceeds 1200 V, the modules are destroyed. Snubber circuits, explained in Section 10.8, will help with lowering the amplitude of the overvoltage spikes. Still, it has to be experimented with whether 900 V is a suitable DC-link voltage level, or if the margin to the maximum module voltage of 1200 V is too small.

13.5.2.2 Generator side voltage level The voltage level on the generator side of the converter is not chosen to a fixed value, since it depends on the linear velocity of the translator and on the number of poles in the stator.

13.5.3 Selection of the converter’s current levels In order to increase the possible extractable power from the generator, two modules are used in parallel for every phase-leg, as was mentioned in Section 13.5.1. This doubles the maximum possible current through the converter, which then becomes 600 A instead of 300 A. This is the maximum peak value of the AC current. The phase current level during the operation of the power plant will vary depending on the energy extracted from the sea waves. Also, it will vary depending on the amplitude set for the reference current by the hysteresis current controller.

13.5.4 Maximum power flow through the power converter Based on the decided DC-link voltage level and the maximum RMS phase cur- rent levels, the maximum power through the converter system can be calculated. 600 Pmax = 3Iphase,RMS,maxVDC = 3 √ 900 ≈ 1.15MW (19) 2

13.5.5 Selection of MOSFET drivers For the task of amplifying the gate pulses to the power modules, MOSFET drivers CGD15HB62P1 from Cree were chosen. These MOSFET drivers are in- tended for use with the CAS300M12BM2 power modules, described in Section 13.5.1. It was seen as a good idea to use these modules and drivers together, since they are made to be compatible. Another important characteristic of this driver is that it has a built-in blanking time (propagation delay time) of 300 nS [10]. This preconfigured blanking time can be a useful safety measure, since it guarantees that short-circuits are avoided in the power modules. A photo showing one of these MOSFET drivers can be seen in Fig 13. In Table 4 some

34 relevant electrical parameters for the drivers can be found.

Supply voltage level 15 V (DC) Input signal amplitude [0,5] V Output signal amplitude [-5,20] V Maximum switching frequency 64 kHz

Table 4: Some electrical properties for the Figure 13: A Cree CGD15HB62P1 MOSFET drivers [10]. CGD15HB62P1 MOS- FET driver.

13.5.6 PWM switching frequency The switching frequency for the hysteresis control algorithm is not set to a con- stant value, in contrast to for sinusoidal PWM. The duration of each switching period depends on how long it takes before a tolerance band is exceeded by the phase current. How fast the current exceeds a tolerance band depends on the derivative of the phase current, which can be seen in Eq 20. The higher the derivative of the current is, the shorter the switching period. The parameter with the highest influence on the current’s derivative is the inductance LS in the stator winding. Also, the switching period is affected by the sampling frequency of the microcontroller. This sampling frequency has to be fast enough, so that it is detected quickly when the phase current exceeds a tolerance band. dI V a = a (20) dt LS

13.5.7 Sizing of a filter circuit on the generator side A low-pass filter circuit was designed for the generator in the master’s thesis of Falk Olson. One LP filter should be connected in series with each of the three stator windings on the generator side of the converter. Hence three filters should be constructed. The inductance of each filter was dimensioned to 5 mH in Falk Olson’s thesis. The construction of these filter circuits is however outside the scope of this master’s thesis.

13.5.8 Sizing of the snubber circuits Snubbers should be connected in parallel with the power MOSFETs, in order to reduce overvoltage and overcurrent transients. The unwanted energy in the transients is then directed into the snubbers, instead of into the semiconductors. The destructive impact of the transients on the converter can then be alleviated. In the master’s thesis of Falk Olson it was decided to use the snubber circuit which can be seen in Fig 14. The values of the electrical components in the snubber circuit are listed in Table 5.

It should be noted that it is necessary for the snubber capacitors to have a low equivalent series resistance (ESR). The reason for this is that the current through the capacitor is occasionally high, which leads to overvoltages if the ESR is not low. A good type of snubber capacitor is a film capacitor, because

35 of its low ESR [12, p. 32].

Component Value Comment L1 135 Turn-on snubber nH inductor R4 2.2 Ω Combined turn-on snubber and over- voltage snubber re- sistor C1, C2 633 Turn-off capacitors pF R1, R2 75 Ω Turn-off resistors C4 100 Over-voltage ca- nF pacitor Figure 14: The snubber cir- Table 5: The snubber circuit cuit which was dimensioned component values which were for the power MOSFETs by dimensioned by Falk Olson. Falk Olson [12]

13.5.9 Sizing of the DC-link filter capacitor The DC-link voltage level should be maintained at a stable voltage level, lim- iting the DC-link’s voltage ripple. In Gustaf Falk Olson’s master’s thesis the DC-link capacitor was dimensioned to a capacitance of CDC = 10mF .

13.6 Electrical components for the initial labora- tory test setup The components decided upon in Section 13.5 are the components which should be used for the final high power laboratory testing. During this thesis, however, power levels of the same magnitude will not be used. This is mainly because of the time limitation for the project and because the initial tests should be kept at fairly low power levels, in order to safely detect eventual problems or errors in the prototype. Therefore, electrical components with lower power ratings can be used for the initial laboratory testing. A different DC-link capacitor and a different topology for the snubber circuits will be used. Also, as a result of the changed energy storage level in the capacitor, a bleeder resistor will be chosen based on that energy level.

13.6.1 DC-link capacitor for the initial lab testing An electrolytic capacitor will be used in the DC-link during the initial testing. This capacitor was present in the laboratory already. Some important values for the electrolytic capacitor are listed in Table 6. The maximum current ripple specifies the maximum allowed difference between the capacitor’s charge current and discharge current.

36 Capacitance 10 mF Maximum voltage 160 V Maximum current ripple 16 A

Table 6: Some important parameters for the DC-link capacitor used during the initial laboratory testing.

Figure 15: The capacitor with maximum voltage 160 V, to be used during the initial labora- tory testing.

13.6.2 Bleeder resistor for the initial lab testing The bleeder resistor is dimensioned in Eq 21 so that the capacitor will discharge down to 10 % of its original voltage UC,0 within 14 minutes. Based on this resistance value and on the power dissipation in 22, a 33.6 kΩ resistor with power rating 2 W was chosen as a bleeder. This power rating was deemed as a safe choice, based on the maximum power dissipation in the bleeder, calculated in Eq 22.

du (t) u (t) tdischarge C c − CR − = 0 =⇒ uC (tdischarge) = UC,0e bleeder = 0.1UC,0 =⇒ dt Rbleeder

t 13 · 60 R = discharge = ≈ 33874Ω bleeder Cln(10) 10 · 10−3ln(10) (21)

V 2 1602 P = C,max = ≈ 0.76W (22) Rbleeder 33600

13.6.3 Snubber circuits for the initial lab testing It was decided to use a modified topology for the snubber circuits during the initial testing, after a consultation with Matthijs Heuvelmans, a PhD student

37 at KTH in the field of power electronics. The solution decided upon was to use one film capacitor of 330 nF in parallel with the DC terminals of each power module. This could be regarded as a good enough solution during low voltage testing, according to Heuvelmans. It may happen that a resonance oscillation is later detected in the voltage drop over the lower MOSFET in a phase-leg. In case this happens, a band-stop filter can be connected in parallel with the lower MOSFET, attenuating the resonance frequency. The topology of this modified snubber circuit with one capacitor across each phase-leg can be seen in Fig 22.

It was decided that the snubber capacitors should be connected to the power modules by means of short cables, instead of fastening the capacitors directly onto the terminals of the modules. A short cable brings along a certain extra inductance before the snubbers, but the benefit of this connection is the modu- larity; the snubbers can easily be removed or connected. This way experiments can be performed with or without the snubbers, as a way of evaluating their performance.

13.6.4 Level shifters The Beaglebone Black microcontroller gives a PWM signal with a maximum amplitude of 3.3 volts on its PWM pins. The MOSFET drivers require PWM input signals with an amplitude of 5 volts. If signals of lower amplitude are used, the voltages on the outputs of the drivers will not be high enough to open the power transistors. For this reason, it is necessary to use level shifters to- gether with the Beaglebone Black. Two reference voltages should be given to each level shifter: 3.3 V on the input and 5 V on the output. This makes the level shifter convert the 3.3 V signals to 5 V signals.

Low-pass filters were considered necessary in the signal path between the level shifter and the MOSFET driver. The reason was to remove high-frequency noise from the PWM signals. A circuit diagram for the level shifter and the filter can be seen in Fig 16 below. The value of the filter resistor R in the diagram is 1 kΩ and the capacitor C is 62 pF . This low-pass filter was dimensioned by Aliro Cofre Osses [7].

Figure 16: Circuit diagram for the level shifter, with its low-pass filters visible to the right.

38 13.7 Electrical isolation paper Electrical isolation paper, surrounding the copper plates in the DC-link, is in- tended to protect persons from the exposure to electrical hazard. It should also make sure that different nodes do not come into contact - which would cause a short-circuit. Most importantly, the isolation paper has to be placed so that it surrounds and isolates the positive DC-link copper plate. This node will even- tually, in later experiments, reach a voltage of 900 V.

Nomex 410 paper was ordered. This isolation paper can withstand voltages kV up to 33 mm . The ordered piece of paper had a thickness of 0.25 mm. This means that it can withstand a voltage of 8.25 kV [11]. This paper should be reliable enough if the DC-link voltage is kept around 900 V.

13.8 Heat sinks A cooling system is required for the power modules, as they will be operating at high currents, causing power losses during switching. The lost power is dissipated as heat. Heat sinks LA6 from Fischer Electronics were chosen for the cooling of this heat. The selection of these heat sinks was based on calculations by Aliro Cofre Osses, available in his master’s thesis [7]. 14 Planning for the control system of the power electronic converter

The development of a PWM code was necessary to be able to control the active rectifier. The PWM code controls the switching of the converter. It thereby de- termines the type of output signal which is generated as a result. The first part of the practical work during this master’s thesis was the development of such a PWM code. In addition to this code development, some software experiments were performed in order to investigate how the switching frequency affects the control of the current using hysteresis current control.

The method which will be used for reducing reactive power in the TFPMSM is active power factor correction. By using hysteresis current control, the cur- rent can be forced to be in phase with the voltage in the stator winding. The principles behind hysteresis control and active power factor correction were ex- plained in section 10.5.1.2 and 13.2.1. In this section it will be explained how a programming code was developed, intended for later use during the control of the converter in the experiments in Section 18.

14.1 Beaglebone Black and the choice of the Python programming language The Beaglebone Black (BBB) microcontroller is versatile in the sense that many programming languages can be used for programming it. It was originally planned to program the BBB using C++. The reason for this was that C++ is a typical and common language for programming microcontrollers [15]. Quite some time was spent in learning the basics of C++ and a hysteresis control code

39 was eventually developed in C++. This code showed the correct results when running in the IDE program Eclipse. There was however less success in getting the BBB to return actual PWM voltages at its PWM pins. In order to get this to work, the BlackLib C++ library for Beaglebone was downloaded. It was tried extensively to achieve a PWM signal, but the attempts were unsuccessful.

Eventually a Python code was created and tried out with the BBB. This turned out to work very effectively together with the preinstalled Adafruit Python GPIO library. With this library it was possible to generate a PWM signal from the BBB.

It is possible that the use of C++ could have been successful if there had been more previous experience with C++. But since there was a lack of time and Python seemed to work well already, it was decided to use Python instead of C++ for the PWM code in this master’s thesis.

14.2 Development of a SPWM control Python code The first Python code to be created for the microcontroller was the code for sinusoidal pulse-width modulation (SPWM). SPWM is used when an AC volt- age with a sinusoidal waveform is desired on the AC side of a voltage-source converter. The final SPWM code can be found in the appendix in Section 22.3.1.

14.3 Development of a hysteresis control Python code The next step was to develop a code for hysteresis control. When hysteresis control is used, the converter should send a voltage pulse to the AC side when it is desired to change the AC current’s derivative. This is achieved by switching of the transistors in the converter. The theory for this was explained in Section 10.4.1.

A PWM code was written in Python, implementing hysteresis current con- trol. This code can be found in the appendix in Section 22.3.2. The AC phase voltage, phase current and reference current were plotted in the time domain. These plots can be seen in Section 22.2 in the appendix. The inductance value which is used for the stator winding is L=40 mH. The voltage on the DC side is 40 V. The AC voltage has an amplitude of 20 V and a frequency of 50 Hz.

Two types of switching schemes for hysteresis control were tested in this sim- ulation. First, bipolar switching was tested, with one tolerance band on each side of the reference current. The converter should then send a voltage pulse to the AC side, immediately when the phase current exceeds a tolerance band. Secondly, unipolar switching was simulated, with two current tolerance bands on each side of the reference current. Then, as the current’s value is between the first and the second tolerance band, the sign of the AC side voltage is taken into account before it is decided if a voltage pulse should be sent. This principle

40 was described in Section 12.3.

Two flow charts describing the functions of the bipolar and unipolar switch- ing codes are presented in the sections 14.3.2 and 14.3.2 below.

14.3.1 Flow chart for the bipolar hysteresis control code The flow chart in Fig 17 describes the different steps in the code which im- plements the bipolar hysteresis control. The value of the actual phase current is compared with the reference current’s value in each iteration. If the phase current’s derivative is correct, the converter’s switching state is kept the same. If the derivative is wrong, however, the switching state is changed.

The variables Ia and Iref in the flow chart are the phase current and the reference current. C denotes the constant value of the tolerance band. Vdc is the constant voltage value on the converter’s DC side, whereas Vconv is the voltage value which appears at a given instant on the converter’s AC side.

Figure 17: Flow chart for the bipolar hysteresis control code.

14.3.2 Flow chart for the unipolar hysteresis control code The flow chart in Fig 18 describes the code for implementing unipolar hystere- sis control. As mentioned in Section 13.2.1, two hysteresis tolerance bands are used. If the phase current exceeds the first tolerance band, the converter only

41 switches if the EMF voltage has a certain sign. If the phase current exceeds the second tolerance band, the converter always switches.

The variables used in the flow chart in Fig 18 have the same names as in the flow chart for bipolar hysteresis control, described in Section 14.3.1.

Figure 18: Flow chart for the unipolar hysteresis control code.

42 14.4 Hysteresis control simulations for different sampling frequencies After Python codes had been composed for implementing bipolar and unipolar hysteresis control, simulations were performed in order to test the codes’ cor- rect function. The results of these simulations are presented in the appendix in Section 22.2. The purpose of these simulations was mainly to examine the effect of the microcontroller’s sampling frequency on the deviation of the generated phase current from the reference current. With sampling frequency is meant how many times per second the microcontroller measures the value of the phase current. This will become important during the experiment with hysteresis con- trol, described in Section 18. The simulations for hysteresis control also measure how the sampling frequency affects the switching frequency of the converter.

14.4.1 Switching frequencies for different sampling fre- quencies In Table 7 it can be seen how the switching frequency is changed for different sampling frequencies.

Sampling frequency Switching frequency, Switching frequency, bipolar switching [Hz] unipolar switching [Hz] 1 kHz 600 602 4 kHz 2500 2600 10 kHz 6300 7370 50 kHz 22698 14300

Table 7: Switching frequency, depending on sampling frequency and SPWM algorithm.

14.4.2 Current deviation from the reference current for different sampling frequencies The phase current’s maximum deviation from the reference current can be seen listed in Table 7, depending on sampling frequency and SPWM algorithm. The current’s deviation plotted against the sampling frequency can be seen in Fig 19.

Sampling frequency Deviation, bipolar Deviation, unipolar switching [%] switching [%] 1 kHz 107.66 107.66 4 kHz 32.58 26.56 10 kHz 8.25 7.83 50 kHz 2.88 0.90

Table 8: Current deviation, depending on sampling frequency and SPWM algorithm.

43 14.4.3 Conclusions about the necessary sampling frequency for unipolar PWM hysteresis control The current’s deviation was plotted against the sampling frequency in Fig 19. Based on this graph and on the data in Table 8 it is concluded that the sampling frequency during hysteresis current control has to be at least 10 kHz. Then it can be assumed that the current is safely controlled and monitored.

Phase current's deviation from the reference current 140

120

100

80

60 Percent

40

20

0

0 20 40 60 80 100 Sampling frequency [kHz]

Figure 19: The phase current’s deviation from the reference current, plotted against the sampling frequency.

15 Planning for the construction of the ac- tive rectifier

The construction of the converter system was divided into five stages: 1. Draw circuit diagrams for the converter 2. Take practical aspects for the construction into account 3. Setting up a CAD model of the system, based on the circuit diagrams and the practical aspects 4. Ordering of electrical and mechanical components 5. Assembly of the converter

44 These individual stages for the converter construction will be presented in this section.

First the special characteristics for the laboratory prototype of the converter system will be described in Section 15.1 below.

15.1 Laboratory setup with machines and two con- verters Two electrical machines, both with Anders Hagnestål’s design, will be used together during the laboratory testing of the wave power plant. One of these machines will be set up working as a motor, in order to simulate the motion of the sea waves. This motor will be used for moving the generator, causing it to generate electric power. Since two machines will be used, two power electronic converter systems will also be needed. The motor will take electric power from the DC-link and the generator will feed power into the same DC-link. The circuit from the diagram in Section 15.3.2 will therefore be built two times, connected to the same DC-link. Since each converter system uses 12 power modules, there will in total be 24 modules placed out on the DC-link. CAD models for the intended final converter system can be seen in Section 15.6.

15.2 Two modules instead of four during the ini- tial testing phase Four power modules per phase will be used in the final converter prototype. This doubles the maximum current for each phase, as was described in Section 13.5.3. In the single-phase converter which is built within the scope of this master’s thesis, however, two power modules instead of four will be used per phase. The reason for this is mainly to simplify the circuit, making a simpler circuit topology work first, before more circuit elements are added. The operation principle with two modules is the same as with four, but working with fewer components was seen as beneficial, since it narrows down the number of possible errors, such as loose connections and similar.

15.3 Circuit diagrams The block diagrams and circuit diagrams for the AC/DC converter system will now be presented. The circuit diagrams will both be presented in simplified and detailed versions. The simplified diagrams intend to give an overview of the double three-phase system described in Section 15.1, which will eventually be constructed after the end of this master’s thesis. The detailed circuit diagram for one phase in Fig 23 shows the circuit which will be built during this thesis. In order to continue building the system with six phases, the circuit for one phase can be built six times. After the finished construction of this six-phase system, the rest is a matter of synchronizing the control of the whole system.

45 15.3.1 Simplified block diagram for the final laboratory setup with two machines The block diagram in Fig 20 shows a simplified representation of the final con- verter system for the lab test setup with two three-phase converters. To the left is the generator and to the right the motor.

Figure 20: Simplified block diagram of the final laboratory test setup with two electrical machines.

15.3.2 Simplified circuit diagram for one single-phase con- verter with four phase-legs Figure 21 shows a simplified diagram for how one single-phase converter should be connected. This should be done after the circuit in Fig 22 works well, as was described in Section 15.2.

Figure 21: Simplified circuit diagram for one single-phase converter with four phase-legs.

46 15.3.3 Simplified circuit diagram for one single-phase con- verters with two phase-legs The circuit diagram below in Fig 22 is a simplified representation of the circuit which should be built during this master’s thesis. When this circuit works well, it can be proceeded with building the circuit in Fig 21.

Figure 22: Simplified circuit diagram for one single-phase converters with two phase-legs.

47 15.3.4 Detailed circuit diagram for one single-phase con- verter with two phase-legs Figure 23 shows a more detailed circuit diagram for the same circuit as in Section 15.3.3 above. In this schematic the level shifter and its filter is included. For the values of this filter, see Section 13.6.4.

Figure 23: Detailed circuit diagram for one single-phase converter with two phase-legs

15.3.5 Circuit diagram for the connection of the current sensor The current sensor has four terminals, which are listed in Table 9. A voltage divider circuit is required for achieving the 2.5 V voltage level for the sensor’s reference pin. Two voltage dividers are also necessary for the connection of the current measurement signals to the Beaglebone Black. The reason for this is

48 Current sensor pin Voltage level VCC 5 V (in) VDD 0 V (in) VREF 2.5 V (out) VOUT Variable ouput voltage: [0,5] V (out)

Table 9: The four pins and the voltage signals which should be connected to the pins.

Current sensor pin Voltage level P9 33 Sensor’s output signal: [0,1.8] V P9 35 Reference voltage of 0.9 V

Table 10: The analog input pins on the Beaglebone Black to which the current sensor signals should be sent. that the AIN pins have a maximum voltage level of 1.8 V. If a higher voltage is given to them, the BBB is destroyed. The selected input pins on the BBB and their corresponding voltage ranges are listed in Table. Decoupling capacitors are also connected for removing high-frequency noise from the measurement sig- nals fed into the Beaglebone Black. These capacitors are connected as close as possible to the pins on the BBB.

The circuit diagram for the connection of the current sensor can be seen in Fig 24. The values for the electrical components in this circuit can be found in Table 11.

Quantity Value R1 1260 Ω R2 560 Ω R3 10 kΩ C1 100 pF C2 220 pF C3 4700 pF

Table 11: Electri- cal component val- ues for the cur- rent sensor circuit in Fig 24.

Figure 24: Circuit diagram for the connection of the current sensor.

49 15.4 Practical design aspects to take into account The design of the power electronic converter depends not only on the electrical system, but also on geometrical and mechanical aspects. This will be discussed in this section.

15.4.1 Copper plate dimensions The two copper plates, making up the nodes of the DC-link, should be large enough to fit all the power modules. In total there are 24 power modules, as was explained in Section 15.1. By setting up a CAD model, it could be visualised how much space is needed for all the components in each phase-leg. This CAD model will be presented in Section 15.6.

15.4.2 Elevation of the copper plates above the DC-link capacitor The DC-link capacitor has a certain height, and it should ideally be placed underneath the copper plates. Placing it under the plates increases the safety, for reasons which will be discussed in Section 15.5.4. The copper plates however have to be elevated a bit into the air, so that the capacitor can fit below the plates,

15.4.3 Mechanical and electrical connection of the power modules Each power module has three electrical terminals and these should be in contact with three nodes: the positive and negative DC-link nodes and the AC node of each phase in the three-phase system. The DC nodes are made up of the copper plates. A good way of attaching a power module to a plate is to use bolts of ap- propriate dimensions, in combination with washers and nuts. This is why there is a threaded hole for each terminal in the power module. A bolt provides a sta- ble mechanical connection, if it has the right length and is sufficiently tightened. A metal bolt also leads current, so the bolts can be part of the electrical cir- cuit. The bolts chosen for the converter in this master’s thesis are made of steel.

In order to pull the bolts through the copper plates, holes have to be made in the plates. Some of these holes should be big, making it possible to avoid contact. Other holes should be small, so that contact is made possible. The chosen design for the copper plate holes will be presented in Section 15.6.

15.4.4 Placement of electrical cables Only two cables are necessary for the DC-link: one positive and one negative. These cables are connected to the terminals of the capacitor in the DC-link. The colors of the DC side cables are chosen to red and black. For the AC-side of each phase, two cables are also needed: one phase conductor and one neutral conductor. These AC cables should be connected to the AC terminals of the power modules.

50 15.4.5 Attachment of the heat sinks Heat is developed as a result of losses in the power modules. This hot air moves in an upward direction from the modules. For this reason, it was decided to flip the power modules upside down, so that free way is given for the hot air to move away. Holes should therefore be drilled in the modules’ undersides. These holes can be used for screwing heat sinks onto the undersides of the modules.

15.5 Safety aspects Since this is a high-voltage project, the safety is a very important aspect. This applies both for the person executing lab work and for people not involved in the project, who are also present in the lab. A few measures related to increasing the safety of the lab setup will now be discussed.

15.5.1 Position of the positive voltage DC-link copper plate The positive DC-link node could be placed either below or above the negative node. Placing it underneath can be seen as safer, since it would then be placed further away from the user of the converter. It was therefore decided to put the positive plate below the negative plate.

15.5.2 Electrolytic DC-link capacitor polarity An electrolytic DC-link capacitor will be used in the preliminary lab setup, used for the experiments for this master’s thesis. It is very important for electrolytic capacitors that the polarity is correct when currents flow into the capacitor. If a positive voltage is connected to its negative terminal it may explode.

In later experiments, after the end of this thesis, film capacitors should be used in the DC-link. Film capacitors are not polarized, so the aspect with the capacitor polarity will not be important. But until the capacitors are changed, this is a very important thing.

15.5.3 Limiting the charging current for the DC-link ca- pacitor Before each experiment is commenced, the DC-link should be charged up to the right voltage. This can be achieved by first connecting a DC voltage source to the DC-link, in order to charge up the capacitor. During the DC-link charging it is very important to limit the charging current into the capacitor. The reason is that a capacitor has a very low internal resistance. If the resistance approaches zero, the current approaches infinity, according to Ohm’s law in Eq 23. This happens regardless of the voltage level in the capacitor. The high current into the capacitor can cause the capacitor to explode. In reality, the current is not infinite, but it can become very high. The capacitor current has to be limited by connecting a resistor in series with the DC voltage source [1].

In the experimental scenarios presented in Section 18, there is a built-in current limit of 1.25 A for the DC voltage source. This maximum current is not

51 so high that it causes a risk of capacitor explosion. Therefore no resistor is used in series with the capacitor in the experiments in Section 18.

Vc Ic = limRc→0 = ∞ (23) Rc

15.5.4 Protection against an eventual capacitor explosion A capacitor explosion can be very dangerous, since hard pieces of the capacitor’s casing may be thrown away out in the room. Also, the release of heat from the explosion and eventual short-circuits may cause a fire, depending on the components and material surrounding the capacitor. A safety measure that can be taken, in case of an explosion, is to block the flying capacitor pieces using a wall. In this master’s thesis, an explosion protection will be built, covering the space under the lower copper plate where the capacitor is located.

15.6 CAD model for the final design In order to plan and to get a good overview before the construction of the con- verter, a CAD-model was set up for the converter system. The CAD model was also intended to help with choosing the right geometrical dimensions of the copper plates and the isolation paper. The software used for making the CAD model was SketchUp. First the individual power modules were drawn in 3D. They were then flipped upside down in the model. The heat sinks were drawn on top of the undersides of the power modules, facing upwards. The MOSFET drivers were drawn connected to the pins of the power modules. Then these entities - the modules, heat sinks and drivers - were copied and pasted 24 times and placed out next to each other. A square area was drawn around the 24 modules, representing the two copper plates. It was found that an area of 1x1 metre for each copper plate would be sufficient. Isolation paper was drawn out in between the plates.

The holes for attachment of the power modules were drawn out on the copper plates. Two holes were made under each module. Small holes were drawn where the bolts should have electrical contact with a plate and big holes where the bolts should avoid contact. The CAD model of only the two copper plates can be seen in Fig 25c. The plate to the left is the upper plate and the plate to the right is the lower plate.

15.6.1 Plastic boxes for containing the snubber circuits Red and blue plastic boxes were chosen as a way of containing the snubber circuit for each power module. The plastic boxes can be seen in the CAD model in Section 15.6. It was seen as practical to contain the snubbers this way, because it isolates them from accidental contact with other devices. Another reason for this solution was to make the circuit layout more clear. Using red and blue colors was intended to show the user of the converter which power module was connected to which AC node.

52 (a) The two three-phase converters, as seen from above.

(b) The two three-phase converters, as seen from the side.

(c) The two copper plates, with the holes for the attachment of the power modules.

Figure 25: Preliminary CAD model for six phases (generator and motor). To be used during the laboratory testing of the final wave power plant prototype.

53 15.7 CAD model for the laboratory setup of the converter There was not enough time during the execution of this master’s thesis for building the whole converter system. Therefore it was decided, as previously mentioned in Section 8, to build only one voltage-source converter during this thesis’ work. The rest of the construction should be finished afterwards. Fig 26 shows the CAD model of the converter system which would be built during the practical part of this thesis.

(a) CAD model for one phase. The converter seen from above.

(b) CAD model for one phase. The converter seen from the side.

Figure 26: Preliminary CAD model for one phase. To be used during the laboratory work during this thesis.

54 Part IV Practical work 16 Construction of the active rectifier

After the required components had been selected, they could be ordered and the construction could begin. The process of building a laboratory prototype of the converter system will now be described.

16.1 Construction of the DC-link The first thing to arrive was a copper plate of size 2x1 metre. This big cop- per plate, which can be seen in Fig 27, was sawn into two equally large plates of 1x1 metre, using a metal saw. The holes for the connection of the power modules were then drilled out. In order to assure a correct placement of the holes, a marker pen was used for drawing straight lines with red ink across the copper plates. At the correct places along the lines, drill hole placements were marked out. The small holes were drilled out using a twist drill bit of diameter 8 mm, whereas the bigger holes were drilled with a circle cutter drill bit with a diameter of 35 mm. In addition to the holes intended for connecting the power modules, two holes were drilled in the middle of the DC-link plates, intended for connecting the DC-link capacitor.

The isolation paper was placed on top of the two plates before the drilling of the holes in the plates. The places for making holes in the paper were marked out by looking at the copper plate markings below the paper. After that, round holes with a diameter of 8 mm were made in the paper, using a twist drill bit.

The two copper plates, constituting the two nodes of the DC-link, were placed on top of each other, separated by the sheets of isolation paper. The upper sheet was folded, covering the upper copper plate on both sides. This can be seen in Fig 28. The lower sheet was originally covered the lower plate in the same way, on both sides. However, this lower part of the paper was eventually cut off, making it easier to see the connections of the power modules from below.

55 Figure 27: 2x1 metre copper Figure 28: Isolation paper. plate, before its division in two.

Figure 29: Photos showing the big copper plate, before it was divided in two, and isolation paper which was folded around the copper plates.

16.2 Construction of a wooden suspension for the copper plates A wooden structure was built for suspending the copper plates above the table beneath. This suspension structure, which can be seen in Fig 30a, was built using wood planks from a pallet that had been sawn into two pieces. The two pallet segments were then stacked on top of each other, rising approximately 16 cm above the table. The reasons for building this suspension were several:

• Making room for the DC-link capacitor under the copper plates • Simplifying the connection and disconnection of the power modules from the copper plates • Providing an explosion safety barrier in case of an accident where the electrolytic DC-link capacitor explodes

16.3 Preparation of the power modules The heat sinks were first prepared with threaded bolt holes of diameter 6 mm, using a threading machine. Thermal paste was applied to the undersides of the two power modules and the heat sinks were steadily attached to the modules, using bolts of 16 mm length and 6 mm diameter.

Electrical cables were connected to the six output pins of the MOSFET drivers. One red cable was connected to the upper transistor’s drain terminal and one yellow cable to the lower transistor’s drain. Four blue cables were

56 (a) Wooden structure which suspends the DC-link above the table beneath - mak- ing room for the capacitor and providing a safety barrier.

(b) Heat sinks attached to the undersides of the power modules.

Figure 30: Two photographs, showing the wooden suspension and a power mod- ule with a heat sink attached.

57 connected to the driver outputs intended for sending the transistor gate-source signals. These blue cables can be seen in Fig30b.

16.4 DC-link capacitor connection The DC-link capacitor was placed under the copper plates, which had been raised up by the wooden suspension. Two bolts of diameter 6 mm and lengths 19 mm, were put through the holes in the plates. Each bolt was thereby connected to one DC-link node and to one capacitor terminal. Also, the bleeder resistor was connected in between these bolts. The cables for connection of the DC voltage source were also connected using these bolts.

16.5 Connecting the power modules, snubber ca- pacitors and high-voltage cable connections The power modules were connected to the DC-link copper plates using bolts of diameter 6 mm (M6 bolts). To the bolt of the positive DC-link node, with length 24 mm, one short red cable was connected. To the negative DC-link node, a short blue cable was connected, using a bolt of length 19 mm. These short cables were then connected to the terminals of the snubber capacitors. The reason for connecting the snubbers in this way was to achieve a modular setup, as was described in Section 13.6.3.

To the AC-terminals of the modules, cables with red or black female banana connectors were connected; the red contact signifying phase-leg A and the black contact signifying phase-leg B.

A photo showing one fully prepared power module from above can be seen in Fig 32. It has a heat sink, a MOSFET driver and a snubber capacitor connected to it. It also has three electrical cables connected to its transistor terminals, but only the black AC side cable is visible in the photo.

16.5.1 Choice of cable colors for marking out the different nodes The choice of color for the cables was intended to mark clearly which node the cable was part of; red signifying positive DC, blue negative DC and yellow the AC side. Red and black contacts were chosen for the cables intended for con- necting the AC load or AC source.

Cable color Converter node Red Positive DC Blue Negative DC Yellow AC side

Table 12: The colors of the cables were chosen for marking out the associated electrical nodes.

58 16.6 Connecting the PWM control system The process of connecting the signal paths for the converter’s control system will now be described. The signals travel from the microcontroller’s PWM pins to the transistors’ gate terminals, amplified in several stages on the way.

16.6.1 Beaglebone Black pins The gate pulses for the transistors are initially produced by the Beaglebone Black PWM pins. The pin which shall generate a specific signal is decided by the code in the microcontroller. The voltage level of all the PWM signals from the BBB is 3.3 V.

The current sensor is also connected to the Beaglebone Black, to the analog input pins. More about this in Section 16.8.

Pin Signal P9 1 Common ground P9 3 3.3 V reference for level shifter P9 14 PWM signal for transistor A1 P9 16 PWM signal for transistor A2 P9 21 PWM signal for transistor B1 P9 22 PWM signal for transistor B2 P9 33 Current sensor output signal P9 35 Current sensor reference voltage

Table 13: The signals con- nected to the Beaglebone Figure 31: The Beaglebone Black. Black with current sensor and level shifter connected.

16.6.2 Conversion of the PWM signal voltage levels The PWM signals from the Beaglebone Black go to the level shifter, which shifts the voltage level of the signals from 3.3 V to 5 V. On the outputs of the level shifter are the low-pass filters, which were described in Section 13.6.4. One 3.3 V reference voltage is connected from pin P9 3 of the BBB to the input reference of the level shifter. To the output reference of the level shifter is connected a 5 V reference voltage from the 5 V supply voltage. A photo showing how the level shifter is connected to the Beaglebone Black can be seen in Fig 31.

16.6.3 MOSFET driver input signals As there was a lack of information in the datasheets for the Cree MOSFET drivers, the way of using them had to be found through trial and error. It was found that the drivers would do what they should, amplifying gate pulses cor- rectly, as long as a PWM signal was fed to its gate pins and a 5 V DC voltage was fed to its reset pins. It is however not known what the purpose of the reset signal is. Until its purpose is found out, a constant 5 V voltage can be fed to the reset pins continuously. There are also two other unknown pins per transistor

59 in the MOSFET drivers. These pins are named ready and fault. It was found out that the driver would work well with these pins disconnected. In Fig 33 a photo can be seen with the connections used for the MOSFET drivers. The connections are also listed in Table 14. The supply voltage is connected at the far right in the photo. The purple cable, which is connected to all the ground pins of the driver, goes to a ground plane which is used as a common ground for all the digital signals in the control system. This ground plane in its turn is connected to the negative terminal of the 5 V DC supply voltage.

Figure 32: One power module with heat sink, MOSFET driver, snubber capacitor and cables connected.

Pin number Signal 2 Gate upper 4 Reset upper (5 V) 10 Gate lower 12 Reset lower (5 V) 18 VCC 15 V 20 VCC 15 V 1,3,5,7,9,11,13,15,17,19 Common ground

Table 14: The input signals to a Cree MOS- FET driver. Figure 33: MOSFET driver signal cabling.

16.6.4 MOSFET driver output signals The output signals from the MOSFET drivers are the gate-source pulses for the power MOSFETs. There are four cables for this: two for the gate terminals and two for the source terminals. These cables had to be arranged so that they cross each other. The reason for this was that the power module is turned upside down, in order to make room for the heat sinks, as was explained in Section 13.8.

60 16.7 Supply voltages for the control system Different components in the control system need different supply voltages in order to operate. Also, the fans in the heat sinks need their own supply voltage source. All these different supply voltages were provided through (switching) DC power adapters. The cables from three different DC adapters were cut off. The ends of these cut-off cables were then attached to lugs, using a cable crimper. The cable ends were then screwed onto small copper plates on the wooden structure next to the DC-link. In this way, supply voltage buses of dif- ferent amplitude could be made available for the different devices in the control system. The three supply voltage levels and the associated devices which are fed by these can be seen in Table 15.

Supply voltage level Supplied devices 15 V MOSFET drivers 12 V Heat sink fans 5 V Level shifter, current sensor and reset signals

Table 15: The supply voltage levels and the supplied electrical devices.

16.8 Connecting the current sensor There were several things to consider during the connection of the current sensor. The current sensor should have a supply voltage of 5 V and a reference voltage of 2.5 V. Also, the analog in (AIN) inputs of the Beaglebone Black could only take a maximum voltage of 1.8 volts. For this reason voltage dividers were used for lowering the amplitude of the output signal from the current sensor. A description on the details of these voltage dividers can be found in Section 15.3.5. An explanation about how the current sensor was calibrated, setting up the BBB to interpret the sensor’s signals, will be given in Section 17.2.

(a) The current sensor’s whole circuit, with its two voltage dividers and the de- coupling capacitors at the input of the Beaglebone Black.

16.8.1 Amplifying the sensor’s measurement signal The current sensor HAIS 400-P was bought with the intention of measuring high currents. The sensor can measure current amplitudes within the range of [-600,600] A. In the initial laboratory testing for this thesis, however, the current will be limited to around 1 A. The problem with using the HAIS 400-P sensor for such a (relatively) low amplitude is that its voltage output signal is only around 10 mV for a 1 A current. A voltage signal of this level is hardly detectable by the microcontroller. But by winding the phase current conductor 52 times around the inside of the current sensor, this voltage signal could be

61 (a) The current sensor, with the phase conductor wound 52 turns around the sensor in order to amplify the voltage signal from the sensor. amplified 52 times; returning a 520 mV voltage for a 1 A current. A photo of the sensor with the wound phase conductor can be seen in Fig 35a. 17 How to use the Beaglebone Black in Mi- crosoft Windows

In order to set up the microcontroller for controlling the converter in Microsoft Windows, a program called Putty can be used for communicating with the Beaglebone Black.

17.1 Logging in to Putty In Putty, the Beaglebone Black can be accessed by connecting to the IP ad- dress 192.168.7.2, with SSH chosen as the connection type. A Linux termi- nal then opens in a Putty window. The username root should be given dur- ing the login. No password is required. Then, by browsing to the directory root/converter_codes in the Beaglebone Black, the Python programs used in the experiments in Section 18 can be viewed and started. The procedure for browsing to the directory and initiating the codes can be executed using standard Linux terminal commands.

62 (a) Putty log in screen. (b) Putty terminal window.

Figure 36: Two examples of the Putty interface, which can be used for interact- ing with the Beaglebone Black.

Current [A] Voltage signal value in BBB 0.5 0.047579 1 0.086134 1.5 0.124689 2 0.163244 2.5 0.201799

Table 16: The values returned in the Putty terminal, used for linear regression in order to calculate the phase current.

17.2 Calibration of the current sensor As the voltage signal was initially fed into the Beaglebone Black’s analog inputs, the values printed in the Linux terminal seemed like unreasonable voltage values. Therefore, the current sensor’s measurements first had to be calibrated; meaning that the linear relationship between the sensor’s voltage signal and the actual measured current had to be found. This could be done by taking notes on the voltage signal value for different currents through the sensor. The voltage values retrieved during this process are listed in the table below. From the values in Table 24, the linear function for the current on the form f(v) = kv + m could be found through linear regression. The retrieved current function can be seen in Eq 24 below.

As this function was written into the Python code, the Linux terminal started returning the correct current values as the current was continuously measured.

1 0.009024 I = k(V − V ) + m = (V − V ) − (24) phase sensor ref 0.07711 sensor ref 0.07711

63 18 Electrical experiments

The plan was to carry out two laboratory experiments, in order to test the con- structed voltage-source converter (VSC). The first experiment would be about the inverter operation mode with sinusoidal-pulse width modulation (SPWM). The task of the converter is then to generate an AC voltage with a given fre- quency. The second experiment would be testing the rectifier operation mode, with the converter controlled through hysteresis current control. Before the ex- ecution of this second experiment it would however be necessary to check that the microcontroller samples and iterates fast enough for a safe and reliable cur- rent control.

All experiments were performed using two power modules in the VSC circuit instead of four, as was described in Section 15.3.

18.1 Word of caution about the capacitor charg- ing current The DC voltage source, a Powerbox 3000, which is connected to the DC-link in the first experiment, has a current limitation of 1.25 A. This is important and must be considered. If another power source without a current limit would be connected instead, then a resistor must be connected in series with the capacitor.

18.2 Inverter mode, unipolar sinusoidal PWM In the first experiment the converter was operated as an inverter, converting power from DC to AC. The DC source was connected at the terminals of the DC-link capacitor, bringing the voltage in the DC-link up to 40 volts. The Beaglebone Black microcontroller was turned on, running the code spwmunipo- lar.py, which can be found in Section 22.3.1 of the appendix. This led to the BBB feeding a sinusoidal PWM signal to the gate drivers, via the level shifter. The reference sine wave in the SPWM code was given a frequency of 50 Hz. The amplitude modulation index ma was set to 1 and the frequency modula- tion index mf to 12.5. A photo can be seen in Fig 37, showing the laboratory setup and how all the components were connected during the experiment. The circuit diagram for the connection can be seen in Fig 38 and the component values found in Table 17.

64 Figure 37: The laboratory setup during the converter experiment with sinusoidal PWM.

VDC 40 V R 24Ω L 0 mH

Table 17: Elec- trical parameters for the circuit elements dur- ing the SPWM experiment. Figure 38: Circuit diagram for the laboratory setup during the experiment with sinusoidal PWM.

18.2.1 Inverter, no load

First the converter was run as an inverter with no load connected, i.e. RL = LL = 0. The DC side voltage was set to 40 V using the DC voltage source. The gate-source voltage signals of the MOSFETs were measured, as well as the DC and AC side voltages.

18.2.2 Inverter, resistive load of 24 Ohm Subsequently a resistive load of 24 Ω was connected on the AC-side. This was done with the intention of bringing the DC current up to 1.25 A, which was the maximum current value from the DC source at the "40 V"-setting. The reason for testing the converter under load was to see if overvoltage spikes would appear

65 over the power transistors, or if these are eliminated by the snubber capacitors.

18.3 Rectifier mode, hysteresis control with unipo- lar PWM The second experiment was intended to test the converter together with the PWM control algorithm which will later be used in the finished wave power plant. This is the hysteresis current control algorithm, described in Section 14.3. The goal of this experiment was to make the converter force the AC current from the grid in phase with the voltage. An inductor should be connected at the input of the converter - between the AC source and the converter. This inductance is necessary because it limits the derivative of the phase current, according to Eq 3. Without this inductance, the current would in theory rise infinitely fast and the current control would be impossible. Also, the inductor makes the system look more similar electrically to the wave power generator, where large inductances exist in the stator windings. The laboratory setup for the hysteresis control experiment can be seen in Fig 41.

18.3.1 Word of caution about the reference current The hysteresis control experiment can be dangerous if it is not performed in a proper way. The current into the converter is set by the reference current given in the microcontroller’s code. This current will flow into the DC-link, regardless of the load on the DC side. This means that if no load is connected on the DC side, and if the reference current is set too high for the bleeder resistance to discharge the capacitor, the capacitor will keep charging until it explodes.

18.3.2 Initial evaluation of the microcontroller’s sampling frequency Another critical thing to evaluate before the hysteresis control experiment was whether the sampling frequency of the Beaglebone Black is high enough. The microcontroller will only give directives to switch the transistors if it knows that the current has a too high or too low value. If it does not sample quick enough, it will not notice in time when the current exceeds the tolerance bands. Therefore, a too low sampling frequency will lead to an uncontrolled current, which is dangerous, since it could lead to a capacitor explosion. For this reason an experiment about the sampling frequency of the BBB had to be performed before the hysteresis control experiment could be carried out.

An autotransformer was connected to the grid. On its input it had a 230 V AC voltage and on its output an AC voltage of variable amplitude. This output voltage was chosen to 24 V and then connected to a 24 Ω resistance, giving rise to a current with peak amplitude 1 A. This current was led through the current sensor and the measurements were saved to a text file. These sampling points were then plotted together with the oscilloscope’s current measurement, in order to make a comparison of the two measurements. The sampling frequency fs of the BBB could be found by looking at the number of samples points for one

66 period in the 50 Hz current. The laboratory setup for this experiment can be seen in Fig 39.

Figure 39: Laboratory setup in the experiment where the sampling fre- quency of the microcontroller is measured.

VˆAC 24 V RL 24 Ω

Table 18: Elec- trical parameters for the circuit elements during current measure- Figure 40: Circuit di- ment. agram for the labora- tory setup during the current measurement.

18.3.3 Active rectifier with active power factor correction This section describes how the hysteresis control experiment can be performed. As will later be explained in the results in Section 19, this experiment could not be performed because of a too low sampling frequency in the Beaglebone Black. But if a higher sampling frequency is eventually achieved, then these experiment instructions can be followed for testing the hysteresis current control.

The autotransformer used in the sampling frequency experiment is connected to the AC side of the voltage-source converter, via a variable inductor. A resis- tive load is connected on the DC side of the converter. No DC power source is connected to the DC-link. Based on the value of the resistive load, the refer- ence current in the microcontroller is chosen. The current entering the DC-link through the converter should be equal to the load current on the DC side. Oth- erwise the capacitor will either keep charging or discharging, depending on if the current is too big or too small, as was explained in Section 18.3.1.

67 The current and the voltage on the AC side of the converter should be mea- sured during this experiment. The hysteresis control is successful if the AC current is in phase with the phase voltage and if the phase current has the same waveform as the reference current.

A photo of the laboratory setup for hysteresis control can be seen in Fig 41 below. The circuit diagram and the used electrical parameters can be seen in Fig 42 and Table 19.

Figure 41: Laboratory setup for the hysteresis control experiment.

VˆAC 24 V CDC 10 mF VDC RL Iref

Table 19: Elec- trical parameters for the circuit ele- ments during the hysteresis control experiment.

Figure 42: Circuit diagram of the laboratory setup during the experiment with sinusoidal PWM.

68 Part V Analysis 19 Experimental results 19.1 Inverter mode, unipolar sinusoidal PWM Four graphs will now be presented for showing the results of the SPWM inverter experiment. The first two graphs show the gate pulses sent from the MOSFET drivers to the transistors. The third, fourth and fifth graphs show the DC voltage, AC voltage and AC current during the no-load and load conditions.

19.1.1 SPWM, gate pulses

MOSFET A1, gate pulse MOSFET B1, gate pulse 30 30

20 20 10 10 [V] [V] 0 0 -10 -10 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 [seconds] [seconds] MOSFET A2, gate pulse MOSFET B2, gate pulse 30 30

20 20

10 10 [V] [V]

0 0

-10 -10 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0.04 [seconds] [seconds]

Figure 43: Gate pulses for phase- Figure 44: Gate pulses for phase- leg A. leg B.

Figure 45: Plots showing the measured gate pulses for the power transistors.

19.1.2 Inverter, no load The time domain measurements of the voltages in the converter during the no-load condition can be seen in Fig 46.

69 Sinusoidal PWM, no load, converter voltages 60 DC-link voltage AC side voltage 40

20

0 [V]

-20

-40

-60 0 0.01 0.02 0.03 0.04 0.05 [seconds]

Figure 46: Graph showing the voltages on the DC and AC side of the converter, as no load is connected on the AC side.

19.1.2.1 Frequency analysis A Fourier transformation, performed on the AC voltage generated in the SPWM experiment, can be seen in Fig 47.

Figure 47: Fourier transform of the AC voltage generated by the VSC. The left graph shows frequencies between 0 and 500 Hz, whereas the right graph shows 0 to 10 kHz.

19.1.2.2 Switching frequency The switching frequency of the generated AC waveform in Fig 46 is 2185 Hz. This frequency value was calculated in MATLAB, by measuring how often the voltage level in the AC signal is changed.

70 19.1.3 Inverter, 24 Ohm load The DC voltage, AC voltage and AC current for the converter, when a load of 24 Ω is connected, can be seen in Fig 48.

Sinusoidal PWM, 24 Ohm resistive load Sinusoidal PWM, 24 Ohm load, AC side current 50 2 DC-link voltage [V] 40 AC side voltage [V] 1.5 AC side current [A] 30 1 20 0.5 10

0 0 [A]

-10 -0.5 -20 -1 -30 -1.5 -40

-50 -2 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 0 0.005 0.01 0.015 0.02 0.025 0.03 0.035 [seconds] [seconds]

Figure 48: Time domain measure- Figure 49: Graph showing only ments when a load resistor of 24 the AC current, when a 24 Ohm Ohm is connected on the DC side. load is connected.

19.2 Measurement of the Beaglebone Black’s sam- pling frequency The graph in Fig 50 shows the current measurement from the Beaglebone Black together with the oscilloscope’s current measurement. Sampling frequency evaluation 1.5 Oscilloscope measurement Beaglebone Black measurement 1

0.5

0 [A]

-0.5

-1

-1.5 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 [seconds]

Figure 50: Graph showing the current measurement from the oscilloscope and from the BBB. It should be noted that the BBB samples only 8 times per period.

71 19.3 Rectifier mode, hysteresis control with unipo- lar PWM It was concluded before beginning of this experiment that it would not be safe enough to perform the hysteresis control experiment because the sampling fre- quency of the Beaglebone Black was too low. Therefore it was not performed. The motivation for this decision will be given in the conclusions in Section 22. 20 Discussion

The experiment with sinusoidal pulse-width modulation was quite successful. The constructed converter was able to convert a DC voltage into a 50 Hz AC voltage. This result showed that the voltage-source converter system is func- tional. If other conversion algorithms are desired, these can be implemented by changing the programming code in the microcontroller.

The experiment on hysteresis current control was however not possible to perform. The reason was that the sampling frequency of the microcontroller was too low. In Fig 51 a simulation showing hysteresis control with a sampling frequency of 300 Hz can be seen. The result with this frequency is an uncon- trolled phase current where the current’s deviation from the reference current is 200 %. This experiment would have been too dangerous to perform.

The sampling time for an AIN pin on the Beaglebone Black is 125 ns - equivalent to a sampling frequency of 8 MHz [3]. Therefore it should not be the hardware in the Beaglebone Black that is causing the problem with the slow sampling frequency. The probable reason for the slow sampling is that Python was used as a programming language. Python is a dynamically typed program- ming language, which makes it relatively slow [43]. Since the sampling of the current’s value is performed one time per iteration, the sampling frequency will also be affected by the code’s slowness. It would probably be a good idea to switch to a non-dynamic language, such as C++ or C, which are statically typed languages. In this thesis, it was originally intended to use C++, but it showed difficult to communicate with the GPIO pins in C++, since no library for that was installed beforehand. With Python the GPIOs could be controlled right from the start, so therefore Python was chosen.

Even though the control system’s slowness was probably caused by Python, not by Beaglebone Black’s hardware, there are also some issues suggesting that the microcontroller itself should be replaced. The first reason is that there are too few PWM pins on the Beaglebone Black for controlling the whole converter system, which will stand finished in the end. In this master’s thesis, experiments were performed on one converter phase, but in the end there will be in total six phases. This would require six microcontrollers if Beaglebone Black controllers were to be used. It would not be easy to synchronize all these controllers, so preferably one single microcontroller with more PWM pins should be used in- stead. Alternatively it may be possible to use the GPIO pins instead of the PWM pins for implementing PWM. There are 65 GPIO pins in a BBB [2]. In that case, two Beaglebone Black microcontrollers could be used for controlling

72 the six-phase system. The reason for using two BBBs is that a total of 12 AIN pins would be needed for measuring the six phase currents.

The other reason for an eventual replacement of the Beaglebone Black is that the voltage level is 3.3 V out from the PWM and GPIO pins. The MOS- FET drivers require PWM signals of amplitude 5 V. This resulted in that level shifters were needed - an extra stage in the signal path, which would have been unnecessary if the PWM voltage level had been 5 V from the start. The Ar- duino microcontroller for example uses a 5 V voltage level in its PWM signals. The Arduino is much too slow for controlling the converter built in this thesis, but possibly there are other more advanced microcontrollers which also use 5 V for their PWM signals. The level shifters can be seen as an unnecessary step. Voltage supplies and filters need to be built for each level shifter. If six phases are to be used in the final laboratory setup, it will require much work to build these six level shifter circuits. Also, the risk increases for glitches and other difficult-to-find errors to appear, as the number of components in the system increase. If all these extra level shifters can be avoided, it would probably be beneficial.

The frequency modulation index should not have been mf = 12.5. This was a mistake. The intention was to set it to mf = 25. The expression for the triangular carrier wave’s slope was however wrongly written, causing mf to be ˆ halved. The slope of the triangle wave should have been set to dvtri = 2·2·Vtri , dt Ttri ˆ but was accidentally set to dvtri = 2·Vtri . This made the triangle wave’s fre- dt Ttri quency, and thereby also mf , half as high as it should have been.

The amplitude modulation index was also set incorrectly. It should have been set lower than 1, but now it was set to 1. Setting ma to 1 is acceptable, distortion-wise, but it is better to set it lower, since that results in a lower THD [24, p. 219].

73 000000 0 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 00 0 0 0 0 0 00 0 0 0 0 0

Figure 51: A simulation showing the phase current which would have resulted for a hysteresis control experiment with a sampling frequency of 300 Hz.

21 Future work

Before the converter system can be used for its final task in the laboratory prototype, several modifications and further work needs to be performed. In this section it is attempted to summarize the necessary remaining steps, before the laboratory prototype can stand finished.

21.1 Increase the microcontroller’s sampling fre- quency The first thing which has to be done is to guarantee that the microcontroller samples quick enough. This could be done by changing the programming lan- guage so that the code runs faster. Also, it might be worth considering to get another microcontroller than the Beaglebone Black, for reasons mentioned in the Conclusions section.

21.2 Implement hysteresis control After the sampling frequency has been increased, the hysteresis control exper- iment described in Section 18.3 should be performed with unipolar switching. If the results are satisfying, more power modules can be added to the converter circuit.

74 21.3 Connection of two more power modules for the single-phase VSC The electrical experiments in Section 18 were performed using two power mod- ules in the VSC circuit. It should later be attempted to perform the experiments on SPWM and hysteresis control with four power modules, according to the cir- cuit diagram in Fig 21.

21.4 Holes for the MOSFET drivers in the copper plates The MOSFET drivers are currently connected to the power modules using four short cables. The reason for this was that the power modules are screwed with bolts onto the copper plates. It was not possible to connect the drivers directly onto the power modules because of the lack of space beneath the modules’ input pins. Also there is a plastic connector on the MOSFET drivers, taking up much space. A possible alternative to the connection solution used now is to cut holes in the copper plates beneath the module’s pins. Then the four cables can be avoided. This would remove undesired cable inductances affecting the gate pulses. The cutting could advisably be done using water jet cutting or similar, so that high accuracy is obtained.

21.5 Acquisition of film capacitors for the DC- link An electrolytic capacitor was used for the experiments in Section 18. During later experiments with higher power, film capacitors should be used instead. These should be bought and connected.

21.6 Holes in the plates for more DC-link capac- itors It is probable that more than one film capacitor will be needed for the DC-link. The reason is that both high voltage ratings and high capacitance is desired. Therefore it may become necessary to drill or jet water cut more connection holes for these capacitors.

21.7 Connection of the snubber capacitors beneath the copper plates A modular topology for the snubber circuits was used during the experiments in this thesis, with the capacitors connected by means of cables. The reason for this was explained in Section 13.6.3. In the final laboratory tests it is however advisable to connect the snubber capacitors directly to the bolts under the DC- link copper plates.

75 21.8 Acquire better understanding of the MOS- FET driver signal pins On the MOSFET drivers are three pins whose purposes were not properly un- derstood during the work in this thesis. These pins are the reset, ready and fault pins. They have not used in an organized manner, for the reason that the information about them online was scarce. It later turned out that the drivers could be used without these pins, but a proper understanding of their purpose should preferably be gained before the final lab work.

21.9 Connect all power modules and set up their control systems The circuit which was tested in this master’s thesis was only one sixth of the circuit for the final laboratory test setup. The final circuit can however be assembled based on the planning which has been done in this thesis. The sim- plified block diagram in Fig 20 shows the final test circuit. It can be achieved by connecting the single-phase converter from the diagram in Fig 21 six times. The intended setup is also illustrated in the CAD model in Fig 25.

21.10 Increase the voltage The voltage levels can be increased when everything for the six phases is con- nected and the whole control system is in place and fully working. 22 Conclusion

During the work of this master’s thesis, a single-phase voltage-source converter has been constructed. The converter should be part of a back-to-back converter topology with two three-phase converter systems interconnected via a DC-link, converting electric power from AC to DC and then back to AC again. This back-to-back converter will stand finished after further electrical construction, which will continue based on the work of this thesis. The final goal for the back- to-back converter will be to use it in the laboratory testing of the TFPMSM wave power generator designed by Anders Hagnestål.

The electrical tests performed on the constructed single-phase VSC showed good results for sinusoidal pulse-width modulation. This is promising, because if SPWM works, other switching algorithms should also work well. There is however an obstacle remaining before the hysteresis current control algorithm can be tested. This obstacle is that the code in the Beaglebone Black micro- controller is not iterating fast enough. The reason for the code’s slowness is thought to be the use of Python. The programming language should therefore be changed from Python to for example C or C++.

76 Part VI References

[1] Michael Allen. “Understanding power supplies and inrush current”. In: Electronic Products (2006). url: http://www.hobbyelectronics.net/ uploads/6/5/7/2/6572022/article_ep_0306_inrush.pdf (visited on 09/12/2017). [2] Beaglebone Black hardware documentation. Beagleboard.org. url: http: //beagleboard.org/support/bone101 (visited on 08/06/2017). [3] BeagleBone Black, The Sequel (3). Part 3: BBB Analog Inputs. Elektor Magazine. url: https://www.elektormagazine.com/files/attachment/ 278 (visited on 08/10/2017). [4] K Bergman. “Silicon carbide-the power semiconductor material of the fu- ture”. In: Fuel and Energy Abstracts. Vol. 4. 37. 1996, p. 274. [5] Marshall Brain. “How Microcontrollers Work”. In: HowStuffWorks. Np, nd Web 10 (2013). [6] Rui Castro. Uma Introdução às Energias Renováveis: Eólica, Fotovoltaica e Mini-Hídrica. 2011. [7] Aliro Cofre. Construction and Design of a Switch-Mode Converter for TFPMSM in Wave Power Application. 2017. [8] Ratna Babu Deekollu. “500 W single phase active rectifier with low input current THD and unity power factor using proportional resonant con- troller”. In: (2016). [9] Diode as a circuit element. Khan Academy. url: https://www.khanacademy. org/science/electrical-engineering/ee-semiconductor-devices/ ee-diode/a/ee-diode-circuit-element (visited on 08/06/2017). [10] Dual Channel SiC MOSFET Driver (CGD15HB62P1 datasheet). wolf- speed.com. url: http://www.wolfspeed.com/media/downloads/823/ CGD15HB62P1.pdf (visited on 09/14/2017). [11] DuPont Nomex 410, Technical data sheet. DuPont. url: http://www. dupont.com/content/dam/assets/products-and-services/electronic- electrical-materials/assets/DPT16_21668_Nomex_410_Tech_Data_ Sheet_me03_REFERENCE.pdf (visited on 08/06/2017). [12] Gustaf Falk Olson. Power Electronic Stages for a TFPMSM in Wave Power Applications. 2016. [13] FAQs: Pulse Width Modulation (PWM). Power Electronics. Apr. 10, 2009. url: http://www.powerelectronics.com/power-management/faqs- pulse-width-modulation-pwm (visited on 08/06/2017). [14] Arthur Eugene Fitzgerald et al. Electric machinery. Vol. 5. McGraw-Hill New York, 2003. [15] John Foxworth. “How to program a microcontroller”. In: (). url: http: //www.egr.msu.edu/classes/ece480/capstone/spring15/group13/ assets/app_note_john_foxworth.docx.pdf (visited on 08/06/2017).

77 [16] Erling Guldbrandzén and Manthan Shah. Mechanical design of transverse flux linear generator for wave power: Mekanisk konstruktion av linjär transversalflödesgenerator för vågkraft. 2016. [17] Anders Hagnestål and Erling Guldbrandzén. “A highly efficient and low cost TFM generator for wave power.” In: The 3rd Asian Wave and Tidal Energy Conference AWTEC 2017. 2017. [18] H-Bridge on a Breadboard. Instructables. url: http://www.instructables. com/id/H-Bridge-on-a-Breadboard/ (visited on 08/06/2017). [19] Per Holmberg. “The development of wave power”. In: A journal from Elforsk, Electricity and heat production Number 1, 2010 (2010). [20] Per Holmberg et al. “Wave Power. Surveillance study of the development”. In: (2011). [21] Shamim Keshavarz. “Design and evaluation of an active rectifier for a 4.1 MW off-shore wind turbine”. In: (2011). [22] Doug Lowe. Electronics All-in-one for Dummies. John Wiley & Sons, 2017. [23] Microcontroller PWM to 12bit Analog Out. Texas Instruments. url: http: //www.ti.com/lit/ug/tidu027/tidu027.pdf (visited on 08/06/2017). [24] Ned Mohan and Tore M Undeland. Power electronics: converters, appli- cations, and design. John Wiley & Sons, 2007. [25] MONTHLY CONSUMPTION OF ALL COUNTRIES FOR A SPECIFIC YEAR (IN GWh) - Jan 2010 - Dez 2013. European Network of Transmis- sion System Operators for Electricity. url: https://www.entsoe.eu/db- query/consumption/monthly-consumption-of-all-countries-for- a-specific-year (visited on 08/10/2017). [26] Anuja Namboodiri and Harshal S Wani. “Unipolar and bipolar PWM inverter”. In: International Journal for Innovative Research in Science & Technology 1.7 (2014), pp. 237–243. [27] Zahra Nasiri-Gheidari and Hamid Lesani. “A survey on axial flux induc- tion motors”. In: Przegląd Elektrotechniczny 88.2 (2012). [28] NDBC - Station 44011 Historical Data. National Data Buoy Center. url: http://www.ndbc.noaa.gov/station_history.php?station=44011 (visited on 08/10/2017). [29] PIC Analog to Digital Converter tutorial. Microcontroller Board. (Visited on 08/06/2017). [30] Matthew Piccoli and Mark Yim. “Cogging Torque Ripple Minimization via Position Based Characterization.” In: Robotics: Science and Systems. 2014. [31] Power MOSFET gate drivers. Electronic Design. 2004. url: http://www. electronicdesign.com/power/power-mosfet-gate-drivers (visited on 08/06/2017). [32] Power Transistors. STMicroelectronics. url: http://www.st.com/en/ power-transistors.html (visited on 08/06/2017). [33] Renewables 2016. Global status report. 2016.

78 [34] Silicon Carbide MOSFETs Challenge IGBTs. Power Electronics. url: http: / / www . powerelectronics . com / discrete - power - semis / silicon - carbide-mosfets-challenge-igbts (visited on 08/12/2017). [35] Fernando Silva, Sónia Pinto, and João Santana. Conversores Comutados para energias renováveis. 2011. [36] Lennart Söder and Mehrdad Ghandhari. Static Analysis of Power Sys- tems. 2016. [37] LuAnne Thompson. Surface Gravity Waves. University Lecture. 2004. [38] Transistors. Analog Devices. June 6, 2017. url: https://wiki.analog. com/university/courses/electronics/text/chapter- 8 (visited on 08/06/2017). [39] Andreas Uihlein and Davide Magagna. “Wave and tidal current energy–A review of the current state of research beyond technology”. In: Renewable and Sustainable Energy Reviews 58 (2016), pp. 1070–1081. [40] Voltage Level Translation. Texas Instruments. url: http://www.ti.com/ logic-circuit/voltage-level-translation/overview.html (visited on 08/06/2017). [41] Zhao Wan et al. “A novel transverse flux machine for vehicle traction aplications”. In: Power & Energy Society General Meeting, 2015 IEEE. IEEE. 2015. [42] What It’s For: The Bleeder Resistor. drewbags.com. url: http://drewbags. com/blog/40- what- it- s- for- the- bleeder- resistor (visited on 09/09/2017). [43] Why is Python slower than the xxx language. Python.org. url: https: //wiki.python.org/moin/Why%20is%20Python%20slower%20than% 20the%20xxx%20language (visited on 08/10/2017). [44] Chris Woodford. How do transistors work? Explain That Stuff. Apr. 27, 2017. url: http://www.explainthatstuff.com/howtransistorswork. html (visited on 08/06/2017).

79 Part VII Appendix 22.1 Total electrical energy consumption in the Nordic countries Mean annual consumed electrical energy, years 2010-2013 Country [GWh] Sweden 139 576 Norway 127 843 [25] Denmark 32 350 Finland 84 044 Total 383 813

22.2 Python simulation results 22.2.1 Unipolar SPWM simulation results The plots in this section show the effect of the microcontroller’s switching fre- quency on the frequency spectrum. Two examples are given with frequency modulation index mf = 25: one with high switching frequency in Fig 52 and one with lower switching frequency in Fig 53.

22.2.1.1 Unipolar SPWM with a high switching frequency, ma=0.6 and mf=25

m_a=0.6, m_f=25, f_iterate=18.1815454538 kHz, f_switch=13.4835337088 kHz AC voltage frequency spectrum 1.0

0.8

0.6 amplitude

0.4 Normalized

0.2

0.0 0 2 4 6 8 10 [kHz]

Figure 52: Frequency domain plot for a 50 Hz AC voltage, generated with SPWM and a high switching frequency.

80 22.2.1.2 Unipolar SPWM low Hz switching frequency, ma=0.6 and mf=25

m_a=0.6, m_f=25, f_iterate=4.08151020376 kHz, f_switch=1.61450403625 kHz AC voltage frequency spectrum 1.0

0.8

0.6 amplitude

0.4 Normalized

0.2

0.0 0 2 4 6 8 10 [kHz]

Figure 53: Frequency domain plot for a 50 Hz AC voltage, generated with SPWM and a low switching frequency.

22.2.1.3 Unipolar SPWM 2800 Hz switching frequency, ma=1 and mf=12.5 In Fig 54 can be seen a Python simulation of the AC voltage from the converter with the same control parameters as were used in the physical experiment in Section 18.2.

ma=1, mf=12.5, f_iterate=4.25501063751 kHz, fswitch=2.81300703251 kHz ma=1, mf=12.5, f_iterate=4.25501063751 kHz, fswitch=2.81300703251 kHz AC voltage frequency spectrum 0 1.0 0 00

0 0.8 0 0000 000 000 00 000 0 0.6 0

00 amplitude 0 0.4 0 0000 000 000 00 000 , AC-side Normalized 0 0 0 0.2 0 0 0 0 0 0 0.0 0000 000 000 00 000 0 2 4 6 8 10 [kHz]

Figure 54: Python simulation with the same parameters as in the SPWM ex- periment.

81 22.2.2 Hysteresis control, bipolar switching, simulation results

22.2.2.1 1 kHz sampling frequency

0000000 0 0 0 0 0 0 0 000 00 00 00 00 00 00 00 00 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00

(a) Time-domain L=40mH, Vac=20V, Vdc=40 V, fsamp=1.0 kHz, fswitch=600.0 Hz Phase current frequency spectrum 1.0

0.8

0.6 amplitude

0.4 Normalized

0.2

0.0 0 500 1000 1500 2000 [Hz]

(b) FFT

Figure 55: Simulation results for bipolar hysteresis control, when the sampling frequency is 1 kHz.

82 22.2.2.2 4 kHz sampling frequency

0000000 0 0 0 0 0 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00

(a) Time-domain L=40mH, Vac=20V, Vdc=40 V, fsamp=4.0 kHz, fswitch=2500.0 Hz Phase current frequency spectrum 1.0

0.8

0.6

0.4 Normalized amplitude Normalized

0.2

0.0 0 500 1000 1500 2000 2500 3000 3500 4000 [Hz]

(b) FFT

Figure 56: Simulation results for bipolar hysteresis control, when the sampling frequency is 4 kHz.

83 22.2.2.3 10 kHz sampling frequency

00000000 0 0 0 0 0 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00

(a) Time-domain L=40mH, Vac=20V, Vdc=40 V, fsamp=10.0 kHz, fswitch=6300.0 Hz Phase current frequency spectrum 1.0

0.8

0.6

0.4 Normalized amplitude Normalized

0.2

0.0 0 500 1000 1500 2000 2500 3000 3500 4000 [Hz]

(b) FFT

Figure 57: Simulation results for bipolar hysteresis control, when the sampling frequency is 10 kHz.

84 22.2.2.4 50 kHz sampling frequency

0 00 000 0 0 0 0 0 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00

(a) Time-domain L=40mH, Vac=20V, Vdc=40 V, fsamp=50.0 kHz, fswitch=22698.0 Hz Phase current frequency spectrum 1.0

0.8

0.6

0.4 Normalized amplitude Normalized

0.2

0.0 0 5000 10000 15000 20000 25000 [Hz]

(b) FFT

Figure 58: Simulation results for bipolar hysteresis control, when the sampling frequency is 50 kHz.

85 22.2.3 Hysteresis control, unipolar switching

22.2.3.1 1 kHz sampling frequency

000000 0 0 0 0 0 0 0 000 00 00 00 00 00 00 00 00 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00

(a) Time-domain L=40mH, Vac=20V, Vdc=40 V, fsamp=1.0 kHz, fswitch=602.0 Hz Phase current frequency spectrum 1.0

0.8

0.6 amplitude

0.4 Normalized

0.2

0.0 0 500 1000 1500 2000 [Hz]

(b) FFT

Figure 59: Simulation results for unipolar hysteresis control, when the sampling frequency is 1 kHz.

86 22.2.3.2 4 kHz sampling frequency

000000 0 0 0 0 0 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00

(a) Time-domain L=40mH, Vac=20V, Vdc=40 V, fsamp=4.0 kHz, fswitch=2750.0 Hz Phase current frequency spectrum 1.0

0.8

0.6

0.4 Normalized amplitude Normalized

0.2

0.0 0 500 1000 1500 2000 2500 3000 3500 4000 [Hz]

(b) FFT

Figure 60: Simulation results for unipolar hysteresis control, when the sampling frequency is 4 kHz.

87 22.2.3.3 10 kHz sampling frequency

0000000 0 0 0 0 0 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00

(a) Time-domain L=40mH, Vac=20V, Vdc=40 V, fsamp=10.0 kHz, fswitch=7370.0 Hz Phase current frequency spectrum 1.0

0.8

0.6

0.4 Normalized amplitude Normalized

0.2

0.0 0 500 1000 1500 2000 2500 3000 3500 4000 [Hz]

(b) FFT

Figure 61: Simulation results for unipolar hysteresis control, when the sampling frequency is 10 kHz.

88 22.2.3.4 50 kHz sampling frequency

00000000 0 0 0 0 0 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00 0 0 00 0 0 000 00 00 00 00 00 00 00 00

(a) Time-domain L=40mH, Vac=20V, Vdc=40 V, fsamp=50.0 kHz, fswitch=14300.0 Hz Phase current frequency spectrum 1.0

0.8

0.6

0.4 Normalized amplitude Normalized

0.2

0.0 0 500 1000 1500 2000 2500 3000 3500 4000 [Hz]

(b) FFT

Figure 62: Simulation results for unipolar hysteresis control, when the sampling frequency is 50 kHz.

89 22.3 Python codes for the Beaglebone Black Mi- crocontroller 22.3.1 Unipolar SPWM

import math as MATH import Adafruit_BBIO.PWM as PWM import Adafruit_BBIO.GPIO as GPIO import decimal from time import sleep import time ## GPIO. cleanup (); PWM. cleanup ();

#define amplitudes Ampcontrol=1; #sine wave reference amplitude amptri=1; #triangle wave amplitude Vtriangular=−1∗amptri; #startvarde trimax=1∗amptri ; trimin=−1∗amptri ;

#define reference frequency mf=25; #frequency modulation index fsin=50; #sine wave reference frequency f t r i=mf∗ fsin; #triangle wave carrier frequency slopetriang=float(2∗ trimax ∗ f t r i ) ;

#define GPIO ## reset1="P9_23" reset2="P9_25"; ## PWMswitchA1="P9_14" PWMswitchA2="P9_16" PWMswitchB1="P9_21" PWMswitchB2="P9_22"

#initialization

90 freq=200000; #ar ju bra, ifall loopen jobbar sa snabbt

PWM. s t a r t (PWMswitchA1 , 0 , f r e q ) ; PWM. s t a r t (PWMswitchA2 , 0 , f r e q ) ; PWM. s t a r t (PWMswitchB1 , 0 , f r e q ) ; PWM. s t a r t (PWMswitchB2 , 0 , f r e q ) ; ## GPIO. setup(reset1 , GPIO.OUT); GPIO. setup(reset2 , GPIO.OUT);

delay=float (0.01 ∗ ( 1 / f r e q ) ) ; delay=float(500E−9); #200 ns. bra enligt arash. tar hansyn driver och modul

switchA1=0; switchA2=0; switchB1=0; switchB2=0;

GPIO. output(reset1 , GPIO.HIGH) GPIO.output(reset2 , GPIO.HIGH);

Triangulardelta=slopetriang ; Triangulardeltaprev=slopetriang ;

timestart=time.time(); timenow=0;

while ( 1 ) : #Vcontrol=Ampcontrol∗MATH. s i n (2∗MATH. pi ∗ deltadeg ∗Ndeg∗ f s i n ) timelast=timenow; timenow=time . time()− t i m e s t a r t ; step=timenow−t i m e l a s t ; Vcontrol=Ampcontrol∗MATH. s i n (2∗MATH. pi ∗timenow∗ f s i n ) Vcontrolneg=−1∗Vcontrol ;

if Vtriangular+Triangulardelta ∗ step>trimax : Triangulardelta=−slopetriang; Triangulardeltaprev=Triangulardelta ;

elif Vtriangular+Triangulardelta ∗ step

e l s e :

91 Triangulardelta=Triangulardeltaprev ;

Vtriangular=(Vtriangular)+(Triangulardelta)∗ step ;

#Control the switches in phase−l e g A if Vcontrol>Vtriangular: PWM. set_duty_cycle (PWMswitchA2 , 0 ) ; sleep(delay); PWM. set_duty_cycle (PWMswitchA1 , 1 0 0 ) ; switchA2=0; switchA1=100;

elif Vcontrol

e l s e : PWM. set_duty_cycle(PWMswitchA1, switchA1 ); PWM. set_duty_cycle(PWMswitchA2, switchA2 );

#Control the switches in phase−l e g B if Vcontrolneg>Vtriangular: PWM. set_duty_cycle (PWMswitchB2 , 0 ) ; sleep(delay) PWM. set_duty_cycle (PWMswitchB1 , 1 0 0 ) ; switchB2=0; switchB1=100;

elif Vcontrolneg

e l s e : PWM. set_duty_cycle(PWMswitchB1, switchB1 ); PWM. set_duty_cycle(PWMswitchB2, switchB2 ); 22.3.2 Hysteresis control

import math as MATH import Adafruit_BBIO.PWM as PWM import Adafruit_BBIO.GPIO as GPIO

92 import Adafruit_BBIO.ADC as ADC import time as time from time import sleep

GPIO. cleanup (); PWM. cleanup (); #ADC. cleanup ();

#d e f i n e

femf=50 irefamp=500E−3;

reset1="P9_23" reset2="P9_25"; reset3="P9_24"; reset4="P9_26";

PWMswitchA1="P9_14" PWMswitchA2="P9_16" PWMswitchB1="P9_21" PWMswitchB2="P9_22"

analogPin="P9_33" vrefpin="P9_35"

#initialization

freq=200000;

PWM. s t a r t (PWMswitchA1 , 0 , f r e q ) ; PWM. s t a r t (PWMswitchA2 , 0 , f r e q ) ; PWM. s t a r t (PWMswitchB1 , 0 , f r e q ) ; PWM. s t a r t (PWMswitchB2 , 0 , f r e q ) ;

GPIO. setup(reset1 , GPIO.OUT); GPIO. setup(reset2 , GPIO.OUT); GPIO. setup(reset3 , GPIO.OUT); GPIO. setup(reset4 , GPIO.OUT); ADC. setup ();

#Constants and variables Tole=float (0.05); #Tole2=float (0.2);

EMF=0; delay=round((0.01 ∗ (1/freq)),9);

93 delay2 =0; t =0;

switchA1=0; switchA2=0; switchB1=0; switchB2=0;

R1=1200; R2=560;

GPIO. output(reset1 , GPIO.HIGH) GPIO.output(reset2 , GPIO.HIGH); GPIO. output(reset3 , GPIO.HIGH) GPIO.output(reset4 , GPIO.HIGH);

timestart=time.time() timelast=timestart ; timenow=0;

iph=[]; #empty current vector ir=[]; #reference current vector

while timenow<20E−3:

timenow=round((time . time()− timestart) ,6);

Iref=round(irefamp ∗MATH. s i n (2∗MATH. pi ∗ femf ∗timenow) ,4);

percentVolt=round(ADC. read(analogPin ) ,6); V18=percentVolt ∗ 1 . 8 ; Vsensor=round(((V18∗(R1+R2) ) /R2 ) , 6 ) ; Vref=round(ADC. read( vrefpin ) ∗ 1 . 8 ∗ 2 , 6 ) ; Vdiff=Vsensor−Vref ;

Iphase=round(( Vdiff −float(0.009024))/float(0.07711),4) #Iphase=(Vdiff −0.009024)/0.07711; #Iphase=665.7876∗ Vsensor −1674.0 −4.16524; #calculate the phase current ’s value

if Iphase

94 PWM. set_duty_cycle (PWMswitchA2 , 0 ) PWM. set_duty_cycle (PWMswitchB1 , 0) sleep(delay) PWM. set_duty_cycle (PWMswitchA1 , 100) PWM. set_duty_cycle (PWMswitchB2 , 100)

elif (Iphase>Iref+Tole): switchA1=0; switchB2=0; switchA2=100; switchB1=100;

e l s e : PWM. set_duty_cycle(PWMswitchA1, switchA1 ); PWM. set_duty_cycle(PWMswitchA2, switchA2 ); PWM. set_duty_cycle(PWMswitchB1, switchB1 ); PWM. set_duty_cycle(PWMswitchB2, switchB2 );

iph.append(Iphase ); ir .append(Iref );

#print(iph) #p r i n t ( i r ) print("Antal samples") print(len(iph))

print(timenow) print(percentVolt) print(Vsensor) print(Vref) print(switchA1)

95 TRITA EE 2017:114

www.kth.se