Field Oriented Control of a PMSM using a Single DC Link Shunt - description

A p p l i c a t i o n N o t e , V 1 . 0, May 2004
AP16084
FOC of PMSM
AP16084
Introduction
16 Bit CMOS
Microcontroller
Product
Field Oriented Control of a PMSM
using a Single DC Link Shunt
Microcontrollers
Application Note
N e1 v e r
s t o p
t h i n k i n g .
XC167CI
Revision History:
2004-05
Previous Version:
Page
Subjects (major changes since last revision)
V 1.0
Controller Area Network (CAN): License of Robert Bosch GmbH
We Listen to Your Comments
Any information within this document that you feel is wrong, unclear or missing at all?
Your feedback will help us to continuously improve the quality of this document.
Please send your proposal (including a reference to this document) to:
[email protected]
AP16084
FOC of PMSM
Introduction
Table of Contents
Page
1
Introduction.............................................................................................................. 5
2
2.1
2.1.1
2.1.2
2.2
2.3
2.4
2.5
Technical Bases ...................................................................................................... 6
Mathematical Models for a PMSM.................................................................... 6
Per Unit Quantities .......................................................................................... 6
Basic Electrical Equations .............................................................................. 7
Construction of a PMSM.................................................................................... 8
Field Oriented Control......................................................................................... 9
Phases Current Acquisition via DC Link Shunt Measurement...................10
Sensorless Model..............................................................................................13
3
3.1
3.2
3.3
3.4
3.5
3.5.1
3.5.2
Components...........................................................................................................15
General remarks ................................................................................................15
PMSM..................................................................................................................16
Inverter ................................................................................................................17
XC167CI-Board.................................................................................................18
Sensors ...............................................................................................................19
Incremental Encoder.....................................................................................19
Shunt-Current Sensor...................................................................................21
4
4.1
4.2
4.3
4.4
4.5
4.6
4.7
Implementations ....................................................................................................22
Software Flow Charts .......................................................................................22
Fixed Point Number Representation..............................................................23
Frame Conversions...........................................................................................25
Space Vector Modulation.................................................................................27
PI Controller.......................................................................................................31
Current Measurement in the DC Link............................................................32
Analog Output (D/A Conversion)....................................................................35
5
5.1
5.2
Optimizations .........................................................................................................36
Measurement Handling in sector edges („Black Zones“)............................36
Faster Operations with the MAC Unit.............................................................37
6
6.1
6.2
6.3
6.4
Measurement Results ..........................................................................................38
Phases and DC-Link Currents.........................................................................38
Dynamical Behavior..........................................................................................40
CPU Performance .............................................................................................41
Pictures ...............................................................................................................42
7
Conclusions............................................................................................................43
References ................................................................................................................................44
Glossary ……………………………………………………………………………………..45
Application Note
3
AP16084
FOC of PMSM
Introduction
Application Note
4
AP16084
FOC of PMSM
Introduction
1
Introduction
A Brushless Permanent Magnet Synchronous Motor (PMSM) has a wound stator and
a permanent magnet rotor assembly. This configuration offers some advantages :
•
•
•
•
High efficiency
Reduction of the motor size (high torque per volume)
Low moment of inertia (rotor inertia)
In comparison with DC motors, the elimination of brushes reduces noise,
electromagnetic emission generation and the maintenance of brushes.
A brushless motor is not self-commutating, therefore is more complicated to control
this motor. The currents and voltages applied to the motor windings must be controlled
independently and correctly as a function of rotor position in order to produce useful
torque.
There are two different ways to control this motor:
• Brushless DC mode with a rectangular (trapezoidal) current impressed into the
PMSM with constant amplitude during 60°.
• Field oriented control with sinusoidal currents, which provides an optimum of torque
production (no torque ripple).
This Application Note describes a field-oriented control that is implemented on an
Infineon XC167CI Microcontroller based system . It begins with an introduction of the
most important technical bases, then are described the used hardware in this project
and the implementation of the software components (especially the implementation of
the space vector modulation, the transformations into the different co-ordinate systems
and the current measurements in the DC-link).
Application Note
5
AP16084
FOC of PMSM
Technical Bases
2
Technical Bases
2.1
Mathematical Models for a PMSM
2.1.1
Per Unit Quantities
Per unit quantities are actual physical quantities (e.g. voltage, current, speed etc.)
which are related to a reference quantity. Therefore, they have the dimension 1 and
give the relative value of the physical quantity compared to the reference quantity. [1]
Example:
The nominal current of the PMSM is 10A. In order to get per unit current quantities we
choose the peak current at rated operation as the reference quantity: Iref = v2*InomialRMS
= 14.1A. We get the p. u. quantity by i(t) = I(t)/ Iref. If, for example, the actual current
were I(t) = 7.07A, we could write i(t) = 0.5 as p.u. quantity.
Physical quantity
Symbol
Reference quantity
p. u. symbol
Angular-position
?
?ref = 1rad
?
Angular speed
O
O ref = O nominal(synch)
?
Time
t
tref = O ref
t
Voltage
V
Vref = v2* VnominalRMS
v
Current
I
Iref = v2*InominalRMS
i
Flux linkage
?
?
Vref*t ref
?
Resistance
R
Rref = Vref/Iref
r
Inductance
L
Lref = 1/Oref*Uref/Iref
l
Table 1
used
ref =
Set of reference quantities of the most important physical quantities
Note: All physical quantities used in this document are per unit quantities
(unless otherwise noted).
Application Note
6
AP16084
FOC of PMSM
Technical Bases
2.1.2
Basic Electrical Equations
Voltage equation of a coil:
v (τ ) = r ⋅ i (τ ) +
dΨ
(1)
dt
This equation in a three-phases winding system, using the powerful space vector
definition:
dΨS
v S = rS ⋅ iS +
(2)
dτ
The stator flux linkage for a general AC machine with a permanent magnet system is
given by the equation:
ΨS = lS ⋅ iS + ΨM ( 3 )
In which ? M is meaning the flux linkage space vector evoked by the permanent
magnet system. [2]
Note: Underscored variables are space vectors.
Torque production in a PMSM
Starting from the fact that the force ? F produced at a certain point in winding system is
given by the vectorial product of the local vector quantities (no p. u. quantities)
r
r r
∆F = I ⋅ ∆s × B ( 4 )
(With current in the winding I, the regarded length of winding piece ?s and the local
flux density B). We can integrate the force around the air gap and substituting the local
quantities by the proportional representing space vector quantities. Then we obtain
t = i s ⋅ Ψs ⋅ sin( ∠is , Ψs ) ( 5 )
That means the torque t produced at a certain moment is proportional to the area
defined by the space vectors of stator current and stator flux linkage. (Figure 1) [2]
Application Note
7
AP16084
FOC of PMSM
Technical Bases
q-Axis
Torque
d-Axis
iS
?M
Figure 1
Torque Production in an AC Motor Visualized by Space Vectors
Note: If the space vectors of stator current and stator flux linkage are parallel,
the machine produces no torque. If the space vectors are orthogonal, the
torque has a maximum.
2.2
Construction of a PMSM
The Permanent Magnet Synchronous Motor is an important drive in servo, positioning
and robotic applications. However, it gets increasing importance in the field of low cost
drives as pumps, fans etc.
Compared to DC and induction motors, the PMSM has many advantages, especially
high efficiency, high torque per volume and low moment of inertia.
The stator is laminated and has frequently slots like a classical AC stator. However,
the stator may be skewed for reducing torque due slotting. Small PMSMs can be fitted
with an air-gap winding system, hence no slots are used and the full winding space is
filled with copper. This yields an extreme low stator inductance and hence high current
per time. This is advantageous with respect to fast change of internal torque but needs
high switching frequency for avoid current ripple.
Different rotor constructions are possible. The most usual is to glue the magnets onto
the rotor surface. However, for flux concentration, buried magnets can be used.
Application Note
8
AP16084
FOC of PMSM
Technical Bases
U
W'
V
N
S
V'
W
U'
Figure 2
2.3
Principle Drawing of a PMSM
Field Oriented Control
The permanent magnets evoke a magnetic field in rotor, which links the stator winding
system well. The main task of PMSM control is to impress the stator current space
vector in an appropriate direction relative to the flux space vector. According to Figure
1 and equation 5, it is clear that the optimum torque production is achieved if the stator
current space vector is placed ±90° relative to the permanent magnet flux space
vector.
The control scheme like this in Figure 3 provides this functionality.
The currents iU and iV are measured with two current sensors. The Clarke
transformation is applied to them to determine the stator current projection in the two
co-ordinate a,ß non-rotating frame. The Park transformation is then applied in order to
obtain this projection in the d,q-rotating frame.
The speed controller calculates a reference torque, which is proportional to the
quadrature-axis stator current component iSqref. The direct-axis stator current
component iSdref is set to zero if there is no field weakening is used (refer to formula
(5)).
The d,q projections of the stator phase currents are then compared to their reference
values iSqref and iSdref and corrected by mean of PI current controllers. The outputs of
the current controllers are passed through the inverse Park transform and a new stator
voltage vector is impressed to the motor using the Space Vector Modulation technique.
Application Note
9
AP16084
FOC of PMSM
Technical Bases
Figure 3
FOC of a PMSM
Note: For field-oriented control with sinusoidal currents, we need a quasicontinuous three phase’s current information and a rotor position (speed)
information.
The information about the phase currents can be obtained by two current sensors e.g.
by phase shunts or current transducers, so-called LEM´s.
The information about the rotor position can be obtained by position sensors (e.g.
incremental encoder, absolute encoder, resolver etc.) or indirect (with mathematical
methods ).
2.4
Phases Current Acquisition via DC Link Shunt Measurement
It is possible to economize one current sensor when the current measurement is not
performed in the phases but in the dc-link. To effect this phase current acquisition
through the dc link current is necessary to know the actual switching pattern.
Application Note
10
AP16084
FOC of PMSM
Technical Bases
Figure 4
Power inverter Switching Pattern (the switches in are drawn in red
and the active coils of motor in black)
Figure 4 shows the switching patterns during one PWM cycle (e.g. in sector 1). There
are four active states (2x [100] and 2x [110]) and three inactive states (2x [000] and
[111]) in inverter.
Application Note
11
AP16084
FOC of PMSM
Technical Bases
Figure 5
Current in DC link and the corresponding values in phases during
one PWM period in the sector 1
According to the sector, the current in the shunt can be determined as follow (e.g.
sector 1): in the first part, state [000] no current flows in the shunt because the 3
phases of the stator are in this case in short circuit. In the second part, state [001], the
current iU flows in the shunt and ia can then be measured. For the same reasons the
current in the phase W can be measured in the 3rd part, state [011], but the current
measured corresponds to a negative current. In the 4th part, state [111] no current
flows in the shunt because the stator is in this state in short circuit. The reverse
sequence is then applied to the inverter bridges, then the current –iW can be measured
in the 5th part, state [011], and the current iU can be measured in the 6th part, state
[001]. We finally apply the state [000] where no current can be measured. Finally, the
shunt current can be described as follow: [0, i U, -iW 0, -iW , i U, 0].
In this way during one PWM period two times, two different phase currents can be
measured through a dc-link current measurement. The third phase current can be
calculate by the equation i U+iV+iW=0.
In order to get a maximum time between the current conversions with the ADC, the
measurement will be started on the edge of the phase with the middle “on time” (edge
of phase V in sector 1 (Figure 5)
Application Note
12
AP16084
FOC of PMSM
Technical Bases
The main drawback of the presented method is that the length of the state where the
current is measured must have a minimum value, which depends on the delay needed
to get a stable current on the line (for filtering the noises), the sample time of the ADC,
and the dead time between the gate signal of the high side Mosfet and the low side
Mosfet. (Figure 6)
Figure 6
Relative State Length for Current Measurement as a Function of the
Rotor Position [3]
States
1. Sector
2. Sector
3. Sector
4. Sector
5. Sector
6. Sector
1.
0
0
0
0
0
0
2.
iU
iV
iV
iW
iW
iU
3.
-iW
-iW
-iU
-iU
-iV
-iV
4.
0
0
0
0
0
0
5.
-iW
-iW
-iU
-iU
-iV
-iV
6.
iU
iV
iV
iW
iW
iU
7.
0
0
0
0
0
0
Table 2
Phase currents which can be measured (in theory) by the dc-link
current in all 7 states and all 6 sectors during a full electrical revolution of
the rotor
2.5
Sensorless Model
1
The basic idea of sensorless control (more exactly speed and position sensorless
control) is to replace position information by measuring electrical quantities and
modeling the PMSM to obtain the desired rotor angular position as an output quantity
of a mathematical motor model.
1
The sensorless model is not im plemented in this project, in this way is necessary a rotor position detection.
But this document will presented the mathematical bases for an implementation of this model.
Application Note
13
AP16084
FOC of PMSM
Technical Bases
The main effect which is used for evaluation is the EMF (induced voltage) when the
rotor rotates at a certain speed.
The stator voltage equation
vS = rS ⋅ i S +
dΨ S ( 6 )
dt
can be transformed in following equation:
ΨS =
∫ (v
)
− rS ⋅ i S dt ( 7 )
S
From a certain frequency, a PT1 operation has the same characteristic function for the
transfer behaviour like an Integrative operation, but not the drifting problem of this.
(Figure 1)
Figure 7
Characteristic Functions of PT1 and I Operation
(
)
ΨS = PT 1 vS − rS ⋅ iS ( 8 )
The stator flux linkage equation
ΨS = lS ⋅ iS + ΨM ( 9 )
can be transformed in a equation for the permanent magnet flux space vector:
ΨM = Ψ S − l S ⋅ iS ( 10 )
The (electrical) angular rotor position is given by the equation:
γ mech = arg( ΨM ) ( 11 )
The problem of this model is that at low speed (below 10-20% of nominal speed) no
EMF occurs in the PMSM. This means that is possible that at low speed the back EMF
model is not working.
Application Note
14
AP16084
FOC of PMSM
Components
3
Components
3.1
General remarks
This application was implemented using following main components :
• Infineon XC167CI SK Board
• Infineon 3 phase low voltage inverter
• Brushless motor fan
• Incremental encoder
Figure 8
Main Hardware Components
Application Note
15
AP16084
FOC of PMSM
Components
3.2
PMSM
The motor which was used in this Application Note is a low voltage permanent magnet
synchronous brushless motor with a heavy external rotor and with a radial fan as load.
Motor Characteristics
•
•
•
•
•
Motor nominal voltage
Motor nominal current
Nominal speed
Pole pairs
Stator line to line resistance
Figure 9
24V
14A
1800rpm
2
0,21O
Dimensions and Design of the PMSM [6]
Functional Principle
The bell shaped external rotor motor (1) rotates around the fixed internal stator (2).
The rotor is connected to a shaft (3), which rotates in bearing in a bearing tube. The
motor is mounted on either end of the fixed shaft (4). The permanent magnets (5) in
the rotor head generates a magnetic field, which react with the magnetic field
generated in the current carrying stator winding (6) and thus creating torque. (Figure 9)
Application Note
16
AP16084
FOC of PMSM
Components
3.3
Inverter
In this project was used a low voltage 3-phase inverter with a maximal power of 1.2
kW or a maximal current of 50A2 and at a voltage of 12 -24V DC. The 3-phase bridge
driver on board is a Infineon TLE6280G and as power switches are used six Infineon
OptiMos MOSFET.
Figure 10
Short circuit detection level and the circuit for the MFP (Multi
functional pin) of TLE6280GP (3.4V at active state)
The TLE6280GP driver IC provides a short circuit protection for the external Mosfets,
by monitoring the Drain-Source voltage of the external Mosfets. The short circuit
detection level is dependent upon the voltage of the MFP pin.
The MFP pin has multiple tasks: Reset the device (at 0 - 1.1V), adjust the short circuit
detection level of the external Mosfet and define the gate voltage limitation for current
limitation in case of short circuit (2.5 - 4V), deactivate the shoot-through protection
(>4.5V). (Figure 10)
The dead time generated by the TLE6280GP can be varied from 100ns to 4µs by
connecting an external resistor from the DT pin to GND. The dead time has to be long
2
Possibly a heat -sink is necessary .
Application Note
17
AP16084
FOC of PMSM
Components
enough to avoid a short between battery and GND, while the dead time should be as
short as possible to reduce extra power dissipation in the external Mosfets.
Figure 11
Internal dead time generation with resistor R22 between DT Pin and
GND on Inverter Board
In this application a dead time of 600ns was chosen (R22 = 27kO).
3.4
XC167CI -Board
The XC167CI is a members of Infineon's family of 16-bit microcontrollers based on the
high-performance C166S V2 core in a sub-0.25µ technology. The C166S V2 core
more than doubles the performance of the well established C166 core while still
providing code compatibility.
The XC16 board is an euro-sized (160 x 100mm) Board equipped with all necessary
hardware such as non-volatile memory, SRAM memory, crystal oscillator (for clock
generation), power supply and drivers for the interfaces.
Application Note
18
AP16084
FOC of PMSM
Components
Figure 12
The Infineon Technologies XC167CI Starter Kit Board
Simple wires effected the connection between the XC167CI board and the power
inverter board. For a better and easier connection was used the XC board stencils.
3.5
Sensors
3.5.1
Incremental Encoder
In this application example was used an incremental encoder to detect the angular
position of the rotor. The code-wheel of this encoder has 500 windows thus we
became 500 counting cycles on channel A and on channel B. (see Figure 13)
Note: The channel A is connected to T3IN at P3.6, the channel B to T3EUD at
P3.4 and channel I to the fast external interrupt input at P2.15.
Application Note
19
AP16084
FOC of PMSM
Components
Figure 13
The Incremental Encoder - how to connect it to a microcontroller3
When any transition (rising and falling edge) of the encoder signals with a 90° phase
shift are evaluated a maximum resolution of 2000 is possible. (see Figure 14)
Figure 14
Evaluation of Incremental Encoder Signals with Timer 3 in Counter
Incremental Mode
The third encoder output CH I indicates the mechanical zero position. This output is
connected to an external interrupt and trigger a reset of timer T3 via PEC transfer. In
this way, the absolute rotor position is known.
3
The signal conditioning is effected by the encoder
Application Note
20
AP16084
FOC of PMSM
Components
Note: After a reset the absolute position of the rotor is unknown. Therefore the
top zero must be found. This position can be found with a manually turn of
the rotor or automatically with a startup procedure (A rotating constant
current is to impress in the stator windings) 4.
3.5.2
Shunt-Current Sensor
A circuit like this in Figure 15 can effect an amplification and noise reduction of the
current signal from the dc link shunt.
It is important that the operational amplifier have a high slew rate (e.g. 15V/µs)
because the switching periods are in some cases very short.
The Shunt (R40 on inverter schematic) must have good power dissipation (P=R*I2) and
high resistance to became a good signal from it. Two parallel 0.1O resistors with a
power dissipation of 3W was used in this application example.
Figure 15
4
Schematic for DC-Link Shunt Current Measurement
Not im plemented in this application.
Application Note
21
AP16084
FOC of PMSM
Implementations
4
Implementations
4.1
Software Flow Charts
The main control tasks are effected by the Pmsm_Foc() C-function. (Figure 16)
Figure 16
Flow Chart for the control Function void Pmsm_foc()
Application Note
22
AP16084
FOC of PMSM
Implementations
This function is called upon each period match of the 6 Timer 12 i.e. each 100µs at a
PWM frequency of 10 kHz. (Figure 17)
Figure 17
Call of Control Function upon T12 Period Match
The initialization of the different units has been done with the DAvE tool. The specific
code for the SVM, frame transformations, current measurement were written in C and
the code for the PI controller as assembly function.
For the SVPWM was used the 6 Unit in center aligned mode in order to drive a three
phase line to line sinusoidal voltage at the output of the power stage.
4.2
Fixed Point Number Representation
The p. u. quantities move the values of the physical quantities in a relatively narrow
band. If are used the reference quantities of table 1 all quantities are limited between 1 and +1. It has been shown that the greatest precision is obtained in 1Q15 fixed-point
format.5
1Q15 numbers can be represented by following formula:
X = -k0*20 + k 1*2-1 + k 2*2-2 + … + kn*2-n + … + k15*2-15, with ki = {0;1}.
For instance, the number 0.6543 can be represented in 1Q15 as follow:
0.1010011110000002 = 53C016 = 2 -1+2-3+2-6+2-8+2-9 (approx. 0.6543).
5
Note that the dynamic range of this format is small.
Application Note
23
AP16084
FOC of PMSM
Implementations
Per Unit Model for Currents
The nominal current of motor is InominalRMS = 14A so that the peak current is InominalRMS *
v2 = ca. 20A. This peak current was chosen as reference value Iref for the calculation
of the p. u. quantity, which is calculated by i(t) = I(t)/ Iref.
The full per unit transformation for the phase currents are given by the equation:
i (t ) pu =
Figure 18
I (t )
( 12 )
14 A * 2
Scaling for Phase Currents
Per Unit Model for Speed
The per unit transformation for angular speed is given by the equation6:
ω pu =
ω
ω
ω
=
=
( 13 )
ω ref 2π ⋅ f nom,el 2π 3600rpm
60s
The speed can be calculated with an angular position changing over time:
∆γ
ω=
( 14 )
∆t
6
The electrical angular speed is meaning. In the case of a pole pair number p of 2 is the electrical angular
speed f nom,el=f nom*p=1800*2=3600 electrical rpm
Application Note
24
AP16084
FOC of PMSM
Implementations
At 1800 rpm (3600 electrical rpm = nominal speed of PMSM) the encoder gives 250
pulses in ?t=4.2ms. 252 equals to FChex as hex number. When FChex is shifted for 7 bit
in left direction the outcome is 7E00hex.
In 1Q15 format 7D00hex equals to 2-1+2-2+2-3+2-4+2-5=0.97 = circa 1. Hence no other
per unit scaling is to do.
Angle Representation
The angular position of rotor is given by the counter value of timer 3, on which are
connected the incremental encoder outputs. The encoder gives 2000 counting steps
for one full mechanical rotation, which are 1000 steps for one electrical rotation. This
angular information is then transformed in two orthogonal components in 1Q15 format,
using a sinus -cosine look-up table. (Figure 19)
Figure 19
4.3
Rotor Angle Representation as complex components 7
Frame Conversions
In Field Oriented Control, motor currents are manipulated in the d-q reference frame of
the rotor. Therefore measured motor currents must be transformed from the threephase static reference frame of the stator windings to the two axis rotating d-q
reference frame, in order to processing by the PI controllers.
Although the reference frame transformations can be performed in a single step, they
are best described in two single steps .
7
The ADC of the XC167CI has a resolution of 10 bit, but in enhanced mode the converted value is saved in the
ADC_DAT2 register as an 12 bit value.
Application Note
25
AP16084
FOC of PMSM
Implementations
The Clarke Transformation
The motor currents are first translated from the 120-degree physical frame of the motor
stator windings to a fixed orthogonal reference frame.

iU

iSα  

  = 1 (i − i ) with iU + iV + iW = 0 ( 15 )
V
W 
i Sβ  
 3

Figure 20
Transformation from the 3 phases reference frame of the stator to
the orthogonal a,ß-frame
The Park Transformation
They are then translated from the fixed frame of the stator to the rotating frame of the
rotor.
iS d   cosγ
  =
 iSq   − sin γ
sin γ   iSα 
 ⋅   ( 16 )
cos γ   iSβ 
The full operation in one-step:
Application Note
26
AP16084
FOC of PMSM
Implementations
i Sd   cosγ
  =
 iSq   − sin γ
Figure 21

iU

sin γ  

1
⋅

(iV − iW ) ( 17 )
cos γ  
 3

Transformation from the static a,ß-frame to the rotating d,q-frame.
The Inverse Park Transformation
This process is reversed to transform voltage signals from the P-I controllers from the
d-q frame of reference to the static stator frame:
iSα   cos γ
  =
i Sβ   sin γ
− sin γ   iSd 
 ⋅   ( 18 )
cosγ   isq 
These signals are then converted from an orthogonal frame to the 120 degree physical
frame of the U,V and W motor windings.
4.4
Space Vector Modulation
The continuous space vector modulation is based on the fact that the space vector
turns through the 6 sectors, and represents the weighted average voltage combination
Application Note
27
AP16084
FOC of PMSM
Implementations
of the 2 adjacent active space vectors and the null vectors during one PWM period.
(Figure 22)
Vαβ = Vα + jV β ( 19 )
Figure 22
Space Vector in a,ß-frame and PWM output pattern in all 6 sectors
In order to obtain an optimum harmonic performance and the minimum switching
frequency for each of the power devices, the state sequence is arranged such that the
transition from one state to the next is performed by switching only one inverter leg.
This condition is met when the sequence begins with the null-state [000] and the
inverter switches are toggled until the next null-state [111] is reached. To complete the
cycle, the sequence is reversed, ending with the null state [000]. (Figure 4 and Figure
23)
Application Note
28
AP16084
FOC of PMSM
Implementations
The sequence is T0/2, Tk , Tk+1 , T0, Tk+1, Tk , T0/2 for the odd sectors and T0/2, Tk+1 ,
Tk , T0, Tk , Tk+1 , T0 /2 for the even sectors. Tk , and Tk+1 represent the time of the
respecting state.
Figure 23
Timing for Space Vector Modulation
The output space vector voltage average can be computed by the integral
Vαβ =
1
TPWM
Tk
Tk+ 1
T0
T0

⋅  V0 ⋅ dt + 2 ⋅ V k ⋅ dt + 2 ⋅ V k +1 ⋅ dt + V7 ⋅ dt  ( 20 )
 0

0
0
0
∫
∫
∫
∫
with the equations
TPWM = T0 + Tk + Tk +1 ( 21)
and
V0 = V7 = 0 ( 22 )
the resulting equation for the voltage space vector is:
Vαβ =
Application Note
[V ⋅ T
k
k
+ Vk +1 ⋅Tk +1
TPWM
29
]
( 23 )
AP16084
FOC of PMSM
Implementations
Figure 24
Vector Product for Space Vector Modulation in Sector 1
The timing values Tk and T k+1 for the space vector can be calculated by the equation:
π
π 

− cos(k ⋅ )  V 
 sin(k ⋅ 3 )
 Tk 
3
3  ⋅  α  ( 24 )
T  = TPWM ⋅ 2 ⋅ U ⋅ 
π
π
 k +1 
DC  − sin((k − 1) ⋅
) cos((k − 1) ⋅ ) V β 
3
3 

Where k as to be determined from the argument of the reference space vector such
that
(k − 1) ⋅ π
k ⋅π
≤ arg( Vα ,Vβ ) ≤
( 25)
3
3
Application Note
30
AP16084
FOC of PMSM
Implementations
For an example Space Vector Vs with an amplitude |Vs|=0.5 and an angle arg(Vs)=30°
at a PWM frequency 20kHz the switching times are shown in Figure 25.
Vector 100/110
50µs
6.25µs
6.25µs
6.25µs
12.5µs
6.25µs
6.25µs
6.25µs
Phase A
0
1
1
1
1
1
0
Phase B
0
0
1
1
1
0
0
Phase C
0
0
0
1
0
0
0
V0
Vk
Vk+1
V0
Vk
V0
Vk+1
Vk+1 (110)
γ = 30°
Vk (100)
V0
(111/000)
Figure 25
4.5
Example of a SVPWM
8
PI Controller
The Field Oriented Control of a PMSM needs three PI Controller. One for each current
in rotating frame (Id and Iq ) and one for the angular speed. (Figure 3)
The structure of a PI controller is shown in Figure 26.
8
in this application was implemented the digital PI Controller as an assembler routine
Application Note
31
AP16084
FOC of PMSM
Implementations
Figure 26
Structure of a PI Controller
The Laplace equation of a PI Controller is given by:
K 

U (s ) =  K p + i  ⋅ E ( s ) ( 26 )
s 

For a discrete implementation as a digital PI Controller is valid following equation:
U (k + 1) = K p ⋅ e(k ) + K i ⋅ e (k ) +
k −1
∑ e( n)
( 27 )
n= 0
4.6
Current Measurement in the DC Link
The cheapest way to measure the currents in a PMSM is to measure the DC-link
current, because only one shunt is used. But this method has its drawbacks, as for
example the current can not be measured in defined machine states .
In order to be able to sample the current in the shunt at a predetermined instant, and
to link it to one of the three motor phase currents, a synchronization between the
actual sector, the output signals of the 6, and the ADC sampling instant has to be
done. According to the sector, the current measurement will be triggered by one of the
three CC6x channels on the rising and falling edges. The Infineon XC167CI
microcontroller provides a feature to perform this measurement without software
interrupts: In order to filter the noise from the IGBT commutation, and the dead time,
the timer 13 from the 6 will be used to introduce a delay between the CCx edge and
the ADC start sample. This timer 13 will be started automatically upon a timer 12
compare event and will be start the ADC conversion when the timer reaches the period
match. (Figure 27)
Application Note
32
AP16084
FOC of PMSM
Implementations
Figure 27
Synchronization of the ADC with the SVPWM by 6 Unit
Then the converted value from the ADC will be stored to the current variable by a PEC
transfer. (Figure 28)
Application Note
33
AP16084
FOC of PMSM
Implementations
Figure 28
Triggering of ADC upon a 6 Event with the Channel Injection Mode
and PEC-Transfer
The Peripheral Event Controller (PEC) provides 8 PEC service channels which move a
single byte or word between any two locations. A PEC transfer can be triggered by an
interrupt service request and is the fastest possible interrupt response. During a PEC
transfer, the normal program execution of the CPU is halted and a special instruction is
injected in the pipeline. No internal program status information needs to be saved. The
PEC transfer is the fastest possible interrupt response. The PEC channels source and
destination pointers specify the locations between which the data is to be moved.
(Figure 29)
Application Note
34
AP16084
FOC of PMSM
Implementations
Figure 29
4.7
The PEC Pointer Address Handling
Analog Output (D/A Conversion)
A simple D/A converter were realized in this application. In thus way it is possible to
check some quantity in microcontroller (e.g. the reconstituted phase currents, the
angular position, the rotor speed etc.).
The D/A converter has been realized with PWM and a smoothing of the PWM output
signal with a low-pass filter. (Figure 30)
Figure 30
D/A Conversion with PWM and Low-Pass Filtering
Application Note
35
AP16084
FOC of PMSM
Optimizations
5
Optimizations
5.1
Measurement Handling in sector edges („Black Zones“)
Figure 31
“Black Zones” during a full rotation where is not possible to
measure 2 phase currents with a dc link measurement
Approximation Method
The idea of this method is to measure the currents in all sectors where is possible and
to approximate mathematically the phase currents in the sectors where a
measurement is not possible.
For the sectors where is not possible to measure the current (Figure 31) the last valid
measurement result of is (isdvalid and isqvalid) is to correct with the dynamic factor ?id and
?iq :
isd = i sdvalid + ∆i d and isq = i sqvalid + ∆iq ( 28 )
The factors ?id and ?iq can be calculated by starting with the full stator voltage
equation:
vs = rS ⋅ iS + lS ⋅ iS + jω̂m ⋅ ΨM ( 29 )
Application Note
36
AP16084
FOC of PMSM
Optimizations
It is possible to write
[
1
ˆ ⋅ e jγ m
i&s ≈ vSref − iS (0) ⋅ rS − jωˆ m ⋅ Ψ
M
lS
] ( 30 )
with iS(0)=0 and in the rotating d,q frame this equation can simplified. Therefore it is
possible to calculate a difference for the d-co-ordinate:
∆id =
∆τ
( 31 )
⋅ [u sd ]
lS
and a difference for the q-co-ordinate:
∆iq =
[
]
∆τ
( 32 )
⋅ u sq − ωˆ m ⋅ 1
lS
Lengthen the Switching Pattern Time
It is possible to extend the state where the current has to be measured when the
length of the state is smaller than the minimum value required for the current
measurement. This method brings noises on the motor current but allows measuring it
everywhere.
t k , t k +1 ≥ t dead + t noise + t conversion ( 33)
5.2
Faster Operations with the MAC Unit
The MAC unit provides single-instruction-cycle, non-pipelined, 32-bit additions, 32-bit
subtractions, right and lefts shifts, 16-bit by 16-bit multiplication and multiplication with
cumulative subtraction/addition. For further information about the MAC unit, refer to the
XC16x User’s Manual Volume 1 “System Units” or on http://www.infineon.com .
Application Note
37
AP16084
FOC of PMSM
Measurement Results
6
Measurement Results
6.1
Phases and DC-Link Currents
a)
b)
c)
Figure 32
DC Link Current (on 50mO Shunt) and PWM states at 15° (a), 45°(b)
and 55° (c). Duty cycle = 30%.
Application Note
38
AP16084
FOC of PMSM
Measurement Results
Figure 33
DC Link Current (on 50mO Shunt) at 60°. There is not possible to
perform the measurement of 2 phase currents.
Figure 34
DC Link Current (Detail)
Figure 35
Current in Phase U reconstructed from DC Link Current (upper
curve) and measured with Current Probe (lower curve with 2A/Div) with a load at
400 rpm
Application Note
39
AP16084
FOC of PMSM
Measurement Results
6.2
Dynamical Behavior
400 rpm
0 rpm
Figure 36
Speed step from 0 to 400 rpm
400 rpm
-400 rpm
Figure 37
Speed step from -400 to 400 rpm (change the rotation direction)
Note: The measurements in Figure 35 - Figure 37 were effected without the
approximation method described in chapter 5.1.
Application Note
40
AP16084
FOC of PMSM
Measurement Results
6.3
CPU Performance
10.5µs
7.5µs
Figure 38
CPU Performance Test with PWM Cycles and Timer 12 states (red),
D0 = Execution Time for Period 1 = 7.5 µs9, D1 = Execution Time for Period 2 =
10.5µs
The timing benchmarks for the most important modules are given below:
Function
GetRotorPosition()
GetSpeed(), executed each 4.2ms
PI_Controller(speed) (ASM)
ClarkeParkTrans()
PI_Controller(Id) (ASM)
PI_Controller(Iq) (ASM)
ParkInverse()
SVM()
Table 3
Period
1
1
1
1
2
2
2
2
Time
2.15µs
1.8µs
2.05µs
2.2µs
2.05µs
2.05µs
1.45µs
4.2µs
Timing Benchmarks @ 40MHz CPU Clock
Note: All functions was implemented in the programming language C (except the
PI Controller function), without performance-enhancement e.g. by software
implementation in assembler or by using the MAC-Unit.
9
Without speed controller execution
Application Note
41
AP16084
FOC of PMSM
Measurement Results
6.4
Pictures
Figure 39
Inverter and XC167CI Board
Figure 40
stencils
Application Note
42
AP16084
FOC of PMSM
Conclusions
7
Conclusions
This paper discussed with the Field Oriented Control of a Permanent Magnet
Synchronous Motor with a single dc link shunt current measurement.
The Field Oriented Control provides the smooth motion at slow speeds as well as
efficient operation at high speeds high speeds. The presented option to measure the
dc link current with a shunt is the cheapest method to become information about the
current in the phases. The drawback of this method is that the current cannot be
measured in defined machine states. If there is no special handling of the
measurement in these problematic sectors (chapter 5.1), the current in the PMSM has
more noise.
It has been shown that the Infineon XC167CI Microcontroller provides all peripherals in
one single chip for an efficient implementation of a Field Oriented Control, e. g. the
triggering automatism of the ADC by the 6 unit.
Application Note
43
AP16084
FOC of PMSM
References
References
[1]
Schrödl M., Sensorless Control of AC Machines, TU Vienna, 2001.
[2]
Schrödl M., Skriptum zur Vorlesung: Drehstromantriebe mit Mikrorechnern,
TU
Wien, 1989.
[3]
Denais A., Infineon
Measurement, 2001.
[4]
Denais A., Infineon Application Note: AP163001 Space Vector Modulation
with the C164, 2001.
[5]
Denais A., Infineon Application Note: AP167401 FOC induction motor
a single shunt in the DC line, 2001.
[6]
Ziehl Abegg, EC Motors / Fans. (www.ziehl-abegg.com)
Application Note
Application
44
Note
C164:
Single
Shunt
Current
with
AP16084
FOC of PMSM
Glossary
Glossary
a,ß-frame
A/D
ADC
CC6
D/A
d,q-frame
FOC
IM
LEM
MAC-Unit
PEC
PI
PM
PMSM
p. u. Quantities
PWM
SVM
SVPWM
U,V,W
Application Note
Static co-ordinate system
Analog to Digital
Analog to Digital Converter
Capture Compare Unit on XC167
Digital to Analog
Rotating co-ordinate system
Field Oriented Control
Induction Motor
Trade name for a current transducer producer
Multiply Accumulate Unit on XC167CI
Peripheral Event Controller
Proportional plus Integrative
Period Match of a Timer
Permanent Magnet Synchronous Motor
Per Unit Quantities
Pulse-Width Modulation
Space Vector Modulation
Space Vector Pulse Width Modulation
Identifier of the three phase of an electric motor, in literature
you can find also A,B,C, 1,2,3, etc.
45
Infineon goes for Business Excellence
“Business excellence means intelligent approaches and clearly
defined processes, which are both constantly under review and
ultimately lead to good operating results.
Better operating results and business excellence mean less
idleness and wastefulness for all of us, more professional
success, more accurate information, a better overview and,
thereby, less frustration and more satisfaction.”
http://www.infineon.com
Published by Infineon Technologies AG