You are on page 1of 112

Magnetic levitation

4.semester project in Energy Technology 2009


Group: ET4-402
Board of Studies of Energy
Aalborg University
Board of Studies of Energy
Energy Technology
Pontoppidanstrde 101
9220 Aalborg
Telefon 99 40 92 47
Title:
Magnetic levitation
Theme:
Control of Energy Converting Systems
Project period:
1/2 27/5, 2009
Project group:
ET4-402
Attendees:
Bjarni Helgi Thorsteinsson
Daniel Ellgaard Tegner
Henrik Rahn
Kenneth Rnsig Kanstrup
Martin Chris Svendsen
Troels Bartholin Bertelsen
Supervisor:
Claus Rasmussen
Copies: 8
Number of pages: 88
Number of appendixes og type:
3 appendixes are included in the back
of the report. A CD with addition-
al appendixes plus pdf-print of web
sources enclosed.
Finished at 27/5-2009
Synopsis:
The purpose of this project is to study an existing
magnetic levitation technology, that will be build
and controlled in a small scale model.
This project treats the issue of levitating an iron
beam beneath an electromagnet by the use of clas-
sic regulation theory. A non-linear model is created
in MATLABSimulink, and fromthis a linear model
is made to determine the type of regulation and the
regulation constants, to use in the non-linear mod-
el.
To test if it is possible to levitate the beam under an
electromagnet, a distance sensor, a PWM-module, a
buck converter and anelectromagnet are construct-
ed. To control and regulate the complete system, a
program in LabVIEW is made.
The complete system is tested with the determined
regulation constants in the models. The tests con-
clude, that the system is not able to hold the levitat-
ing beam steady at the height desired. The primary
reasonis that the LabVIEWprogramdoes not reg-
ulate at a sufcient speed, which have to be at least
be 140 [Hz] and Therefore, an alternative approach
is needed.
Dansk resume
Formlet med dette projekt er at undersge magnetisk levitation baseret p en eksisterende maglev-
teknologi, og at bygge og styre en model i lille mlestok. Dette projekt behandler sprgsmlet om
at fen bjlke til at svve under en en elektromagnet ved brug af regulerings teori. En ikke-linere
model er oprettet i MATLABSimulink, og en liner model er lavet for at bestemme regulerings type
og konstanter som andvendsen i den ikke-linere re model. For at teste, om det er muligt at fen
bjlke til at svve under en elektromagnet, er der konstrueret en afstands sensor, et PWM-modul, en
buck converter og en elektromagnet. For at kontrollere og regulere det samlede system, er et program
i LabVIEW udarbejdet. Det komplette system er testet med regulerings konstanterne bestemmet i
modelen. Testen, konkludere, at systemet ikke er i stand til at holde bjlke svvende i nogen hjde.
Den primre rsag er, at LabVIEW programmet ikke regulere med en tilstrkkelig hastighed, som
mindst skal vre 140 [Hz]. Derfor vil en alternativ fremgangsmde vre ndvendigt.
v
Preface
This report has been written by the project group ET4-402 on 4
th
semester at Aalborg University -
Board of Studies of Energy. The report is aimed at students in science education.
The theme for the semester is Control of Energy Converting Systems.
This report uses SI base units, derived units and prexes as described by The International System of
Units [1] together with units outside of the SI standard, and all units are written as [unit]. Sources are
inserted after the Vancouver method, with a [number], which refers to the bibliography in the back of
the report.
Appendixes are declared with an A in front of the page number and can be found in the back of the
report.
Frequently used constants and abbreviations are described in the reports constants and terminology
list, which can be found in appendix A on page A1. Additionally, a CD has been made, which features
the report, sources and all programming in digital format.
Bjarni Helgi Thorsteinsson Daniel Ellgaard Tegner
Henrik Rahn Kenneth Rnsig Kanstrup
Martin Chris Svendsen Troels Bartholin Bertelsen
By signing this document, each member of the group conrms that all participated in the project work equally and thereby all members are collectively
liable for the contents of the report.
I
Table of contents
Table of contents III
1 Introduction 1
Problemanalysis 2
2 Types of maglev technology 5
2.1 The electrodynamic suspension (EDS) system . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 The electromagnetic suspension (EMS) system . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 The inductrack system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 Technology discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 The Magnetic circuit 9
3.1 Magnetic ux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Magnetic force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Summary of the problem analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 Thesis statement 15
4.1 Specication of requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Problemsolving 16
5 Physical components 19
5.1 The buck converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
5.2 The PWM-module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.3 The operational amplier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
5.4 Electromagnetic theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5.5 The distance sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
5.6 The complete system design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
6 Linear model 31
6.1 Transfer function for the plant G
p
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.2 Transfer function for the plant with velocity feedback G
pv
. . . . . . . . . . . . . . . . . 35
6.3 Transfer function for the current feedback G
i
. . . . . . . . . . . . . . . . . . . . . . . . . 39
6.4 Transfer function for the plant with velocity and current feedback G
pvi
. . . . . . . . . . 44
7 Non-linear model 47
7.1 MATLAB Simulink model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
III
TABLE OF CONTENTS
8 Regulation 55
8.1 Regulation of plant model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
8.2 Determining the regulation type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
8.3 LabVIEW programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9 Validation 75
9.1 Test of the distance sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
9.2 Test of the PWM-module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
9.3 Test of the buck converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
9.4 Test of the op-amp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
9.5 Validation of the hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
9.6 Validation of the complete system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
10 Conclusion 83
11 Discussion 87
Appendix 89
A Constants and terminology A1
B Hardware A5
B.1 Choose of operational amplier type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A5
C Regulation A7
C.1 Routh-Hurwitz array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A7
C.2 Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A7
C.3 Deriving I
0
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A8
C.4 Analyse of the difference between G
pv
and G
pvi
. . . . . . . . . . . . . . . . . . . . . . . . A9
Bibliography A11
IV
Chapter 1
Introduction
The current global economic and environmental crisis has shown the world, that it is time to take re-
sponsibility and to use our resources to create a better and safer world for future generations. Respon-
sibility must be taken to counteract the fact, that the transport sector still contributes signicantly to
the rising emissions of greenhouse gases, noise exposure, air pollution, fragmentation of habitats and
impacts on wildlife [2]. In the past years, the emissions of greenhouse gases have increased by 26 [%]
between 1990 and 2006, excluding international aviation and marine transport [3].
In key sectors such as transport, resource harvesting and energy production, humanity must think of
smarter and stronger long-term solutions. Europes freight sector still favors the least efcient trans-
port methods, and railways across the EU still does not have a system standard. Between 1996 and
2006, the total freight volume for EUstates increased by 35 [%]. Rail freight and inland waterways saw
a decline in market share and is therefore losing its dominant position within logistics [3].
Japan, China, Germany and U.S.A. have developed a new high speed and efcient traveling method.
The technology usedis calledmaglev (magnetic levitation). The basic principles behindmaglev trains
are shown in gure 1.1.
Figure 1.1: Shows the basic parts of a maglev train [4].
In general, this technology uses the principle that magnets will either reject or be attracted by each
other, depending on the polarities of the magnets. This technology is used to keep the train levitating.
With this technology, there are no wheels rolling over the railway like on normal trains, which means
there is no rolling resistance. The only resistance the train is exposed to is drag fromthe air. Therefore
1
CHAPTER 1. INTRODUCTION
the maglev train can achieve high velocities and a better energy efciency.
Ideally the maglev trains can reach its full potential if deployed in an evacuated tunnel. In such a
tunnel, the train has the potential to reach speeds which exceeds 6400 [km/h] [5].
In the future, the maglev trains will be even faster, quieter, and more energy efcient than wheeled
transportation systems, and could be a part of the solutions to the Worlds transport challenges [2].
The regulation is what makes maglev possible, and it is essential to employ regulation theory in order
to succeed.
This project will specically look at the magnetic levitation technology, and the regulation behind.
The main focus of this project will be to hold a metal beam levitating using maglev technology, with
the help of regulation.
2
PROBLEM ANALYSIS
PART I
Chapter 2
Types of maglev technology
In this section three types of maglev systems will be studied and explained. Basic understanding of
the systems is important in order to choose what system best ts in for further research. The system
that is chosen should be relatively simple and preferably use only one magnet, as it must be easy to
control and regulate the system.
The main advantage the maglev train system has over the standard railway system is, that there is no
friction between the maglev trains and the . The train can reach speeds much higher than trains on
standard railways. Another advantage of a maglev train is that it can climb steeper hills than normal
trains [6].
There are three types of maglev train systems used today. The three systems are electrodynamic sus-
pension (EDS), electromagnetic suspension (EMS) and inductrack. Knowledge of these three differ-
ent types of systems is important to better understand the capabilities of this traveling method. All
these methods are very different from each other even though they all use the magnetic levitation
technology. In the following, these differences will be accounted for.
2.1 The electrodynamic suspension (EDS) system
The EDS technology uses repulsive forces between two magnets to levitate the train of the rail, and it
requires that powerful permanent magnets are installed in the train cars and in the guide way. The
guide way is shaped like an U. On the sides of the guide way, coils shaped like the number eight are
placed as seen on gure 2.1.
Figure 2.1: Figure of an EDS guide way [7].
5
CHAPTER 2. TYPES OF MAGLEV TECHNOLOGY
Throughthe propulsioncoils ows analternating current, whichpropels the trainforward. The speed
of the train is controlled with the frequency of the current that ows through the propulsion coils.
Higher frequency results in higher speed. Permanent magnets are attached to the side of the train,
which aligns with the poles of the propulsion coils. The propulsion coils generate magnetic poles on
the top and the bottom. The bottom half repels the train of the ground and the top poles attract the
train resulting in steady levitation of the train. Figure 2.2 gives a better understanding of the guide
way layout.
S N S N S N
N S N S N S
N S
S N
Figure 2.2: Explanation of the propulsion coils [8].
At low speeds, the the magnetic ux in the coils is too small to levitate the train. This makes it nec-
essary to install a wheel mechanism on the train, so the train can run safely on the guide way until
it levitates. The train starts to levitate at around 100 [km/h] , then the magnetic eld is sufcient to
levitate the train. This is one of the biggest disadvantages of electrodynamic suspension trains. This
type of train is mostly used in Japan and the idea of these tires is, that they can serve as an extra safety
precaution if the train should suddenly experience malfunctions and lose its power suddenly, such
that the train will not crash into the guide way. A disadvantage regarding the electrodynamic sus-
pension is, the magnetic eld inside the train itself. This eld is generated by the magnets on board
the train and can be dangerous to passengers with a pacemaker, so they have to be shielded from the
magnetic eld for safe transportation by a maglev train [9].
2.2 The electromagnetic suspension (EMS) system
Trains using the electromagnetic suspension system uses the attractive forces of a magnet. In this
type of trains there are no magnetic eld inside the train. The magnets are located under the train at
the fork arms. The guide way on electromagnetic suspension trains is shaped like a T, and the train
cars fork arms wrap around the guide way. A better understanding can be achieved by examining
gure 2.3.
Figure 2.3: Figure of the T guide way. [10].
6
2.3. THE INDUCTRACK SYSTEM
The electromagnets under the train are attracted to the ferromagnetic stator packs, and because al-
ternating current ows through the stator packs, this produces the forward momentum of the train.
Like in an electric motor that runs over the guide way, this attraction also levitates the train to a dis-
tance of 10 mm above the guide way. The electromagnets on the train get their energy from a battery
pack, which is located on board the train. The magnets at the fork arms require little energy, less than
the air conditioning on board for comparison [11]. Additionally, another set of magnets is placed on
the side of the train to limit the sideways motion of the train and keep the train balanced over the
guide way. In the track there is a synchronous longstator linear motor, which drives the train forward.
The linear motor works as a stator in a normal revolution motor. Electric current ows through the
track and generates magnetic elds. The train then acts as a rotor in a normal electric motor. The
magnets on board the train follow these magnetic elds and propels the train forward. The speed of
the train is, like with the EDS-system, controlled by the frequency of the current. To stop the train,
the frequency is lowered followed by the current changing direction, which results in slowing down
the train or completely stopping it. In gure 2.4 the traveling propulsion eld is shown.
Figure 2.4: Figure of the propulsion traveling eld. [11].
Inside the train, there is a communication system. This systemcommunicates with antennas located
along the guide way, separated by an even interval. The guide way is split up so that the current in the
guide way is just where it needs to be, in front of and under the train. These masts sense the position
of the train, and with their aid, the current can be directed to the correct part of the guide way as seen
in gure 2.5. This is also how the current is controlled in the guide way of the EDS trains.
Figure 2.5: Figure showing the active part of the guide way. [11].
2.3 The inductrack system
Inductrack is only used on test basis in America. Inductrack uses a set of powerful permanent mag-
nets in the trains, which are aligned in a special way to give a very large magnetic force on one side
of the magnet and canceling it on the other. When magnets are aligned in this way, it is called a Hal-
bach array [12]. This type of magnets gives the train constant levitation without electric power. In the
inductrack rail there are copper coils, so when the magnets on the train move over the coils, they gen-
erate a current in the coils that levitate the train. When the train is stationary, no current is produced
in the coils and therefore, no levitation occurs. The train is supported by a set of auxiliary wheels,
7
CHAPTER 2. TYPES OF MAGLEV TECHNOLOGY
when it is stopped. These wheels help the train gain a speed of 2 [km/h], which is enough to generate
a current in the coils of the track and levitate the train. This is shown in gure 2.6.
Halbach array
Magnetic eld lines
Magnetic eld lines
Levitation circuit
Figure 2.6: Figure showing the magnetic lines and the coils in the track. [13].
Figure 2.6 shows how the magnet is aligned together to produce a strong magnetic eld in one side
and canceling it in the other.
2.4 Technology discussion
As mentioned before in this section, is it preferred to use a simple technology. Two of the three be-
forementioned technologies are quite advanced to model and replicate.
The electrodynamic suspension (EDS) consists of two magnets and it will be difcult to make some-
thing levitate with two magnets as this doubles the complexity, and the fact that the trains in Japan
have to obtain a speed of 100 [km/h] in order to levitate, which also makes this kind of systemdifcult
to experiment with in a laboratory.
The most simple technology is the electromagnetic suspension (EMS), which only has one magnet
for levitation. This will make it easy to create an experiment, where an iron beam, which represents
the train, must levitate under an electromagnet. This will be the simplest experiment that can prove
if the magnetic levitation theory is consistent in practice.
The inductrack system is also too advanced to get working as a rst time maglev test model. It re-
quires a series of permanent magnets, which must be set up in a Halback array and, to make a model
of a levitating vehicle, the vehicle has to obtain some speed and this will make the system more com-
plex.
Therefore, the electromagnetic suspension system(EMS) is chosen for further work and testing in the
project.
8
Chapter 3
The Magnetic circuit
This sectionwill derive the magnetic force, that is producedwhenanelectric current is owing through
a coil with an iron core. This transforms the coil with the iron core into an electromagnet which can
be designed to hold an iron beam levitating at a predened height h
0
[m]. The system is shown in
gure 3.1.
Figure 3.1: The electromagnet levitating an iron beam.
3.1 Magnetic ux
The magnetic ux [Wb] owing in the electromagnet will be described by using the rule, that an
electromagnet can be seen as a magnetic circuit [14]. A magnetic circuit is a convenient analogy to an
electric circuit, because it greatly simplies the analysis. The magnetic circuit is shown in gure 3.2
on the following page and the electric-magnetic analogy is shown in table 3.1.
Electric Magnetic
Name Symbole Unit Name Symbole Unit
Current I [A] Flux [Wb]
Voltage V [V] Ampere windings mmf [A Wi]
Resistance R [] Reluctance R [1/H]
Table 3.1: Electric-magnetic analogy [14].
When using this analogy, it will be possible to apply basic electric circuit theory to the magnetic cir-
9
CHAPTER 3. THE MAGNETIC CIRCUIT
cuit, and therefore the magnetic ux can be derived. The main assumption is, that all the ux is
owing inside the core and through square boxes of air into the oating beam beneath the electro-
magnet. However, this model does not take leak ux into account. Leak ux is the ux which does
not ow as described above. This analogy works when the relative permeability of the core is much
greater than that of air.
R
4
R
1
R
5
R
2
+

mmf
R
6
R
3
R
8
R
7

1/2 1/2
Ai r g ap
Beam
Core
Figure 3.2: Magnetic circuit.
Whenanalyzing the magnetic circuit, the magnetic reluctance inthe core (R
1
, R
2
, R
3
) will be neglect-
ed, because the reluctance in the air gap (R
4
, R
5
, R
6
) is much greater than the reluctance of the core
[14]. However, the reluctance of the beam (R
7
, R
8
) can not be neglected because of the cross section
area, A
beam
, is quite small compared to that of the core
1
. This do not make the reluctance of the iron
beam negligible compared with the reluctance of the air gap.
The magnetic reluctance R is dened in equation 3.1.
R
h

0

r
A
[1/H] (3.1)
It can be seen in equation 3.1 that the magnetic reluctance R is calculated by dividing with the rela-
tive permeability
r
. Because iron is a ferromagnetic material [15], it is acceptable to neglect the core
reluctance as the relative permeability of ferromagnetic materials is somewhere between 50 and 10
6
[H/m] [15], whereas the relative permeability of iron is typically between 1000 and 5000. The relative
permeability of air is dened as 1[H/m] [15],[16]. The relative permeability of the beam depends on
the material of the beam and the cross section area, and therefore it will not be neglected in the fur-
ther analysis.
The new circuit with the neglected reluctances is shown in gure 3.3 on the facing page, where the
magnetic voltage supply mmf [A Wi] is dened as the number of coil windings N [Wi] multiplied by
the current I [A] owing in the coil.
1
This was the assumption at the beginning of the project, later it was discovered, that the mass of the beam, and
therefore also the cross section area, had to be increased. This means, that the reluctance of the iron beam will not be very
large, which results in that the air gap will be the determining factor.
10
3.1. MAGNETIC FLUX
R
4
R
5
+

mmf
R
6
R
8
R
7

1/2 1/2
Ai r g ap
Beam
Core
Figure 3.3: Magnetic circuit with neglected core reluctances.
To analyze the magnetic circuit, KVL (Kirchhoffs voltage law) is applied. As it is shown in gure 3.3
there is one magnetic voltage supply and two loops containing reluctances. To begin with, two KVL
equations must be used to describe the magnetic circuit, this is done in equation 3.2 and 3.3.
1
2
R
4
+
1
2
R
7
+ R
5
mmf 0 [A Wi] (3.2)
and
1
2
R
6
+
1
2
R
8
+ R
5
mmf 0 [A Wi] (3.3)
If equation 3.1 on the facing page is substituted into equation 3.2 and 3.3, and mmf is isolated, it
then follows as in equation 3.4 and 3.5.
N I
1
2

h
4

*
1

r
4

0
A
4
+
1
2

h
7

r
7

0
A
7
+
h
5

*
1

r
5

