0% found this document useful (0 votes)
210 views52 pages

Closed Loop Control of PMSM Motor: Field Oriented Control Using Hall Sensors

This document presents a thesis for a Master of Science degree. The thesis investigates closed loop control of permanent magnet synchronous motors (PMSM) using field oriented control with Hall sensors. Two motor control algorithms are investigated: 6-step control and field oriented control. Field oriented control algorithms are derived based on mathematical motor models transformed into different reference frames. Simulation results show the control system can track speed and current references with minimal error using field oriented control for two different motors. Low battery simulations also demonstrate how field weakening allows higher speeds at lower DC voltages.

Uploaded by

Loyel Rose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
210 views52 pages

Closed Loop Control of PMSM Motor: Field Oriented Control Using Hall Sensors

This document presents a thesis for a Master of Science degree. The thesis investigates closed loop control of permanent magnet synchronous motors (PMSM) using field oriented control with Hall sensors. Two motor control algorithms are investigated: 6-step control and field oriented control. Field oriented control algorithms are derived based on mathematical motor models transformed into different reference frames. Simulation results show the control system can track speed and current references with minimal error using field oriented control for two different motors. Low battery simulations also demonstrate how field weakening allows higher speeds at lower DC voltages.

Uploaded by

Loyel Rose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

A thesis presented for the degree of

Master of Science

Closed loop Control of PMSM Motor


Field Oriented Control using Hall sensors

Shawon Kumar Baral

Integrated Circuits and Systems Division


Electrical Engineering Department
Linköping University
SE-581 83 Linköping, Sweden.
November 23, 2021.
Master of Science Thesis in Electrical Engineering
Closed loop Control of PMSM Motor,
Field Oriented Control using Hall sensors
Shawon Kumar Baral
LiTH-ISY-EX–21/5444–SE

Supervisor
Tomas Uno Jonsson
ISY, Linköping University

Examiner
Lars Eriksson
ISY, Linköping University

Integrated Circuits and Systems Division


Electrical Engineering Department
Linköping University
SE-581 83 Linköping, Sweden.
November 23, 2021.

Linköping University i
Abstract

Fossil-fuel vehicles are one of the main causes of CO2 emissions nowadays. As we are moving toward
cleaner environment electrification of vehicles are becoming more and more popular. With the environ-
ment in mind, the recent improvement in battery technology and electronics has drawn a lot of attention
to Brushless DC or BLDC motors. Due to their high torque output and robust design, BLDC motors
are a popular choice as the main propulsion unit in electric vehicles. Permanent magnet synchronous
motor, PMSM, is also a brushless dc motor with minor changes in design. So the word BLDC and
PMSM is used interchangeably. In this thesis, two motor control algorithms were investigated. 6-Step
control and Field oriented control or FOC. A three-phase inverter allows these motors to be driven by
a battery. But when battery voltage goes down the speed of the motor also goes down. This thesis
investigates a method to maintain the same speed at lower dc voltage. Also running of other motors
than the control system was designed for. The control system performs well in simulation for two of
the motor tested with the FOC algorithm. Simulation results show that the control system can track
speed and current references with minimum error. Speed controller and current controllers control each
parameter independently to control the motor. Low battery simulations provide useful data that shows
how the field weakening technique makes it possible to achieve higher speed at low dc voltages.

ii
Sammanfattning

Fossildrivna fordon är en av de främsta orsakerna till koldioxidutsläpp i dag. I och med att vi går
mot en renare miljö blir elektrifieringen av fordon allt mer populär. Med miljön i åtanke har den
senaste tidens förbättring av batteriteknik och elektronik dragit mycket uppmärksamhet till Brushless
DC- eller BLDC-motorer som ska användas som huvudframdrivningsenhet. På grund av dess höga
vridmomentutgång och robusta design så är BLDC-motorer mer populära. En permanent magnetisk
synkronmotor, PMSM, är också en borstlös dc-motor med mindre förändringar i designen. Så orden
BLDC och PMSM används omväxlande. I denna avhandling undersöktes två motoriska styralgoritmer. 6-
stegskontroll och fältorienterad kontroll eller FOC. En trefas växelriktare gör att dessa motorer kan drivas
av ett batteri. Men när batterispänningen går ner går motorns hastighet också ner. Denna avhandling
undersöker en metod för att bibehålla samma hastighet vid lägre likspänning, men även drift av andra
motorer än vad styrsystemet var konstruerat för. Styrsystemet fungerar bra i simulering för två av de
motorer som testas med FOC-algoritmen. Simuleringsresultat visar att styrsystemet kan spåra hastighet
och aktuella referenser med minimalt fel. Hastighetsregulator och aktuella styrenheter kontrollerar varje
parameter individuellt för att styra motorn. Simuleringar med lågt batteri ger användbara data som
visar hur fältförsvagningstekniken gör det möjligt att uppnå högre hastighet vid låg likströmsspänning.

iii
Acknowledgements

I would like to sincerely thank my supervisor, Tomas Uno Jonsson for his help and feedback during the
project.

I am also thankful to Arvind Balachandran and my friend, Anton Källström.

Finally, I would like to thank my opponent for the thesis, Vinod Diwakara.

iv
Contents

Abstract ii

Sammanfattning iii

Acknowledgements iv

List of Figures vii

List of Tables ix

1 Introduction 1
1.1 Problem definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Thesis outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Theory 3
2.1 Electric motor fundamentals and control systems . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.1 Brushed DC motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.1.2 Brushless motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1.2.1 PMSM types and motor inductances . . . . . . . . . . . . . . . . . . . . . 5
2.1.3 Motor pole pairs, mechanical and electrical properties . . . . . . . . . . . . . . . . 5
2.1.4 Control hardware and commutation . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1.5 Rotor position sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 6 Step control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.1 Problem with 6 step control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3 Field oriented control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.1 Mathematical model of PMSM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.1.1 Motor model in abc frame . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3.1.2 abc to αβ transformation (Clarke Transformation) . . . . . . . . . . . . . 10
2.3.1.3 Motor model in αβ frame . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.3.1.4 αβ to dq transformation (Park Transformation) . . . . . . . . . . . . . . 11
2.3.1.5 Motor model in dq frame . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.1.6 Electromagnetic torque . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3.2 Field Oriented Control implementation . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.3 Stator voltage decoupling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.3.4 Speed and angle feedback from motor . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.3.4.1 Speed calculation from Hall sensor . . . . . . . . . . . . . . . . . . . . . . 14
2.3.4.2 Angle estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.5 PWM techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.3.5.1 Sinusoidal PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

v
2.3.5.2 Space vector PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.6 Startup issues with FOC and rotor alignment . . . . . . . . . . . . . . . . . . . . 19
2.4 PI controller tuning and motor parameter dependency . . . . . . . . . . . . . . . . . . . . 20
2.5 Battery low voltage and field weakening . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

3 Simulation 22
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.2 Simulation Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3 Speed and current controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3.1 Speed control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3.2 Current control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.4 Speed and Angle simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.4.1 Speed estimation using hall sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.4.2 Angle estimation simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.5 Low battery voltage operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.6 Running different motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

4 Discussion 34
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.3 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

5 Conclusion 36
5.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.2 Future works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

References 37

A Motor Specifications 40

B Matlab Script for PI gain calculation 41

Linköping University vi
List of Figures

2.1 Current conducting wire in a magnetic field . . . . . . . . . . . . . . . . . . . . . . . . . . 3


2.2 Back EMF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 SPMSM and IPMSM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.4 Motor inductance path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.5 3 phase h-bridge configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.6 Hall sensor position. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.7 Torque ripple in 6 step control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.8 Rotor and stator magnetic field orientation for maximum torque generation. . . . . . . . . 8
2.9 Stator magnetic field alignment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.10 3-phase equivalent model of PMSM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.11 abc to αβ transformation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.12 αβ to dq transformation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.13 FOC algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.14 Hall sensor and interrupt generator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
2.15 Hall sensor’s frequency estimator. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.16 Edge detection for hall sensors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.17 PWM generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.18 PWM slowly decreasing width of the pulse. . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.19 Sinusoidal PWM generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.20 Space Vectors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.21 Adding 3rd harmonic to fundamental frequency. . . . . . . . . . . . . . . . . . . . . . . . . 19
2.22 3 phase space vector reference signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.23 Space vector PWM generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2.24 Rotor alignment during startup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.1 Field oriented control Simulink model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23


