PMSM Foc DTC
PMSM Foc DTC
PMSM Foc DTC
=
|
|
.
|
\
|
+ + =
invariant power
invariant power non
) ( ) ( ) (
3
2
3
2
3
4
3
2
c
e t i e t i t i c i
j
c
j
b a
t t
+
(
(
(
=
(
(
(
c
b
a
c
b
a
s
c
b
a
dt
d
i
i
i
R
v
v
v
(
(
(
+
(
(
(
(
(
(
=
(
(
(
) cos(
) cos(
) cos(
3
4
3
2
t
t
u
u
u
r
r
r
m
c
b
a
c cb ca
bc b ba
ac ab a
c
b
a
i
i
i
L M M
M L M
M M L
l
L
m
L
m l c b a
L L L L L + = = =
2
m
ca bc ab
L
M M M = = =
ba ab
M M ; =
cb bc
M M ; =
ac ca
M M ; =
a
b
c
i
i
b
i
c
a
a
v
a
+ -
v
c
+
-
-
+
v
b
m
u
r
13/98
UPC
PMSM Dynamic Equations
Voltage vector equation in the stationary o-| frame
(
+
(
|
.
|
\
|
+ +
(
=
(
) cos(
) cos(
2
3
2
t
|
o
|
o
|
o
u
u
r
r
m m l s
dt
d
i
i
dt
d
L L
i
i
R
v
v
i
v
+ -
m
u
r
o
o
o
i
v
+
-
|
| |
a
b
c
i
i
b
i
c
a
a
v
a
+ -
v
c
+
-
-
+
v
b
m
u
r
Clarke
transformation
( )
( )
=
=
=
invariant power
invariant power non
30 cos 30 cos
60 cos 60 cos
3
2
3
2
c
x x c x
x x x c x
c b
c b a
|
o
14/98
UPC
i
v
+ -
m
u
r
o
o
o
i
v
+
-
|
| |
a
b
c
i
i
b
i
c
a
a
v
a
+ -
v
c
+
-
-
+
v
b
m
u
r
=
(
(
(
(
(
(
=
(
invariant power
invariant power non
;
2
3
2
3
0
2
1
2
1
1
3
2
3
2
c
x
x
x
c
x
x
c
b
a
|
o
=
(
(
(
(
(
(
(
(
=
(
(
(
invariant power
invariant power non 1
;
2
3
2
1
2
3
2
1
0 1
3
2
c
x
x
c
x
x
x
c
b
a
|
o
Clarke
-1
Transformation
Clarke Transformation
Non power invariant versus power invariant. See the comparison.
PMSM Dynamic Equations
15/98
UPC
PMSM Dynamic Equations
Saliency: Variation of the stator phase inductance as function of the
rotor position.
) 2 cos(
) 2 cos(
) 2 cos(
3
2
3
4
t
t
u A
u A
u A
+ =
+ =
+ =
r m
m
l a
r m
m
l b
r m
m
l a
L L L L
L L L L
L L L L
) 2 cos(
2
) 2 cos(
2
) 2 cos(
2
3
4
3
2
t
t
u
u
u
A =
A =
A =
r m
m
ca
r m
m
bc
r m
m
ab
L
L
M
L
L
M
L
L
M
|
o
m
d
q
m
m
l
r m
m
l a
L L L
) 2 cos( L L L L
- + =
= - + =
|
o
m
u
r
d
q
m
l
r m
m
l a
L L
) 2 cos( L L L L
+ =
= - + =
|
o
m
u
r
d
q
m
m
l
r m
m
l a
L L L
) 2 cos( L L L L
+ + =
= - + =
16/98
UPC
PMSM Dynamic Equations
voltage vector equation in the stationary o-| frame
considering saliency
Where
If there is no saliency and it is obtained the previous
equation.
(
+
+
(
A + A
A A
+
(
=
(
) cos(
) cos(
) 2 cos( ) 2 sin(
) 2 sin( ) 2 cos(
2
t
|
o
|
o
|
o
u
u
u u
u u
r
r
m
r s s r s
r s r s s
s
dt
d
i
i
L L L
L L L
dt
d
i
i
R
v
v
m s
m
l s
L L L L L A = A + =
2
3
;
2
3
0 =
m
L A
17/98
UPC
PMSM Dynamic Equations
Voltage vector equation in the synchronous reference d/q
frame fixed to the rotor
Angle chosen equal to the PM position
Direct axis ( L
d
= L
S
-
L
S
) and quadrature ( L
q
= L
S
+L
S
) axis
inductances
m
u
r
o
d
|
i
d
+
-
v
d
v
q
+
-
i
q
q
Park
transformation
i
v
+ -
m
u
r
o
o
o
i
v
+
-
|
| |
(
+
(
+
(
=
(
1
0
r m
q
d
q r d
r q d
q
d
s
q
d
i
i
dt d L L
L dt d L
i
i
R
v
v
e
e
e
18/98
UPC
i
v
+ -
m
u
r
o
o
o
i
v
+
-
|
| |
(
=
(
|
o
u u
u u
x
x
x
x
q
d
cos sin
sin cos
m
u
r
o
d
|
i
d
+
-
v
d
v
q
+
-
i
q
q
=
(
q
d
x
x
x
x
u u
u u
|
o
cos sin
sin cos
PMSM Dynamic Equations
Park Transformation
Park
-1
Transformation
19/98
UPC
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
-0.25
-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0.2
0.25
Time [ s ]
[
A
]
i
alpha
i
beta
i
b
i
c
i
q
i
d
Non power invariant
Different constant values. (c=2/3) for Clark & (c=1) for Clarke
-1
.
Same amplitudes for (a,b,c) & (,) & (d,q).
PMSM Dynamic Equations
20/98
UPC
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35
-0.4
-0.3
-0.2
-0.1
0
0.1
0.2
0.3
Time [ s ]
[
A
]
i
alpha
i
beta
i
b
i
c
i
q
i
d
i
a
Power invariant
Same constant value. ( c=sqrt(2/3) ) for Clark & Clarke
-1
.
Different amplitudes for (a,b,c) versus (,) & (d,q)
PMSM Dynamic Equations
21/98
UPC
(
(
(
(
(
(
=
(
c
b
a
q
d
x
x
x
c
x
x
2
3
2
3
0
2
1
2
1
1
cos sin
sin cos
u u
u u
( ) ( )
( ) ( )
=
(
(
(
(
(
+
+
=
(
invariant power
invariant power non
;
3
2
sin
3
2
sin sin
3
2
cos
3
2
cos cos
3
2
3
2
c where
x
x
x
c
x
x
c
b
a
q
d
t
u
t
u u
t
u
t
u u
Direct (Clarke & Park) transformation
PMSM Dynamic Equations
22/98
UPC
(
(
(
(
(
(
(
=
(
(
(
q
d
c
b
a
x
x
c
x
x
x
u u
u u
cos sin
sin cos
2
3
2
1
2
3
2
1
0 1
( ) ( )
( ) ( )
=
(
(
(
(
(
+ +
=
(
(
(
invariant power
invariant power non 1
;
3
2
sin
3
2
cos
3
2
sin
3
2
cos
sin cos
3
2
c where
x
x
c
x
x
x
q
d
c
b
a
t
u
t
u
t
u
t
u
u u
Direct (Clarke & Park) Inverse transformation
PMSM Dynamic Equations
23/98
UPC
PMSM Dynamic Equations
Instantaneous torque expression:
| | | |
( ) ( ) | |
( ) | |
q d q d q m
d q q q d d m
d q q d e
L L i i i P c
i i L i i L P c
i i P c i P c T
+ =
+ =
= =
flux magnet permanent the is psi - and
number poles' pair the is ,
invariant power 1
invariant power non
where ;
2
3
m
P
c
=
First term, usually called as magnet torque, is directly
proportional to i
q
and independent of i
d
.
Second term, or reluctance torque, is only present in
salient machines where ( L
d
- L
q
) 0 and is proportional to
the current product ( i
d
i
q
).
24/98
UPC
=
= +
function transfer ;
equation l diferentia ;
D Js
T T
w
T T w D
dt
dw
J
L e
m
L e m
m
Motion equation
Drive Inertia ( J )
Damping constant due to Friction ( D or F )
Load Torque ( T
L
)
PMSM Dynamic Equations
25/98
UPC
Exercise: Sketch a complete PMSMscheme model
Use the d/q model equations
Find out all the required equations involved
Determine where the Clarke (a,b,c) to (,) & Park (,) to (d,q)
transformations should be applied to get a more realistic model
PMSM Modeling
26/98
UPC
PMSM Modeling
27/98
UPC
PMSM Modeling
The adopted parameters for the model are as follows:
Lq=0.009165; Ld=0.006774; R=1.85; psi=0.1461; P=3.
(specific motor data is on the next page)
For the motion equation of the whole drive it can be used:
J =0.77e-3; F=1e-3.
28/98
UPC
unimotor fm
Emerson Control Techniques
Model: 115E2A300BACAA115190
Number of poles: 6
Rated speed: 3000 (rpm)
Rated torque: 3.0 (Nm)
Rated power 0.94 (kW)
K
T
: 0.93 (Nm/Arms)
K
E
: 57.0 (Vrms/krpm)
Inertia: 4.4 (kgcm)
R (ph-ph): 3.7 (Ohms)
L (ph-ph): 15.94 (mH)
Continuous stall: 3.5 (Nm)
Peak: 10.5 (Nm)
PMSM Modeling
L
d
and L
q
values?
L
s
can be obtained measuring the
inductance for different rotor positions.
The first order system, composed by
an L and R, can be identified by
supplying a step voltage in the d and q
components.
How to obtain the parameters
from a commercial catalogue?
s s d s s q
d q d q
s
L L L L L L
L L
Ls
L L
L
A = A + =
= A
+
=
;
2
;
2
29/98
UPC
How to obtain the J and F values?
The first order system, composed by a F and F, can be identified by
supplying a step torque.
Usually, the machine manufacturer provides the J value. In a laboratory
rig composed by two machines, the total J value can be then worked
out from the manufacturer data.
Why K
T
and K
E
are not equal?
The units must be in the International System.
Experimental (taken in the laboratory) K
E
value is 56.22 instead of 57.
( ) ( ) ( ) ( )
rms
rms
A
Nm
rad
rev s
rpm
V
T E
F
m
L
star
connected
F m
F
m F F
K K
I
T V
I
T V
T I V
929 . 0
2
1
1
60
1000
22 . 56
3 ; 3
3
3 3 ; 3
min
=
=
=
= =
t
e
e
e
PMSM Modeling
30/98
UPC
How to obtain the value?
From the torque expression, and the K
T
(Nm/A
rms
)
parameter, it can be deduced the following expression:
Finally, the numerical value will be:
And the factor is used to convert the rms to the maximum value.
q m e
i P c T =
P c
K
P c K
i
T
T
m m T
q
e
= = =
( ) Wb
P c
K
T
m
1461 . 0
3
2
3
93 . 0
2
1
2
1
PMSM Modeling
31/98
UPC
PMSM Modeling
Lq=9.1e-3 Ld=6.7e-3
R=1.85
psi=0.1461 P=3
J =0.77 F=1e-3
Ld=Lq=0.016416
R=0.656
psi=3.184 P=10
J =206.05 F=1.5
32/98
Parameters are PMSM(L, R, psi, P) and whole drive (J , F) dependent.
UPC
Types of Controllers
33/98
UPC
Field Oriented Control (FOC) for PMSM
Instantaneous torque for the PM synchronous machine
|
o
m
u
r
d
q
I
q
>0
|
o
m
u
r
d
q
I
q
<0
T
e
> 0 T
e
< 0
| | ) (
2
3
q d q d q m e
L L i i i P T + =
If i
d
= 0, for not demagnetizing the PMSM, the reluctance torque is 0.
Therefore, the electromagnetic torque will be regulated with i
q
.
Duality with the DC Machine control.
q m
i P =
2
3
i
d
= 0
34/98
UPC
FOC in PMSM
Four quadrant Motor (Q1 & Q3) Generator (Q2 & Q4)
35/98
UPC
FOC Scheme
Typical dynamic values
(for a PMSM 0.5 / 10 kW)
discretization time /
switching frequency
Closed loop time response /
band width
Current 100 s / 10kHz 5ms / 200Hz
Speed 5ms / 200Hz 0.5s / 2Hz (inertia dependent)
3 PI control loops:
2 inner (and faster) current loops.
1 outer (and slower) speed loop.
Limited by the
semiconductors
switching frequency
Separation principle will be applied
36/98
UPC
Current Controller
The current loop, for controlling design purposes, can be modeled as
a first order system.
( )
s
s
s
R L
s R L
R
v
i
=
+
=
t
;
1
1
(
+
(
+
(
=
(
1
0
e m
q
d
q e d
e q d
q
d
s
q
d
i
i
s L L
L s L
i
i
R
v
v
e
e
e
( ) 1
1
+ s R L
R
s d
s
( ) 1
1
+ s R L
R
s d
s
( ) 1
1
+ s R L
R
s q
s
( ) 1
1
+ s R L
R
s q
s
The coupling terms are eliminated, since they are considered as a
perturbation.
37/98
UPC
The current loop can be modeled as a first order system, whose
transfer function in Laplace domain is:
) ( 99 . 0 1 ) ( ; 5
) ( 98 . 0 1 ) ( ; 4
) ( 95 . 0 1 ) ( ; 3
) ( 632 . 0 1 ) ( ;
) ( ) 1 ( 1 ) (
t v R t i t
t v R t i t
t v R t i t
t v R t i t
t v e R t i
s
s
s
s
t
s
= =
= =
= =
= =
=
t
t
t
t
t
t
t 4
1 ) (
1
) (
) (
+
=
s R L
R
s V
s I
s
s
Its open loop step time
response is:
Current Controller
38/98
UPC
0 0.005 0.01 0.015 0.02 0.025 0.03
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
System: g
Time (seconds): 0.0172
Amplitude: 0.531
System: g
Time (seconds): 0.0298
Amplitude: 0.54
Step Response
Time (seconds)
A
m
p
l
i
t
u
d
e
Considering the motor
parameters given before:
Time constant:
Time response at 98%
Final value:
) ( 23 . 17 4 ms = t
1 85 . 1 10 97 . 7
85 . 1 1
) (
) (
3
+
=
s s V
s I
) ( 31 . 4
85 . 1
10 97 . 7
3
ms = =
t
54 . 0
85 . 1
1
=
Current Controller
39/98
UPC
0 0.01 0.02 0.03
0
0.2
0.4
0.6
0.8
-1000 -500 0
-500
0
500
Open loop
s = -R
s
/L = -232
t = L/R
s
= 4.3(ms)
K
P
=1
s = -(K
P
+R
s
)/L = -358
t = L/(K
P
+R
s
) = 2.8(ms)
Final value: K
P
/(R
S
+K
P
) = 0.35
K
P
=10
s = -(K
P
+R
s
)/L = -1486
t = L/(K
P
+R
s
) = 0.6(ms)
Final value: K
P
/(R
S
+K
P
) = 0.84
Root locus
Step response
i* i
( ) 1
1
+ s R L
R
s
s
P
K
P controller always
introduces the
Position Error E
0
E
0
= R
s
/ (R
s
+K
P
)
-R
s
/ L
Solution: add a PI controller
Current Controller
40/98
UPC
-3000 -2000 -1000 0
-1000
0
1000
K
P
= 14.09 K
I
= 15945
Closed loop poles ~ -1000+1000j
Specifications:
Settling time at 2% = 4ms
Overshoot ~ 4.23% Damping =0.707
Root locus
-R
s
/ L 0
-K
I
/ K
P
( ) 1
1
+ s R L
R
s
s
s
K s K
I P
+
Current Controller
41/ 98
UPC
Step
response
The overshoot (17%) is too large ! The settling time is not fulfilled !
The integrator makes the Error E
0
= 0
The specifications are not fulfilled:
What is the problem ?
Current Controller
42/98
UPC
L
K
L
K
L
R
s s
s
K
K
L
K
i
i
I P s
I
P I
+
|
.
|
\
|
+ +
|
|
.
|
\
|
+
=
2
1
*
2 2
2
2
n n
n
s s e e
e
+ +
What is the closed loop transfer function?
Is it a pure 2
nd
order term?
NO! There is an
unwanted zero !
A pre filter is used
to cancel the zero
( ) 1
1
+ s R L
R
s
s
s
K s K
I P
+
( ) 1
1
+ s K K
I P
L
K
L
K
L
R
s s
s
K
K
L
K
s
K
K
i
i
I P s
I
P I
I
P
+
|
.
|
\
|
+ +
|
|
.
|
\
|
+
|
|
.
|
\
|
+
=
2
1
1
1
*
L
K
L
K
L
R
s s
L
K
i
i
I P s
I
+
|
.
|
\
|
+ +
=
2
*
Current Controller
43/98
UPC
0 1 2 3 4 5 6 7
x 10
-3
0
0.5
1
Time (s)
L
K
L
K
L
R
s s
L
K
L
K
L
K
L
R
s s
L
K
s
K
K
L
K
L
K
L
R
s s
s
K
K
L
K
i
i
I P s
I
I P s
I
I
P
I P s
I
P I
+
|
.
|
\
|
+ +
+
+
|
.
|
\
|
+ +
=
+
|
.
|
\
|
+ +
|
|
.
|
\
|
+
=
2 2 2
1
*
( ) 1
1
+ s R L
R
s
s
s
K s K
I P
+
( ) 1
1
+ s K K
I P
( ) 1
1
+ s R L
R
s
s
s
K s K
I P
+
zero
PI
PF+PI
Current Controller
44/98
UPC
+
-
i*
i
( ) 1
1
+ s R L
R
s
s
s
K
I
+
-
P
K
+
-
i*
i
s
K
I
1
1
+
+
+
s
K R
L
K R
P s
P s
Root locus
-(R
s
+K
P
)/ L
0
K
P
= 14.09 K
I
= 15945
Closed loop poles ~
-1000+1000j
Settling time at 2% = 4ms
Overshoot ~ 4.23% Damping =0.707
Current Controller
45/98
UPC
Current Controller
Fixing the settling time at 2% (Ts
2%
) and the damping factor ()
the K
P
and K
I
can be calculated
n
Ts
e ,
~
4
% 2
2 2
2
2
n n
n
s s e e
e
+ +
L
K
L
K
L
R
s s
L
K
i
i
I P s
I
+
|
.
|
\
|
+ +
=
2
*
L
K R
P s
n
+
= e 2
s n P
R L K = e 2
s P
R
Ts
L
K
=
% 2
8
L
K
I
n
=
2
e
2
n I
L K e =
2
% 2
2
16
Ts
L
K
I
=
,
2nd order TF
Current loop TF with PI or IP
Identifying coefficients
4.22 instead of 4 when = 0.707
46/98
UPC
( ) 1
1
+ s R L
R
s
s
s
K
I
P
K
( ) 1
1
+ s R L
R
s
s
s
K s K
I P
+
( ) 1
1
+ s R L
R
s
s
s
K s K
I P
+
i
( ) 1
1
+ s R L
R
s
s
s
K
I
+
+
P
K
+
P
-
L
K
L
K
L
R
s s
s
L
i
I P s
+
|
.
|
\
|
+ +
=
2
1
P
0 2 4 6 8
x10
-3
0
0.01
0.02
0.03
0.04
Step Response
Time (seconds)
A
m
p
l
i
t
u
d
e
PI
IP
In terms of Perturbation, both solutions (PI & IP) have the same performance
Current Controller
47/98
UPC
( ) 1
1
+ s R L
R
s d
s
( ) 1
1
+ s K K
I P
Decoupling terms have to be added:
( ) 1
1
+ s R L
R
s q
s
Current loop with PI + PF (d axis) and IP (q axis)
-
L
q
w
e
i
q
Current Controller
48/98
UPC
Implementing PI in a DSP
From S to Z domain
Ts=100us
Step Response
Time (sec)
A
m
p
l
i
t
u
d
e
0 1 2 3 4 5 6 7 8
x 10
-3
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1 - z
) Ts - 1 ( - z
K ) z ( PI
s
s
K ) s ( PI
P
I
P
I
K
K
P
K
K
P
=
+
=
1 - z
,92 0 - z
5 , 5 ) z ( PI
s
800 s
5 , 5 ) s ( PI =
+
=
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Root Locus Editor (C)
Real Axis
I
m
a
g
A
x
i
s
0.84 0.86 0.88 0.9 0.92 0.94 0.96 0.98 1
-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0.2
Root Locus Editor (C)
Real Axis
I
m
a
g
A
x
i
s
Current Controller
49/ 98
UPC
// start iq PI controller
iq_error = iq_ref-iq;
vq_ref = vq_ref_last+c_Kp*(iq_error-c_Ki_Kp*iq_error_last);
iq_error_last = iq_error;
if (vq_ref > VPI_MAX) vq_ref = VPI_MAX;
if (vq_ref < -VPI_MAX) vq_ref = -VPI_MAX;
vq_ref_last = vq_ref;
// end iq PI controller
Implementing a PI Controller in a DSP
From Z to discrete time domain
C code for the TI DSP 6711
1 - z
) Ts - 1 ( - z
K
) z ( error _ iq
) z ( ref _ vq
) z ( PI
P
I
K
K
P
= =
))] Ts - 1 ( - z ( K )[ z ( error _ iq ) 1 - z )( z ( ref _ vq
P
I
K
K
P
=
))] K _ K _ c ( z - 1 ( K )[ z ( error _ iq ) z - 1 )( z ( ref _ vq
p i
-1
P
-1
=
)) K _ K _ c ( last _ error _ iq - error _ iq ( K last _ ref _ vq ref _ vq
p i P
+ =
Current Controller
50/98
UPC
The plant can be simplified as follows
First order with one pole
Mechanical time constant might be 50 times slower than the
electrical one. Current loop can be neglected.
Typical sampling time 5ms.
J
D
- s =
PI
T
e
*
D s J
1
e
*
T
L
Speed Controller
51/98
UPC
s
1
Windup phenomenon
Limits of the real plant (currents and voltages)
Might end up with instability
Anti Windup PI
Speed and Current Controller
52/98
UPC
Exercise
Sketch a complete FOC scheme for a PMSM. It has to
include:
Speed and currents control loops
(PI + pre filter) or IP
Saturations (software protections)
Anti Windup
Feed forward (decoupling) terms
Draw the magnitudes (speed reference, speed response, iq
reference and iq response) waveforms for the cases: (i)
electrical car & (ii) lift. Indicate, in the drawn waveforms,
the motoring or generating operating modes.
Propose a programming code (any generic language) to
implement a PI.
53/98
UPC
PMSMmodel in a b c
All control in s domain
Speed and currents control loops with: PI + pre filter,
Saturations (software protections) and Anti Windup.
Feed forward (decoupling) terms for the current loops.
54/98
UPC
The PMSM model has been simplified to d q
55/98
UPC
PMSM model in a b c
All control in z domain. Two different sampling periods: Tsm, Ts
56/98
UPC
SISO tool. Matlab
Matlab/Simulink PMSM FOC. Waveforms.
FOC in a DSP
57/98