0
A
5
[A Wi]
{
N I
_
1
2

h
4

0
A
4
+
1
2

h
7

r
7

0
A
7
+
h
5

0
A
5
_
[A Wi] (3.4)
and
N I
1
2

h
6

*
1

r
6

0
A
6
+
1
2

h
8

r
8

0
A
8
+
h
5

*
1

r
5

0
A
5
[A Wi]
{
N I
_
1
2

h
6

0
A
6
+
1
2

h
8

r
8

0
A
8
+
h
5

0
A
5
_
[A Wi] (3.5)
The relative permeabilities
r
4
,
r
5
and
r
6
are 1 because they are the relative permeability of air. The
heights h
4
, h
5
and h
6
are all the same height h, which is the distance between the electromagnet and
the beam. The core is designed so that the cross section area A
4
and A
6
each is half the cross section
area A
5
, which is now denoted A, so that A
4
and A
6
each is
1
2
A. The relative permeability of the beam
is denoted
beam
, the ux length in one half of the beam is the length h
7
or h
8
. The cross section
area is the same for A
7
and A
8
and is now denoted A
beam
. The meaning of these relations, is that
equation 3.4 is equal to equation 3.5 and each of themcan be transformed to equation 3.6 on the next
page which is reduced into equation 3.7 on the following page.
11
CHAPTER 3. THE MAGNETIC CIRCUIT
N I
_
1
2

h

1
2
A
+
1
2

1
2
h
beam

beam

0
A
beam
+
h

0
A
_
[A Wi] (3.6)
{
N I
_
2 h

0
A
+
h
beam
4
beam

0
A
beam
_
[A Wi] (3.7)
The ux [Wb] can now be isolated. This can be seen in equation 3.8.

N I
2 h

0
A
+
h
beam
4
0

beam
A
beam
[Wb]
{

4 A I N A
beam

0

beam
A h
beam
+8 h A
beam

beam
[Wb] (3.8)
The ux is used to describe the force on the beamproduced by the electromagnet, and thereby deter-
mine how much current is necessary to hold the beam levitating at the predened distance. That is,
the ux is a function of the current and the height, which makes the force a function of the same.
3.2 Magnetic force
If the force is to be described, it is necessary to use the equation for magnetic force between two
poles. When using a ferromagnetic material such as that of the beam, the beam then becomes a
magnet itself, when it is subjected to a magnetic eld. This means, that equation 3.9 can be used [17].
F
m

B
2
A
2
0
[N] (3.9)
In which B is the magnetic ux density
_
Wb/m
2
_
and F
m
[N] is the force between the two poles [17].
By using the SI unit of the magnetic ux density
_
Wb/m
2
_
, the magnetic ux density can be described
as in equation 3.10.
B

A
_
Wb/m
2
_
(3.10)
If equation 3.10 is substituted into equation 3.9 it gives the unied equation 3.11.
F
m


2
2 A
0
[N] (3.11)
Next, the ux described by equation 3.8 is substituted into equation 3.11. The magnetic force acting
on the beam can then be expressed in equation 3.12.
F
m
(I , h)
_
4 A I N A
beam

0

beam
A h
beam
+8 h A
beam

beam
_
2
2 A
0
[N]
{
F
m
(I , h)
8 A I
2
N
2
A
2
beam

0

2
beam
_
A h
beam
+8 h A
beam

beam
_
2
[N] (3.12)
12
3.3. SUMMARY OF THE PROBLEM ANALYSIS
There are two variables in equation 3.12 on the facing page, the electric current I and the height h.
When the current is increased, the force increases and the opposite goes for the height. It can be seen,
that the magnetic force is not a linear function of the two variables mentioned.
3.3 Summary of the problemanalysis
In the previous sections, basic knowledge of maglev technology has been established. The system
that has been chosen is the electromagnetic suspension (EMS) system, as described in section 2.2 on
page 6, modeled by an electromagnet levitating of an iron beam.
Additionally an equation for the magnetic force acting on the beam was derived in equation 3.12 on
the facing page section 3.2 on the preceding page. The electromagnetic force needs to be regulat-
ed, otherwise the beam will be uncontrollable and it becomes impossible to levitate the beam at a
predened height. This leads to the thesis statement in chapter 4 on page 15.
13
Chapter 4
Thesis statement
"Can an electromagnet be regulated, so that an iron beamwill levitate in a specied distance under the
magnet?"
Problems to be examined
What hardware should be designed and used to physically regulate the magnet?
How to measure distance and velocity of the beam?
How to design a nonlinear model in MATLAB Simulink?
How to create a linear model in MATLAB?
Which type regulation should be used to control the movement of the beam?
How to regulate the magnet with LabVIEW?
4.1 Specication of requirements
In this section the specication of requirements will be dened. The requirements applies to both the
physical pieces of equipment, as to the software.
4.1.1 Requirements for the electromagnet
The electromagnet has to be able to attract an iron beam of a mass of minimum 1 [kg] from at
least 15 [mm]. An iron beam is to be used because this structure replicates the maglev train.
The number of windings in the electromagnet has to be as high as possible, in order to get
sufcient magnetic force fromthe maximumallowed current. The number of windings is set to
be at least 500.
The magnetic eld must be spread equally out, so that the iron beam is attracted equally in
both ends to prevent the beam from only being picked up in one end.
4.1.2 Requirements for the converter
The converter has to be able to convert a DC-voltage to a DC-voltage of lower magnitude.
The converter has to be able to supply the electromagnet with enough current to lift the beam
from at least 15 [mm].
15
CHAPTER 4. THESIS STATEMENT
The converter must use a MOSFET (Metal Oxide Semiconductor Field Effect Transistor) that is
controlled using a PWM-signal(Pulse Width Modulated signal).
The converter must be able to change the current so fast, that the electromagnet does not drop
the beam, nor that the beam hits the electromagnet.
4.1.3 Requirements for the PWM-module
The PWM-module has to be able to drive the converter.
The highs in the PWM-signal must have an amplitude, so that the MOSFET conducts.
The frequency of the PWM-module must be as fast as possible inorder for the converter tomake
a near perfect DC output voltage, and to make a reasonable sized lter inductor. The higher
the switching frequency, the smaller the lter inductor is needed. The minimum switching
frequency is set to be at least 10 [kHz].
The PWM-module must be able to output the complete range of duty cycles, as close between
0 to 1 in duty cycle as possible. The reason for this, is that both zero and max current is to be
used, in order to control the movement of the beam.
The deviations of the duty cycle must be at max 5 [%], in order to secure, that the desiredduty
cycle is close to the actual duty cycle.
4.1.4 Requirements for the distance sensor
The distance sensor has to be immune to a change in a magnetic eld in proximity to it.
The distance sensor has to be able to measure a distance between 0 [mm] and at least 15 [mm].
The distance sensor has to be so fast that the updating frequency is at least 20 times faster than
the natural frequency of the plant, in order to measure the correct distance.
4.1.5 Requirements for the regulation
The system has to be controlled using LabVIEW.
The regulation of the system must execute so fast, that the system will be stable within a dis-
tance between 0 and 15 [mm] from the electromagnet.
The regulation must be able to calculate the velocity of the beam by data from the distance
sensor.
16
PROBLEM SOLVING
PART II
Chapter 5
Physical components
5.1 The buck converter
In the specication of requirements in section 4.1.2 on page 15, the requirements for a converter were
established. These requirements can be fullled by to use of a buck converter.
A buck converter is a converter which reduces the input voltage controlled with a MOSFET, which
acts as a switch. The output voltage is controlled with a duty cycle. Duty cycle is a termused for com-
paring the time in which the PWM-signal is high with the total time period, as seen on gure 5.1. The
consequence of the PWM-signal is, that the amplitude of the resulting signal can only be a maximum
of the input signal. The resulting signal will have a smaller amplitude due to a duty cycle <1. The duty
cycle D vary from0 to 1 and its complement D
t
is by denition 1D, or the off time of the duty-cycle.
It can be looked at as a scalar multiplied by the source voltage. This means that the transfer function
of the buck converter is a function of the the duty cycle D. In the following, the transfer function of
the buck converter will be derived. A circuit of the actual buck converter can be seen in gure 5.4 on
page 21.
t [s]
V [V]
D T
s D
t
T
s
T
s
Figure 5.1: A PWM-signal with a duty cycle of 0.5.
5.1.1 Buck converter theory
The buck converter contains of a low-pass lter, which removes the switching harmonics and pass
the DC component of the v
out
(t ) to the output together with a negligible AC-ripple. This is account-
ed for later on. However, not all the undesired components of the switching and its harmonics are
ltered. As a consequence, a small amount of high-frequency AC ripple passes through the output as
described in equation 5.1 [18].
v(t ) V
out
+v
r i ppl e
(t ) [V] (5.1)
In the analysis of the buck converter, the small ripple effect is neglected and equation 5.2 on the next
page is created.
19
CHAPTER 5. PHYSICAL COMPONENTS
|v
r i ppl e
| <V
out
[V]
{
V
out
v(t ) [V] (5.2)
The ideal buck converter can be shown in gure 5.2.
+

V
g
L
Buck
+
V
L
(t )
C
I
c
(t )
R

+
V
out
(t )
1
2
Figure 5.2: The ideal buck converter.
To apply circuit analysis to a basic buck converter as seen in gure 5.2, there will be looked at the
converter in the on- and off-state, or, position 1 and 2 as shown in gure 5.3.
+

V
g
L
Buck
+
V
L
(t )
I
L
(t )
C
i
C
(t )
R

+
V
out
(t )
1.
+

V
g
L
Buck
+
V
L
(t )
I
L
(t )
C
i
C
(t )
R

+
V
out
(t )
2.
Figure 5.3: The buck converter circuits.
The buck converter is analyzed in the two different states in a switching period, T
s
, and the KVL
(Kirchoffs Voltage Law) equations for both states are written in equation 5.3 and 5.4.
1. 0 V
g
+V
L
buck
+V
out
[V]
{
V
L
buck
V
g
V
out
[V] (5.3)
2. 0 V
L
buck
+V
out
[V]
{
V
L
buck
V
out
[V] (5.4)
The average voltage for the lter inductor is set to zero in this switching period according to assump-
tion, that the converter is operating in steady state, and in CCM (continuous conduction mode). The
small ripple approximation is employed, which results in, that only the DC component is left, which
means that constants are to be integrated in equation 5.5 on the next page by the use of inductor
volt-second balance [18]. This can be reduced to form equation 5.6 on the facing page.
20
5.1. THE BUCK CONVERTER
_
V
L
buck
_

1
T
s
_
T
s
0
V
L
buck
dt
1
T
s
_
DT
s
0
_
V
g
V
out
_
dt +
1
T
s
_
T
s
DT
s
(V
out
) dt 0 [V] (5.5)
{

1
T
s
_
DT
s
_
V
g
V
out
_
+(T
s
(V
out
) DT
s
(V
out
))
_
[V]
{
D V
g
V
out
[V] (5.6)
The transfer function for the buck converter can then fromequation 5.6 be written as in equation 5.7.
G
buck

V
out
V
g
D [] (5.7)
5.1.2 The buck converter in practice
When creating a buck converter there are some differences between the ideal buck converter shown
in gure 5.2 on the preceding page and the real buck converter as shown in gure 5.4. The main
difference is that the MOSFET is placed at the negative source terminal. This is done for securing that
the MOSFET has the desired effect.
C

+
V
i n
+

V
o L C
L
Buck
D
G
S
D

R
s
0.1
V
PWM
Figure 5.4: circuit diagram of the actual buck converter.
If the MOSFET is connected to the positive source, then there is a possibility that the MOSFET does
not open, when there is applied a signal to the gate of the MOSFET. The reason is that a MOSFET nor-
mally has a dened gate source voltage which is less than the output voltage, the gate source voltage
will become negative, if the output voltage is greater than the gate voltage as shown in equation 5.8.
V
g at e
V
out
V
g at e sour ce
[V] (5.8)
Another difference from the ideal buck converter is, that there is a capacitor in parallel to the input
terminal of the buck converter. This is done to lter the input signal, so the
buck converter does not give any disturbances to the supply grid.
To control the discharge of the inductor, a diode is placed in parallel to the input voltage source, so
when the MOSFET is off, the diode is forward biased and thereby letting the inductor discharge the
21
CHAPTER 5. PHYSICAL COMPONENTS
energy stored in it. When the MOSFET is on, the diode is reverse biased and thereby charging the
inductor with energy.
The last difference between the ideal and real buck converter is that there is a shunt resistor R
s
be-
tween the ground terminal and the source of the MOSFET. If this shunt resistor is not placed, it will
be necessary to make a galvanic isolation between the output and ground.
5.1.3 The buck converter Inductor
To determine the size of the inductor in the buck converter, it is necessary to look at the load R
l oad
and the frequency of the PWM signal. The current in the load can not be equal to the ripple current.
Otherwise the buck converter will enter discontinuous conduction mode, which means, that the in-
ductor is completely discharged in the end of the period and the ripple current is the same as the
inductor current. If the buck converter enters discontinuous conduction mode, it is much harder to
control the output voltage because, the output is dependent on more factors than the input voltage
and duty cycle. The ripple current is calculated from equation 5.9
i
V
g
V
out
2 L
D T
s
[A] (5.9)
If the resistance in the load is increased, the current will decrease, however, the voltage will remain
the same in relation to 5.10. If that is done, the current in the load will decrease, however, the current
ripple will remain the same. The ripple current does not change with increased load resistance be-
cause the ripple current is dependant on voltage in the buck converter not the load current as seen in
equation 5.9
V I R [V] (5.10)
To determine the size of the inductor, in the buck converter equation 5.11 is used [18].
R
cr i t

2 L
D
t
T
s
[] (5.11)
In equation 5.11 R
cr i t
is the the minimumvalue R
l oad
can have before the converter enters discontin-
uous conduction mode. By calculations of equation 5.11 R
l oad
is set to 15[] which is the resistance
in the load and the duty cycle is set to be 0.01. The appropriate value of the inductor is then found to
be 120[H]. 153[H] inductor is chosen to be certain the inductor is big enough. If 153[H] is insert-
ed into equation 5.11 the critical resistance is found to be 19[]. To test if the calculations are correct
equation 5.12 can be used.
R
l oad
<
2 L
T
s
[] (5.12)
The results fromequation 5.12 is that R
l oad
is smaller than R
cr i t
and therefore the inductor should be
large enough to keep the buck converter from entering discontinuous conduction mode.
5.2 The PWM-module
The buck converter described in section 5.1 on page 19 needs a system to control the output voltage
of the buck converter, so the electromagnet acquires the current needed for levitating an iron beam.
This section will describe some possibilities for doing this, and make a decision for the nal design.
22
5.2. THE PWM-MODULE
5.2.1 Control of the buck converter
To control the voltage output of the buck converter, the switching of the MOSFET must be controlled.
A way to do this is by using a PWM-signal. The gate to source voltage must be at least 4 [V] to open
the MOSFET [19]. The upper limit for the Gate to Source voltage must not exceed 20 [V]. To control
the output voltage, the duty cycle needs to be controlled. There are some different methods for con-
trolling the duty cycle, and securing a voltage of 4 [V]. One way is by using a DAQ (data acquisition)
USB-device, whilst another is by using an IC, an integrated circuit, with a PWM-module built in. The
before mentioned methods will, in the following, be described.
DAQUSB-device
ADAQUSB-device fromNational Instrumentscanoutput a PWM-signal directly to the MOSFET. To
use a DAQ, a LabVIEW-programmust be created to control the PWM-signal. A module for creating
a PWM-signal is preprogrammed, where there is an input for controlling the duty cycle and thereby
setting the amplitude. This can be seen in gure 5.5.
AMP
PWM MOSFET
Dutycycle
Figure 5.5: LabVIEWPWM-module example.
In this project, the National Instruments DAQ USB-6215 is chosen to be used because this device
is available for this project. This device has 4 digital inputs, 4 digital outputs, 2 analog outputs and
16 analog inputs. The DAQ device has a maximum sample rate of 250 [kHz], a maximum resolution
of 16 [bit], and it has an internal clock. The voltage output of the DAQ USB-device is 10 [V] and the
device may not exceed a load current of 6 [mA] [20].
To control the duty cycle to the buck converter, a feedback loop is to be used. A PCmust be connected
to the DAQ USB-device and this gives some problems, which causes the system to be non real-time.
The USB-system is not in compliance with the precision that is needed for real-time and the USB-
system can have a delay up to 50 [ms] [21]. Another problem is that the internal clock only has a
precision of 1 [ms] [22].
Integrated circuit
An IC with a PWM-module can be controlled by an analog voltage source or a variable resistor. An IC
is showm in gure 5.6. The speed of an IC is recognized for upholding the precision in real-time, and
there is no delay froma signal to change the duty cycle that is received, till the duty cycle has changed.
Figure 5.6: Example of an IC.
An IC can output with a frequency from a few [Hz] to several [MHz] and have an output voltage from
a few [mV] to several [V].
23
CHAPTER 5. PHYSICAL COMPONENTS
Comparison of a DAQand an IC
DAQ IC
Sample rate (max) 250[kHz] XX[MHz]
Voltage out (max) 10[V] <10[V]
Current limed 6[mA] XX[A]
Real time No Yes
Table 5.1: Comparison of DAQ and IC.
In table 5.1 it is shown that the DAQ USB-device compared to the IC can output a max output voltage
at 10 [V], but the IC can output over 10 [V]. Depending on the IC, it will be able to accumulate more
samples than the DAQ USB-device can. The DAQ USB-device has the advantage, that no hardware
has to be designed, however, this is necessary when using an IC. An advantage for the IC is, that it
operates in real-time, while the DAQ USB-device does not.
Based on table 5.1, an IC is selected to generate the PWM-signal.
5.2.2 Design of PWM-module by using an IC
For designing the PWM-module by using an IC, the DRV103 is selected. The DRV103 comes in two
different versions; one called SO-8 Package (DRV103U) where the typical output current is 1.5 [A] and
the other is PowerPAD SO-8 Package (DRV103H) with a typical output current of 3 [A]. Due to the
typical output current, the PowerPAD SO-8 Package (DRV103H) is selected.
To design a PWM-module, the way to control the duty cycle, delay time and frequency has to be
investigated. The rst decisionto make is, if delay time is neededor not. For this project, it is preferred
to regulate as fast as possible and a minimum delay time. For DRV103, the minimum delay time can
be set to 1 [s]. This is done by connecting a resistor to the delay adjust pin. If more delay is needed, a
capacitor can be connected to the delay adjust pin. To control the frequency of the DRV103, f
want ed
,
a resistor is selected so it will result in a signal with a frequency of 75 [kHz]. The resistor R
FREQ
is
calculated from equation 5.13 from the DRV103 datasheet [23].
R
FREQ

6808417
f
1.0288
want ed
[k] (5.13)

R
FREQ
65.7 [k]
This resistor has to be connected to the frequency adjust pin. A 68 [k] resistor is selected because it
is the closest value from the available resistors found in the laboratory. Then the frequency f
real
will
be approximately 72.5 [kHz].
R
FREQ

6808417
f
1.0288
RE AL
[k]
{
f
RE AL
4.383 10
6

_
1
R
FREQ
_
0.972006
[Hz]

f
RE AL
72535 [Hz] (5.14)
24
5.2. THE PWM-MODULE
For controlling the buck converter , a PWM-module is designed by modifying a circuit diagram from
the DRV103s datasheet [23, Figure 17]. The modied circuit is shown in gure 5.7
R
FREQ
R
out
V
PWM
12V
R
on
I nput
C
1
C
2
DRV
103
5
6
7
8
4
3
2
1
Figure 5.7: The PWM circuit used to control the buck converter.
The circuit has a resistor, R
out
, between pin 5 and 6 with a value of 3 [k], see the datasheet for
DRV103.
To have a circuit that operates in continuous mode, the circuit has a resistor R
on
, which is connected
from the supply voltage to the on pin, pin 8. The resistor is 10 [k]. This value is selected to secure
that the on pin input does not get voltages above +5.5 [V], and the input voltage V
on
is above +1.7 [V],
and is not connected to the supply voltage V
s
directly.
V
R
on

R
on
R
out
+R
on
V
s
[V]

V
R
on
9.23 [V]
V
on
V
s
V
R
on
[V]

V
on
2.77 [V] (5.15)
As shown in equation 5.15, the voltage to the input pin is 2.77 [V].
The DRV103 needs a voltage supply, and in this circuit, it is dened to be a 12 [V] because it is between
the minimum Gate to Source Threshold Voltage 4 [V] and the maximum Gate to Source Threshold
Voltage 20 [V]. On the source pin, a bypass capacitor of 22 [F] is connected to ground. This is done
to secure a stable supply voltage to the DRV103, and removing statics from the voltages supply.
To change the duty cycle, it is decided to use an analog voltage. This is done to minimize statics with a
capacitor, which is connected between the duty cycle pin and the analog voltage. The analog voltage
to control the duty cycle is a DC signal that can be regulated from -0.2 [V] to + 5.5 [V], which are ab-
solute maximum values. In this project, a DC-voltage of +1.3 to +3.9 [V] is chosen, as this is the active
voltage range according to [23, page 4]. This analog voltage signal is made by using a DAQUSB-device.
The PWM-module has been tested in section 9.2 on page 76, and the test shows that the PWM-signal
can be adjusted as expected. If the DAQ USB-device outputs an analog voltage to regulate the PWM-
signal to have a duty cycle of 45 [%], the PWM-module is generating a signal with 45 [%] duty cycle.
The signal is as shown in gure 5.8 on the following page, where no load is added.
25
CHAPTER 5. PHYSICAL COMPONENTS
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
10
5
2
0
2
4
6
8
10
12
14
Time [s]
V
o
l
t
a
g
e
[
V
]
Figure 5.8: PWM-signal from IC with no load.
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
10
5
10
5
0
5
10
15
Time [s]
V
o
l
t
a
g
e
[
V
]
Figure 5.9: PWM-signal from IC with buck converter as load.
When the buck converter is added, the PWM-signal does not have a high enough current to charge
the capacitor of the MOSFET. An equivalent circuit of a MOSFET can be seen in gure 5.10. As a
consequence, the signal has a long rise time as shown in gure 5.9
C
gd
C
g s

D
G
S
C
ds
Figure 5.10: Equivalent circuit of a MOSFET.
Because of this the output current of the buck converter is not high enough for the electromagnet to
levitate the beam. It will therefore be necessary to amplify the current of PWM-signal to the MOSFET.
The complete test of the PWM-module can be seen in section 9.2 on page 76.
5.3 The operational amplier
An op-amp (operation amplier) is a DC-coupled high-gain electronic voltage amplier with differ-
ential inputs, which can amplify an input signal. It is used in almost every modern electronic appli-
cation. Op-amps are used in different congurations to do arithmetic computations, like adding and
multiplying. The output of an op-amp is controlled by a negative or positive feedback, which controls
the magnitude of the gain.
The reason why an op-amp is implemented in the control system, is because the PWM-module does
not output a large enough current, and therefore, the PWM-signal is overloaded when connected to
the buck converter, resulting in a non-ideal signal characteristic. This is accounted for in section 9.2
on page 76. A way to solve this is using an op-amp to boost the current. This is done with an unity
gain conguration, as shown in gure 5.11 on the next page.
26
5.4. ELECTROMAGNETIC THEORY
-
+
V
cc
V
ee
V
PWM
V
o
Figure 5.11: Op-amp in unity gain conguration.
In this way, the amplitude of the signal is unchanged, but the current can be boosted. Therefore,
amplifying the signal with an op-amp with unity gain conguration results in a more square-shaped
waveform of the PWM-signal as seen on an oscilloscope, compared to no amplication of the signal,
where the signal has some non-idealized, as seen on gure 5.12[24].
1.
t [s]
V [V]
2.
t [s]
V [V]
Figure 5.12: 1. The ideal PWM-signal. 2. A non-ideal PWM-signal, which needs amplication.
The op-amp used for amplifying the PWM-signal is a type TL082CP by Texas Instruments , can be
seen in gure 5.13. The reason for the use of this particular op-amp is, that it is essential to have a fast
regulating op-amp. The term used for specifying how fast an op-amp can change its output is slew
rate. The unit for slew rate is typically [V/s], and the higher the slew rate, the faster the op-amp
can change its output. The slew rate of the Texas Instruments TL082CP at unity gain is typically 13
[V/s] [25]. With the slew rate of the Texas Instruments TL082CP, the op-amp should be fast enough
to control the buck converter.
Figure 5.13: The Texas Instruments TL082CP op-amp. [25].
In appendix B.1 on page A5 it is shown, that the Texas Instruments TL082CP is fast enough to control
the buck converter.
5.4 Electromagnetic theory
Current owing in an electrical wire produces a magnetic eld around the wire. The strength of the
eld is proportional to the current. This means, that an increase in the current increases the magnetic
eld around the wire. If the wire is wound into a solenoid, then most of the magnetic eld in the wire
passes through the center of the solenoid resulting in one large magnetic eld. The magnetic eld
of a solenoid can be increased by increasing the number of windings of the wire or the current. In
gure 5.14 on the next page the magnetic eld can be seen in a single wire, and in gure 5.15 on the
following page the magnetic eld can be seen when the wire is wound into a solenoid.
27
CHAPTER 5. PHYSICAL COMPONENTS
I
-
+
B
Figure 5.14: Magnetic eld produced by current owing in a single
wire [26].
S
N
Figure 5.15: Magnetic eld produced by current owing in a solenoid
[27].
It is, however, possible to increase the magnetic eld of the solenoid without adding more current or
windings. This canbe done by placing a core of ferromagnetic material e.g. soft iron. Inironthe atoms
are divided into small domains. In these domains all the electrons have the same magnetic orienta-
tion and produce a small magnet. This happens in all the atomic domains inside the iron block. The
iron is, however, not magnetized because the domains do not have the same magnetic orientation
and therefore they cancel each other out. By placing the ferromagnetic material inside the solenoid,
the magnetic eld from the wires goes into the iron and starts aligning these little domains and mak-
ing them all point in the same direction. The result is an electromagnet. In gures 5.16 and 5.17, the
changes to the domains magnetic orientation are visible before and after they are aligned by a bar
magnet.
S N
Ferromagnetic material Bar magnet
Figure 5.16: Atomic domains cancel each other out [28].
S N
Ferromagnetic material Bar magnet
Figure 5.17: Atomic domains are aligned [28].
The magnetic eld produced when the soft iron is placed inside the solenoid is dependent on both
the number of turns (N) the wire is wound around the iron core, the strength of the current owing
through the wire (I), and the willingness of the iron to be magnetized ().
To levitate a beam, it is a good choice to use an electromagnet, because it is relatively easy to control
the size and strength of the magnetic eld, produced by the magnet. It is also desirable to have aniron
core that has a north and south pole both at the same side. Therefore, a m-shaped iron core is chosen
and the wire is wound around the middle leg of the m-shaped core. This can bee seen in gure 5.18.
wire
iron core
Figure 5.18: An iron core with a wire wound around the center.
By choosing a m-shaped core like the one in gure 5.18 two poles are produced at the ends; a north
28
5.5. THE DISTANCE SENSOR
pole in the middle and two south poles at each end. The position of the poles can be changed by
changing the direction of the current that ows through the wire, resulting in a south pole at the
center and two north poles. To levitate a beam, it is good the have the area of the magnetic poles
larger than the width of the beam so that the magnetic eld will pull evenly at the center of the beam
and the edges. To be able to have the width of the poles larger than the width of the beamit is required
to have a relatively large magnet. The number of turns the wire is wound around the middle leg of the
iron core is 1000 [Wi] and the wire that is chosen is 0.5 [mm] thick copper wire, which gives a large
enough magnetic force to levitate over 1.2 [kg] beam with a current of just under 2 [A] from 15 [mm]
as required in 4.1.1 on page 15. With the 1000 [Wi], the length of the wire will become quite large and
it produces a 15 [] resistance in the wire. By having a 15 [] resistance in the magnet it is necessary
to have a high enough voltage over the magnet to make a high enough current to levitate the beam.
5.5 The distance sensor
To be able to monitor the distance the beamhas fromthe magnet, it is necessary to have some sort of
a sensor that canmeasure distance. The sensor has to be able to measure the distance to the beamfast
enough and give a stable voltage output in relations to the distance of the beam. At rst, a hall sensor
was chosen. Hall sensors are used to measure close distances and rotating devices. By measuring the
strength of the magnetic eld it is possible to calculate the distance from a magnet to the hall sensor,
but the magnetic eld from the electromagnet will disturb the hall sensor. Another possibility is an
infrared sensor. An infrared sensor consists of a LED (Light Emitting Diode) and a photo transistor.
The LED emits a ray of infrared light on the plate and the photo transistor detects the strength of
the infrared light that reects back from the beam, and converts it to a voltage. An optical sensor
is chosen to measure the distance because it is not affected by the magnetic eld produced by the
electromagnet.
The model that is chosen is a CNY70 from Vishay. The CNY70 is chosen because of the operating
range it can measure an object with good accuracy. Its working range is between 0.3 to 10 [mm] away
from the measured object, however, tests conducted showed decent results with a distance of up to
20 [mm], see section 9.1 on page 75 for the test of the sensor.
The sensor can be seen in gure 5.19 and the principle of the sensor can be seen in gure 5.20
Figure 5.19: The Vishay CNY70 optical sensor [29].
h
Emitter Detector

t
t
t
Figure 5.20: Principle of the sensor [27].
It can be seen from gure 5.20 that the diode emits an infrared light onto the beam and the photo-
transistor detects the strength of the light that is reected back.
5.6 The complete systemdesign
All the components were tested individually to see if they worked as intended, and minor aws were
corrected in all the circuits. Afterwards, all the circuits were connected together to see if they worked
with the electromagnet. First the PWM-module is connected to the DAQ USB-device from National
Instruments , to get the control signal for the duty cycle, and a 12 [V] DC supply voltage is used.
29
CHAPTER 5. PHYSICAL COMPONENTS
The PWM-signal is connected to the op-amp for amplication. The op-amp, like the PWM-module,
is connected to a 12 [V] DC voltage supply. The output signal from the op-amp is connected to the
MOSFET in the buck converter. The buck converter is connected to an external voltage supply of 24
[V] DC to provide the voltage that is needed for the electromagnet.
Two car batteries are used as a supply of the DC voltage needed in the circuit. These batteries are
connectedinseries to obtain24 [V] for the buck converter and12 [V] to the PWM-module andthe Op-
Amp. The 12 [V] is obtainedby connecting the circuits, whichonly needs 12 [V], to one of the batteries.
Car batteries are used so the sensor can work without AC disturbances caused by disturbances in the
power grid, as shown in gure 5.21.
Di st ance sensor Usb PWM
Op amp
Buck Pl ant
12V 12V Pc
+
-
5V
+ - + - usb
Figure 5.21: The total electromagnet system.
The sensor is connected through the DAQ USB-device to a laptop computer to measure the distance
the beam is away from the electromagnet. The measured distance is then analyzed by a LabVIEW
program, and an appropriate voltage is generated by the DAQ USB-device to the PWM-module, to
match the required duty cycle. Further explanations of the LabVIEW program and the function of
the system is explained in section 8.3 on page 72.
30
Chapter 6
Linear model
In this chapter, there will be given an explanation on howto make a linear model so that it will be easy
to work with. To control and regulate the electromagnet, some transfer functions will be analyzed
with the theory of feedback control systems, and applied to determine the regulation constants K
p
,
K
v
and K
D
. This is done in a series of sections, which analyse each transfer function as the system
gets more and more complex. This chapter is based on source [30].
6.1 Transfer function for the plant G
p
The following section explains how to to obtain a transfer function for the plant using feedback con-
trol theory. The plant essentially consists of two forces which counteract each other, as described in
section 7.1 on page 47. The magnetic force is a function of, the current owing in the electromagnet
and the height from the electromagnet to the beam. The equation describing the magnetic force was
derived in section 3.2 on page 12 and is represented in equation 3.12 on page 12. As it is seen from
equation 3.12 on page 12, the magnetic force is not a linear function of current I and height h. Feed-
back control regulation theory only applies to linear systems and therefore, the magnetic force needs
to be linearized in order to use this theory [30]. In the following, a number of constants, c
1
, c
2
etc. are
introduced to make the equations simple and thereby easier to understand. See table A.1 on page A2
for the denition of these constants.
6.1.1 Linearization of the magnetic force
The magnetic force represented in equation 3.12 on page 12 and is seen in equation 6.1 for revision
purposes.
F
m
(I , h)
8 A I
2
N
2
A
2
beam

0

2
beam
_
A l
beam
+8 h A
beam

beam
_
2

I
2
c
1
(c
2
+c
3
h)
2
[N] (6.1)
According to the theory of linearization, rst order Taylor approximation can be used to make a func-
tion linear. If the equation which is to be linearized is far fromlinear, the error of the nonlinear model
will be massive. Application of this method begins by choosing a point of linearization. A suitable
point of linearization is around the desired height h
0
, where I
0
is the current required to maintain the
beam at a xed point at the particular height.
The magnetic force F
m
as a functionof the height withvarious constant currents as showningure 6.1
on the next page.
31
CHAPTER 6. LINEAR MODEL
5 6 7 8 9 11 12 13 14 15
0
20
40
60
80
100
120
h[mm]
F
m
[
N
]
I 0.4A
I 0.8A
I 1.2A
I 1.6A
I 2A
Figure 6.1: Magnetic force as a function of the height with various constant currents.
As it can be seen from gure 6.1, a linearization of the force is only valid in proximity of the desired
height h
0
= 10 [mm]. The linearization of the magnetic force is used to describe the system in the
frequency domain. The linearized force gives an idea of how the system behaves in the frequency
domain, not an exact picture. By Taylors theorem [31] the magnetic force can be linearized as in
equation 6.2.
F
m
(I , h) F
m0
(I
0
, h
0
) +
F
m
I
[
I I
0
(I I
0
) +
F
m
h
[
hh
0
(h h
0
) [N]
{
F
m
(I , h) c
4
I +c
5
h +c
6
[N] (6.2)
6.1.2 Obtain transfer function for the plant
Next stepis to substitute equation6.2 into equation6.3, whichresults inequation6.4, and thencancel
all constant terms by setting these to0. This is done because at the point of linearization, the magnetic
force equals the gravitation force. As a consequence, only the change in current and height will effect
the magnetic force [32].
F
res
F
m
F
G
[N] (6.3)
{
m

h c
4
I +c
5
h +

>
0
c
6

:
0
m g [N] (6.4)
It is to be noted that the constant c
5
is negative, see table A.1 on page A2 in appendix A on page A1.
Next, equation 6.4 is Laplace transformed into equation 6.5 on the facing page, which enables a trans-
fer function for height versus current to be derived. This transfer function is named G
p
, where
p
stands for plant as in equation 6.6 on the next page.
32
6.1. TRANSFER FUNCTION FOR THE PLANT G
P
s
2
m h(s) s m

*
0
h(0) m

*
0
h
t
(0) c
4
I (s) +c
5
h(s) [] (6.5)
{
G
p

h(s)
I (s)

c
4
m
s
2

c
5
m
[] (6.6)
All initial values in equation 6.5 are cancelled out, because the starting distance and starting velocity
are chosen to be 0. If equation 6.6 is compared with the standard form for a second order system,
equation 6.7, it is seen, that there is no rst order s-term, which means, that the damping ratio is
zero and therefore the plant is not damped [30].
G
2. order

K
2
n
s
2
+s 2
n
+
2
n
[] (6.7)
Furthermore, if equation 6.6 and equation 6.7 are compared, it can be seen that the gain K is less than
1. This becomes particularly clear, if the bode plot for G
p
is viewed.
100
50
0
50
100
150
M
a
g
n
i
t
u
d
e

(
d
B
)
10
0
10
1
10
2
10
3
180
135
90
45
0
P
h
a
s
e

(
d
e
g
)
Bode Diagram
Frequency (rad/sec)
Figure 6.2: Bode plot of G
p
.
As it is shown in gure 6.2 the system remains under the 0 [dB] axis in the low frequency, to the left
of the upper plot. The effect of no damping in system can also be seen from the very high resonance
peak, as well as it could be identied in the transfer function, in equation 6.6. Minimization of res-
onance peaks is vital in making a working and stable system. It can be seen from a Root-Locus plot,
that the transfer function G
p
is marginally stable. This is shown in gure 6.3 on the next page.
33
CHAPTER 6. LINEAR MODEL
20 15 10 5 0 5 10 15 20
200
150
100
50
0
50
100
150
200
Root Locus
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
Figure 6.3: Root-locus plot of G
p
.
As the poles of the transfer function lie on the imaginary axis, the system is marginally stable. This
behavior becomes very clear, when the plant G
p
is exposed to a step input. A step input replicates the
behavior the system should have, when the system is switched on. The step response for G
p
is shown
in gure 6.4.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
0.045
0.05
Step Response
Time (sec)
A
m
p
l
i
t
u
d
e
Figure 6.4: Step response of G
p
.
In order to make a working stable system, there has to be some sort of systemdampening. The system
does not have any dampening on its own, and it can be seen in gure 6.4, that the beam will never
34
6.2. TRANSFER FUNCTION FOR THE PLANT WITH VELOCITY FEEDBACK
G
PV
settle at the wanted height, but rather hit the underside of the electromagnet, or be dropped into the
tray under the magnet. This behavior would be seen if the systemwas controlled using a proportional
regulator. Dampening the system can drag the poles towards the left half plane, or it can drag them
to the right half plane, which relates to an unstable system, so it is necessary to analyze the system to
determine if the system becomes unstable. One way to dampen the system is to measure the velocity
of the beam with a sensor and use a feedback loop to take this velocity into account. The distance
sensor does not measure the velocity directly, but instead it measures the distance between itself and
the beam. This distance can be processed and transformed into height in the model. To acquire
velocity from a certain height, a differentiator is applied. In the Laplace domain this is simply done
by multiplying the height by s. In section 6.2, a new transfer function is derived with the articial
dampening.
6.2 Transfer function for the plant with velocity feedback G
pv
In section 6.1 on page 31,a transfer function for the plant was derived and it was concluded that some
sort of damping was needed. A velocity gain K
v
is therefore introduced, so that the transfer function
can be ne tuned to behave in a designed manner, where the system can be stabilized. A way to use
velocity feedback, is to use a D regulator. Some characteristics of using a D regulator is increased
relative stability, which is the main reason since the plant needs additional dampening, increased
high frequency performance, which relates to better transient response and thus making it better at
handling inuences. When velocity feedback is used to obtain a new transfer function for the plant,
it is known as rate feedback [30].
The feedback loop is illustrated in gure 6.5.

G
p
s K
v
I h

G
pv
Figure 6.5: Feedback loop with velocity.
It is easier to design a regulator step by step, therefore K
v
needs to be included into a new transfer
function for the plant, G
pv
. This new transfer function is a loop inside the original block diagram
and it is marked with dotted lines in gure 6.5. This loop can be reduced to G
pv
using Masons gain
equation for block diagram reduction as shown in equation 6.8.
G
pv

G
p
1+G
p
s K
v

c
4
m
s
2
+s K
v

c
4
m

c
5
m
[] (6.8)
Whenequation6.8 is comparedtothe standardformfor secondorder system, equation6.7 onpage 33,
equation 6.9 is derived in equation 6.9.
K
v

c
4
m
2
n
[] (6.9)
It is shown in equation 6.8, that K
v
affects the damping ratio directly. If equation 6.6 on page 33
and equation 6.8 is compared, it can be seen that K
v
introduces an articial dampening that was not
35
CHAPTER 6. LINEAR MODEL
present in the original transfer function for the plant, G
p
. This was the intention of introducing K
v
.
The larger K
v
gets, the larger the damping ratio becomes. Thereby, changing the value of K
v
alters
the dampening of the system, which is just as intended.
6.2.1 Analyzing K
v
using the Routh-Hurwitz array
To determine the desired value of K
v
, some analysis must rst be made. First, the range of K
v
where
the system is stable, must be determined. A way to do this is using the Routh-Hurwitz criteria of sta-
bility. The Routh-Hurwitz method for determining the stability of a system utilizes an array, where
the coefcients in the rst two rows come from the characteristic equation of the closed loop trans-
fer function. A closed loop transfer function is, as the name indicates, a transfer function that has
closed all loops, so that the overall block diagram can be represented as a single block. The charac-
teristic equation is then the denominator of the closed loop transfer function set equal to zero. If any
sign changes in the rst column in the Routh-Hurwitz array occur, the system is unstable. Each sign
change means that there is a pole in the right half plane, which violates the BIBO-denition, which
states that there must not be any poles in the right half plane . The transfer function G
pv
, shown in
equation 6.8 on the previous page, is already brought into closed loop form, which means that the
characteristic equation is the denominator of G
pv
.
s
2
+s K
v

c
4
m

c
5
m
0 [] (6.10)
With numbers inserted, from table A.1 on page A2, the characteristic equation is given be equa-
tion 6.11.
s
2
+s K
v
16.612+2159.7 0 [] (6.11)
From equation 6.11, the rst two rows in the Routh-Hurwitz array can be made. The constant in the
third row is calculated as shown in appendix C.1 on page A7. Only the results are shown in equa-
tion 6.1.
s
2
1 2159.7
s
1
16.612 K
v
0
s
0
2159.7
Table 6.1: Routh-Hurwitz array.
From table 6.1, it can be seen that there are no sign changes occurring when K
v
is larger than zero,
which means that K
v
needs to be larger than zero for the system to be stable.
6.2.2 Analyzing K
v
using the Root-Locus plot
To determine the value of K
v
, a Root-Locus plot is to be made. In the Root-Locus plot, the placement
of the system poles is a function of the gain. In the Root-Locus plot, the placement of the poles show
important characteristics about the behavior of the system. Complex poles give an under damped
system, a double real pole gives critical damped system and two real poles give over damped system.
To plot the Root-Locus, the transfer function G
pv
must be rewritten into the general form, where a
gain, K, which is a variable parameter, is multiplied with a transfer function G(s) and a sensor gain
H(s), as seen in equation 6.12 on the facing page.
36
6.2. TRANSFER FUNCTION FOR THE PLANT WITH VELOCITY FEEDBACK
G
PV
1+K G(s) H(s) 0 [] (6.12)
As it can be seen from equation 6.11 on the preceding page, the characteristic equation is not yet in
the standard form, which has to be done in order to continue analyzing the transfer function using a
Root-Locus plot. This is done easily, and the function then becomes equation 6.13.
1+K
v

s 16.612
s
2
+2176.312
0 [] (6.13)
Using this function to plot the Root-Locus for the system, the gure 6.6 is obtained.
90 80 70 60 50 40 30 20 10 0 10
50
40
30
20
10
0
10
20
30
40
50
0.16 0.34 0.5 0.64 0.76 0.86
0.94
0.985
0.16 0.34 0.5 0.64 0.76 0.86
0.94
0.985
10 20 30 40 50 60 70 80 90
Root Locus
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
Figure 6.6: Root-Locus plot to determinate K
v
.
From gure 6.6, it can be seen that if K
v
is zero, the system is marginally stable, and the poles lie on
the imaginary axis. Altering the value of K
v
changes the placement of the poles from lying on the
imaginary axis to lying on the arc until the poles are only real. Fromthereafter, the poles separate and
turn towards origo and . At the point where the poles lie together on the real axis, the system is
critically damped, which means is equal to 1. For poles lying on the arc, is between one and zero,
meaning the system is under damped. For poles lying on the real axis, but not on the same spot on
the axis, then is larger than 1 and the system is over damped.
As the desired system has to have a fast response and low settling time, a system which is maximally
critically damped is required. The maximum value of K
v
then occurs when the system is critically
damped. To determine the value of K
v
, the dampening ratio needs to be determined rst. A good
way to illustrate the inuence, the dampening ratio has on the system, is to plot various values of in
the time-domain using a step input.
37
CHAPTER 6. LINEAR MODEL
6.2.3 Analyzing K
v
using step response in the time domain
A plot of various values of , where is between one and zero, can be seen in gure 6.7 using equa-
tion 6.14 [30]
1
. The steady state value is chosen to be 1, however, it is only the difference between the
various values of in gure 6.7 that is of interest.
c(t ) 1
1

e

n
t
si n(
n
t +) [] (6.14)
Where the values and are dened to be
_
1
2
and t an
1
_

_
. Equation 6.14 results in
gure 6.7.
0 0.1 0.2 0.3 0.4 0.5
0
0.4
0.8
1.2
1.6
2
t [s]
c
(
t
)
0
0.1
0.2
0.4
0.7
1
Figure 6.7: The inuence of different values of .
From gure 6.7, it can be seen that although a critically damped system has no overshoot, it is not
the ideal value of , as the rise time T
r
is slower than some of the under damped cases. Rise time,
T
r
, is dened to be the time it takes to obtain from 10% to 90% of the steady state value [30]. A good
compromise between a fast rise time, settling time T
s
and overshoot is the value of
1
_
2
0.7. This
value of corresponds to a value of K
v
3.96 inthe Root-Locus plot. With the value of K
v
determined,
the next step in the analysis is to check the settling time T
s
, which is given by equation 6.15 for a
second-order system.
T
s

c
K
n
[s] (6.15)
Where c
K
is usually chosen to be 4 [30]. The equation is then rewritten to equation 6.16.
T
s

4
K
v
0.5
c
4
m

8
K
v

c
4
m
[s]
{
T
s

8
3.96 16.612
0.122 [s] (6.16)
1
Equation 6.14 is valid only for under damped systems.
38
6.3. TRANSFER FUNCTION FOR THE CURRENT FEEDBACK G
I
Inserting values from table A.1 on page A2, T
s
is determined to be 0.122 seconds. Now that T
s
has
been determined, it is useful to determine the time constant , which is given by equation 6.17.
T
s
c
K
[s] (6.17)
Solving for in equation 6.17, becomes as shown in equation 6.18.

T
s
c
K

0.122
4
0.305 [s] (6.18)
The value of is then determined to be 0.305 seconds.
Because the magnetic force is linearized, the overshoot is of great importance because it alters the
validity of the model. A large overshoot (approx. 30 [%]) will bring the beam to far away from the
point of linearization h
0
, thereby rendering the linearization useless. To determine the overshoot,
equation 6.19 is used.
O e

_
1
2
100% [%] (6.19)
From this equation, the overshoot is determined to be 4.32 [%], which is acceptable compared to
1, where there is no overshoot at all. With the results above, it can be justied to use a K
v
3.96 as
it provides a good compromise between sufcient dampening, settling time and overshoot.
In an actual system there are losses in e.g. electrical circuits, which results in differences from what is
wanted to what is actually happening. To ensure that the current that is wanted is no different from
the current which ows through the electromagnet, a current feedback loop can be used to check if
any deviations occur. This will be accounted for in the next section.
6.3 Transfer function for the current feedback G
i
As mentioned in section 6.2 on page 35, it is important that the current that the controller measures
through the electromagnet, is the same as the current that actually ows through it. Therefore, a
feedback loop with a sensor monitoring the present current in the electromagnet is needed. This idea
can be seen in gure 6.8, where a wanted current is given as input and a current now is the output.
G
i
I
want ed
I
now
Figure 6.8: The idea behind the current feedback transfer function.
First the current, I
want ed
, enters the model. The wanted current is previously calculated and it is the
current needed at a given time. The output of the model is the present current, I
now
, or the current
that actually ows in the electromagnet at a given time. The present current can be different fromthe
wanted current, and therefore I
now
is sent back in a control loop. The buck converter regulates the
output voltage using duty cycles, and therefore it is a reasonable idea to regulate the current owing
in the electromagnet using changes in the duty cycle.
To make this kind of regulation possible, a feedback loop can be used. A stationary constant loop
executes a well estimated guess as to what the specic duty cycle should be, and the feedback loop
covers the difference between the wanted current and current now.
39
CHAPTER 6. LINEAR MODEL
6.3.1 Current feedback regulation
To begin with, the stationary constant loop is described. This loop calculates a duty cycle based on
the steady state value of the current owing in the electromagnet. To do this, some analysis must rst
be made. The transfer function for the ideal buck converter is given by equation 5.7 on page 21 and is
seen in 6.20 for revision purposes.
V
out
V
g
D [V] (6.20)
The voltage V
out
is the output voltage from the buck converter, which is the present voltage over the
electromagnet. When there are no changes in the output voltage or the changes in output voltage are
small, the electromagnet can be modeled simply as a resistor with the resistance R
copper
. The output
voltage is then equal to the voltage over a resistor where the current I
want ed
is owing through it. This
is the basis for the stationary constant loop and the guess of duty cycle is named D
0
. The calculation
to determine D
0
is done in equation 6.21, where the duty cycle D
0
is based on the wanted current.
I
want ed
R
copper
V
g
D
0
[V] (6.21)
In equation 6.21, D
0
is isolated to determine the guess value for the duty cycle. The difference be-
tween current wanted and current now is multiplied by a regulation constant K
D
. This duty cycle
in- or decrease is then added to the guessed duty cycle D
0
to form the regulation equation, shown in
equation 6.22. As the constant K
D
is multiplied to a difference in current, this type of regulation is P
regulation with a constant part, D
0
.
D D
0
+K
D
(I
want ed
I
now
) [] (6.22)
{
D
I
want ed
R
copper
V
g
+K
D
(I
want ed
I
now
) [] (6.23)
As it can be seen from equation 6.23, K
D
can not be too small, or this would make the change in the
duty cycle too little and it would take too much time to change the current resulting in a slow sys-
tem. However, it can not be to big either, as this will cause the control loop to overcompensate. This
current feedback shall be thought as a loop inside a bigger loop, which covers the calculation of the
wanted current depending on the height and velocity of the beam. A rule of thumb is that an inner
loop should be 10 times faster than an outer loop. This can be done by ensuring that the time con-
stant is 10 times smaller than the for the outer loop, which gives the meaning of K
D
[30].
The model of the buck converter requires a voltage to work and therefore, all calculations must be in
[V] regarding the buck converter, however, calculations regarding the electromagnet are based on the
present current. In regards to the model, this means that voltage has to be transformed into current,
in order to continue. The duty cycle, which is found in equation 6.23, is rst transformed into an
output voltage, named V
out
, using equation 6.20. V
out
is equal to voltage drop over the ideal inductor
(the electromagnet), and the voltage drop over the copper resistance in the electromagnet shown in
equation 6.24 on the next page. This circuit can be seen in gure 6.9 on the facing page.
40
6.3. TRANSFER FUNCTION FOR THE CURRENT FEEDBACK G
I
+

V
out
R
copper
L
Figure 6.9: Model of the electromagnet.
From gure 6.9, equation 6.24 can be derived.
V
out
L
dI
now
dt
+R
copper
I
now
[V] (6.24)
{
I
now

1
L
_
V
out
dt +
V
out
R
copper
[A] (6.25)
In equation 6.25 there is nowa link between the output voltage and the present current owing in the
electromagnet.
The concept of this type of regulation is shown in gure 6.10, G
D
0
is the duty cycle calculated from
I
want ed
shown in equation 6.21 on the preceding page.

K
D

G
b
G
D
0
I
want ed
I
now

Figure 6.10: Current feedback transfer function.


In gure 6.10 the blockG
b
is a combination of the two equations, equation 6.20 on the preceding page
and equation 6.24, thus it can be split up into two blocks as shown in gure 6.11.
V
g V RL
D
I
now
G
b
Figure 6.11: Transfer function for the buck converter.
V
g
is given by equation 6.20 on the facing page and the output of this block is the output voltage V
out
,
whereas block V RL is more complicated. The block V RL is based around equation 6.24 and can be
represented as shown in gure 6.12.
1
L

1
s
R
copper
L
V RL
V
out
I
now

Figure 6.12: Transfer function model of the electromagnet.


41
CHAPTER 6. LINEAR MODEL
The block G
b
in gure 6.10 on the previous page is made of the two blocks shown in gure 6.11 on the
preceding page. Now the complete model of the current regulation is derived to analyze the effect of
the regulation constant K
D
. The complete model will become the transfer function G
i
.
6.3.2 Obtaining the transfer function for the current feedback loop
Block G
b
is shown in equation 6.26 and Laplace transformed into equation 6.27.
D V
g
L
dI
now
dt
+R
copper
I
now
[V] (6.26)
{
L
_
D V
g
_
L
_
L
dI
now
dt
+R
copper
I
now
_
[]
{
D V
g
L s I
now

*
0
i (0) +R
copper
I
now
[V]
{
G
b

I
now
D

V
g
L s +R
copper
[] (6.27)
The block G
D
0
is the equation 6.21 on page 40 and this equation is Laplace transformed into equa-
tion 6.28.
I
want ed
R
copper
V
g
D
0
[V]
{
L
_
I
want ed
R
copper
_
L
_
V
g
D
0
_
[]
{
G
D
0

D
0
I
want ed

R
copper
V
g
[] (6.28)
If the block diagram shown in gure 6.10 on the previous page is reduced using the equations for the
blocks G
b
and G
D
0
, it can be represented as the transfer function G
i
shown in equation 6.29. The
intermediate results are not presented here because of the lack of relevance for the report.
G
i

I
now
I
want ed

1
L
R
copper
+V
g
K
D
s +1
[] (6.29)
6.3.3 Analyzing K
D
using the limit for the time constant
The transfer function G
i
shown in equation 6.29 is deliberately brought into the standard form for a
rst order system. The standard form is shown in equation 6.30 for reference.
G
1.order

K
g ai n
s +1
[] (6.30)
When G
i
is compared to the standard form, some interesting things can be concluded. Firstly, it can
be seen from equation 6.29, that there is an unity gain, that is, that K
g ai n
1. This should obvious-
ly also be the case, since the transfer function G
i
is made to make I
now
and I
want ed
equally, faster
42
6.3. TRANSFER FUNCTION FOR THE CURRENT FEEDBACK G
I
than they would without the K
D
feedback, without altering the amplitude of the input. More inter-
estingly however, the time constant can be identied in equation 6.29 on the facing page as the
equation 6.31.

L
R
copper
+V
g
K
D
[s] (6.31)
From equation 6.31, it can be seen, that if K
D
is increased will be smaller. The other terms in the
equation are constant. The thought is, that if the mass of the beam is little, a high V
g
would result in
very small changes in duty cycle, in order to stabilize the beam. The physical system can not operate
with very small changes in duty cycle, and therefore a suitable V
g
should be chosen if the mass is
changed.
If equation 6.31 is viewed separately, without taking the rest of the system into account, it could be
argued for, that an increase in copper resistance, R
copper
, would make the system faster. If the resis-
tance is increased, less current will ow in electromagnet, and if the resistance is increased further,
the electromagnet will not be able levitate the iron beam. Therefore the resistance should be as small
as possible, so as much current as possible can ow in the electromagnet. The natural frequency,
n
,
can be seen as a part in equation 6.8 on page 35 and is shown in equation 6.32.

_
c
5
m

_
2309.8
1.07
43.7 [rad/s] (6.32)
{
f
n


n
2
7 [Hz] (6.33)
From equation 6.32 it can clearly be seen that the mass of the beam, m, has inuence on the natural
frequency. Larger mass results in lower natural frequency. A low natural frequency is needed in order
to be able to use a distance sensor in practice. The distance sensor has to be able to sample 20 times
faster than the natural frequency of the plant, as described in section 4.1.4 on page 16, in order to
measure the correct height. In section 5.5 on page 29 an optical sensor was chosen.
Since the feedback fromG
i
is in an inner loop, it has to be ten times faster than the outer loop. That
is, if there are differences between I
want ed
and I
now
in the inner loop, there is a good chance that this
difference will have died out before it reaches the outer loop. To make a system ten times faster, the
time constant for G
i
has to be ten times smaller. This leads to of the transfer function G
i
, given in
equation 6.34.

G
i

1
10

G
pv

1
10
0.0305 3 10
3
[s] (6.34)
With
G
i
, K
D
can be determined, from equation 6.31, to be :

G
i

364, 3 10
3
15+30 K
D
3 10
3
[s]
{
K
D
3.55 [1/A] (6.35)
Now both the regulation constants K
v
and K
D
have been determined and the transfer function anal-
ysis can continue, to determine the regulation constant K
p
.
43
CHAPTER 6. LINEAR MODEL
6.4 Transfer function for the plant with velocity and current feedback
G
pvi
The next step, in determinating the regulation constants and nding the complete transfer function
of the system, is to combine the transfer function for the plant with velocity feedback, G
pv
, with
the transfer function for the current feedback, G
i
. This idea is shown in gure 6.13, where it can
be seen, that G
i
is just a block between current wanted and current now leading into the plant, the
electromagnet itself.

G
i
G
p
I h
s K
v

Figure 6.13: Overall block diagram for the transfer function G


pvi
.
If the blocks in gure 6.13 is reduced, using theory of block diagram reduction [33], the transfer func-
tion G
pvi
appears as shown in equation 6.36.
G
pvi

G
i
G
p
1+G
i
G
p
s K
v

c
4
m
s
3

G
i
+s
2
+s
c
5

G
i
+c
4
K
v
m

c
5
m
[] (6.36)
As it can been seen from equation 6.36, the transfer function G
pvi
is a third order system. This in-
creases the complexity of the analysis needed to determinate the regulation constants, if the regula-
tion constants were to be determined using transfer function G
pvi
for the plant. There is however no
need for this added complexity, when determinating the regulation constants, as this evaluation will
make clear. To begin with three different pole zero maps will be examined, the rst withG
pv
, the sec-
ond with G
i
and the third with G
pvi
. A pole zero map is a plot, where the poles and zeros of a transfer
function can be seen.
35 30 25 20 15 10 5 0
40
30
20
10
0
10
20
30
40
PoleZero Map
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
Figure 6.14: Pole zero map G
pv
.
350 300 250 200 150 100 50 0
1
0.8
0.6
0.4
0.2
0
0.2
0.4
0.6
0.8
1
PoleZero Map
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
Figure 6.15: Pole zero map G
i
.
44
6.4. TRANSFER FUNCTION FOR THE PLANT WITH VELOCITY AND CUR-
RENT FEEDBACK G
PVI
300 250 200 150 100 50 0
40
30
20
10
0
10
20
30
40
PoleZero Map
Real Axis
I
m
a
g
i
n
a
r
y

A
x
i
s
Figure 6.16: Pole zero map G
pvi
.
As it can be seen from the three plots, the poles from the transfer function G
pv
, which can be seen
in gure 6.14 on the preceding page. G
i
can be seen in gure 6.15 on the facing page, are added to
become the transfer function G
pvi
, as can be seen in gure 6.16. The reason for this is, that G
pvi
is
based on both G
pv
and G
i
. The pole zero map of the transfer function G
pvi
is now compared to the
theory regarding insignicant and dominant poles, this theory is shown in gure 6.17.
_
Insignicant
poles
_ _
Dominant
poles
_
(Unstable region)
s
-b
-a
Figure 6.17: Pole zero map showing insignicant and dominant poles [30].
As it can be seen from gure 6.17, the poles that are located further to the left in the s-plane are so
called insignicant poles. The insignicant poles give the system transient responses that are much
faster than the dominating poles. The insignicant poles in gure 6.16 originate from the transfer
function G
i
, gure 6.15 on the preceding page.
The regulation constant K
D
inG
i
was chosen, so that the time constant
G
i
is 10 times faster than the
time constant
G
i
for G
pv
. It is this behavior that can be seen in gure 6.16. The dominant poles give
transient responses that are slow, making themthe limiting factor in a particular transfer function. In
gure 6.16 the dominant poles originate fromthe transfer functionG
pv
, gure 6.14 onthe facing page.
If the ratio of the poles real part
b
a
, where the poles real part here are named a and b, is greater than
5, the poles that give the fast transient responce, the insignicant poles, can be ignored [30]. In g-
ure 6.16 this is the case, which results in, that the poles from G
i
can be ignored when the overall
regulation type is determined. The meaning of this is, that the block G
i
in block diagram 6.13 on the
facing page can be replaced with the gain of G
i
. In section 6.3 on page 39 it is concluded, that the gain
of the transfer function G
i
is 1, therefore G
i
is replaced with the number 1. This simplies the block
diagram of G
pvi
into the block diagram of G
pv
.
45
Chapter 7
Non-linear model
7.1 MATLABSimulink model
In this section a non-linear model of the system is created in MATLAB Simulink. This model will
be used to predict the behavior of the system, when the height of the levitating beam is controlled
using a feedback control system. The derived theory regarding the magnetic force, from section 3.2
on page 12, will be used to model the physical system.
7.1.1 General description
The main goal for the MATLAB Simulink model is to prove in theory, that it is possible to create
a system, which can levitate an object. This is done by creating a model of the plant, which is the
electromagnet, andsome formof regulationto control the height of the object. The principle is shown
in gure 7.1.
Regul at i on
Pl ant
h
0
h
now
Figure 7.1: The principle of the MATLAB Simulink model.
7.1.2 The plant model
To create a model of the plant, the theory fromsection 3.2 on page 12 is used, where equation 3.12 on
page 12 is the main part of the plant. This equation is shown in equation 7.1 for revisional purposes.
F
m
(I , h)
8 A I
2
N
2
A
2
beam

0

2
beam
_
A h
beam
+8 h A
beam

beam
_
2
[N] (7.1)
To use the equation in the MATLAB Simulink model, it is necessary to set up an equation for the
resulting force. This is done by drawing a free body diagram of the electromagnet and the beam,
where the positive direction is dened to be upwards. The point of reference is from the surface of
the electromagnet. By this convention the free body diagram can be drawn in gure 7.2 on the next
page:
47
CHAPTER 7. NON-LINEAR MODEL
h
m g
1/2F
m
1/4F
m
1/4F
m
Figure 7.2: Free body diagram of the electromagnet and the beam.
Newtons second law states that the sum of all forces yields the resulting force. See equation 7.2.
F
r
F
m
F
g
[N]
{
F
r

8 A I
2
N
2
A
2
beam

0

2
beam
_
A h
beam
+8 h A
beam

beam
_
2
m g [N] (7.2)
Now the gravitational acceleration, g, and the mass of the beam, m, is taken into account. With
equation 7.2, it is possible to nd the height of the beam, when a start height and start velocity are
known. From Newtons second law, the acceleration can be found as in equation 7.3.
F
r
m

h [N]
{

h
F
r
m
_
m/s
2
_
(7.3)
Equation7.2 and equation7.3 canbe combinedinto a complete block diagram, as showningure 7.3.
Electromagnet

1
m

h h
Gravity
I
now
F
r

h
now
h
now

Pl ant
Figure 7.3: Overview over the mechanical system based on equation 7.2 and equation 7.3.
When the acceleration

h
now
is found, the velocity and height of the beam can be calculated. This is
shown in gure 7.3 with the block
_

h h
_
. The calculation from the acceleration to the height can
48
7.1. MATLAB SIMULINK MODEL
be done in two ways. The rst way is to use integrals to determine the velocity

h
now
and height h
now
,
see equation 7.4 and 7.5.

h
now

_

h
now
dt [m/s] (7.4)
To calculate the height, the velocity is integrated as shown in equation 7.5.
h
now

_

h
now
dt [m] (7.5)
In this way, the built-in memory of the integral block in MATLABSimulink is used to store the initial
conditions for every time step. The initial condition in equation 7.5 is the initial height of the beam,
h
st ar t
, whereas the initial velocity of the beam,

h
st ar t
, is set to zero in equation 7.4, because the beam
is assumed to be at rest when the simulation starts. If there were no physical limits in the system,
then two integral blocks could perfectly be used to calculate the height from the acceleration. There
are, however, some physical limits. The beam can move no further than to the bottom of the elec-
tromagnet and to the tray under the electromagnet. This causes some problems when modelling the
systemand these problems are addressed in section 7.1.3 on the following page. For now, it is enough
to realise, that the built-in initial conditions in a time step has to be overwritten in order to make a
working model. The built-in memory in the integral block in MATLAB Simulink can not be manu-
ally overwritten. Therefore a new approach is needed to calculate the height from the acceleration.
The other way to calculate the height from the acceleration is to assume, that the acceleration is con-
stant within small time steps, and thereby use equations for an object under constant acceleration.
This is done in equation 7.6.

h
now


h
now
t
st ep
+

h
ol d
[m/s] (7.6)
The height can now be calculated using the beforementioned assumption, as shown in equation 7.7.
h
now


h
ol d
t
st ep
+h
ol d
[m] (7.7)
In equation 7.6 and 7.7, the time step t
st ep
is a predened parameter that is being used in the MAT-
LABSimulink model. In this way, the integral blocks are split up into several blocks, where the initial
conditions are separated from the rest of the calculation. This is exploited in the next section, where
logic is added to the model. The manual split up of the integral blocks, the idea behind equations 7.6
and 7.7, can be seen in gure 7.4.

timestep

h
now

h
now
h
now
Figure 7.4: The manual integration of acceleration using blocks.
The difference between manual integration and the use of MATLAB Simulink can be seen in g-
ure 7.5 on the following page
49
CHAPTER 7. NON-LINEAR MODEL
Figure 7.5: The difference between manual integration and integration performed by MATLAB Simulink.
As it can from gure 7.5, manual integration can be used if small time steps are used, where the
difference is small, whereas it will result in erroneous values if large time steps are used.
7.1.3 Model logic
In this section, a method to incorporate the physical limits of the system is derived. To account for
when or if the beam hits the electromagnet or the tray, basic logic is applied. A way to do this is to
introduce an articial normal force. Another method is to manipulate the calculation of acceleration
to height. It is chosen not to incorporate a normal force, when the beam touches the limits based on
the fact, that this would also involve some manipulation of the acceleration to height calculatinon.
The choice to strictly focus on manipulation of the acceleration to height calculation, because it is
simpler to understand and carry out in practice.
The rst approach is to limit the height of the beam, which means, that the height should be between
the electromagnet and the tray. When this is done, the height is limited at the xed boundaries, how-
ever, the velocity is not reset. When the acceleration is integrated into velocity, the velocity remains
constant even when the acceleration at some point becomes zero. This means, that the beam travels
at constant velocity inside the electromagnet, when the velocity actually should be zero as the beam
can not move any further. As the physical system consists of an inductor, the current owing in the
wire can not be changed arbitrarily fast, which can result in a situation, where the current still ows
in the electromagnet, even though the beam has hit the electromagnet. This situation leads to a too
large magnetic force.
If instead the initial velocity in a time step is overwritten by zero, the beam will, in the next time step,
be at rest. The key to incorporate the physical limits into the model is to reset the initial velocity in a
time step. The way of doing this in the model, is to introduce a multiplication block after the calcu-
lation of the velocity. As long as the beam is situated between the two physical limits, the velocity is
multiplied with the number 1. Multiplication with the number 0 is used to set the velocity of the beam
to zero when the beam has hit the electromagnet or the tray. The rst approach to incorporate this
behavior is to compare the present height, h
now
, with the limits. This will work to reset the velocity,
but the beam will stay xed at the limits, because the velocity is always set to zero, so no change in
height can occur.
50
7.1. MATLAB SIMULINK MODEL

t i mest ep
Logi c

h
now

h
now
h
now
Figure 7.6: The logic incorporated into the calculation from acceleration to height.
To counter this, a secondapproachis needed, where the present acceleration,

h
now
, is to be takeninto
account. This concept is shown in gure 7.6. The logic must investigate if the present acceleration
will bring the beam further away from or closer to the height limit. This is done by comparing the
acceleration with zero, where two different compare-to-zero-blocks are used. Two compare blocks
are used, because of the upper and lower limit of the height, which results in a contradictory sign
for the acceleration, that would bring the beam away from the limit. The block diagram for the logic
block shown in gure 7.6 is expanded in gure 7.7. In gure 7.7, the block to the left of the switch-
block is a memory-block, which remembers the value from the previous time step. The switch block
uses the upper constant, [0], when the input is true, (1), and the lower constant, [1], when the input
is false, (0). The memory block is used because MATLAB Simulink can not calculate a loop several
times in a single time step, which means that the logic lags the reality by a single time step. This small
error will later be accounted for. The ANDblock returns true, (1), if both inputs are true, (1), otherwise
it returns false, (0). The OR block returns true, (1), if either inputs are true, (1), if both inputs are false,
(0), it returns false, (0).
h
now
0
h
now
h
max

h
now
>0

h
now
<0
AND
AND
OR
0
1
Logi c
h
now

h
now
Figure 7.7: The logic of the MATLAB Simulink model.
The limits in height are determined from the model in the laboratory. The lower limit h
max
is the
distance from the electromagnet to the tray and this value should chosen such that the electromag-
net can pull the beam towards itself using the maximum allowed current of 1.6 [A]
1
. The possible
scenarios for the logic blocks shown in gure 7.7 are shown in table C.2 on page A8 in appendix C.2
on page A7, where the ANDand OR blocks fromgure 7.7 are used. The initial velocity is reset to zero
if the OR block returns true, (1).
1
Maximum output voltage is 30 [V] and the copper resistance is approximately 15[], which results in 2A
51
CHAPTER 7. NON-LINEAR MODEL
Now the small error caused by the logic lagging behind by one time step, is accounted for. The height
needs to be reset to 0 or h
max
after the velocity has been reset, if this is not done, the beam would,
in the model, lie inside the electromagnet or in the tray. This is done by using switches that compare
h
now
to 0 or h
max
, and if h
now
is positive, then the model outputs a 0 to the system. If h
now
is less
than h
max
, then the system outputs h
max
, as shown in gure 7.8.
0
h
max
h
now
h
now
Figure 7.8: Resetting height by switching.
Nowthe present acceleration calculated fromthe resulting force can be converted into a height, while
the physical limits of the system are maintained.
To obtain the desired height, a current I
want ed
has to ow through the electromagnet. This is done
by regulating the duty cycle. Therefore, the current I
want ed
needs to be converted into a duty cycle by
the regulation. This will be explained in the following.
7.1.4 Current wanted to duty cycle
The DAQ USB-device can not in practice output the wanted current needed to levitate the beam.
Therefore it is chosen in section 5.1 on page 19, that a buck converter should be used to output the
needed current. This causes two difculties, which have to be solved. The buck converter is con-
trolled using duty cycles and the output of the buck converter is a voltage, whilst the magnetic force
is a function of current.
In the model, the current is transformed to a duty cycle, using the steady state value of the current.
This means that the duty cycle is calculated based onthe DCcurrent owing inthe electromagnet and
this current is determined by the resistance of the electromagnet using the Ohms law, and the transfer
functionfor the buck converter, givenby equation5.7 onpage 21. This is showninequation7.8, where
the specic duty cycle D
0
is derived.
D
0

I
want ed
R
copper
V
g
[] (7.8)
Equation 7.8 is visualized in MATLAB Simulink as seen in gure 7.9.
R
copper
V
g
I
want ed
D
o

Figure 7.9: The duty cycle calculated based on DC values of the electromagnet.
To limit the value of the duty cycle to be between 0 and 1, a saturation is applied to the output, which
is D
0
. This transformation of current into duty cycle would work in practice, if the electromagnet was
52
7.1. MATLAB SIMULINK MODEL
just a resistor. That is, however, not the case, so equation 7.8 on the facing page is not an accept-
able solution to control the duty cycle in practice, but it is a good rst approach. A more acceptable
approach will be developed in section 8.1 on page 55.
7.1.5 Duty cycle to current now
The calculated duty cycle enters the buck converter. The buck converter then transforms the duty
cycle to an output voltage using the transfer function for the buck converter, equation 5.7 on page 21.
For revision purposes, the equation is shown in equation 7.9.
V
out
D V
g
[V] (7.9)
In MATLAB Simulink, equation 7.9 is visualize as shown in gure 7.10.
V
g
D
V
out
Figure 7.10: Duty cycle to output voltage.
The output voltage fromthe buck converter shown in gure 7.10, has to be transformed into a current
in the electromagnet. An electrical model of the electromagnet has been derived in section 6.3 on
page 39 and is visualized in MATLAB Simulink as seen in gure 7.11.
1
L

1
s
R
copper
L
V
out
I
now

Figure 7.11: Electrical model of the electromagnet.


Now a link between current wanted, I
want ed
and current now I
now
has been established. This link
can be transformed into a single block, which is named IDVI. The name stands for I
want ed
to Duty
cycle to V
out
to I
now
. IDVI is the non linear counterpart to the transfer function G
i
. IDVI consist of
blocks, which do the various operations in MATLAB Simulink whereas G
i
is a transfer function in
the s-plane. The system can be simulated, when a regulation type has been determined. This will be
done in the following chapter.
53
Chapter 8
Regulation
8.1 Regulation of plant model
In the MATLABSimulink model it is necessary to control the height, so that the predened height h
0
can be achieved.In this section non-optimized values for the various regulation constants are used.
This sectionserves as a descriptiononhowthe regulationworks inMATLABSimulink. Insection8.2
on page 62, values for the various regulation constants will be found.
To control the height of the beam a proportional regulator, also known as P regulator, can be used.
This works by comparing the present height, h
now
, to the desired height, h
0
, and multiplying a con-
stant with the difference between h
now
and h
0
. The desired height is chosen to be h
0
= -10 [mm].
This gives a current wanted based on the proportional error, I
p
. The equation for the potential
regulation is shown as equation 8.1, where K
p
is the proportional constant, with the unit [A/m].
I
p
K
p
(h
now
h
0
) [A] (8.1)
The implementation of the P regulation into MATLAB Simulink is shown in gure 8.1. The block
[IDVI] is the calculation from I
want ed
to I
now
.

K
p I DV I Pl ant
h
want ed
I
p
-
h
now
Figure 8.1: Plant with P regulation.
With a simple P regulator, the system works as a simulation in the non-linear model, which can be
seen in gure 8.2 on the following page.
55
CHAPTER 8. REGULATION
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 8.2: Height of the beam versus time, with P regulation only.
In gure 8.2 the beam does not settle at the predened height, which is h
0
10[mm], but instead it
moves up to a height of approximately 12 [mm] and down to the tray. The beam will never settle at
the predened height. From gure 8.2 there are two problems to be solved. There is a steady state
error, caused by the beam that does not move up to h
0
, and there is a settling error because of the lag
of the damping. First the steady state error will be explained.
For the system to take the steady state error into account, there are different methods.
8.1.1 P regulation with constant part I
0
One method is to add a reference current, I
0
, to the current calculated from the proportional regu-
lator. This type of regulation can be called a P regulator with constant part I
0
. For this to work, the
reference current has to be calculated from equation 7.2 on page 48. I
0
is the current needed to lev-
itate the beam at h
0
at rest. An expression for I
0
is derived in equation C.4 on page A8. As shown in
equation 8.2, I
0
has been isolated.
I
0

_
_
A l
beam
+8 [h
0
[ A
beam

beam
_
2
m g
8 A N
2
A
2
beam

0

2
beam
[A] (8.2)
To obtain an applicable I
0
, the absolute value of h
0
must be used to obtain the correct reference. The
regulation equation for the P regulator with constant part I
0
then becomes, as shown in equation 8.3.
I
want ed
I
0
+K
p
(h
now
h
0
) [A] (8.3)
The type of regulation shown in equation 8.3 is visualized in MATLABSimulink as seen in gure 8.3.

K
p

I DV I Pl ant
I
o
h
want ed
I
p
I
p
+I
o
-
h
now
Figure 8.3: Block diagram of P regulator with constant part I
0
.
56
8.1. REGULATION OF PLANT MODEL
The systemis simulatedusing the regulationtype presentedinequation8.3 onthe preceding page.There
is still no damping involved in the regulation and as a result of this, the beam will not settle as seen in
gure 8.4.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 8.4: Height of the beam versus time, with P regulator with constant part I
0
and no damping.
In gure 8.4 the beam no longer moves to -12 [mm], but instead it moves up to the surface of the
electromagnet and down into the tray. Now the articial damping, as described in section 6.2 on
page 35, is taken into account. The articial damping is accomplished using a regulation constant K
v
and multiplying this constant with the present velocity of the beam. Inthe linear model, this damping
becomes part of the plant itself, whereas it in the non-linear model, has to be explicitly calculated.
The velocity now,

h
now
has to be fed back and transformed into a de- or increase in current , I
v
. I
v
can then be dened by equation 8.4.
I
v
K
v


h
now
[A] (8.4)
I
v
is then added to the rest of the regulation, equation 8.3 on the facing page, to form the regulation
equation for the complete system as shown in equation 8.5.
I
want ed
I
0
+K
p
(h
now
h
0
) +K
v


h
now
[A] (8.5)
The type of regulation shown in equation 8.5 is visualized in MATLABSimulink as seen in gure 8.5.

K
p

I DV I Pl ant
I
0
(h
re f
)
d
dt
K
v
h
re f
h

Figure 8.5: Block diagram of P regulator with constant part I
0
with velocity feedback.
If this type of regulation is used to regulate the beam, the result can be seen in gure 8.6 on the
following page.
57
CHAPTER 8. REGULATION
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 8.6: Height of the beam versus time, with P regulator with constant part I
0
and damping added.
As seen in gure 8.6, adding the velocity feedback is not enough to make the beam settle. The move-
ment of the beamdoes not look much different fromthat of gure 8.4 on the preceding page, but this
does not mean, that the velocity feedback does not work. The reason is the dynamics of the electro-
magnet. The regulation system is designed around an electromagnet that behaves like a resistor, and
not like a resistor and aninductor inseries. The calculated duty cycle, D
0
, does not include the behav-
ior of the inductor in the electromagnet. This problemis also described in section 6.3 on page 39. The
result is, that the current wanted, I
want ed
, is not the same as the current owing in the electromagnet,
I
now
. This behavior can be seen in gure 8.7.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0.2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
2.2
Ti me[s]
C
u
r
r
e
n
t
[
A
]
I
want ed
I
now
Figure 8.7: I
now
lags I
want ed
without current feedback.
To counter the behavior seen in gure 8.7, a duty cycle regulation is added to calculation of the duty
cycle, as seen in equation 7.8 on page 52. This duty cycle regulation will counter the behavior of the
electromagnet, which means, that it outputs a very high or very low duty cycle when the difference
between I
want ed
and I
now
is large. A duty cycle regulation was derived in section 6.3 on page 39. The
duty cycle regulation equation is shown here in equation 8.6 for revision purposes.
D
I
want ed
R
copper
V
g
+K
D
(I
want ed
I
now
) [] (8.6)
Equation 8.6 is visualized in MATLAB Simulink as seen in gure 8.8 on the facing page, where the
duty cycle is limited to be between 0 and 1 using a saturation block.
58
8.1. REGULATION OF PLANT MODEL
R
copper
V
g

K
D
I
want ed D
I
now

D
0
Figure 8.8: Regulation of the duty cycle using current feedback.
As it can be seen from equation 8.6 on the preceding page, the duty cycle calculation now makes use
of a current feedback. However, due to inductor dynamics, I
want ed
can not be the same as I
now
when
I
want ed
changes fast, even after duty cycle regulation is added. When the current feedback, gure 8.8,
is added to the calculation from I
want ed
to I
now
, IDVI, a new block diagram for IDVI can be seen in
gure 8.9. Block diagram IDVI is the complete block diagram for calculation I
now
from I
want ed
.
R
copper
V
g

K
D
V
g
1
L

1
s
R
copper
L
I
want ed
D
0 D

V
out
I
now

I DV I
Figure 8.9: IDVI with the use of current feedback.
With the current feedback added to IDVI, a simulation is ran where I
want ed
and I
now
can be seen.
This is shown in gure 8.10.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
2.2
Ti me[s]
C
u
r
r
e
n
t
[
A
]
I
want ed
I
now
Figure 8.10: I
now
and I
want ed
with current feedback.
Figure 8.10 shows how I
now
and I
want ed
behave when the duty cycle regulation has been applied.
The duty cycle regulation makes I
now
and I
want ed
equal over time. The duty cycle regulation can not
make I
now
and I
want ed
equal at the beginning of the simulation, because of the difference between
59
CHAPTER 8. REGULATION
I
now
and I
want ed
leads to a duty cycle greater than 1, this would lead to a scenario, where V
out
>V
g
which is not possible with a buck converter. The difference in the supplied duty cycle can be seen in
gure 8.11, which shows the difference between the regulation with and without current feedback.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
Ti me[s]
D
u
t
y
c
y
c
l
e
[

]
Wi t h
Wi t hout
Figure 8.11: Duty cycle with and without current feedback.
It can be seen in gure 8.11, that the feedback results in a smoother duty cycle, whereas without the
feedback, the duty cycle is switched between 0 and 1. If all the regulations are combined, the beam
can be simulated to settle at the desired height h
0
, as shown in gure 8.12. In MATLABSimulink this
complete block diagram is the same as shown gure 8.5 on page 57.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 8.12: Height of the beam versus time. P regulator with constant part I
0
, together with duty cycle and velocity regulation.
Ingure 8.11 the beamsettles perfectly at the desired height h
0
after approximately 0.3 [s]. The reason
for this is, that the same theory behind the magnetic force is used twice. One time to calculate I
0
and
another time to translate a height and current into a magnetic force. This means, that the theory has
to be quite precise in order to obtain the behavior as seen in gure 8.12. The theory of the magnetic
force is based on the assumption that no leak ux occurs, which is not the case in reality. If the
constant part I
0
is not exactly the constant current needed to levitate the beam at height h
0
, there
will be a steady state error. This is more clearly seen in gure 8.13 on the facing page, where I
0
is
respectively 80 [%], 100 [%] and 120 [%] of the standard I
0
.
60
8.1. REGULATION OF PLANT MODEL
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
100%I
0
120%I
0
80%I
0
Figure 8.13: Height of the beam versus time. Steady state error from different values of I
0
.
In gure 8.13 the beam settles at different heights, as a result of the difference in I
0
. If the theory is as
accurate as 20 %the steady state error is about 2 [mm]. For this project it is not crucial, that the beam
settles precisely at the desired height, however in real life such an error in height is unacceptable. For
this project, it is acceptable to have a steady state error, and therefore this type of height regulation
is marginally acceptable to control the beam. It would be better, however, if this steady state error is
removed.
8.1.2 The PI regulator
Another way to control the height of the beam is to utilize a PI regulator
1
. The P part in a PI regulator
acts just as the P part described in the text above, whereas the I part integrates the error in height over
time. The result is, that the I part removes any steady state error over time. However, if the PI regulator
is not suitable tuned, it can lead to a disadvantage, where the system takes long time to settle at the
steady state value. A PI regulator is implemented using equation 8.7 [30].
I
want ed
K
P
(h
now
h
0
) +K
I
_
(h
now
h
0
) dt [A] (8.7)
With the use of this PI regulation only, the system works as shown in gure 8.14.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 8.14: Height of the beam versus time, with PI regulator only.
1
PI stands for proportional plus integral.
61
CHAPTER 8. REGULATION
The movement of the beam, as seen in gure 8.14 on the preceding page, replicates that of gure 8.4
on page 57. The same approach to counter the undesirable movement of the beam, as the approach
done with the P regulator with constant part I
0
, is needed, when the PI regulator is to be used. When
both the velocity feedback with the regulation constant K
v
and the current feedback with the reg-
ulation constant K
D
is added to the controller, the PI regulation can be compared to that of the P
regulator with constant part I
0
. The PI regulator with current and velocity feedback can be visualized
in MATLAB Simulink as shown in gure 8.15.

K
P

I DV I Pl ant
d
dt
K
v
1
s
K
I
h
0
h
er r or
-
h
now
Figure 8.15: PI regulator with velocity and current feedback.
A single run of the complete PI regulator is shown in gure 8.16.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 8.16: Height of the beam versus time. PI regulator together with duty cycle and velocity regulation.
As it can be seen from gure 8.16, the beam settles at the desired height h
0
. The PI regulator requires
no use of the theory behind the magnetic force, which results in a more robust regulator than the P
regulator with constant part I
0
. The regulation constants in the PI regulator are, however, found on
basis of the theory of the magnetic force, but the regulator will work, even if these constants are not
ideal.
In the model for the system in MATLAB Simulink it is possible to change between the choice of reg-
ulation type with a switch. In this way it is possible to simulate both types of regulation and compare
them, to nd the best suited regulation type to be carried out in practice.
8.2 Determining the regulation type
In section 7.1 on page 47 two different regulation types are presented, a P regulator with a constant
part I
0
and a standard PI regulation without the constant part I
0
. A PI regulator is chosen because the
I part removes the steady state error and the P part is used to tune the regulation to get a satisfactory
62
8.2. DETERMINING THE REGULATION TYPE
transient and steady state response. A PID regulation is not chosen, because there has already been
made a D regulator, that takes the velocity of the beam into account. This D regulator has been made
part of the plant for the system, that is, in the transfer function G
pv
a D regulator is incorporated.
In this section the two types of regulation will be compared and the most suitable will be chosen
to control the system. The overall idea for both regulation types is shown in gure 8.17, where the
present height is fed back into a type of regulation.
Regul at i on G
pv
h
0
h
now
Figure 8.17: Regulation concept, with height feedback.
The two types of regulation are presented in the following equations, where equation 8.8 is the P
regulation with constant part I
0
and equation 8.9 is the PI regulation part.
I
want ed
I
0
+K
p
(h
now
h
0
) [A] (8.8)
I
want ed
K
P
(h
now
h
0
) +K
I
(h
now
h
0
)
1
s
[A] (8.9)
The two regulation types can be viewed in two different block diagrams, shown in gure 8.18 and
gure 8.19.

K
p

G
pv
I
0
(h
re f
)
h
re f
h

Figure 8.18: Complete block diagram with P regulator and constant part I
0
.

K
p

G
pv
1
s
K
i
h
0
h
er r or
-
h
now
Figure 8.19: Complete block diagram with PI regulator.
Now in order to choose the most suitable regulation type, the different regulation constants, K
p
, K
P
and K
I
are determined.
Analyzes of and determining K
p
The regulation constant K
p
is to be found. The minimum value of K
p
is the value, that results in
the current wanted at the maximum magnitude, when the beam is the furthest away from the elec-
tromagnet. This means, that the difference in height between h
now
and h
0
will be multiplied by a
63
CHAPTER 8. REGULATION
regulation constant K
p
to give the needed increase in the current, which is insured by the buck con-
verter

The maximum output voltage will be V


out max
= 30 [V] and the copper resistance of the electro-
magnet is R
copper
= 15 [], which results in the maximum current I
max
= 2 [A]. The idea is shown in
equation 8.10. In equation 8.11 the various values found in table A.1 on page A2 are inserted and K
p
is solved for equation 8.12.
I
max
I
0
+K
p mi n
(h
0
h
max
) [A] (8.10)
{
2 1.3+K
p mi n

_
10 10
3

_
15 10
3
__
[A] (8.11)
{
K
p mi n
140 [A/m] (8.12)
Now the minimum value for K
p
has been chosen. This type of regulation with a constant part and
a P regulation can not be easily analyzed using frequency analysis, because it does not follow the
standard classic types of regulations, that is, it is not a lag, lead, lag-lead, P, PI, PD or PID regula-
tion. Instead the inuence of K
p
is analyzed using the model constructed in section 7.1 on page 47.
The model is simulated with the starting height at the maximum allowed height, which means that
h
st ar t
h
max
15[mm]. The model is simulated using values of K
p
from 150 to 250 with step size
of 25 and the height of the beam versus time is shown in gure 8.20.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
14
13
12
11
10
9
Time [s]
H
e
i
g
h
t
[
m
m
]
K
P
150
175
200
225
250
Figure 8.20: Height of the beam versus time for different values of K
p
.
In gure 8.20, it can be seen, that the rise time decreases with the increase in K
p
, but the decrease
in the rise time becomes smaller as K
p
increases. At the same time the overshoot increases from K
p
equal to 200. This means, that K
p
should not be increased much further than 250, because the little
decrease in rise time can not be justied with the increase in overshoot. A good compromise is the
value of K
p
250. This value of K
p
is chosen, because the rise time is 0.5 [ms] faster than the critically
damped system with K
p
200 and the settling time is about the same, that is T
s
2.4[ms].
Now the PI regulation constants have to be chosen.
Analyzes of and determining K
P
and K
I
using time domain
Much of the same approach can be used to nd the regulation constant K
P
in the PI regulation. It
could be argued for, that K
P
could be set to an arbitrary low value. This is also the case, if the settling
64
8.2. DETERMINING THE REGULATION TYPE
time is of no interest. In the following it is assumed, that the starting height is the same as the max-
imum height, exactly as in the section above. If K
P
is set too low, it will take some time before the
error in height has built up in the integral part in the PI regulator, before the I part will generate a high
enough signal, so that the beam will move toward the electromagnet.
With this small K
P
, the integral part will dominate and the system will be very slow to settle around
the wanted height, because the beam will move up and down for a long time. This behavior can
be seen in gure 8.21, where K
P
100 and K
I
2000. However if K
p
is very small, it will not react
strongly on its position, and thereby, only the integral part compensates for the error, which results
in slow reaction times, which can be seen by the sudden changes in height as seen on gure 8.21.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 8.21: Height versus time with low value of K
P
, K
P
100 and K
I
2000.
A more suitable value for K
P
is found using the same analysis as the one done with K
p
. This is shown
in equation 8.13 and a value for K
P
is found in equation 8.15. The difference from equation 8.10 on
the facing page to equation 8.13 is, that there exists no constant part I
0
.
I
max
K
P
(h
0
h
max
) [A] (8.13)
{
2 K
P

_
10 10
3

_
15 10
3
__
[A] (8.14)
{
K
P
400 [A/m] (8.15)
This value of K
P
is neither a minimum nor a maximum, it is more of a guideline to which value K
P
should have. If this value of K
P
is chosen as a base point, the inuence of the regulation constant K
I
can be determined as shown in gure 8.22 on the following page.
65
CHAPTER 8. REGULATION
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
15
14
13
12
11
10
9
8
Time [s]
H
e
i
g
h
t
[
m
m
]
K
I
0
500
1000
1500
2000
Figure 8.22: Height versus time with K
P
400 and different values of K
I
.
As mentioned in section 6.4 on page 44, the I part in the PI regulation removes the steady state error.
This behavior can clearly be seen in gure 8.22, where larger values of K
I
results in faster removal of
the steady state error. With K
I
0, a steady state error is present in the system, and the regulation
will never make the beam levitate at the desired height. It was mentioned in section 6.2 on page 35,
that the behavior of the systemcanbe simulatedusing a stepinput andsee howfast the systemsettles.
The transfer function G
pv
is a type 0 system, which means, that if G
pv
is introduced to a step input,
there will be a steady state error, whenthe type of regulationis a pure gain. The type of a transfer func-
tion is determined from the number of poles in origo, where G
pv
has no poles in origo. The number
of poles are determined by setting the denominator of the transfer function equal to zero, and solve
for the unknown. For simulation where K
I
0, the regulation is pure gain and the system behaves as
intended.
For this specic choice of K
P
= 400, the regulationconstant K
I
must not be set muchhigher than2000,
as seeningure 8.22, before the behavior seeningure 8.21 onthe previous page will dominate again.
It can also be seen from gure 8.22, that the integral regulator does not make the system response
faster, the slope is the same for every values of K
I
. This should also be the case, PI regulation is not
used to make a systemfaster than a P regulated system, only to remove the steady state error. As seen
from gure 8.22, an optimum value is between K
I
1500 and K
I
2000. With the value of K
I
2000
the settling time is considerably faster than with K
I
1500, but an overshoot is introduced. For this
type of regulation tuning a value of K
I
2000 is chosen.
Analyzes of and determining the values of K
P
and K
I
in the frequency domain
The previous discussion and determination of the regulation constants K
P
and K
I
was based purely
on examination of the response of the system in the time domain with the use of the nonlinear mod-
el. Now follows an analytic determination of the regulation constants based purely on the transfer
functions with the use of both frequency and time domain. This evaluation is based on a standard
approach to determine the regulation constants of a PI regulator [30]. While evaluating the regulation
constants, the meaning of excluding the dynamics fromG
i
will be discussed. First the open loop bode
plot of both G
pv
and G
pvi
is shown in gure 8.23 on the facing page.
66
8.2. DETERMINING THE REGULATION TYPE
200
150
100
50
0
M
a
g
n
i
t
u
d
e

(
d
B
)
10
0
10
1
10
2
10
3
10
4
270
180
90
0
P
h
a
s
e

(
d
e
g
)


Bode Diagram
Frequency (rad/sec)
G
pv
G
pvi
Figure 8.23: Bode plot of G
pv
and G
pvi
.
In gure 8.23, the bode plot for both G
pv
and G
pvi
are combined into the same diagram. The in-
uence of G
i
is purely in the high frequency area, where the mechanics of the plant dominate the
low frequency. It can be seen, that the magnitude declines faster when the dynamics of the electro-
magnet, G
i
is taken into account, meaning that the high frequency noise is dampened more. In this
analytic determination, G
pvi
will be used, because of the more precise description of the plant. See
appendix C.4 on page A9 for the small difference in step response betweenG
pv
andG
pvi
. The method
to determine the regulation constants K
P
and K
I
is as follows.
First a phase margin,
m
, is to be chosen. The phase margin should be around
m
45

, where
a lower phase margin leads to faster rise time, but also some overshoot. A higher phase margin
leads to slower rise time, but small or none overshoot.
The angle G(
1
) 180

+
m
+5

is determined. The frequency


1
is the frequency at which
the effect of the integral regulator should be strongest, which means, that the amplication of
the signal fromthis frequency andtoany higher frequency shouldbe at the lowest. The +5

is an
error in angle from adding an integral regulator at the frequency
1
. In adding this small angle,
the angle of a transfer function at frequency
1
becomes unaffected by the integral regulation.
This behavior can be seen in gure 8.24 on the next page. The calculated angle is noted in the
bode plot, so that the frequency
1
can be found.
The frequency
1
is found based on the previously determined angle of the transfer function
by a bode plot.
The magnitude of the transfer function is found at frequency
1
. This magnitude in [dB] is
converted to a real number using the following equation 10
[G(
1
)[
dB
20
[G(
1
)[.
The regulation constant K
P
is dened to be K
P

1
[G(
1
)[
. Which means, that at frequency
1
the
regulation constant K
P
is multiplied with the gain of the transfer function should be equal to 1.
The regulation constant K
I
is then determined with the following equation K
I
0.1
1
K
P
.
The factor 0.1 comes from the fact, that the I part of the PI regulator should be at least 1 decade
to the left of the frequency
1
in the bode plot.
67
CHAPTER 8. REGULATION
From this review on determining the regulation constants, table 8.1 is made.
Phase margin
m
35

45

55

65

G(
1
) 140

130

120

110

1
85.3rad/s 74.9rad/s 66.6rad/s 58.8rad/s
[G(
1
)[ 2.45 10
3
3.09 10
3
3.63 10
3
4.32 10
3
K
P

1
[G(
1
)[
407.4 323.6 275.4 231.7
K
I
0.1
1
K
P
3475 2424 1834 1362
Table 8.1: Analytic determination of the regulation constants K
P
and K
I
.
The transfer function for the PI regulator, G
c
, seen in gure 8.19 on page 63, can be written as in
equation 8.16.
G
c
K
P
+
K
I
s

s K
P
+K
I
s
[] (8.16)
If the transfer function G
c
is plotted in a bode diagram for the various values of K
P
and K
I
, found in
table 8.1, gure 8.24 is obtained.
40
60
80
100
M
a
g
n
i
t
u
d
e

(
d
B
)
Bode Diagram
Frequency (rad/sec)
10
1
10
0
10
1
10
2
10
3
90
45
0
P
h
a
s
e

(
d
e
g
)

m
= 35

m
= 45

m
= 55

m
= 65

Figure 8.24: Bode plot of the transfer function for the controller, G
c
.
In gure 8.24 the mentioned error of 5

at frequency
1
can be seen in the lower plot, the phase plot,
for the four different PI controllers. The different gains fromdifferent values of K
P
can also be seen in
gure 8.24 in the upper plot, the magnitude plot, and the decrease in amplication as the frequency
increases. Because of the nature of the transfer functions for the plant, that is, that the input is current
in [A] and the output is [m] , a great amplication K
P
is needed. If the closed loop transfer function
for the controller and plant is calculated using Masons gain equation and plotted in a bode diagram,
gure 8.25 on the next page is obtained.
68
8.2. DETERMINING THE REGULATION TYPE
150
100
50
0
50
M
a
g
n
i
t
u
d
e

(
d
B
)
10
1
10
0
10
1
10
2
10
3
10
4
270
180
90
0
P
h
a
s
e

(
d
e
g
)


Bode Diagram
Frequency (rad/sec)

m
= 35

m
= 45

m
= 55

m
= 65

Figure 8.25: Bode plot of the closed loop transfer function.


In gure 8.25 the inuence of the various regulation constants can be seen. The resonance peak be-
comes smaller when K
P
gets smaller. More information about the behavior of the various regulation
constants is shown in a step response for the closed loop transfer function.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4


Step Response
Time (sec)
A
m
p
l
i
t
u
d
e

m
= 35

m
= 45

m
= 55

m
= 65

Figure 8.26: Step response for the closed loop transfer function.
Figure 8.26 shows the step response for the complete linear model. It should be noted, that the fur-
ther the beam moves away from the point of linearization, h
0
, the larger the error from linearization
gets. This means, that the large overshoot in gure 8.26 will lead to an even larger overshoot in the
non-linear model. A 20% overshoot from the values for the phase margin by
m
35

should in this
context be viewed as a large overshoot. The inuence of a higher value of K
P
can be seen as a decrease
in the rise time. This is perfectly in tune with the theory regarding the meaning of the proportional
regulation constant.
69
CHAPTER 8. REGULATION
From gure 8.26 on the previous page, the values of K
P
and K
I
for the phase margin
m
55

should
be viewed as an optimum. It should be noted, that gure 8.26 on the preceding page and gure 8.22
on page 66 should not be compared directly. This is the case, because gure 8.22 on page 66 is a simu-
lation of the non-linear model, where the current in the electromagnet should rst be built up before
the beam levitates. This is shown by the time delay before the beam moves towards the electromag-
net.
In order to check the various constants found using the linear model, the constants are to be used
in the non-linear model, so that this new gure can be compared with gure 8.22 on page 66 and
gure 8.20 on page 64, from the P regulation with constant part I
0
.
0 0.2 0.4 0.6 0.8 1
15
10
5
0
Time [s]
H
e
i
g
h
t

[
m
m
]

m
= 35

m
= 45

m
= 55

m
= 65

Figure 8.27: Step response in the non-linear model with use of K


P
and K
I
from table 8.1 on page 68.
In gure 8.27 the limits of linearization can clearly be seen. The overshoot from the regulation type,
where the phase margin is
m
35

, results in a too large overshoot in the non-linear model, which


leads to, that the beam hits the electromagnet. The settling time is equal for the three values of
m
between 45

and 65

, T
s
3.5 [ms], but with
m
35 the beam hits the limits of the height, and thus
needs much more time to settle. From gure 8.27, it can be seen, that the optimum for the regulation
is where the phase margin is
m
55

, the same value as concluded from from the step response in


the linear model.
8.2.1 Choosing the regulation type
If gure 8.20 on page 64, gure 8.22 on page 66 and gure 8.27 are compared, the most suitable reg-
ulation type is to be chosen. For easy review, the three step responses are combined into the same
gure, as seen in gure 8.28 on the facing page and the values of the various regulation constants are
shown in table 8.2 on the next page.
70
8.2. DETERMINING THE REGULATION TYPE
Plot K
p
K
P
K
I
Description
1 250 undened undened P regulator with constant part I
0
2 undened 400 2000 PI regulator manually tuned
3 undened 275.4 1834 PI regulator analytically tuned
Table 8.2: Overview over the three regulators to be compared.
0 0.2 0.4 0.6 0.8 1
15
10
5
0
Time [s]
H
e
i
g
h
t

[
m
m
]


Plot 1
Plot 2
Plot 3
Figure 8.28: Step response in the non-linear model with the three different regulators.
It can be seen from gure 8.28, that the P regulator with the constant part I
0
has the smallest over-
shoot and a settling time of about 2.4 [ms]. The best tuned PI regulator using analytic analyzis has a
settling time of about 3.5 [ms]. The same is true for the PI regulator with has been tuned manually.
The only problem with the P regulator with the constant part I
0
, is that the theory has to t the real-
ity completely in order to obtain the exact behavior seen in gure 8.28. The use of this regulator in
reality is considered risky, because of the uncertainty of the validity of the theory. Even though the PI
regulator is slower than the P regulator with the constant part I
0
, it is considered a more safe solution
to be used in the validation of the model.
The PI regulator is therefore used and the values of K
P
and K
I
is pointed out in table 8.3 for revision
purposes.
Regulation constant Value
K
P
275.4
K
I
1834
Table 8.3: Values chosen as the optimum for the PI regulator.
Now this type of regulator can be validated using the hardware made for this project, which will be
done in chapter 9 on page 75.
71
CHAPTER 8. REGULATION
8.3 LabVIEWprogramming
In this section, the LabVIEW program will be accounted for. The LabVIEW program is used to
validate the results found in sections 6.2 on page 35, 6.3 on page 39 and 6.4 on page 44 for the regula-
tion constants K
p
, K
v
, K
D
and K
I
in section 8.2 on page 62.
Overall, the LabVIEW program is not much different from the MATLAB Simulink model. Both
programs have the same structure and they are both based on the use of blocks to calculate the vari-
ous equations. The simulation is a more graphic based programming instead of text based program-
ming (like MATLAB and L
A
T
E
X). Since both programs have the same structure, the programs look
very identical. The main difference is that LabVIEW is a program for data acquisition, whereas
MATLAB Simulink is not, therefore, some additions to the model in MATLAB Simulink are made.
For the data acquisition to work, a link between the program and the physical system is made. This is
done by setting up some data acquisition blocks in the LabVIEW program. These blocks can either
acquire input from or output to the physical system. The system then processes the data to calculate
the duty cycle needed at a giventime, whichtranslate to ananalog output voltage. For the LabVIEW
program to work, three DAQmx blocks (DAQ assistants), must be congured - one to read the voltage
from the distance sensor, one to read the voltage over the resistor needed for current feedback, and
one to make the DAQ USB-device put out a voltage once a duty cycle has been calculated. Setting
up the DAQmx blocks in LabVIEW is fairly easy, as these blocks have been designed to work as
subprograms by National Instruments , and the blocks are almost completely congured before-
hand. These subprograms are called VIs (Virtual Instruments). The information needed to set up the
VIs, is either to acquire or generate a signal, and the type of signal, e.g. analog or digital, as seen on
gure 8.29.
Figure 8.29: LabVIEW task initialization program.
Next, a channel on the DAQUSB-device is chosen to either generate or acquire a signal. Finally, when
the port has been chosen, the VI needs information on howto sample, e.g. continuous or on demand,
72
8.3. LABVIEW PROGRAMMING
a number of samples to read, and how often to sample in [Hz]. This task is then a block which can be
connected to the DAQ block, and the data acquisition can begin.
The program works as follows: the distance sensor detects a distance to the beam. From the test of
the distance sensor, in section 9.1 on page 75, the output of the distance sensor is a given voltage that
can be translated into a distance in the program via the expression found in section 9.1 on page 75,
equation 9.1 on page 76. From this point, the distance is now known.
The next step is calculating the duty cycle needed to levitate the beam. This is calculated via the pre-
dened mass and wanted distance from the beam by means of the equation for the magnetic force
between two poles, as derived in equation 3.12 on page 12 or the programcan be chance to use PI reg-
ulation. As the duty cycle is per denition between 0 and 1, a saturation for the duty cycle is made, so
that the duty cycle is kept within these limits, even if the calculated duty cycle is above or under. This
saturation of duty cycle is the same, as the saturation built into the model explained in section 7.1
on page 47. The calculated duty cycle is then transformed into a voltage via the relation between the
duty cycle and the corresponding voltage supplied to the DRV103, as in section 9.2 on page 76.
Testing the program has been done to ensure that it works properly. Initially, the program has been
designed in small steps, and have been used for testing the hardware. This means, that the program
is made of smaller programs, which has been put together to form the nal program. In this way, it
is much easier to test if the program works, as the complexity of the program is a lot smaller in these
small programs than in a large program.
73
Chapter 9
Validation
Inthis sectionthe hardware testing will be described. It will be described howthe test were performed
and nally the results. The main tools that has been used during the hardware testing were a mul-
timeter, an oscilloscope, a DAQ USB-device from National Instruments and a voltage supply. The
hardware consists of a buck converter, PWM-module and a distance sensor. All the hardware except
the buck converter is used to control the duty cycle, which is supplied to the buck converter.
9.1 Test of the distance sensor
To test the function of the distance sensor, it was soldered onto a circuit board, which was then glued
to the casing around the electromagnet. The distance sensor is placed a little higher than the bottom
of the electromagnet, which is because the distance sensor is most sensitive at a small distance from
the measured object. The electromagnet and the distance sensor is placed so, there is no difference
in angle between them. The distance sensor is connected to a DAQ USB-device to be able to see a
graph for the output voltage in real time and to perform precise measurement of the output. At rst
there where no resistors in the circuit, only the distance sensor and a three point wire connection.
When the distance sensor was tested for the rst time, the output voltage was unusable, as it did not
change when the distance sensor was measuring different distances. It was discovered that a resis-
tor between the output terminal and ground was needed. The value of this resistor was determined
experimentally to be 20 [M]. After the resistor was placed between the ground and the output ter-
minal, the signal on the output graph gave a stable voltage output. The output of the distance sensor
is measured in [V]. The higher the voltage, the shorter the distance.
It was clear from the data sheet of the distance sensor that the output voltage would not be linear in
relationship with measured distance. From the data sheet, it was expected that the relation would
look like a power function. In order to obtain this relation, the distance the beam had from the mag-
net was measured with a standard ruler. The starting distance was at 0 [mm], and then the gap was
increased by 1 [mm] at a time up till 15 [mm], and 20 [mm] were measured.
Three different measurements were taken, during which the rst measurement the output graph was
very irregular. This was caused by external light interfering with the distance sensor during longer
distances. The external light problem was solved by placing a cardboard box over the casing, which
the magnet sits in and therefore shielding the distance sensor from external light. During the sec-
ond measurement the same method was used. The output graph looked a lot better for the second
measurement than the rst, however, there were still some points that looked a little off. Because the
distance sensor is very sensitive when the beam is close to the magnet, with little to no difference
75
CHAPTER 9. VALIDATION
between 0 [mm] to 3 [mm], it was decided to elevate the distance sensor a little higher than the elec-
tromagnet so that the least sensitive region is not used in the measurements. The third measurement
was made with the distance sensor elevated and the the measuring process was repeated like rst and
second measurement.
The result from the nal test of the distance sensor is visible on gure 9.1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0
2
4
6
8
10
12
14
16
18
20
22
Voltage [V]
H
e
i
g
h
t
[
m
m
]
Measurements
Curve t (31.83 x
0.4032
17.62)
Figure 9.1: Output voltage from sensor versus the distance.
In gure 9.1, the purple dots are the measured output values from the distance sensor, and the red
line is a curvet made with MATLAB. Some irregularities can be detected in the graph and that
can be caused by some interference by external light disrupting the distance sensor and some impre-
cise distance measurements. The resulting tendency line can be observed, and the equation is given
as 9.1.
h(V) 31.83 V
0.4032
17.62 [mm] (9.1)
A big disadvantage was detected with the distance sensor under testing. The distance sensor is really
sensitive to disturbance from AC signals. When the distance sensor was rst tested the output signal
was pulsing and if the pulses are measured they correspond to 50 [Hz]. The distance sensor is con-
nected to a DAQ USB-device, with a shielded cable to minimize noice from other AC circuits, if the
battery charger is disconnected from the computer, and therefore the computer was powered via its
battery, the pulsing in the distance sensor signal stops. Removing the battery charger was not enough
to stop the interference in the distance sensor output when all the circuit elements are connected
together. AC interference also come from the voltage supplies to the distance sensor. To completely
stop this interference all power to the circuits has to come from true DC sources. For this purpose,
batteries were used as the main power supply. The reason that these disturbances come from the
battery charger and power generators is, that the ground connection is not pure.
9.2 Test of the PWM-module
To construct a PWM-module, an integrated circuit of the type DRV103 was chosen to control the duty
cycle, to the buck converter. The IC circuit was soldered to a circuit board along with the resistors
76
9.2. TEST OF THE PWM-MODULE
and the capacitors. The PWM-module operates with 12 [V] DC and the duty cycle is controlled by a
voltage delivered by the DAQUSB-device in the range of 1,3 [V] to 3,9 [V]. The duty cycle was tested to
be linear in relations to the control voltage in the range of 5 to 95 [%]. The PWM-module was designed
to operate at a frequency of 72.5 [kHz]. The frequency is measured to 62,5 [kHz] with an oscilloscope.
The PWM-module is connected to the DAQ USB-device to give the control signal. The 12 V input was
connected to an external voltage supply. The output signal was measured with an oscilloscope. At
rst the PWM-module works as intended, see gure 9.2, outputting a duty cycle which ranges from 0
to 100 [%].
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
10
5
2
0
2
4
6
8
10
12
14
Time [s]
V
o
l
t
a
g
e
[
V
]
Figure 9.2: PWM-signal with no load with a duty cycle of 45
[%].
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
10
5
10
5
0
5
10
15
Time [s]
V
o
l
t
a
g
e
[
V
]
Figure 9.3: PWM-signal with buck converter as load with a du-
ty cycle of 45 [%].
The output signal was, however, inverted from the PWM meaning higher voltage gave a lower duty
cycle and lower voltage input gave a higher duty cycle. This could be corrected by a transistor that
could be placed on the circuit board. However, it was decided that the LabVIEW program was de-
signed to counteract the inverted output signal from the PWM-module instead, which means that if
the duty cycle is increased in the program, so does the real duty cycle. An incline line was calculated
for the input control voltage and the output duty cycle to calibrate the program. This was done by
measuring the voltage required to give out a 10 [%] duty cycle, a 50 [%] duty cycle and a 90 [%] duty
cycle. From initial testing, this span of the duty cycle was linear, which justies the incline line.
When the PWM-module was connected to the buck converter and the output signal was measured
again, the duty cycle looked a little different than before, see gure 9.3.
This irregularity in the duty cycles rising time is caused by the capacitors inside the MOSFET, which
can be seen in gure 5.10 on page 26. As mentioned before in section 5.2.2 on page 24, the output
signal fromthe PWM-module does not have enough current to charge the capacitors quickly enough,
and therefore an op-amp was placed after the PWM-module to boost the current of the signal, so that
the capacitors can be charged faster. After the op-amp was placed in the circuit, the duty cycle looked
a little different than before as seen in gure 9.4 on the following page. There are some disturbances
in the off period in the duty cycle, and it is not known what causes these disturbances, however, it is
assumed it does not matter because the MOSFET requires 4 [V] to open and the disturbances do not
reach4 [V] andtherefore, it does not openthe MOSFET. The arc inthe duty cycle has disappearedafter
the op-amp is placed in the circuit, which means the current from the duty cycle signal is sufcient
to charge the MOSFET and turning on the buck converter.
77
CHAPTER 9. VALIDATION
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
10
5
0
2
4
6
8
10
12
Time [s]
V
o
l
t
a
g
e
[
V
]
Figure 9.4: The duty cycle after it was connected to the Op-Amp at 50 [%].
9.3 Test of the buck converter
The buck converter was made in a lesson in power electronics. First the components where soldered
to a circuit board to create the buck converter. A MOSFET is placed in the circuit as switch to turn the
converter on and off. The MOSFET switch is controlled with the duty cycle from the PWM-module.
On the buck converter there are two input plugs and one output plug. The buck converter is sup-
plied with 24 [V], the output is connected to the electromagnet. The control signal is given by the
PWM-module and it is connected to the gate on the MOSFET. To test the buck converter, the buck
converter was connected to a signal generator, which was set to output a PWM-signal. The output
was measured with a multimeter. At rst the buck converter did not work as intended. It looked like
the MOSFET did not get the input signal from the signal generator. By better inspection of the buck
converter it was discovered that the input connection from the signal generator was not soldered
properly to the circuit board. After this was changed the buck converter worked as intended, the out-
put voltage changed by changing the duty cycle on the signal generator.
Later on the buck converter was tested with the PWM-module. At rst the buck converter did not
work. Again it seemed like the MOSFET did not open properly. This was changed by adding an op-
amp to the circuit to boost the signal current. After the op-amp was placed in the circuit, the buck
converter worked as intended.
9.4 Test of the op-amp
The purpose of the op-amp is to boost the PWM-signal before it enters the buck converter

It was clear,
that without the op-amp the MOSFET would not open properly and therefore, the buck converter
would not work. The op-amp was tested, and it was discovered, that it saturated and ceased to work
as intended. By inspection with an oscilloscope, it was determined that a lover voltage would solve
the problem. Therefore, a voltage divider was designed to lower the voltage to the op-amp. When the
op-amp was connected to the PWM-module and the duty cycle was measured with an oscilloscope,
a spike in the rising time around 4 [V] when the MOSFET opens could be seen. However, this has no
inuence.
78
9.6. VALIDATION OF THE COMPLETE SYSTEM
Afterwards, the op-amp was tested with a voltage generator and multimeter to see if it amplied the
voltage input, and the test showed tat it worked as intended.
9.5 Validation of the hardware
Based on the experiments described above it can be concluded that the hardware work as intended
except fromthe disturbances inthe duty cycle fromthe op-amp. Like statedbefore these disturbances
are believed to have no meaning to the function of the system. When the PWM-module, op-amp,
buck converter and the electromagnet where all connected together the system worked as intended
the voltage over the electromagnet changed by changing the duty cycle. Therefore the conclusion is
that the hardware works and is usable in the purpose of regulating the systemto make a beamlevitate
with help from the electromagnet.
9.6 Validation of the complete system
After all the hardware had been tested, and a LabVIEW program had been made to control the
system, the complete system could be tested. From initial analyzis of the system, the regulation con-
stants were determined analytically, and these values were then tested to see if the model in MAT-
LAB Simulink was consistent with real life.
First and foremost, it should be made clear, that the overall validation of the systemwas unsuccessful.
All the regulation simulations presented in section 8.2 on page 62 was tested, in order to determinate
the best suited regulation type in real life. In total 14 simulations was tested and these are presented
in table 9.1 for easy review. The tests were conducted without any current feedback. This is done
because the system is already too slow to respond to the height and velocity measurements, which is
something that will become clear in the following.
Run K
p
K
P
K
I
K
v
Description
1 150 NaN NaN 3.96 P regulator with constant part I
0
2 175 NaN NaN 3.96 P regulator with constant part I
0
3 200 NaN NaN 3.96 P regulator with constant part I
0
4 225 NaN NaN 3.96 P regulator with constant part I
0
5 250 NaN NaN 3.96 P regulator with constant part I
0
6 NaN 400 0 3.96 PI regulator manually tuned
7 NaN 400 500 3.96 PI regulator manually tuned
8 NaN 400 1000 3.96 PI regulator manually tuned
9 NaN 400 1500 3.96 PI regulator manually tuned
10 NaN 400 2000 3.96 PI regulator manually tuned
11 NaN 231.7 1362 3.96 PI regulator analytically tuned
12 NaN 275.4 1834 3.96 PI regulator analytically tuned
13 NaN 323.6 2424 3.96 PI regulator analytically tuned
14 NaN 407.4 3475 3.96 PI regulator analytically tuned
Table 9.1: Overview of the different regulation types used.
Not every test will be shown in the following. 3 runs are selected from the 14 presented in table 9.1,
the 3 runs are the same as the runs selected in table 8.2 on page 71 in section 8.2 on page 62. The
regulation types are tested over a period of 10 [s] with a starting height of approximately 12.5 [mm].
79
CHAPTER 9. VALIDATION
0 1 2 3 4 5 6 7 8 9 10
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 9.5: Run 5. P regulator with constant part I
0
.
0 1 2 3 4 5 6 7 8 9 10
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 9.6: Run 10. PI regulator manually tuned.
0 1 2 3 4 5 6 7 8 9 10
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 9.7: Run 12. PI regulator analytically tuned.
As it can be seen from gure 9.5, gure 9.6 and gure 9.7, the overall picture is the same for all three
regulations. The saw-toothed signal seen in the gures originates from the slowness of the regula-
tion system. The testing showed, that the electromagnet was unable to levitate the beam at a certain
height. The beam could only be picked up, hit the electromagnet, and be dropped onto the tray. Fine
tuning the regulation constants by trial and error made it possible for the beam to bounce in the tray
under the electromagnet, however, it would only pick it up randomly, and when that happened, the
beam would subsequently hit the electromagnet, where after the beam would be dropped back into
the tray. This then repeated randomly. From the test, it can then be concluded, that the system was
unable to stabilize or hold the beam at a predened height between the electromagnet and the tray
underneath it. Thereby, the regulation constants could not be veried as intended. It is not possible
to determinate the inuence of the various regulation constants, because every run is approximately
the same.
There can be several causes for this. Firstly, the distance sensor can be too slowfor the task of measur-
ing the beam. In the nal testing of the distance sensor, it was discovered that the almost triangular
signal from the distance sensor was caused by interference from the power grid. When this interfer-
80
9.6. VALIDATION OF THE COMPLETE SYSTEM
ence was discovered, measures was taken to bring the interference to a minimum, where after the
signal from the distance sensor was almost a constant voltage. This was done using batteries instead
of a standard DC power supply.
Secondly, the resulting delay from the USB-interface could be too dominant in order for the system
to work. This could be solved if the data acquisition was in real time, however, such a module was not
available.
Thirdly, a LabVIEW program can be optimized for faster calculations. It is uncertain if the Lab-
VIEW program is performing its calculations as fast as it should. A demo by a National Instru-
ments employee showed how sensitive a LabVIEW program can be, and what it means for the
time it takes to perform calculations. From this, the LabVIEW program can most certainly be op-
timized for speed, however, due to the lack of experience with LabVIEW, the key to create a faster
program is unknown.
It was discovered to be the main cause was that the USB-device. It was discovered, that with the
present program structure and the use of the DAQ USB-device, the sampling frequency could not
continuous be any higher than 25 [Hz]. This speed is not acceptable in order to control the system
and this shortcoming can be seen in gure 9.8, where the slow speed of the control system is clearly
shown.
0.5 0.6 0.7 0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
15
10
5
0
Ti me[s]
H
e
i
g
h
t
[
m
m
]
Figure 9.8: 1 [s] of run 12.
In gure 9.8 the measured points are marked with an asterix (), and as it can be seen in gure 9.8,
there are far too few measure points to accurately describe the movement of the beam. The low sam-
pling rate contributes to a too slow data acquisition, and it is evident, that there is not enough data
points. It should be noted, that the majority of the data points are either at maximum or minimum
distance. From this, it can be seen, that the system is too slow to detect, that the beam has been
picked up and is on its way towards the electromagnet or the tray. This behavior can be described as
an on/off regulation, which disregards both the height and velocity calculations. It was stated as a re-
quirement, in section 4.1 on page 15, that the control systemhas to be at least 20 times faster than the
natural frequency of the plant, and it was shown in section 6.3 on page 39, that the natural frequency
of the plant is 7 [Hz]. This relates to a minimum required frequency of 140 [Hz], which the present
control system does not fulll. In section 11 on page 87 a possible solution to counter this problem is
stated. With the present speed of the control system, there is no chance to make the beam settle.
81
CHAPTER 9. VALIDATION
Ontop of the frequency problem, there were some insecurities regarding the movements of the beam,
meaning that there were too many directions the beam could move. The electromagnet can only
move the beam up and down, which relates to one movement direction, but the beam can move in
six different directions. The six degrees of freedom for a rigid body are: Up and down movement
(heaving), left and right movement (swaying), forward and backward movement (surging), forward
and backward tilting (pitching), side to side tilting (rolling) and turning left and right (yawing). In
section 11 on page 87 a solution to counter this problem is also stated.
To summarize the test, it is noted that the test is a failure. It was not possible to hold a beamlevitating,
nor was it possible to validate the regulation constants. However, it should also be noted that there
are a couple of things , which could be improved. The before mentioned possible causes could be
corrected, however, due to the limited time available after the test was conducted, the corrections
could not be made.
82
Chapter 10
Conclusion
The purpose of this project was to study, analyze and build a small scale model of a magnetic lev-
itation system. Out of three different maglev technologies, the electromagnetic suspension system
was chosen as the technology, that was to be used for this project. A simple electromagnetic levita-
tion system was built, which consisted of a buck converter, a PWM-module, a distance sensor, a DAQ
USB-device and an electromagnet. The system was tested, and the results were compared to see, if
they complied with the theory. The components were tested individually, and the results are summa-
rized here.
The electromagnet was designed to be able to lift a beamwith a mass of at least 1 [kg] froma distance
of 15 [mm] with the use of a supply voltage of 30 [V]. The electromagnet consists of a m-shaped iron
core, where the legs of the core are designed, so that each of the two outer legs are half the area of
the center leg. This results in, that the north and south pole of the electromagnet has the same sur-
face area, which leads to symmetrically distributed magnetic force. To achieve a large magnetic force
with a small current, the number of windings was chosen to be 1000 [Wi]. The test showed, that the
electromagnet was able to lift the beam. To control the current supplied to the electromagnet, a buck
converter was constructed.
The test of the buck converter showed, that it complied with the theory. The output voltage of the
buck converter could be controlled using PWM-signal with a varying duty cycle. There was a linear
connection between the supplied duty cycle and the output voltage. Initially some problems with
DCM (discontinuous conduction mode) arose because of too high load resistance, however, these
were solved by replacing the lter inductor in the buck converter.
To control the buck converter, a PWM-module was made and tested. The PWM-module was tested
with an oscilloscope, and it seemed to work, which means, that the output was a square waveform.
However, when the PWM-module was connected to the buck converter, the signal from the PWM-
module had some imperfections. Instead of a square waveform PWM-signal, an arc was present on
the rising edge of the signal. This was due to, that the signal was overloaded by the internal capacitor
in the MOSFET of the buck converter. The voltage fromthe PWM-signal was at the proper magnitude,
but the output current was too low, and a boost in current was needed.
To prevent this behavior, an op-amp was connected between the output terminals of the PWM-
module and the input terminals of the buck converter. The test of the PWM-module showed a linear
link between the analog control input voltage and the duty cycle output in the range of 5 to 95 [%].
Aditionally, the amplitude of the PWM-signal was measured to be 12 [V], and the frequency was mea-
sured to be 62.5 [kHz], which more than satied the requirements stated in section Specication of
83
CHAPTER 10. CONCLUSION
requirements.
An infrared distance sensor was used to measure the distance, the beam was away from the electro-
magnet. The sensor did not work at rst, but it was discovered that a load resistor of 20 [M] was
needed between the output and ground. Afterwards, the sensor worked, and it was able to measure a
distance between 0 and 20 [mm]. In the output voltage from the sensor, it was discovered, that there
were some noise. This noise affected the signal to the extent, that signal was unusable. The noise
issue was solved using batteries as the voltage supply, instead of a DC power supply. After this adjust-
ment, the maximumvoltage of the voltage supply was 24 [Volt]. This did not affect the electromagnet
too much, as it was still able to lift the beam from the required distance. To obtain the velocity of the
beam, a differentiator in LabVIEW was used to calculate the change in height in each time step.
Two models were made in MATLAB and in MATLAB Simulink to predict the behavior of the sys-
tem. A non-linear model was made to have a model, which depicted a real life system, and a linear
model was made to analyze the system by the use of control theory, and ultimately determine the
type of regulation. The non-linear model was used to verify the regulation type and the values of the
regulation constants determined using the linear model. In total, three types of regulation was used.
The types of regulation used were velocity, current and position regulation.
The velocity regulation was made using the actual velocity of the beam in a feedback loop. The main
difference between the linear and the non-linear model is, that this regulation is implemented into
the transfer function for plant, G
pv
, in the linear model, whereas it is used in a feedback loop in the
non-linear model. The same is done with the current regulation. The current regulation is imple-
mented in the transfer function for the plant, G
pvi
, in the linear model, and it is used in a feedback
loop in the non-linear model.
Generally seen, two different types of position regulators are presented in the report, a P regulation
with constant part I
0
, and a PI regulator. The PI regulator was chosen for this project, as its not as
sensitive to deviations from the theory. If the theory of the magnetic force is not completely accurate,
the P regulator with constant part I
0
results a steady state error in the settling height. The values for
the various regulation constants can be seen in table 10.1.
Regulation constant Value
K
v
3.96
K
D
3.55
K
P
275.4
K
I
1834
Table 10.1: Values of the regulation constants.
To validate the results of the simulation, a LabVIEW program was made. The LabVIEW program
is based on the non-linear model, and uses a DAQUSB-device to acquire and generate signals to con-
trol the system. A test of all the physical components connected together was made to determine, if
the values of the regulation constants, needed to stabilize the system at the predened height, were
consistent withthe values intable 10.1. The test was unable to validate the results fromthe simulation
of the model, as it was discovered, that the LabVIEW program and the DAQ USB-device were too
slow. It was only possible to regulate at a continuous frequency of 25 [Hz]. As a consequence of the
slow regulation frequency, the current feedback regulation was omitted. For the regulation to work,
the frequency must be at least 140 [Hz].
84
In all, the theory and the models show, that it is possible to levitate a beamat a predened height, but
it was not possible demonstrate this in practice.
85
Chapter 11
Discussion
This project focused on the levitation system of the magnetic levitation trains. The next step would
be to focus on the propulsion system. This could be done by employing multiple electromagnets to
construct a track, on which the model of the maglev train could travel along. With this track, it could
be looked into what it takes to make an efcient track, where the track is divided into small sections,
which can be individually powered. Finally, all the different parts can be assembled, and tested to-
gether, which should result in a working EMS maglev system.
In this project, it was discovered that a beam is a difcult object to levitate. An alternative approach
could be to use a sphere instead. With a sphere, the degrees of freedom, e.g. rotation, pitch and yaw,
has no effect whatsoever, and it thus provides an ideal geometry. A circular electromagnet could be
used, as it will distribute the magnetic eld equally out in a circle, whereas the m-core electromagnet
, used in this project, concentrates the magnetic eld in three points. An iron spear with copper wire
wound around it could also be used. To model the propulsion system, however, it is better to employ
a square-shaped item instead of the sphere.
In the conclusion it has been stated, that the regulation is too slow when LabVIEW is used. At least
two alternatives might work. One is the use of a microcontroller programmed, for example, in C, C++,
C#, ASSEMBLY. If a microcontroller is to be used, then it has to regulate with at least 140 [Hz] as stat-
ed in section 9.6 on page 79. A possible microcontroller could be the ATmega168, which can regulate
with at least 1 [kHz] [34], and it has an internal PWM-module, which can drive the buck converter
without any amplication. Lack of knowledge and experience in programming, was the decisive fac-
tor, why this method was not chosen in the project. The ATmega168 can be seen in gure 11.1
Figure 11.1: The ATmega168 microcontroller.
The second alternative is to construct an analog regulator by the use of op-amps, resistors and ca-
pacitors. This would make the regulation as fast the components allow. The system already make
use of analog voltages to measure the distance and control the PWM-module, which means that the
87
CHAPTER 11. DISCUSSION
transition to analog regulator would be possible. An analog regulation can be constructed by the use
of a transfer function as shown in equation 11.1.
G(s)
V
i
(s)
V
o
(s)
[] (11.1)
Where V
i
(s) in this transfer function is the input voltage and V
o
(s) is the output voltage of the regula-
tion.
If a PI controller is needed, it could be described as equation 11.2.
G(s)
R
4
R
3

R
2
R
1

R
2
C
2
s +1
R
2
C
2
s
[] (11.2)
By the use of equation 11.2, an electric circuit can by designed as shown in gure 11.2.
+
-
+
-
R
1
R
2
C
2
R
3
R
4
Figure 11.2: Analog PI controller with use of op-amps [35].
88
APPENDIX
PART III
0 0.1 0.2 0.3 0.4 0.5
0
0.5
1
1.5
2
Appendix A
Constants and terminology
Constants
Symbol Alias/size Unit
A 4.36 10
3
[m
2
]
A
beam
11.6 10
6
[m
2
]
c
1
8 A N
2
A
2
i r on

0

2
i r on
[H/m
3
]
c
1
252.7 10
3
[H/m
3
]
c
2
A h
i r on
[m
3
]
c
2
436 10
6
[m
3
]
c
3
8 A
beam

beam
[m
2
]
c
3
19.21 [m
2
]
c
4
16 A I
0
N
2
A
2
beam

0

2
beam
(A h
beam
+8 h
0
A
beam

beam
)
2
[N]
c
4
17.77 [N]
c
5
128 A I
2
0
N
2
A
3
beam

0

3
beam
(A h
beam
+8 h
0
A
beam

beam
)
3
[N]
c
5
-2310 [N]
c
6
8 A I
2
0
N
2
A
2
beam

0

2
beam
(A h
beam
+8 h
0
A
beam

beam
)
2
[N]
c
6
11.52 [N]
f
real
62.5 [Hz]
g 9.82 [m/s
2
]
h
0
10 10
3
[m]
h
beam
100 10
3
[m]
h
st ar t
15 10
3
[m]
h
max
15 10
3
[m]
Continued on next page
A1
APPENDIX A. CONSTANTS AND TERMINOLOGY
- Continued from previous page
Symbol Alias/size Unit
I
0 @h
0
1.3 [A]
I
max
2 [A]
L
magnet
364.3 10
3
[H]
m 1.07 [kg]
N 1000 []
R
copper
14.94 []
R
FREQ
68 [k]
R
out
3 [k]
timestep 1 10
3
[s]
V
g
30 [V]

G
i
L
R
copper
+V
g
K
D
[s]

0
4 10
7
[T m/A]

beam
3000 []

r
4

r
5

r
6
1 []
h h
4
h
5
h
6
[m]
A A
5
2A
4
2A
6
[m
2
]

beam

r
7

r
8
[]
h
beam
2h
7
2h
8
[m]
A
beam
A
7
A
8
[m
2
]
A2
Terminology
Abbreviation Extended
BIBO Bounded-Input and Bounded-Output
DAQ Data acquisition
EDS Electrodynamic suspension
EMS Electromagnetic suspension
IC Integrated circuit
LED Light-emitting diode
Maglev Magnetic levitation
MOSFET Metal-oxide-semiconductor eld-effect transistor
Op-amp Operational amplier
P Proportional
PI Proportional plus Integral
PID Proportional plus Integral plus Derivative
PWM Pulse-width modulation
[Wi] Windings
A3
Appendix B
Hardware
B.1 Choose of operational amplier type
In this appendix it is argued for, that the Texas Instruments TL082CP can be used to amplify the
PWM-signal. The switching period of the PWM-module is found to be:
T
sw

1
f
sw

1
62.5 10
3
16 [s] (B.1)
The highs in the PWM-signal is V
PWM hi gh
12[V]. The slew rate of the Texas Instruments TL082CP
is 13[V/s]. This means, that it takes the op-amp 1[s] to go from 0 to 13[V]. Based on the switching
time of the PWM-module it is believed that the op-amp is fast enough for the buck converter. The
MOSFET requires only 4[V] to open so it takes less than 1[s] for the op-amp to open the MOSFET.
This behavior can be seen in gure B.1.
t [s]
V [V]
D T
s D
t
T
s
T
s
Figure B.1: The slew rate of the op-amp inuence the PWM-signal, marked with dashed lines.
A5
Appendix C
Regulation
C.1 Routh-Hurwitz array
Routh-Hurwitzs method for determining the stability of a system utilizes an array, where the coef-
cients in the rst two rows come fromthe characteristic equation of the closed loop transfer function.
The characteristic equation must be on the form shown in equation C.1.
D(s) a
n
s
n
+a
n1
s
n1
+ +a
1
s +a
0
[] (C.1)
If any sign changes, in the rst column of the Routh-Hurwitz array occur, the systemis unstable. Each
sign change represent a pole in the right half plane. A Routh-Hurwitz array is shown in table C.1,
where the coefcients in third row and the following rows are determined as shown in equation C.2.
b
1

1
a
n1

a
n
a
a2
a
a1
a
a3

[] b
2

1
a
n1

a
n
a
a5
a
a1
a
a4

[] (C.2)
s
n
a
n
a
n2
a
n4

s
n1
a
n1
a
n3
a
n5

s
n2
b
1
b
2
b
3

.
.
.
.
.
.
.
.
.
s
2
k
1
k
2
s
1
l
1
s
0
m
1
Table C.1: Routh-Hurwitz array.
C.2 Logic
In table C.2 on page A8 the possible scenarios of the logic block diagramfromsection 7.1.3 on page 50
are shown. The velocity of the beamis reset to zero, if columnnamed Velocity intable C.2 onpage A8
returns the number 1.
A7
APPENDIX C. REGULATION
Height Acceleration Velocity
h
now
0 h
now
h
max

h
now
<0

h
now
>0 Reset to 0
1 0 1 0 0
1 0 0 1 1
1 0 0 0 0
0 1 1 0 1
0 1 0 1 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 0
Table C.2: Logic for resetting velocity to zero.
C.3 Deriving I
0
I
0
is the current needed to levitate the iron beam at the height h
0
at rest. I
0
is calculated based on
equation 7.2 on page 48. The beam is at rest and therefore the resulting force is set to zero, which is
shown in equation C.3.
F
r
F
m
(I
0
, h
0
) F
g
0 [N] (C.3)
{
m g
c
1
I
2
0
(c
2
+h
0
c
3
)
2
[N]
{
I
0

_
m g (c
2
+h
0
c
3
)
c
1
[A] (C.4)
A8
C.4. ANALYSE OF THE DIFFERENCE BETWEENG
PV
ANDG
PVI
C.4 Analyse of the difference between G
pv
and G
pvi
It is concluded in section 6.4 on page 44, that the transfer function G
I
could be ignored when deter-
mining the regulation for the plant. The difference between including G
i
and not including G
i
can
easily be viewed when the close loop transfer function is exposed to a step input. The values for the
regulation constants K
P
and K
I
are the values found in table 8.1 on page 68.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.2
0.4
0.6
0.8
1
1.2
1.4
Time (sec)
A
m
p
l
i
t
u
d
e
Figure C.1: Step response for close loop transfer function. With and without the inuence of G
i
.
As it can be seen from gure C.1, there is not much difference between taking G
i
into account and
neglecting it. Only small uctuation in the output can be seen in beginning, where the closed loop
transfer function, that has taken G
i
into account, uctuates the most. The settling time is the same
as is the rise time, but there are some small differences in the overshoot. Overall the assumption to
ignore G
i
when determining the regulation constants is valid.
A9
Bibliography
[1] The international system of units, 2006. Source on CD. URL http://www.bipm.org/utils/
common/pdf/si
_
brochure
_
8.pdf.
[2] Transport at a crossroads, 2008. Source on CD. URL http://www.eea.europa.eu/
publications/transport-at-a-crossroads.
[3] scar Romero Sanchez. Europe needs to steer transport policy in the right direction docu-
ment actions, mar 2009. URL http://www.eea.europa.eu/pressroom/newsreleases/
europe-needs-to-steer-transport-policy-in-the-right-direction.
[4] Germany to build maglev railway, 2007. Source on CD. URL http://news.bbc.co.uk/2/
low/business/7011932.stm.
[5] Carl Hoffman. Trans-atlantic maglev, dec 2004. URL http://www.popsci.com/scitech/
article/2004-04/trans-atlantic-maglev.
[6] The pennsylvania project, high speed maglev. Source on CD. URL http://www.maglevpa.
com/index.html.
[7] Olivier Huber / Roman Yurchak. Presentation maglev, 24 oct 2008. PDF-le on CD.
[8] Trainspotting world. Source on CD. URL http://train.spottingworld.com/Maglev
_
train.
[9] Kevin Bonsor. How maglev trains work, 2000. PDF-le on CD. URL http://science.
howstuffworks.com/maglev-train2.htm.
[10] Frantech international licensing vip worldwide trade and investment missions. Source on CD.
URL http://www.frantechusa.com/t/maglev/done
_
maglev.htm.
[11] Transrapid International. Levitation system, 1 apr 2009. Source on CD. URL
http://www.transrapid.de/cgi-tdb/en/basics.prg?session=82e139224a0fd78c
_
70093&a
_
no=41.
[12] Lawrence livermore national laboratory. Source on CD. URL https://www.llnl.gov/str/
Post.html.
[13] Space cable. Source on CD. URL http://www.spacecable.org.uk/Technology.html.
[14] Hans Ebert. Quasistatiske elektriske og magnetiske felter, 17 mar 1998. Compendium.
[15] David K. Cheng. Field and wave electromagnetic, 1989. ISBN 0-201-52820-7.
[16] John W. Jewett / Raymon A. Serway. Physics for scientists and engineers with modern physics,
2008. ISBN 0-495-11240-2.
A11
BIBLIOGRAPHY
[17] P. W. Karlson. Teknisk elektromagnetismelre, 1992. ISBN 87-502-0724-5.
[18] Dragan Maksimovis / Robert W. Erickson. Fundamentals of power electronics, 2001. ISBN 0-
7923-7270-0.
[19] Fairchild Semiconductor Corporation. Irf530n. Data sheet on CD.
[20] Ni usb-621x user manual, 2009. Data sheet on CD. URL http://digital.ni.com/manuals.
nsf/websearch/5452CD6A491AC0288625757B0065EA32.
[21] Hewlett-Packard Company / Intel Corporation / Lucent Technologies Inc / Microsoft Corpora-
tion / NEC Corporation Koninklijke / Philips Electronics / N.V. Compaq Computer Corporation.
Universal serial bus specication. Data sheet on CD.
[22] Ni usb-6215, 2009. Data sheet on CD. URL http://sine.ni.com/nips/cds/view/p/lang/
en/nid/203091.
[23] Texas Instruments. Drv103. Data sheet on CD.
[24] J. David Irwin / R. Mark Nelms. Basic engineering circuit analysis, 2005. ISBN 0-471-66158-9.
[25] Tl082cp. Data sheet on CD.
[26] Kevin DeMarco. Mixed-up-signals analog and digital design. Source on CD. URL http://www.
mixedupsignals.com/.
[27] Integrated Publishing. Integrated publishing. Source on CD. URL http://www.tpub.com/
neets/book7/26g.htm.
[28] National High Magnetic Field Laboratory. National high magnetic eld laboratory. Source
on CD. URL http://www.magnet.fsu.edu/education/tutorials/magnetacademy/
magnets/page2.html.
[29] Cny70. Data sheed on CD. URL http://www.elektrobotik.com/dersler/sensorler.
html.
[30] Charles L. Phillips / Royce D. Harbor. Feedback control Systems, 2000. ISBN 0-13-949090-6.
[31] C. Henry Edwards / David E. Penny. Elementary differential equations, 2009. ISBN0-13-235881-
6.
[32] Gene F. Franklin / J. David Powell / Abbas Emani-Naeini. Feedback control of dynamic systems,
1991. ISBN 0-201-50862-1.
[33] Henrik C. Pedersen / Torben O. Andersen. Blokdiagrammer og blokdiagramsreduktioner, 2008.
[34] Atmega168. Data sheet on CD. URL http://www.atmel.com/dyn/resources/prod
_
documents/doc2545.pdf.
[35] Electrical implementation of controllers ogata incl table.
A12

You might also like