3.2 FOC controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.3 Current measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.4 Inverter control block. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.5 Decoupling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6 Initial rotor alignment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.7 Current controllers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.8 Speed controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.9 Speed tracking by the controller without load. . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.10 Fixed RPM with 0.02 Nm external load. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.11 q-axis current control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.12 d-axis current control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.13 Measured currents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

vii
3.14 Vd and Vq voltage outputs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.15 Space vector generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.16 Phase currents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.17 RPM calculation using 1 and 3 hall sensors and actual RPM. . . . . . . . . . . . . . . . . 30
3.18 Estimated angle from calculated speed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.19 Boel motor speed control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.20 Motor speed and output torque of the Boel motor. . . . . . . . . . . . . . . . . . . . . . . 32
3.21 Current control performance of the Boel motor. . . . . . . . . . . . . . . . . . . . . . . . . 33
3.22 Phase currents for the given reference speed. . . . . . . . . . . . . . . . . . . . . . . . . . 33

Linköping University viii


List of Tables

2.1 Hall signals to emf conversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7


2.2 emf to gate signal conversion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Space vectors with inverter gate signal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3.1 Low battery voltage simulation result. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

A.1 Motor specifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

ix
CHAPTER 1

Introduction

The rapid growth of electric vehicles in recent years has drawn lots of attention in using Permanent mag-
net synchronous motors (PMSM) as the main drive motor. Being lightweight and compact compared to
diesel or petrol engines it is much cheaper. PMSM has no moving part other than the rotor that makes
them robust and suitable for long-term use in industrial and home applications. Right now PMSMs are
used where any motor is required from HVAC, cooling fan, electric scooter, and electric bikes the list
goes on [1–13].

PMSM can be controlled with or without sensor feedback from the motor. With sensors, the control
system is easy to develop but costly and adds more failure points to the whole system. Sensorless control
on the other hand is more robust and also more complex. In this thesis, hall sensors are used by the
control system to calculate motor speed and electric angle.

There are many ways to control a PMSM, for example, 6 step control, field-oriented control, and field
weakening control. Field-oriented control is the main interest for this thesis but 6 step control is also
investigated as it has much easier implementation.

1.1 Problem definition


This thesis aims to investigate low battery voltage situations and cases when the motor is changed or
use of another motor than the control system was originally designed for. At the end of the thesis, two
questions will be answered,

1. What happens when the battery voltage goes low? and how the control system will handle low
battery voltage to keep steady RPM?
2. Is it possible to run a different motor without the need for a change in the control algorithm?

1
1.2 Thesis outline
In chapter 2, the theory of motor and control systems is discussed. Motor mathematical models, the
transformation between different models, and estimation methods are discussed in this chapter.

Chapter 3 is for the simulation result. All the method discussed in the theory chapter is simulated and
presented in this chapter.

Chapter 4 is for discussion based on the simulation. Simulation results provide answers asked in the first
chapter.

Chapter 5 is for the conclusion and future work-related discussion.

Linköping University 2
CHAPTER 2

Theory

2.1 Electric motor fundamentals and control systems


An electric motor is a machine that can convert electricity to mechanical energy with the presence of a
magnetic field. A current conducting wire in a magnetic field can be the simplest representation of an
electric motor. From figure 2.1, a conductor is placed in a magnetic field, i is the direction of the current.
If the direction of the magnetic field is B, then the wire will feel an electromotive force towards F. This
is also known as the left-hand rule.
S

F
B
N

Figure 2.1: Current conducting wire in a magnetic field .

2.1.1 Brushed DC motor


The rotor, moving part of the motor, is made of an iron armature with coils. When current flows through
these coils, generated magnetic fields push the magnets on the stator and this repulsion makes the rotor
move. Current is delivered from the stationary housing to these moving coils through 2 pieces of metal,
usually, copper is known as the brush of the motor and the motor is called Brushed dc motor. These
brushes are always in contact with the rotor. There are 3 sets of coils and they are mechanically made in
such a way so that the active coil can produce maximum torque. When the current coil moves current is
passed through the next set of coils to produce constant torque. As the direction of current never change

3
these are also known as DC motor and this process of passing currents through different coils’ is called
commutation. DC motors’ have very high starting torque this allows diverse use of these motors. But
there are losses in the brush. As the brush is in contact with moving metal it wears off and requires
constant maintenance. Also, the brush generates heat and spark which prohibits the use of these motors
in a gas-related application.

As the rotor is moving in a magnetic field, a current is induced through the coils and generates volt-
age in phase with the rotor position in relation to the stator magnets. This voltage is known as Back
electromotive force or simply Back EMF. At higher speeds, back emf can be very high and physically
damage the motor and other connected components.

2.1.2 Brushless motor


To avoid the problems mentioned above, a different type of motor is used that does not have any brush,
hence the name brushless DC motor. With this type of motor, the coil is stationary and the magnet is
the rotor. This makes the motor robust as there is no moving electrical part. Since the coils are not
moving, commutation is done electronically. Although the control system is complex, modern computers
and the use of sensors makes it easier to apply these control systems.

The most commonly used brushless motors are Brushless DC (BLDC) motor and the Permanent magnet
synchronous (PMSM) motor.

Both BLDC and PMSM motors are similar in configuration. They both have permanent magnets as
rotors are usually made of neodymium magnets.

What makes them different is their back emf. Due to stator winding construction BLDC motor produces
trapezoidal back emf and PMSM produces sinusoidal voltage shown in figure 2.2.

10 10
Va Va
Vb Vb
5 Vc 5 Vc
Voltage (V)

Voltage (V)

0 0

-5 -5

-10 -10
0 0.05 0.1 0 0.05 0.1
Time (sec) Time (sec)
(a) BLDC. (b) PMSM.

Figure 2.2: Back EMF

Linköping University 4
2.1.2.1 PMSM types and motor inductances
Depending on the rotor design, PMSMs can be of several types. Merrill’s rotor, interior magnet, surface
magnet, inset, and symmetrical buried to name a few [14]. Among all other types two most commonly
used PMSMs are Interior PMSM and Surface mounted PMSM. Shown in figure 2.3. Due to the difference
in magnetic path interior PMSM has different d-axis inductance and q-axis inductance [15] . In surface-
mounted magnets, both paths have same inductance path, shown in figure 2.4a. So Ld = Lq . Figure
2.4a shows Ld and Lq inductances. Figure 2.4b shows high and low inductance paths for Lq and Ld . So
for IPMSM Ld 6= Lq .

SPMSM IPMSM

Figure 2.3: SPMSM and IPMSM.

(a) Magnets on the surface of the rotor.


(b) Magnets inside the rotor.

Figure 2.4: Motor inductance path.

2.1.3 Motor pole pairs, mechanical and electrical properties


Motor stator poles usually come in pairs. This is generally referred to as either number of poles or pole
pair number. In this thesis, poles are counted as pairs and written in pairs. Pole pair directly correlates
to the electrical and mechanical properties of the motor. A few other important parameters are the

Linköping University 5
motor’s mechanical speed, angle, and electric speed and angle.

The physical speed of the rotor is mechanical speed. and the rotor’s physical angular velocity is the
mechanical angle of the rotor. But electrical parameters are required by the controller to calculate and
estimate different parameters and maintain the stability of the whole control algorithm.

The following equations show the relation between mechanical and electrical parameters.

ωe = pp × ωm (2.1)

θe = pp × θm (2.2)
Here,
ωe = Electrical speed of the motor in Rad/s
ωm = Mechanical speed of the motor in Rad/s
θe = Rotor electrical angle in Rad
θm = Rotor mechanical angle in Rad
pp = Motor pole pair

2.1.4 Control hardware and commutation


Usually PMSMs’ have 3 coils in Y or ∆ configuration. Their inductance and resistance can be represented
as 3 phase balanced system shown in figure 2.10. This 3 phase system can be controlled by applying
different voltages at a different node.

3 phase inverter is used to connect motor terminals to either high or low DC voltage shown in figure 2.5.
To run the motor different gate pulse is used from a high-speed microcontroller to turn on or off each
MOSFET. Speed of the motor is controlled by using pulse-width modulated(PWM) gate pulse. PWM
techniques are discussed in later sections of this thesis.

g1 g3 g5

12 V B
C

g2 g4 g6

Figure 2.5: 3 phase h-bridge configuration.

2.1.5 Rotor position sensor


