Fulltext01 33
Fulltext01 33
AVANCERAD NIVÅ, 30 HP
STOCKHOLM, SVERIGE 2017
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 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 help-
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.
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
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
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
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
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.
11
the 19th century Japanese painter Katsuhika Hokusai.
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.
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.
dΨ dΦ
ε=− = −N (1)
dt dt
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].
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.
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].
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].
17
is the percentage of the switching period when the control voltage is high. [24,
p. 162].
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].
v
u P∞ V 2
k,RM S 2
t k=1 ( k ) − V1,RM S
u
T HDW = 2 (2)
V1,RM S
19
Figure 3: Topology of a three-phase voltage-source converter [35].
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
current dI
dt on the AC side is dependent on the AC side’s inductance L and on
a
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.
dIa VDC
= (3)
dt L
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].
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,
has a peak amplitude of V̂O,1 = V̂control
V̂
VDC
2 [24, p. 206].
tri
( (
1 if S1 ON and S3 ON +VDC , γ=1
γ= VO (γ) =
-1 if S2 ON and S4 ON −VDC , γ = −1
(4) (5)
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
a peak amplitude of V̂O,1 = V̂control
V̂tri
VDC [24, p. 216]. One benefit of choosing
unipolar switching over bipolar switching is that unipolar switching has a lower
weighted THD, compared with bipolar switching [35].
1 if S1 ON and S3 ON
+VDC , γ = 1
γ = 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)
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
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].
25
Figure 7: Back-to-back connection of two MOSFET-based three-phase voltage-
source converters.
kW
J = cg ES [ ] (11)
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 2ωwave s Group velocity of the sea waves [37]
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]
dΨ(t) πh
ε(t) = −N = Êcos(ωwave t)cos( sin(ωwave t)) =
dt λ
(14)
Ψ̂hπ πh
= ωwave cos(ωwave t)cos( sin(ωwave t))
λ λ
~ = P
|I| (15)
~
|U |cos(φ)
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].
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].
29
ρ
R = `cond (16) P = RI 2 (17)
Acond
Q = U Isin(φ) (18)
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.
Figure 10: Topology of the whole converter system for the eventual generator,
with two three-phase converters connected back-to-back.
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.
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.
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.
33
11.2. There is however an upper limit for the voltage level, set by the voltage
ratings of the power modules.
34
relevant electrical parameters for the drivers can be found.
35
of its low ESR [12, p. 32].
36
Capacitance 10 mF
Maximum voltage 160 V
Maximum current ripple 16 A
t
duC (t) uc (t) − discharge
− = 0 =⇒ uC (tdischarge ) = UC,0 e CRbleeder = 0.1UC,0 =⇒
dt Rbleeder
tdischarge 13 · 60
Rbleeder = = ≈ 33874Ω
Cln(10) 10 · 10−3 ln(10)
(21)
2
VC,max 1602
P = = ≈ 0.76W (22)
Rbleeder 33600
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.
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.
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.
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.
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.
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.
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.
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.
120
100
80
Percent
60
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.
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.
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.
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
48
Current sensor pin Voltage level
VCC 5 V (in)
VDD 0 V (in)
VREF 2.5 V (out)
VOU T Variable ouput voltage: [0,5] V (out)
Table 9: The four pins and the voltage signals which should be connected to
the pins.
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
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.
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.
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.
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.
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
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.
52
(a) The two three-phase converters, as seen from above.
(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.
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.
• 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
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.
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.
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.
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.
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
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.
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.
Table 15: The supply voltage levels and the supplied electrical devices.
(a) The current sensor’s whole circuit, with its two voltage dividers and the de-
coupling capacitors at the input of the Beaglebone Black.
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.
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.
Table 16: The values returned in the Putty terminal, used for linear regression
in order to calculate the phase current.
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
Iphase = k(Vsensor − Vref ) + m = (Vsensor − Vref ) − (24)
0.07711 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.
64
Figure 37: The laboratory setup during the converter experiment with
sinusoidal PWM.
VDC 40 V
R 24Ω
L 0 mH
65
over the power transistors, or if these are eliminated by the snubber capacitors.
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 Ω
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.
V̂AC 24 V
CDC 10 mF
VDC
RL Iref
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.
20 20
10
[V]
[V]
10
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
[V]
[V]
10 10
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.
69
Sinusoidal PWM, no load, converter voltages
60
DC-link voltage
AC side voltage
40
20
[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.
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.
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
[A]
0 0
-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.
0.5
[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 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 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 dvdttri = 2·2·V̂tri
Ttri ,
but was accidentally set to dvdttri = 2·TV̂tri
tri
. This made the triangle wave’s fre-
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
L=40mH, Vac=20V, Vdc=40 V, fsamp=300 Hz, fswitch=288.0 Hz
60
Phase voltage
40
20
0
[V]
−20
−40
−60
0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25
[sec]
4
Phase curre t
3
2
1
0
[A]
−1
−2
−3
−4
0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25
[sec]
1.0
Refere ce curre t
0.5
0.0
[A]
−0.5
−1.0
0.17 0.18 0.19 0.20 0.21 0.22 0.23 0.24 0.25
[sec]
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.
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.
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.
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.
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
0.8
Normalized amplitude
0.6
0.4
0.2
0.0
0 2 4 6 8 10
[kHz]
80
22.2.1.2 Unipolar SPWM low Hz switching frequency, ma=0.6 and
mf=25
0.8
Normalized amplitude
0.6
0.4
0.2
0.0
0 2 4 6 8 10
[kHz]
1.0
Sine references
0.6
0.5
0.0
−0.5
−1.0
0.4
0.000 0.005 0.010 0.015 0.020
40
Phase voltage, AC-side
30
20 0.2
10
0
[V]
−10
−20
−30
−40 0.0
0.000 0.005 0.010 0.015 0.020 0 2 4 6 8 10
[sec] [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
−20
−40
−60
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
3
Phase curre t
2
1
0
[A]
−1
−2
−3
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.0
Refere ce curre t
0.5
0.0
[A]
−0.5
−1.0
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
(a) Time-domain
L=40mH, Vac=20V, Vdc=40 V, fsamp=1.0 kHz, fswitch=600.0 Hz
1.0 Phase current frequency spectrum
0.8
Normalized amplitude
0.6
0.4
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
−20
−40
−60
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.5
Phase curre t
1.0
0.5
0.0
[A]
−0.5
−1.0
−1.5
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.0
Refere ce curre t
0.5
0.0
[A]
−0.5
−1.0
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
(a) Time-domain
L=40mH, Vac=20V, Vdc=40 V, fsamp=4.0 kHz, fswitch=2500.0 Hz
1.0 Phase current frequency spectrum
0.8
Normalized amplitude
0.6
0.4
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
−20
−40
−60
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.5
Phase curre t
1.0
0.5
0.0
[A]
−0.5
−1.0
−1.5
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.0
Refere ce curre t
0.5
0.0
[A]
−0.5
−1.0
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
(a) Time-domain
L=40mH, Vac=20V, Vdc=40 V, fsamp=10.0 kHz, fswitch=6300.0 Hz
1.0 Phase current frequency spectrum
0.8
Normalized amplitude
0.6
0.4
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
−20
−40
−60
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.5
Phase current
1.0
0.5
0.0
[A]
−0.5
−1.0
−1.5
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.0
Reference current
0.5
0.0
[A]
−0.5
−1.0
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
(a) Time-domain
L=40mH, Vac=20V, Vdc=40 V, fsamp=50.0 kHz, fswitch=22698.0 Hz
1.0 Phase current frequency spectrum
0.8
Normalized amplitude
0.6
0.4
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
−20
−40
−60
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
3
Phase curre t
2
1
0
[A]
−1
−2
−3
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.0
Refere ce curre t
0.5
0.0
[A]
−0.5
−1.0
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
(a) Time-domain
L=40mH, Vac=20V, Vdc=40 V, fsamp=1.0 kHz, fswitch=602.0 Hz
1.0 Phase current frequency spectrum
0.8
Normalized amplitude
0.6
0.4
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
−20
−40
−60
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.5
Phase curre t
1.0
0.5
0.0
[A]
−0.5
−1.0
−1.5
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.0
Refere ce curre t
0.5
0.0
[A]
−0.5
−1.0
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
(a) Time-domain
L=40mH, Vac=20V, Vdc=40 V, fsamp=4.0 kHz, fswitch=2750.0 Hz
1.0 Phase current frequency spectrum
0.8
Normalized amplitude
0.6
0.4
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
−20
−40
−60
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.5
Phase curre t
1.0
0.5
0.0
[A]
−0.5
−1.0
−1.5
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.0
Refere ce curre t
0.5
0.0
[A]
−0.5
−1.0
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
(a) Time-domain
L=40mH, Vac=20V, Vdc=40 V, fsamp=10.0 kHz, fswitch=7370.0 Hz
1.0 Phase current frequency spectrum
0.8
Normalized amplitude
0.6
0.4
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
−20
−40
−60
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.5
Phase curre t
1.0
0.5
0.0
[A]
−0.5
−1.0
−1.5
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
1.0
Refere ce curre t
0.5
0.0
[A]
−0.5
−1.0
0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
[sec]
(a) Time-domain
L=40mH, Vac=20V, Vdc=40 V, fsamp=50.0 kHz, fswitch=14300.0 Hz
1.0 Phase current frequency spectrum
0.8
Normalized amplitude
0.6
0.4
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
#d e f i n e a m p l i t u d e s
Ampcontrol =1; #s i n e wave r e f e r e n c e a m p l i t u d e
amptri =1; #t r i a n g l e wave a m p l i t u d e
V t r i a n g u l a r =−1∗amptri ; #s t a r t v a r d e
trimax =1∗amptri ;
t r i m i n=−1∗amptri ;
#d e f i n e r e f e r e n c e f r e q u e n c y
mf=25; #f r e q u e n c y modulation i n d e x
f s i n =50; #s i n e wave r e f e r e n c e f r e q u e n c y
f t r i =mf∗ f s i n ; #t r i a n g l e wave c a r r i e r f r e q u e n c y
s l o p e t r i a n g=f l o a t ( 2 ∗ trimax ∗ f t r i ) ;
#d e f i n e GPIO
##
r e s e t 1 ="P9_23 "
r e s e t 2 ="P9_25 " ;
##
PWMswitchA1="P9_14 "
PWMswitchA2="P9_16 "
PWMswitchB1="P9_21 "
PWMswitchB2="P9_22 "
#i n i t i a l i z a t i o n
90
f r e q =200000; #a r j u bra , i f a l l l o o p e n j o b b a r s a 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 . s e t u p ( r e s e t 1 , GPIO .OUT) ;
GPIO . s e t u p ( r e s e t 2 , GPIO .OUT) ;
d e l a y=f l o a t ( 0 . 0 1 ∗ ( 1 / f r e q ) ) ;
d e l a y=f l o a t ( 5 0 0E−9); #200 ns . bra e n l i g t a r a s h . t a r hansyn d r i v e r och modul
switchA1 =0;
switchA2 =0;
switchB1 =0;
switchB2 =0;
T r i a n g u l a r d e l t a=s l o p e t r i a n g ;
T r i a n g u l a r d e l t a p r e v=s l o p e t r i a n g ;
t i m e s t a r t=time . time ( ) ;
timenow =0;
while ( 1 ) :
#V c o n t r o l=Ampcontrol ∗MATH. s i n ( 2 ∗MATH. p i ∗ d e l t a d e g ∗Ndeg∗ f s i n )
t i m e l a s t=timenow ;
timenow=time . time ()− t i m e s t a r t ;
s t e p=timenow−t i m e l a s t ;
V c o n t r o l=Ampcontrol ∗MATH. s i n ( 2 ∗MATH. p i ∗ timenow ∗ f s i n )
V c o n t r o l n e g=−1∗V c o n t r o l ;
i f V t r i a n g u l a r+T r i a n g u l a r d e l t a ∗ s t e p >trimax :
T r i a n g u l a r d e l t a=−s l o p e t r i a n g ;
T r i a n g u l a r d e l t a p r e v=T r i a n g u l a r d e l t a ;
e l i f V t r i a n g u l a r+T r i a n g u l a r d e l t a ∗ s t e p <t r i m i n :
T r i a n g u l a r d e l t a=s l o p e t r i a n g ;
T r i a n g u l a r d e l t a p r e v=T r i a n g u l a r d e l t a ;
else :
91
T r i a n g u l a r d e l t a=T r i a n g u l a r d e l t a p r e v ;
V t r i a n g u l a r =( V t r i a n g u l a r )+( T r i a n g u l a r d e l t a ) ∗ s t e p ;
#C o n t r o l t h e s w i t c h e s i n phase−l e g A
i f Vc ontrol >V t r i a n g u l a r :
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA2 , 0 ) ;
sleep ( delay ) ;
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA1 , 1 0 0 ) ;
switchA2 =0;
switchA1 =100;
e l i f Vcontr ol <V t r i a n g u l a r :
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA1 , 0 ) ;
sleep ( delay )
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA2 , 1 0 0 ) ;
switchA1 =0;
switchA2 =100;
else :
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA1 , switchA1 ) ;
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA2 , switchA2 ) ;
#C o n t r o l t h e s w i t c h e s i n phase−l e g B
i f V co ntr oln eg >V t r i a n g u l a r :
PWM. s e t _ d u t y _ c y c l e ( PWMswitchB2 , 0 ) ;
sleep ( delay )
PWM. s e t _ d u t y _ c y c l e ( PWMswitchB1 , 1 0 0 ) ;
switchB2 =0;
switchB1 =100;
else :
PWM. s e t _ d u t y _ c y c l e ( PWMswitchB1 , switchB1 ) ;
PWM. s e t _ d u t y _ c y c l e ( PWMswitchB2 , switchB2 ) ;
92
import Adafruit_BBIO .ADC a s ADC
import time a s time
from time import s l e e p
GPIO . c l e a n u p ( ) ;
PWM. c l e a n u p ( ) ;
#ADC. c l e a n u p ( ) ;
#d e f i n e
f e m f =50
i r e f a m p =500E−3;
r e s e t 1 ="P9_23 "
r e s e t 2 ="P9_25 " ;
r e s e t 3 ="P9_24 " ;
r e s e t 4 ="P9_26 " ;
PWMswitchA1="P9_14 "
PWMswitchA2="P9_16 "
PWMswitchB1="P9_21 "
PWMswitchB2="P9_22 "
a n a l o g P i n ="P9_33 "
v r e f p i n ="P9_35 "
#i n i t i a l i z a t i o n
f r e q =200000;
#C o n s t a n t s and v a r i a b l e s
Tole=f l o a t ( 0 . 0 5 ) ;
#Tole2=f l o a t ( 0 . 2 ) ;
EMF=0;
d e l a y=round ( ( 0 . 0 1 ∗ ( 1 / f r e q ) ) , 9 ) ;
93
d e l a y 2 =0;
t =0;
switchA1 =0;
switchA2 =0;
switchB1 =0;
switchB2 =0;
R1=1200;
R2=560;
t i m e s t a r t=time . time ( )
t i m e l a s t=t i m e s t a r t ;
timenow =0;
i p h = [ ] ; #empty c u r r e n t v e c t o r
i r = [ ] ; #r e f e r e n c e c u r r e n t v e c t o r
w h i l e timenow <20E−3:
p e r c e n t V o l t=round (ADC. r e a d ( a n a l o g P i n ) , 6 ) ;
V18=p e r c e n t V o l t ∗ 1 . 8 ;
Vsensor=round ( ( ( V18 ∗ (R1+R2 ) ) / R2 ) , 6 ) ;
V r e f=round (ADC. r e a d ( v r e f p i n ) ∗ 1 . 8 ∗ 2 , 6 ) ;
V d i f f=Vsensor−V r e f ;
I p h a s e=round ( ( V d i f f −f l o a t ( 0 . 0 0 9 0 2 4 ) ) / f l o a t ( 0 . 0 7 7 1 1 ) , 4 )
#I p h a s e =( V d i f f − 0 . 0 0 9 0 2 4 ) / 0 . 0 7 7 1 1 ;
#I p h a s e =665.7876∗ Vsensor −1674.0 −4.16524; #c a l c u l a t e t h e phase c u r r e n t ’ s
94
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA2 , 0 )
PWM. s e t _ d u t y _ c y c l e ( PWMswitchB1 , 0 )
sleep ( delay )
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA1 , 1 0 0 )
PWM. s e t _ d u t y _ c y c l e ( PWMswitchB2 , 1 0 0 )
else :
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA1 , switchA1 ) ;
PWM. s e t _ d u t y _ c y c l e ( PWMswitchA2 , switchA2 ) ;
PWM. s e t _ d u t y _ c y c l e ( PWMswitchB1 , switchB1 ) ;
PWM. s e t _ d u t y _ c y c l e ( PWMswitchB2 , switchB2 ) ;
i p h . append ( I p h a s e ) ;
i r . append ( I r e f ) ;
#p r i n t ( i p h )
#p r i n t ( i r )
p r i n t ( " Antal s a m p l e s " )
p r i n t ( len ( iph ) )
p r i n t ( timenow )
print ( percentVolt )
p r i n t ( Vsensor )
p r i n t ( Vref )
p r i n t ( switchA1 )
95
TRITA EE 2017:114
www.kth.se