To apply correct voltage at the different nodes the control system needs position feedback from the
motor. One of the cheapest ways is using hall sensors. In one motor there are 3 sensors placed 120
degrees apart from each other, shown in figure 2.6. These are digital hall sensors. They change their
output from 0 → 1 or 1 → 0 when the magnetic pole of the rotor changes.

Linköping University 6
Figure 2.6: Hall sensor position.

2.2 6 Step control


The easiest and cheapest way to run a PMSM is to apply DC voltage at each node based on hall sensors
output [16]. In table 2.1 shows which voltage to be applied based on the hall sensor combination. Here
+1 denotes full DC voltage and -1 is ground and 0 means no connection. Based on this combination it is
possible to get the gate signals required to apply the correct voltage at each node. These combinations
are shown in table 2.2. This table is used by the microcontroller to turn on/off MOSFETs. From table
2.2 it is clear that only 6 steps are needed to move the rotor. This is why it is called a 6-Step control
system. These steps are repeated sequentially by the microcontroller to run the motor. The order of
the steps determines the direction of the motor. So changing the order from 1 → 6 to 6 → 1 will change
the motor’s direction.

Hall emf
a b c a b c
0 0 0 0 0 0
0 0 1 0 -1 +1
0 1 0 -1 +1 0
0 1 1 -1 0 +1
1 0 0 +1 0 -1
1 0 1 +1 -1 0
1 1 0 0 +1 -1
1 1 1 0 0 0

Table 2.1: Hall signals to emf conversion.

emf Gate signals


Step a b c g1 g2 g3 g4 g5 g6
1 0 -1 +1 0 0 0 1 1 0
2 -1 +1 0 0 1 1 0 0 0
3 -1 0 +1 0 1 0 0 1 0
4 +1 0 -1 1 0 0 0 0 1
5 +1 -1 0 1 0 0 1 0 0
6 0 +1 -1 0 0 1 0 0 1

Table 2.2: emf to gate signal conversion.

Linköping University 7
2.2.1 Problem with 6 step control
The table 2.1 shows that the motor coils are energized between high and low voltages. This high voltage
switching creates torque ripple. This is unwanted as ripple can cause vibration, unwanted noise, and
unsmooth operation. Another problem is only 2 phases are active at a time, which reduces possible
output power. To avoid these problems sinusoidal voltage is applied to the gates of the inverter so that
the motor runs smoothly without any torque ripple.

10 -3

Torque
20

15
Torque (Nm)

10

-5
0 0.2 0.4 0.6 0.8 1
Time (sec)

Figure 2.7: Torque ripple in 6 step control.

Through field-oriented control, it is possible to apply sinusoidal voltage at the motor. To control the
motor with a microcontroller, a simplified mathematical model is required which is discussed in the next
section.

2.3 Field oriented control


The basic principle of field-oriented control is to run the motor with sinusoidal voltage to achieve smooth
torque while producing maximum torque. Maximum torque is generated, when the angle between the
stator’s magnetic field and the rotor’s magnetic field is 90 degrees. This control system continuously
makes an adjustment to align the stator magnetic field right-angled to the rotor magnetic field, hence
the name Field oriented control, FOC. All the hardware is designed to achieve this goal.

Figure 2.8: Rotor and stator magnetic field orientation for maximum torque generation.

Linköping University 8
Stator magnetic field can be represented by its vector components. One component is aligned to the
rotor magnetic field called the direct axis,d, and the other one is perpendicular to the rotor magnetic field
called quadrature axis,q which is shown in figure 2.9. Stator magnetic field can be aligned perpendicular
to rotor magnetic field by setting d axis to 0 and adjusting q axis.

The Control system is designed to turn on or off specific MOSFET of the inverter in figure 2.5 so that
necessary voltage is applied to the motor to keep correct stator magnetic field orientation. The Control
system needs feedback from the motor to know if it is running properly eg. correct speed and protection
from overvoltage or over current and also to detect stall.

Figure 2.9: Stator magnetic field alignment.

2.3.1 Mathematical model of PMSM


A mathematical model of the motor is a requirement to apply the FOC algorithm in a digital processor
so that it can predict the voltage required to keep the q axis aligned perpendicular to the d axis based
on current speed and phase current measurement. The General 3 phase mathematical model is quite
complex to implement in a digital processor. The following sections provide the motor’s equation and a
simplified model to be implemented in a microcontroller.

2.3.1.1 Motor model in abc frame


From the stator’s point of view a motor is simply a 3 phase balanced system, shown in figure 2.10. As
this is from stator’s reference point this is a stationary reference frame.
Voltages at each phase is given by the following equation, [17]
     
va ia Ψsa
d
 vb  = Rs  ib  +  Ψsb  (2.3)
dt
vc ic Ψsc

Were,
vabc = Phase voltages
Rs = Stator coil resistance
iabc = Phase currents
Ψsabc = Stator flux
and, Ψsabc is given by [18]      
Ψsa ia Ψra
 Ψsb  = Lss  ib  +  Ψrb  (2.4)
Ψsc ic Ψrc
Were,

Linköping University 9
Figure 2.10: 3-phase equivalent model of PMSM.

Lss = Inductance matrix, depends on motor


Ψrabc = Amplitude of the flux generated by the permanent magnets
   
Ψra cos(θe )
 Ψrb  = Ψr cos(θe − 2π/3) (2.5)
Ψrc cos(θe + 2π/3)
Here,
θe = Electrical angle of the rotor
Ψr = Amplitude of the flux generated by the permanent magnets

So the equation 2.3 can be written as,


       
va ia ia cos(θe )
d d
 vb  = Rs  ib  + Lss  ib  + Ψr cos(θe − 2π/3) (2.6)
dt dθe
vc ic ic cos(θe + 2π/3)

2.3.1.2 abc to αβ transformation (Clarke Transformation)


A three-phase system is a balanced three-phase system if the signals are in the following form [19]

xa = A cos(ωt + ϕ) (2.7)
xb = A cos(ωt + ϕ − 2π/3) (2.8)
xc = A cos(ωt + ϕ + 2π/3) (2.9)

For balanced system,


xa + xb + xc = 0 (2.10)
These variables may be voltage, current or magnetic flux. This three-phase system can be simplified to
2 phases by applying Clarke Transformation named after the inventor Edith Clarke [20].
1 1  
 
  r 1 − − xa
xα 2 2 2 
=  √ √   xb  (2.11)
xβ 3 3 3  xc
0 −
2 2

Linköping University 10
Figure 2.11: abc to αβ transformation.

2.3.1.3 Motor model in αβ frame


Motor model in αβ frame can be found by applying above transformation to the equation 2.6 [21].
     
d iα Rs 1 vα e
=− + − α (2.12)
dt iβ Ls Ls vβ eβ
Were,
iαβ = Stator currents
vαβ = applied stator voltages
Ls = Stator inductance
eαβ = Back EMF

and eαβ is given by [18],


r
3
eα = − Ψr ωe sin θe (2.13)
2
r
3
eβ = Ψr ωe cos θe (2.14)
2
Here,
Ψr = Amplitude of the flux generated by the permanent magnets
ωe = Electrical speed of the rotor
θe = Electrical angle of the rotor

2.3.1.4 αβ to dq transformation (Park Transformation)


Although αβ frame is reduced to 2 phases this reference frame is stationary. This is 2 phase projection
of the 3 phase model from the stator’s point of view. Also, the differential terms in equation 2.12 can
be hard and inefficient to compute by a microprocessor. To make them simpler these equations need to
be transformed to get the rotor’s perspective which will be in the rotation. This transformation is also
known as Park Transformation.
Which is given by,     
xd cos ωt sin ωt xα
= (2.15)
xq − sin ωt cos ωt xβ

Linköping University 11
Figure 2.12: αβ to dq transformation.

2.3.1.5 Motor model in dq frame


Motor model in dq frame is obtained by applying Park transformation [22] on equation 2.12.
Which is,
did vd Rs i d Lq
= − + .ωe .iq (2.16)
dt Ld Ld Ld
did
vd = Rs id + Ld − ωe .Lq .iq (2.17)
dt
and,
diq vq Rs .iq Ld ωe
= − − .ωe .id − λ (2.18)
dt Lq Lq Lq Lq
diq
vq = Rs iq + Lq + ωe .Ld .id + λωe (2.19)
dt
Here,
id,q = d-axis and q-axis currents
vd,q = d-axis and q-axis voltages
Ld,q = d-axis and q-axis inductance
Rs = Coil resistance
ωe = Electrical speed of the rotor
λ = Permanent magnet flux linkage.

2.3.1.6 Electromagnetic torque


Torque in dq frame is given by,
3
Te = pp[λiq + (Ld − Lq )id iq ] (2.20)
2
Rotor speed wr is given by,
d
J ωr = Te − fv ωr − Tl (2.21)
dt
For the motor used in this thesis equation 2.21 becomes,
 
d 3
J ωr = pp ∗ iq pp[λiq + (Ld − Lq )id iq ] − fv ωr − Tl (2.22)
dt 2

Here,
iq = Current in q axis
id = Current in d axis
Lq = q Axis inductance

Linköping University 12
Ld = d Axis inductance
pp = Number of pole pairs
J = Inertia moment
fv = Viscous friction coefficient
Tl = Load torque

2.3.2 Field Oriented Control implementation


FOC control algorithm constantly solves equations 2.17 and 2.19 to keep rotor and stator magnetic fields
aligned as mentioned in section 2.3. Differential terms in those equations can be ignored for the steady-
state as there is no change in currents in the steady-state.

Starting from the current measurement, phase currents are measured from the motor terminal, shown
in figure 2.13. Then Clarke and Park transformation is applied to generate id and iq currents. Which
is then compared with the reference, to generate the error. The error signal is then amplified by the
PI controllers. The decoupling block simultaneously calculates vdd and vqd to control d-axis and q-axis
voltage independently of their d and q axis currents. These voltages are added with the PI controllers’
output to generate vd and vq voltages. Inverse Carke transform then followed by Inverse Park transform
generates abc voltages that are required by PWM generator to generate Space vector modulated signals.
Which is then fed to the inverter that generates 3 phase voltage for the motor.

In summery FOC algorithm performs the following steps sequentially.


1. Measure motor speed and phase currents
2. Transform phase currents into 2 phase system, abc → αβ, using Clarke transformation
3. Perform αβ → dq using Park transformation
4. Calculate vdd and vqd independently using id and iq from Park transformation.
5. Calculate Output vd and vq from measured phase currents and decoupling block.
6. Apply inverse Park transformation, dq → αβ and inverse Clarke transformation, αβ → abc.
7. Generate space vector modulated waves from abc voltages.

vq
Speed ref PI(s) PI(s) a
iq_ref
vqd Inv Clarke SVPWM 3 Phase Inverter
iq &
b
vd Park
PI(s)
id_ref vdd c
id

Decoupling
ia

Clarke & Park ib

Angle

Hall
Hall Decoder Sensors PMSM
Speed

Figure 2.13: FOC algorithm.

2.3.3 Stator voltage decoupling


Both d and q axis voltages must be controlled independently to have proper field-oriented control [23].
But equations 2.17 and 2.19 show that vd is dependent on iq and vq is dependent on id . To control them
independently separate equations are computed by the decouple block in figure 2.13.

The decoupling block solves the following equations to generate vdd and vqd .

vdd = Rs id − ωe .Lq .iq (2.23)

Linköping University 13
vqd = Rs iq + ωe .Ld .id + λωe (2.24)

2.3.4 Speed and angle feedback from motor


Information of current speed is required by the FOC algorithm to generate correct vd and vq voltages,
also to determine if the motor is running at the speed desired speed set by the user. There are lots of
ways to measure the speed of the motor. But in this thesis, speed will be calculated by hall sensors
output. This method only uses software calculation, so no extra hardware is necessary.

2.3.4.1 Speed calculation from Hall sensor


Each hall sensor changes it’s output whenever rotor magnet changes from N → S or S → N with 50%
duty cycle.
Speed of the rotor can be calculated by the following equation [24].
f
Ns = 60 × (2.25)
pp
Here, Ns is the rotor speed in RPM, f is the frequency of the hall sensor and pp is the number of pole
pair of motor. As the duty cycle is 50%, only measurement of high time, T h is enough. Which is shown
in figure 2.14.

1 Revolution

Figure 2.14: Hall sensor and interrupt generator.

To measure the high time of the hall sensor an interrupt generator is used that produces a tick with
known time interval, Tq . Then, when the hall signal transitions from 0 → 1, a counter is incremented
with each tick, Tq . When the next falling edge of hall signal is detected the counter value is stored and
reset for the next cycle, which is shown in figure 2.15. Multiplying the counter value with tick interval,
Tq will give hall sensor high time,Th .

The following algorithm simplifies the frequency measurement process,

Step 1: Initiate the interrupt generator


Step 2: On the rising edge of hall sensor start the counter
Step 3: On the next falling edge stop the counter
Step 4: Store counter value and reset the counter
Step 5: Calculate f from equation 2.28
Step 6: Calculate and store rotor speed from equation 2.25
Step 7: Go to step 2.

Linköping University 14
1
Hall_input

0.8

0.6

0.4

0.2

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


Time (seconds) 10 -3

50
Counter

40

30

20

10

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


Time (seconds) 10 -3

Figure 2.15: Hall sensor’s frequency estimator.

From the following equations, f can be calculated. For this project, Tq = 10 µS.
Th = Tq × Nc (2.26)
T = 2 × Th (2.27)
1
f= (2.28)
T
Estimating speed from one hall sensor means speed is updated at every hall change or 180◦ . Which can
be a problem during startup or when the motor is ran at a slower speed. To avoid this problem all of
the hall sensors are used. With the same algorithm mentioned above except the counter is reset at every
hall change from all sensors. So reset pulse is generated from simple edge detection for all sensors and
counter is reset at every pulse from the edge detector. In this way the algorithm gives 6 times better
resolution for speed update.

2.3.4.2 Angle estimation


The angle of the motor can be easily calculated by the current speed of the motor. Equation 2.25 provides
the motor’s current speed in Rad/s. Simple integration over time produces an angle for the provided
speed. So, angular velocity of the rotor from equation 2.28 is,
ωe = 2 × π × f (2.29)
And rotor electrical angle, Z
θe = ωe dt (2.30)

Here, ωe is electrical speed of the rotor in Rad/s, and θe is the electrical angle of the rotor in Radians.

As the angle keeps increasing, it needs to be reset to align with phase A back emf. This is done through
correct edge of hall pulses. So the integrator is reset with correct hall edge to start the calculation again.

2.3.5 PWM techniques


2.3.5.1 Sinusoidal PWM
Pulse width modulation or PWM is a modulation technique where the width of a pulse signal or duty
cycle is modulated. This modulated pulse is applied to a switch like MOSFET or IGBT to control output

Linköping University 15
1
h_a

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Time (seconds)

1
h_b

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Time (seconds)

1
h_c

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Time (seconds)

1
Edge_abc

0.5

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Time (seconds)

Figure 2.16: Edge detection for hall sensors.

1
Fundamental freq
0.8 Triangle
Amplitude

0.6

0.4

0.2

0
0 0.05 0.1 0.15 0.2 0.25
Time (Seconds)

1
SPWM
0.8
Amplitude

0.6

0.4

0.2

0
0 0.05 0.1 0.15 0.2 0.25
Time (Seconds)

Figure 2.17: PWM generation.

voltage from a DC source. For example, speed control of a motor by changing battery voltage.
The modulator produces output 1 or 0 by comparing the amplitudes of a reference signal to a high-
frequency triangular wave. If reference amplitude is greater than carrier then output is high else output
is low. Figure 2.17 shows the comparison and PWM signal generation.

This ’high’ time is also called the duty cycle and expressed in percentage. As it shows the percentage
of DC voltage seen by the load. Dividing duty cycle by 100 gives modulation index. Which is another
representation of the ratio between applied DC voltage to the load and total DC voltage. so for modu-
lation index ma , 0 ≤ ma ≤ 1. In case of ma > 1, it is called over modulation.

For example, if a DC source is 24V and duty cycle is 30% or ma = 0.3 that is the switch stays 30% of

Linköping University 16
the time on and 70% of the off then the voltage seen by a load will be,
30
= 24 ×
100
= 7.2 V

Similarly for 90% duty cycle, ma = 0.9, and output voltage is,
90
= 24 ×
100
= 21.6 V

If a sinusoidal voltage is used as the reference then modulated PWM signal changes according to the
frequency of the sinusoidal voltage shown in figure 2.19. Using a low pass filter sinusoidal voltage can
be reproduced from the PWM signal. As the motor coils are huge inductors they act as low pass filters.
This way AC voltage is applied from a DC source. This is why this modulator is also called an inverter
and for 3 phase system, it is called 3 phase inverter.

1
Fundamental freq
Triangle
0.8

0.6

0.4

0.2

0
0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8
Time (seconds)

1
SPWM

0.8

0.6

0.4

0.2

0
0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8
Time (seconds)

Figure 2.18: PWM slowly decreasing width of the pulse.

2.3.5.2 Space vector PWM


High side switches in 3 phase inverter shown in figure 2.5 have 23 combinations. Low side switches are
complements of high side switches. All zeros and ones are invalid states so the rest of the combinations
can be expressed as vectors in a hexagon vector space shown in figure 2.20 [25]. Vectors and switch
combinations are listed in table 2.3. by modulating each nearby vectors’ magnitude the average voltage
Uref can be rotated. For a rotating Uref reference voltage is generated by injecting 3rd harmonic to a
sinusoidal voltage shown in figure 2.21. Space vector PWM provides 15.4% higher [14] [26] DC voltage
utilization compared to sinusoidal PWM. 3 phase reference voltage is shown in figure 2.22. Space vector
PWM signal is generated from this reference signal the same way discussed in section 2.3.5.1 which is
shown in figure 2.23.
Mathematical analysis and generation of Space vector PWM with a digital processor are quite complex
and are beyond the discussion of this thesis. So they are not included here.

Linköping University 17
1
Fundamental freq
0.8 Triangle

Amplitude
0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (Seconds)

1
SPWM
0.8
Amplitude

0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (Seconds)

Figure 2.19: Sinusoidal PWM generation.

Figure 2.20: Space Vectors.

Space Vector g1 g3 g5
U1 1 0 0
U2 1 1 0
U3 0 1 0
U4 0 1 1
U5 0 0 1
U6 1 0 1

Table 2.3: Space vectors with inverter gate signal.

Linköping University 18
1
3rd Harmonic
Fundamental freq
0.5

Amplitude
0

-0.5

-1
0 0.5 1 1.5
Time (sec)

SVPWM
0.5
Amplitude

-0.5

0 0.5 1 1.5
Time (sec)

Figure 2.21: Adding 3rd harmonic to fundamental frequency.

a
b
0.5 c
Amplitude

-0.5

0 0.5 1 1.5
Time (sec)

Figure 2.22: 3 phase space vector reference signal.

2.3.6 Startup issues with FOC and rotor alignment


Figure 2.13 and equations 2.17,2.19,2.23,2.24 show that there must be some speed to calculate angle, vd
and vq . It is also true that the control system designed in this thesis has a minimum running speed,
below which angle calculation will be inaccurate and the motor will stall. To avoid this start-up and
minimum speed condition a few steps can be taken. one of them is to start the motor open-loop with
a constant Vd and Vq. After minimum speed, the controller can slowly take over to avoid vibration.
But this technique comes with problems too. Start-up condition must be tuned to known load. Any
unknown load can cause rapid acceleration or stall.

This thesis deals with the start-up condition by changing the initial angle. At start-up, the FOC algorithm
has no idea of the angle of the rotor. So a small voltage is provided to vd , strengthening the magnetic
field of the rotor causing the rotor to align with the known stator magnetic field. This also provides
a small initial rotation, enough for the decoupling block to calculate vd and vq voltages which in turn
provides the necessary voltage to the motor. Figure 2.24 shows the initial angle and RPM change during
start-up.
At start-up, the control system performs the following actions,

Step 1: Disable current controllers


Step 2: Disable speed controller

Linköping University 19
1
Fundamental freq
0.8 Triangle

Amplitude
0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (Seconds)

1
SVPWM
0.8
Amplitude

0.6

0.4

0.2

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time (Seconds)

Figure 2.23: Space vector PWM generation.

20
Rpm_matlab
0

-20
RPM

-40

-60

-80

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35


Time (seconds)

1.5 Angle_matlab
Angle (Rad)

0.5

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35


Time (seconds)

Figure 2.24: Rotor alignment during startup.

Step 3: Set initial angle to π/6


Step 4: Apply voltage to d-axis to align the rotor to predefined angle from step 3.
Step 5: Enable current and speed controllers.

2.4 PI controller tuning and motor parameter dependency


The gain of the PI controller is calculated based on motor parameters [27]. Proportional and integral
gain is calculated from motor phase resistance, inductance, and rotor inertia. Gains can be found from

Linköping University 20
the following equations. Matlab script in appendix B shows the calculation used in simulation.

wm = Rs /Ld (2.31)
wc = 5 ∗ wm (2.32)
Kic = wc2 ∗ Ld (2.33)
Kpc = wc ∗ Ld (2.34)
ws = wc /10 (2.35)
Kis = ws2 ∗J (2.36)
Kps = ws ∗ J (2.37)

So in the case of a new motor, these parameters need to be updated manually before running the motor.
This process can be automated if motor parameter identification is included in the control system. Similar
process is discussed in [28].

2.5 Battery low voltage and field weakening


Part of the goal of this thesis is to run a PMSM with a constant RPM without exceeding phase current
limitation. Low battery voltage causes low inverter output voltages. Also, motor back EMF is directly
proportional to rotor speed. From equation 2.19, higher back emf λωe , will reduce iq current which in
turn limits the rotor’s maximum speed.

One of the methods to maintain high RPM is to weaken the magnetic field of the permanent magnets.
d-axis current is aligned with rotor magnetic field which was discussed in 2.3. Permanent magnets have
fairly constant magnetic flux [29]. Until now d-axis reference was set to zero to achieve maximum torque.
But applying currents to the d-axis can weaken or strengthen the rotor magnetic field. Applying a nega-
tive current to the d axis will weaken the flux. There are other methods of field weakening control [30–34].
The equation 2.19 also shows that vq is dominant at a high load, negative id allows lower vq for the same
rotor speed.

Setting negative id reference will allow the controller to apply appropriate voltage by the inverter. But
too much negative current reference may exceed the current limits for the inverter or the motor.

Linköping University 21
CHAPTER 3

Simulation

3.1 Introduction
Computer simulation of any model is the ideal way of understanding the behavior and overall perfor-
mance. Deploying and running a new control algorithm of a motor to an existing system can be dangerous
in real life.

To avoid damage to the motor or any other component both Six step control and Field oriented control
were simulated in Simulink. The simulation contains a PMSM motor model, that has parameters speci-
fied in table A.1.

Different parameter values were tested by applying different conditions and some of the values were
tweaked to achieve maximum performance. The control system was designed using the Linix motor [35],
provided by NXP and then tested on Boel motor [14] to check the performance and verify questions
asked in Chapter 1.

3.2 Simulation Overview


The Simulink model of FOC control is shown in figure 3.1. The model was designed to be implemented
in an embedded system. So control system and input-output were kept separated to make it easier for
hardware implementation.

FOC controller block consists of the control algorithm, shown in figure 3.2. Hall decoder reads hall
signals and performs calculations to provide angle and speed measurement discussed in section 2.3.4.
Decoupling block executes equations mentioned in section 2.3.3 and outputs calculated vd and vq . A
detailed view of this block is shown in figure 3.5.

The speed control block compares the current speed and measured speed from the Hall decoder block
and produces the reference q-axis current for the input speed. Detailed views are shown in figure 3.7.
Current measurement block measures phase currents using ADC then performs Clarke and Park trans-
form to produce d and q axis currents shown in figure 3.3. The difference between speed control blocks
output and Current measurement blocks output is the d and q axis error signals.

The current controller takes these error signals as input and PI controllers output d and q axis voltage
based on Kp and Ki gains calculated from motor variables. These outputs are then added with decou-
pling blocks output to produce d and q axis voltage by the Inverter to generate space vectors and space

22
vector PWM.The inverter control block, detailed view in figure 3.4, shows the generation of space vector
by the inverse Park and Clarke transform to produce Uref from d and q axis voltage discussed as in
section 2.3.5.2.

Rotor align block performs initial rotor alignment discussed in section 2.3.6 to align rotor to a predefined
angle by applying a voltage at d axis shown in the figure. Initialization block provides a signal to sync
this initialization and disable all other blocks as necessary.
FOC Controller

Phase Current Out In

Speed input
ADC

Hall out In

U_ref
Discrete Hall Sensor
5e-06 s.

U_ref

Uref Tm
+ T_in
A A
12 V m
B B
-
C C

PMSM
3 Phase Inverter

Figure 3.1: Field oriented control Simulink model.

Hall decoder [V_q] [V_d] [init] [Te]


Hall
[init] int_ctrl
3 Hall
vq_d

vd_d

Angle
Init_ctrl
Angle [Te] Speed input
Speed

[init] Init_ctrl
1 Speed_reference Speed_ctrl_out iq_err
iq_ref iq_err
vd vd_in vd_out vd

Speed_estimated
RPM
[iq] [init] Init_ctrl u_ref 1
Speed Control U_ref

Phase Current
Speed_in

[id] id_ref vd_d [V_d] vq vq_in vq_out vq


2 Current iq id_err
q_mes id_ref id_err
[iq] iq_ref vq_d [V_q]
[id] Current Control
Decoupling Rotor Align Inverter Control
[Te] Angle id
d_mes
init [init]

Initialization Current Measurement

Figure 3.2: FOC controller

a α α
1 Clarke d 2
Transform
Current b β β id
Park
Transform
sin sinθ
Sine e
2 θ Cosine q 1
e
LUT cosθ
Angle cos e
iq

Figure 3.3: Current measurement

Linköping University 23
1 d
a A
vd
α α

2 q
vq
Inverse Inverse B U_ref 1
Park Clarke b
u_ref
sin sinθ
e
Sine
3 θ Cosine β β
e
LUT
Angle c C
cos cosθ
e

Sine-Cosine Lookup Inverse Park Transform Inverse Clarke Transform Space Vector Generator

Figure 3.4: Inverter control block.

id_mes 1

did vd R s id Lq
= − + .ωe.iq
dt Ld Ld Ld 1
iq_mes 2 vd_d
did
vd = R sid + Ld − ωe.Lq.iq [we]
dt

Speed_in 3 [we]

rpm2rad/s

2
iq_mes_copy
diq vq Rs.iq Ld ωe
= − − .ωe.id − λ id_mes_copy
dt Lq Lq Lq Lq 1
2
di vq_d
vq = Rsiq + L q q + ωe.Ld .id + λωe
dt [we]

Figure 3.5: Decoupling.

1
vd_in >= 1
vd_out

3
Init_ctrl
2
vq_in >= 2
vq_out

Figure 3.6: Initial rotor alignment.

Linköping University 24
id_err 3 5
vd_d

P
PI(z) 1
I vd

2
Init_ctrl
pi_d

iq_err 1 4
vq_d

P
PI(z) 2
I vq

pi_q

Figure 3.7: Current controllers.

3.3 Speed and current controller


There are two feedback loops to control a PMSM motor in this algorithm. Speed control loop and current
control loop. This is also described in 2.3.2. Current controllers’ gain is chosen to be much faster than
the speed controller to maintain stability.

Speed controller receives speed feedback from hall sensor decoder and outputs necessary voltage command
for Current controllers. The current controllers constantly monitor motor phase currents and based on
the speed controller’s output, provide voltage command to the Space vector modulator. The decoupling
block’s output is added with the current controller’s output to control d and q axis voltage independently.

3.3.1 Speed control


Speed controller amplifies the error signal produced by the controller from the difference between user
input and current estimated speed input. Speed controllers gain is calculated from motor specifications
shown in the script B. On the figure 3.9 it is shown that the speed controller is tracking input speed
with no load condition. Figure 3.10 shows the same motor running at 500 RPM while torque on 0.02
Nm applied at 1.5 sec.

Speed_reference 2

int_ctrl 1 >=

3 P
Speed_estimated PI(z) 1
I Speed_ctrl_out

pi_s

Figure 3.8: Speed controller.

Linköping University 25
2000 Motor RPM
Speed_ref

Motor Speed (RPM)


1500

1000

500

0 1 2 3 4 5
Time (Seconds)
Figure 3.9: Speed tracking by the controller without load.
Speed (RPM)

400

200

0 Motor RPM

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


Time (Seconds)

0.04
Torque (Nm)

0.02

0 Torque

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2


Time (Seconds)

2
Current (A)

0 Ia
Ib
Ic
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (Seconds)

Figure 3.10: Fixed RPM with 0.02 Nm external load.

Linköping University 26
3.3.2 Current control
Figure 3.13 shows the transformation results of phase currents. d and q axis currents are transformed
using Clarke and park transformation. Figure 3.14 shows the output vd and vq which is calculated from
decoupling block and current measurement block. Inverter control block produces necessary space vector
signal as output is shown in figure 3.15. Figure 3.16 shows phase currents for the same time.

1
q_measured
iq_ref
0.5
Current (A)

-0.5

-1
0 1 2 3 4 5
Time (Seconds)
Figure 3.11: q-axis current control

d_measured
0.3 id_ref
Current (A)

0.2

0.1

-0.1

0 1 2 3 4 5
Time (Seconds)
Figure 3.12: d-axis current control

Figure 3.11 and 3.12 shows current tracking for the same simulation on figure 3.9. Differences at the
beginning of the simulation is from rotor alignment. After initial rotor alignment idref is zero. Measured
d-axis current also measures the same value. Changes in speed reference require higher or lower iq
current. Figure 3.11 and 3.12 shows reference currents are well tracked by the current controllers.

Linköping University 27
q_measured
2

Current (A)
1.5

0.5

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (Seconds)

d_measured
0.3
Current (A)

0.2

0.1

-0.1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (Seconds)

Figure 3.13: Measured currents

Vq and Vd output
vq
1.5
Voltage (V)

0.5

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (Seconds)

0 vd
Voltage (V)

-0.5

-1

-1.5
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Time (Seconds)

Figure 3.14: Vd and Vq voltage outputs.

Linköping University 28
U_ref_a
0.2 U_ref_b
U_ref_c
0.1

Voltage (V) 0

-0.1

-0.2

-0.3
0.4 0.45 0.5 0.55
Time (Seconds)
Figure 3.15: Space vector generation.

1.5
Ia
1 Ib
Ic
0.5
Current (A)

-0.5

-1

-1.5
0.4 0.5 0.6 0.7
Time (Seconds)
Figure 3.16: Phase currents

Figure 3.10 also shows that the current controllers control phase currents according to the load or input
speed. When a torque was applied externally at 1.5 sec, more current was applied to the motor to sustain
500 RPM by the controller. Figure 3.14 also shows higher vq voltage.

Linköping University 29
3.4 Speed and Angle simulation
3.4.1 Speed estimation using hall sensors

500 Rpm_h_abc
Rpm_h_a
400 Rpm_actual
Speed (RPM)

300

200

100

0.3 0.35 0.4 0.45 0.5 0.55


Time (sec)
Figure 3.17: RPM calculation using 1 and 3 hall sensors and actual RPM.

Figure 3.17 shows speed calculation results from one hall sensor and 3 hall sensors. Using 3 hall sensors
provides better speed resolution as mentioned in section 2.3.4.1.

3.4.2 Angle estimation simulation

1500 Rpm_estimated

1000
RPM

500

0
0.35 0.4 0.45 0.5 0.55 0.6
Time (seconds)
Angle (Radians)

6 Angle_actual
Angle_estimated
4

0
0.35 0.4 0.45 0.5 0.55 0.6
Time (seconds)

Figure 3.18: Estimated angle from calculated speed.

Figure 3.18 shows that as soon as the motor speeds up, the estimated gets closer to the actual angle. So
at higher speeds, the estimation error will be almost zero.

Linköping University 30
3.5 Low battery voltage operation
Section 2.5 discusses techniques to maintain high RPM at lower battery voltage. To simulate low volt-
age operation the motor was run at various DC voltage levels simulating different battery charge levels.
Measured parameters are listed in table 3.1.

DC voltage is measured from the battery terminal. id_ref is the applied id reference for different cases.
id and iq are dq currents, measured at output Current measurement block shown in figure 3.3. vd and
vq are the controller output voltage to the inverter, measured at the current controllers’ output, shown
in figure 3.7. For motor phase currents, only phase A current is shown in the table as the rest of the
phases are the same. The mod index is the modulation index calculated by the following equation,
q
vd2 + vq2
ma = (3.1)
DC
2

Measured(A) Output(V) Current(A) Mod index


DC(V) id_ref(A) RPM(max) id iq vd vq Phase a m_a
0 3546 0 2.8 -2 146 2.8 1.17
-2 3719 -2 3 -2.5 147 3.8 1.18
-4 3866 -4 3.2 -2.6 146 5.1 1.17
250
-6 4117 -6 3.4 -3 146 6.9 1.17
-8 4218 -8 3.7 -3.4 145 8.8 1.16
-10 4435 -10 4 -3.9 145 10.8 1.16
0 3196 0 2.5 -1.6 132 2.6 1.17
-2 3328 -2 2.6 -1.9 131 3.5 1.16
-4 3474 -4 2.9 -2.1 131 4.9 1.16
225
-6 3630 -6 3.1 -2.5 131 6.7 1.16
-8 3806 -8 3.3 -2.8 131 8.6 1.16
-10 3992 -10 3.6 -3.2 131 10.6 1.16
0 2843 0 2.3 -1.4 117 2.3 1.17
-2 2960 -2 2.6 -1.6 117 3.3 1.17
-4 3090 -4 2.6 -1.6 117 4.8 1.17
200
-6 3231 -6 2.8 -2 117 6.6 1.17
-8 3426 -8 3 -2.3 119 8.5 1.19
-10 3609 -10 2.4 -2.7 119 10.4 1.19
0 2565 0 2.1 -1.2 106 2.1 1.18
-2 2678 -2 2.2 -1.3 106 3.2 1.18
-4 2803 -4 2.3 -1.5 106 4.7 1.18
180 -6 2920 -6 2.5 -1.6 106 6.5 1.18
-8 3086 -8 2.7 -1.8 106 8.4 1.18
-12 3374 -12 3.2 -2.4 105 12.4 1.17
-15 3657 -15 3.6 -3 104 15.4 1.16

Table 3.1: Low battery voltage simulation result.

The table shows that applied negative d-axis current increases RPM. This can be used partly to alleviate
speed loss during low battery voltage. idref can be reduced as long as phase currents do not exceed the
hardware limit. Here rated maximum phase current is 100 A.
The first case can be considered where without any field weakening the motor produces 3500 RPM at
250V. This speed was maintained throughout the voltage drop cases. Even at 180 V, the motor can
produce 3500 RPM with a higher phase current. The calculated modulation index also shows 15%
overmodulation with slight roundoff errors. This is true for the space vector modulation technique.

Linköping University 31
3.6 Running different motor
The Boel motor in appendix A.1 was run with 200 VDC, without making any change in the control
system. Figure 3.19 shows speed control performance and figure 3.20 shows the output motor torque.

2000 Motor RPM


Motor Speed (RPM) Speed_ref
1500

1000

500

0
0 2 4 6 8 10 12
Time (Seconds)
Figure 3.19: Boel motor speed control.

2000
Motor RPM
Speed_ref
Speed (RPM)

1500

1000

500

0
0 2 4 6 8 10 12
Time (Seconds)

Torque
2
Torque (Nm)

-1

-2
0 2 4 6 8 10 12
Time (Seconds)

Figure 3.20: Motor speed and output torque of the Boel motor.

Linköping University 32
10
d_measured 4 q_measured
8 id_ref iq_ref

6 2

Current (A)
Current (A)

4
0
2

0 -2
-2

0 5 10 0 5 10
Time (Seconds) Time (Seconds)
(a) d-axis current control. (b) q-axis current control.

Figure 3.21: Current control performance of the Boel motor.

10
Ia
Ib
Ic
5
Current (A)

-5

0 2 4 6 8 10 12
Time (Seconds)
Figure 3.22: Phase currents for the given reference speed.

Figure 3.22 shows phase currents at no load operation for the given speed reference. Figure 3.21b and
3.21a shows current control performance with new control gains. This proves that it is possible to run a
separate motor with this control system with new current and speed control gains as long as the motor
specifications are known.

Linköping University 33
CHAPTER 4

Discussion

4.1 Introduction
This chapter contains a discussion between the questions asked in chapter 1 theories provided in chapter
2 and results from the simulation chapter.

4.2 Results
The primary goal of this thesis was to run a PMSM and investigate the situation for low battery voltage
and maintain RPM and run a different motor with minimum or no change in the control algorithm.

Speed tracking simulations in Figures 3.9, 3.10, 3.19 and 3.20 show that the control system can run a
PMSM with minimum overshoot while input speed reference changes. Speed control is stable and fast.
As the speed is estimated from the hall sensors speed calculation error minimizes with higher speed.
Angel estimation error is multiplied by the speed estimation. So minimum speed error means low angle
estimation error.

Table 3.1 shows the performance during low battery voltage operation. RPM values at lower idref show
that it is possible to maintain a high RPM at low battery voltage. The theory section 2.5 discussed that
field weakening will allow higher motor speed at lower dc voltage levels with higher phase current. But
this high speed comes at the cost of torque. Since the battery has less power at lower voltages, the motor
can not produce the same power, in other words, maintain high speed and high torque at the same time.
So when battery voltage drops controller applies low idref to increase the speed at lower torque output.
This can be observed at phase current too. With lower idref , phase current increases to maintain higher
speeds. Also in section 2.3.5.2, it was mentioned that Space vector modulation allows 15% more use of
DC voltage. Maximum speed is achieved when the motor is run at maximum DC voltage. So in the case
of space vector modulation, if modulation index ma = 1.15 then the motor will run at maximum speed.
Modulation index results and RPM values in the table prove this. There are some roundoff errors, which
caused ma > 1.15.

For the second motor, only gains of current and speed controller were changed. So the second question
asked in chapter 1 is yes, the control system can run any motor as long as the specifications are known
and have fixed d and q axis inductances.

34
4.3 Methods
Field-oriented control is not a new control algorithm and all the IEEE papers and books used in this
thesis work show the same equations for implementation. But improvement the possibilities of the algo-
rithm are endless. Few estimation techniques were used in this thesis work with better estimation the
control algorithm will perform better and become robust. In [24] speed estimation was done by using
one hall sensor but in this thesis use if three hall sensor technique shows better performance.

Currently, negative speed is not taken into account. So the motor can only run in one direction. Direc-
tion identification requires detecting predefined hall patterns, which is kept as future work.

There are motors available that have variable d and q axis inductances. This control system can not run
these types of motors yet. Future improvements are necessary to run these motors.

Hardware implementation raises safety concerns. At the time of implementation in an embedded system,
the control system might need modification or tweaking based on performance. So this model despite
having good simulation performance is not yet ready to be implemented in hardware.

Linköping University 35
CHAPTER 5

Conclusion

5.1 Conclusion
The thesis intended to implement closed-loop field-oriented control with hall sensor feedback for speed
and angle estimation and study the case for low battery voltage and the use of different motors. The
theory chapter provides theories and mathematical analysis for the control algorithm. The simulation
results show that positive outcomes for the research questions asked in chapter one.

5.2 Future works


This project already shows good performance in simulation. However, lot of improvements can still be
done. A few of them are,

• Implementation of negative speed.


• making the control algorithm sensorless.
• Making the estimators robust to handle low speeds

• Improving the control algorithm to run motors that have d and q axis inductance matrix.
• Making the control system automatic. So that it can measure motor variables by running a self-test
algorithm.

36
References

[1] C.-I. Nicola, M. Nicola, A. Vintilă, and D. Sacerdoţianu, “Identification and sensorless control of
pmsm using foc strategy and implementation in embedded system,” in 2019 International Conference
on Electromechanical and Energy Systems (SIELMEN), pp. 1–6, 2019.

[2] L. Qu, L. Qu, and W. Qiao, “A linear active disturbance rejection controller-based sensorless control
scheme for pmsm drives,” in 2019 IEEE Energy Conversion Congress and Exposition (ECCE),
pp. 792–797, 2019.
[3] L. Yu, C. Wang, H. Shi, R. Xin, and L. Wang, “Simulation of pmsm field-oriented control based on
svpwm,” in 2017 29th Chinese Control And Decision Conference (CCDC), pp. 7407–7411, 2017.

[4] F. Jin, W. Qian, H. Bai, D. Lu, and B. Cheng, “Using one fpga to control two high-switching-
frequency pmsm drive systems through a novel time-division multiplexing method,” in 2018 IEEE
Applied Power Electronics Conference and Exposition (APEC), pp. 998–1002, 2018.
[5] M. Caruso, A. Di Tommaso, R. Miceli, C. Nevoloso, G. Vassallo, and G. Vitamia, “Foc with resolver
implementation for pmsm drives by using a low cost atmel sam3x8e microcontroller,” in 2020 Fif-
teenth International Conference on Ecological Vehicles and Renewable Energies (EVER), pp. 1–8,
2020.
[6] A. O. di Tommaso, R. Miceli, G. R. Galluzzo, and M. Trapanese, “Efficiency control for permanent
magnet synchronous generators,” in 2006 IEEE International Conference on Industrial Technology,
pp. 2079–2084, 2006.

[7] M. Caruso, A. O. Di Tommaso, M. Lombardo, R. Miceli, C. Nevoloso, and C. Spataro, “Experimental


comparison of two control algorithms for low-saliency ratio interior permanent magnet synchronous
motors,” in 2018 Thirteenth International Conference on Ecological Vehicles and Renewable Energies
(EVER), pp. 1–6, 2018.
[8] M. Caruso, A. O. Di Tommaso, R. Miceli, C. Nevoloso, C. Spataro, and F. Viola, “Enhanced loss
model algorithm for interior permanent magnet synchronous machines,” in 2017 AEIT International
Annual Conference, pp. 1–6, 2017.
[9] M. Caruso, A. O. Di Tommaso, F. Genduso, and R. Miceli, “Experimental investigation on high
efficiency real-time control algorithms for ipmsms,” in 2014 International Conference on Renewable
Energy Research and Application (ICRERA), pp. 974–979, 2014.

[10] C. Cavallaro, A. Di Tommaso, R. Miceli, A. Raciti, G. Ricco Galluzzo, and M. Trapanese, “Anal-
ysis a dsp implementation and experimental validation of a loss minimization algorithm applied to
permanent magnet synchronous motor drives,” in IECON’03. 29th Annual Conference of the IEEE
Industrial Electronics Society (IEEE Cat. No.03CH37468), vol. 1, pp. 312–317 vol.1, 2003.

37
[11] G. Schettino, C. Buccella, M. Caruso, C. Cecati, V. Castiglia, R. Miceli, and F. Viola, “Overview
and experimental analysis of mc spwm techniques for single-phase five level cascaded h-bridge fpga
controller-based,” in IECON 2016 - 42nd Annual Conference of the IEEE Industrial Electronics
Society, pp. 4529–4534, 2016.

[12] M.-F. Tsai and H.-C. Chen, “Design and implementation of a cpld-based svpwm asic for variable-
speed control of ac motor drives,” in 4th IEEE International Conference on Power Electronics and
Drive Systems. IEEE PEDS 2001 - Indonesia. Proceedings (Cat. No.01TH8594), vol. 1, pp. 322–328
vol.1, 2001.
[13] M. T. Kassa and D. Changqing, “Design optimazation and simulation of pmsm based on maxwell and
twinbuilder for evs,” in 2021 8th International Conference on Electrical and Electronics Engineering
(ICEEE), pp. 99–103, 2021.
[14] A. Kronberg, “Salient pole motor inverter design: with implementation of space vector modulation,”
2012.

[15] M. Johansson, “Evaluation of sensor solutions & motor speed control methods for bldcm/pmsm in
aerospace applications,” 2017.
[16] X. Gao, “Bldc motor control with hall sensors based on frdm-ke02z,” 2013.
[17] D. Daniel, “Pmsm and foc theory.” https://community.nxp.com/t5/
NXP-Model-Based-Design-Tools/Module-2-PMSM-and-FOC-Theory/m-p/761926.

[18] G. Alain and J. De Leon-Morales, Sensorless AC Motor Control: Robust Advanced Design Tech-
niques and Applications. SPRINGER, May 2005.
[19] Fadili, Abdelmounime El Magri, Fouad Giri, and Abderrahim El , Control Models for Synchronous
Machines, ch. 3, pp. 41–56. John Wiley & Sons, Ltd, 2013.

[20] Wikipedia contributors, “Alpha–beta transformation — Wikipedia, the free encyclopedia,” 2021.
[Online; accessed 14-March-2021].
[21] I. WESTIN, “Sensorless control of a pmsm,” 2016.
[22] Mathworks, “Permanent magnet synchronous machine.” https://se.mathworks.com/help/
physmod/sps/powersys/ref/permanentmagnetsynchronousmachine.html.
[23] F. Semiconductor, “Sensorless pmsm vector control with a sliding mode observer for compressors
using mc56f8013,” 2008.
[24] D. Daniel, “Motor control class: Lecture 10 - speed estimator.” https://community.nxp.com/t5/
NXP-Model-Based-Design-Tools/Motor-Control-Class-Lecture-10-Speed-Estimator/m-p/
681518.
[25] Mathworks, “Space vector modulation (svm) for motor control.” https://se.mathworks.com/
solutions/power-electronics-control/space-vector-modulation.html.
[26] L. Zhen, “Sinusoidal control of bldcm with hall sensors based on frdm-ke04z and tower board,” 2014.

[27] L. Harnefors and H. Nee, “Control of variable speed drives applied signal processing and control,”
Mälardalen University, Västeras, Sweden, 2002.
[28] Mathworks, “Estimate pmsm parameters using recommended hardware.” https://se.mathworks.
com/help/mcb/gs/estimate-pmsm-parameters-using-recommended-hardware.html.

[29] T. Deng, Z. Su, J. Li, P. Tang, X. Chen, and P. Liu, “Advanced angle field weakening control
strategy of permanent magnet synchronous motor,” IEEE Transactions on Vehicular Technology,
vol. 68, no. 4, pp. 3424–3435, 2019.

Linköping University 38
[30] R. U. Lenke, R. W. De Doncker, M.-S. Kwak, T.-S. Kwon, and S.-K. Sul, “Field weakening control of
interior permanent magnet machine using improved current interpolation technique,” in 2006 37th
IEEE Power Electronics Specialists Conference, pp. 1–5, 2006.
[31] D. Stojan, D. Drevensek, Z. Plantic, B. Grcar, and G. Stumberger, “Novel field-weakening con-
trol scheme for permanent-magnet synchronous machines based on voltage angle control,” IEEE
Transactions on Industry Applications, vol. 48, no. 6, pp. 2390–2401, 2012.
[32] Z. Lei, W. Xuhui, Z. Feng, K. Liang, and Z. Baocang, “Deep field-weakening control of pmsms for
both motion and generation operation,” in 2011 International Conference on Electrical Machines
and Systems, pp. 1–5, 2011.

[33] C.-T. Pan and J.-H. Liaw, “A robust field-weakening control strategy for surface-mounted
permanent-magnet motor drives,” IEEE Transactions on Energy Conversion, vol. 20, no. 4, pp. 701–
709, 2005.
[34] L. Harnefors, K. Pietilainen, and L. Gertmar, “Torque-maximizing field-weakening control: design,
analysis, and parameter selection,” IEEE Transactions on Industrial Electronics, vol. 48, no. 1,
pp. 161–168, 2001.
[35] F. Semiconductor, “Bldc sensorless reference design using mc56f8006,” 2009.

Linköping University 39
APPENDIX A

Motor Specifications

In this project, Linix 45ZWN24-40 [35] and Boel motor [14] were simulated.

Parameter Linix 45ZWN24-40 Boel Motor Unit


Pole-pair number 2 2 ∼
Stator resistance 0.56 0.015 Ohm
Direct axis inductance 0.000375 0.004 H
Quadrature axis inductance 0.000435 0.001 H
Back-EMF constant 0.0135281 ∼ V*Sec/rad
Drive inertia 0.000012 0.003334 Kg*m^2
Maximum current 2.3 100 A
Rated speed 2000 3000 RPM
Friction 0.0001529694 0.00425 Nms

Table A.1: Motor specifications.

40
APPENDIX B

Matlab Script for PI gain calculation

1 clc
2 clear
3
4 % Motor Parameters for Linix / NXP motor
5
6 pp = 2; % Pole pair
7 Rs = 0.56; % Stator resistance [ Ohm ]
8 Ld = 0.000375; % Direct axis inductance [ H ]
9 Lq = 0.000435; % Quadrature axis inductance [ H ]
10 Ke = 0.0135281; % Back - EMF constant [ V . Sec / rad ]
11 J = 0.12 e -4; % Drive inertia [ kg . m2 ]
12 lambda = sqrt (2/3) * Ke / pp ; % Flux linkage
13
14 % PI gain Calculation
15 wm = Rs / Ld ;
16 wc = 5* wm ;
17 ws = wc / 10;
18
19 % Speed controller gain
20 Ki_s = ws ^2 * J ; % Integral gain
21 Kp_s = ws * J ; % Proportional gain
22
23 % Current controller gain
24 Ki = wc ^2 * Ld ;
25 Kp = wc * Ld ;
26
27 % Simulation Parameters
28 Ts = 5e -6; % Sample time
29
30 % Speed calculation
31 int_b = 0.01 e -3; % Interrupt Base
32
33 disp ( ' Motor parameters initialized ! ')

41
www.liu.se

You might also like