You are on page 1of 52

Page 1 of 52 Metode regulacije EP primenom mikroprocesora- skripta

Metode regulacije energetskih pretvaraa


primenom mikroprocesora
- skripta -
Darko Marcetic, Ph.D.
Rev Date DCO Originator Description
X1 10/17/09 --- dr Darko Marcetic First draft


TABLE OF CONTENTS

1. Uvod u vektorsko upravljanje AM.................................................................................................... 3
2. Matematiki model asinhronog motora........................................................................................ 5
2.1. Matematiki model u originalnom abc domenu.................................................................. 5
2.2. Koriene transformacije koordinata ....................................................................................... 6
2.3. AM model u domenu..................................................................................................................... 9
2.4. IM model in dq reference frame .................................................................................................. 9
3. Indirektna vektroska kontrola (IFOC)........................................................................................ 11
3.1. Strujno kontrolisani naponski invertor redukcija reda AM modela.................. 11
3.2. IFOC Teorijske osnove, analogni domen.......................................................................... 14
3.3. IFOC Praktina implementacija (preview)...................................................................... 15
4. Merenje linijskih struja motora....................................................................................................... 17
5. Merenje poloaja rotora inkrementalnim enkoderom....................................................... 20
5.1. Procena brzine rotora na osnovu merenog poloaja..................................................... 22
6. Space vector PWM modulator (SVPWM) for VSI................................................................... 24
6.1. Introduction........................................................................................................................................... 24
6.2. Space Vector reference Inverse Park................................................................................. 24
6.3. Space vector theory .......................................................................................................................... 24
6.4. Space Vector Pulse-Width Modulation (SVPWM) ............................................................ 27
6.5. Software implementation notes for SVPWM....................................................................... 30
7. Motor current regulators in dq reference frame................................................................... 32
7.1. Motor phase currents from measured line currents ...................................................... 32
7.2. Motor phase currents from abc to dq frame....................................................................... 33
7.3. Typical digital current control model ...................................................................................... 33
7.4. Incremental dq current regulators with output limits ................................................. 34
7.5. Current regulators parameters evaluation.......................................................................... 36
8. Discrete IFOC control ............................................................................................................................ 38
Page 2 of 52 Metode regulacije EP primenom mikroprocesora- skripta

8.1. IFOC overview...................................................................................................................................... 38
8.2. Implementation of discrete IFOC equations ...................................................................... 38
8.3. Simplified block diagram of IFOC control algorithm...................................................... 41
8.4. IFOC quasi C-code implementation ..................................................................................... 41
9. Speed regulator........................................................................................................................................ 42
9.1. Speed regulator parameters calculation procedure....................................................... 42
9.2. Maximum Q phase current calculation current limit ................................................. 42
10. Field weakening flux control ........................................................................................................ 42
11. Induction motor parameters and data ....................................................................................... 43
11.1. Initial Induction motor parameters and data............................................................... 43
12. Influence of Tr parameter error on IFOC.................................................................................. 44
12.1. Dobro odabran paramater Tr*= Tr...................................................................................... 44
12.2. Pogreno odabran paramater Tr* Tr................................................................................ 44
13. Signal data ranges for 12-bit ADC................................................................................................ 47
13.1. DC bus voltage measurement................................................................................................. 47
13.2. Inverter leg current measurement...................................................................................... 48
14. Appendix- Motor phase voltage and currents......................................................................... 49
14.1. Motor phase windings connected in the wye connection ...................................... 50
14.2. Motor phase windings connected in the delta connection .................................... 50
14.3. Phase voltages and currents in coordinate system............................................. 51
14.4. Phase voltages and currents in dq coordinate system............................................ 52



Page 3 of 52 Metode regulacije EP primenom mikroprocesora- skripta


1. Uvod u vektorsko upravljanje AM

U svim elektrinim pogonima sa promenjivom brzinom (Sl. 1.1) je poeljno imati pogon
koji se ponaa kao aktuator momenta, t.j. u kome se skoro trenutno moe razviti
momenat jednak zadatoj vrednosti. Time se dinamika elektrinog dela sistema potpuno
razdvaja i ne utie na dinamiku mehanikog dela i upravljanje brzinom i poloajem je u
takvim sistemima znatno uproteno.


Fig. 1.1. Pogon motora sa promenjivom brzinom

Pogon motora jednosmerne struje, prikazan sa povratnom spregom po brzini, Sl. 1.2,
predstavlja idealan konvertor momenta zato to su statorsko i rotorsko polje uvek
normalni jedno na drugo i bilo kom trenutku. Uz konstantno polje statora, razvijeni
momenat je mogue linearno regulisati promenom struje rotora i time se dobija
optimalna dinamika karakteristika pogona.


Fig. 1.2. Speed control block diagram of the DC drive.

U sluaju asinhronog motora, koji je jeftiniji, robusniji i laki za odravanje od
jednsomernog motora, linearna kontrola momenta je mogua samo primenom raznih
kompleksnih algoritama upravljanja, poznatih kao kontrola orijentacije polja (FOC -field
oriented control) . Ima vie vrsta ove kontrole: orijentacija ka fluksu statora, ka fluksu
rotora i ka fluksu u meugvou. Postoje i dve osnovne metode upravljanja fluksom ,
direktna i indirektna. Tokom ovog kursa uglavnom emo se zadrati na indirektnoj
vektorskoj kontroli (IFOC - indirect rotor field oriented control).
Osnovni princip FOC upravljanja se moe razumeti preko strujne konture koja se nalazi
u konstantnom polju fluksa, kao to je prikazano na sl. 1.3. Momenat koji deluje na
strujnu konturu iznosi:

sin = i T
e


Gde je amplituda fluksa kroz konturu (proizvod indukcije -B, i povrine konture -S, i
broja navojaka konture -N), i je veliina struje, i je ugao izmeu vektora fluksa i
vektora struje (normalan na povrinu strujne konture i u smeru fluksa koji se pravi od
te struje). Oigledno, maksimalni momenat se dobija kada je strujni vektor normalan
na polje fluksa.
Page 4 of 52 Metode regulacije EP primenom mikroprocesora- skripta


Fig. 1.3. Momenat koji deluje na strujnu konturu

Dakle, da bi se ostvarilo optimalno upravljanje asinhronim motorom neophodno je
nezavisno upravljati fluksom i ostvarenim elektromagnetnim momentom.Konture
upravljanja ovim veliinama se mogu razdvojiti regulacijom amplitude magnetopobudne
sile statora i njenog relativnog poloaja u odnosu na vektor fluksa rotora.
Magnetopobudnu silu statora je mogue regulisati strujno regulisanim naponskim
invetorom (CRVSI-current regulated voltage source inverter). Poloaj fluksa rotora se
proraunava algoritmom indirektne vektorske kontrole (IFOCindirect filed oriented
control). Po ovom algoritmu procena poloaja se vri u strujnom modelu rotorskog kola
koji na osnovu vektora struje statora i mehanikog poloaja rotora simulira pojave u
rotoru motora. Blok ema tipinog IFOC pogona sa davaem poloaja na vratilu data je
na slici 2.4.

Regulacioni sistem
Strujno regulisani
naponski invertor
M
3~
r
Dava
poloaja
PI reg.

procena poloaja
rotorskog fluksa
Reference
fluksa i
momenta
dq
abc
dq
abc
id
i
q

i
d
*

iq
*

v
d
*

vq
*

Vabc
*

I
abc

V
dc

Va
Vb
V
c

dq
V~

dq

Sl. 1.4. ematski prikaz vektorski kontrolisanog asinhronog motora sa
strujno regulisanim naponskim invertorom.

TA JE ZADATAK PRI VEKTORSKOM UPRAVLJANJU AM?

Primiti komande eljene amplitude rotorskog fluksa i eljenu vrednost el.
momenta
proceniti poloaj vektora rotorskog fluksa
utisnuti u stator vektor struje takve amplitude i ugla da se ostvare zadati fluks i
momenat
Page 5 of 52 Metode regulacije EP primenom mikroprocesora- skripta

2. Matematiki model asinhronog motora

2.1. Matematiki model u originalnom abc domenu

Matematiki model asinhrone maine se sastoji od diferencijalnih i algebarskih
jednaina, kojima se opisuju elektromagnetne (elektrini podsistem) i mehanike
pojave (mehaniki podsistem) u maini.
Model elektrinog podsistema moe se dobiti na osnovu poloaja faznih namotaja
statora i rotora asinhrone maine u originalnom abc podruju.


Sl. 2.1 ematski prikaz namotaja statora i rotora asinhrone maine

U originalnom, trofaznom podruju, jednaine naponske ravnotee i fluksnih obuhvata
za asinhronu mainu sa kratkospojenim rotorom u matrinom obliku glase:

, 0
,
r
r
r
r
r
r
r
= + =
+ =
dt
d
R
dt
d
R
r
r r r
s
s s s

i u
i u
(2.1.)

,
,
r r s
T
sr r
r sr s s s
i L i L
i L i L
r r
r
r r
r
+ =
+ =

(2.2.)

gde su vektori napona, struja i fluksa, za stator i rotor,

(
(
(

=
cs
bs
as
s
u
u
u
u
r
,
(
(
(

=
cs
bs
as
s
i
i
i
i
r
,
(
(
(

=
cs
bs
as
s

r
,
(
(
(

=
0
0
0
r
u
r
,
(
(
(

=
cr
br
ar
r
i
i
i
i
r
,
(
(
(

=
cr
br
ar
r

r
, (2.3.)

Rs i Rr predstavljaju omske otpornosti navojaka statora i rotora, matrice induktivnosti
statora i rotora i meusobne induktivnosti statora i rotora, koriene u jednainama
(2.2) i (2.3) su date u (2.4),
Page 6 of 52 Metode regulacije EP primenom mikroprocesora- skripta

(
(
(

=
cc cb ca
bc bb ba
ac ab aa
s
L L L
L L L
L L L
L
(
(
(

=
CC CB CA
BC BB BA
AC AB AA
r
L L L
L L L
L L L
L
(
(
(
(
(
(

+
+
+
=
) cos( )
3
2
cos( )
3
2
cos(
)
3
2
cos( ) cos( )
3
2
cos(
)
3
2
cos( )
3
2
cos( ) cos(
r r r
r r r
r r r
aA sr
L


L
(2.4.)
uz:

L
aa
, L
bb
, L
cc
sopstvene induktivnosti navojaka statora , L
AA
, L
BB
, L
CC
sopstvene
induktivnosti navojaka rotora , L
ab
, L
bc
, L
ca
meusobne induktivnosti navojaka statora
, L
AB
, L
BC
, L
CA
meusobne induktivnosti navojaka rotora,
r
ugao izmeu ose navoja 'a'
statora i rotora.

Da bi se upotpunio model AM, modelovan je i njen mehaniki podsistem.


r
tr r
m tr
m
opt el
p
k
dt
d
p
J
k
dt
d
J m m

+ = + =
, (2.5.)

gde su :
p - broj pari polova,
m
- mehanika ugaona brzina rotora,
r
- elektrina ugaona brzina
rotora, J- momenat inercije, k
tr
- koeficijent trenja i ventilacije, m
opt
- momenat
optereenja i m
el
- razvijeni elektromagnetni momenat.

Dobijeni model maine nije pogodan za dalju analizu. Diferencijalne jednaine modela
su nelinearne i kao posledicu okretanja rotora sadre vremenski promenjive koeficiente.
Ove jednaine se mogu reiti numerikim metodama ali postupak bi bio dugotrajan i
komplikovan.

2.2. Koriene transformacije koordinata

Naponske jednaine u modelu AM u abc domenu imaju parametre induktivnosti koji su
funkcija brzine. To znai da dobijamo diferencijalne jednaine sa promenjivim
koeficijentima koje nije lako reavati, pogotovo ne u realnom vremenu. Da bi se ovaj
model uprostio koriste se razne transformacije promenjivih i samim tim ceo model se
prenosi u domene razliita od originalnog.
U teoriji maina se koriste barem dva koordinatnog sistema (domena), stacionarni i
rotacioni dq koordinatni sistem. Dok prvi stoji, drugi se kree uganom brzinom
dq
.
Uglavnom , u jednom trenutku je ugao izmeu ova dva sistema jednak
dq.
U teoriji
maina postoje dve transformacije kojima se promenjive prenose u ove sisteme:
Clarke transformacija koja trofaznu promenjivu iz originalnog abc domena
prenosi u dvofazni stacionarni domen, poznat kao domen,
Park transformacija koja dvofaznu promenjivu iz stacionarnog domena
prenosi na sinhrono rotirajui referentni sistem osa, poznat kao dq domen.

Ako imamo vektor 3x1 t.j. trofaznu promenjivu X , nju moemo opisati sa tri koordinate
u abc sistemu, X
abc
, sa dve u sistemu, X

, ili dve u dq sistemu, X


dq
.

Page 7 of 52 Metode regulacije EP primenom mikroprocesora- skripta

2.2.1. Clarke transformacija - trofazni abc u dvofazni domen

Prelazak iz osnovnog trofaznog u dvofazni sistem

Sl. 2.2. Prelazak iz abc u domen.
Na osnovu |

\
|
+ |

\
|
= |

\
|
+ |

\
|
+ =
3
2
sin
3
2
sin
3
2
cos
3
2
cos

c b c b a
X X X X X X X
Clarke transformacija:
(
(
(

(
(
(
(


=
(

c
b
a
X
X
X
X
X
2
3
2
3
0
2
1
2
1
1
3
2


Koeficijent 2/3 kod Clarke transformacije se koristi da se dobiju jednake amplitude
faznih abc veliina i veliina u domenu.
Provera za ugao 0 stepeni.
A A
A
A
A
X = |

\
|
+ + =
(
(
(

+

(

=
=
2
1
2
1
2
1
2
1
1 1
3
2
) 3 / 2 cos(
) 3 / 2 cos(
) cos(
2
1
2
1
1
3
2
0


Ovim se dobija Clarke invarijantan po ampitudi, transformacija koja se mnogo ee
koristi od drugih (kao na primer invarijantne po snazi). Razlog za to je uglavnom
kontrola struja. Sa koeficijentom 2/3 struje u alpha-beta, su iste amplitude, a struje u
dq su iste veliine kao i fazne. Ukoliko neko eli da ogranii faznu struju na 5 Amp, on
na tu vrednost treba da ogranii i amplitudu alpha-beta, kao i sqrt(Id
2
+Iq
2
).
Ako se koristi ovaj koeficijent transformacije, treba samo obratiti panju raunu snage i
momenta korienjem dvofaznih ili dq, koji se moraju mnoiti sa 3/2 da bi se dobile
tane vrednosti.


Page 8 of 52 Metode regulacije EP primenom mikroprocesora- skripta

2.2.2. Park transformacija - stacionarni u rotacioni dq domen

Prelazak iz stacionarnog dvofaznog (vezan za stator), u rotacioni dvofazni. Rotacioni
sistem se okree sa
dq
i uvek je pod promenjivim uglom
dq
u odnosu na stator.

Fig. 2.3. Promenjiva opisana koordinatama u i dq sistemu.
Pozitivan ugao
dq
(
s
na slici) je u kontra smeru sata, ime se dobija sledea
transformacija koordinata
dq
j
dq
e

= X X
r r
ili
( )( )

+ =
+ =
+ = +
dq dq q
dq dq d
dq dq q d
X X X
X X X
j jX X jX X






cos sin
sin cos
sin cos
Park transformacija:
(

=
(



X
X
X
X
q
d
cos sin
sin cos

dq
se definie kao:

= dt
dq dq
, sa
dq
sinhronom rotirajuom brzinom.
Iz dq sistema moemo nazad u inverznom transformacijom obrtanja (promena
znaka ugla transformacije !),
dq
j
dq
e e

+
= X X
r r

Inverzna Park transformacija:
(


=
(

q
d
X
X
X
X

cos sin
sin cos

Intuitivna provera inverzne transformacije:
Za vektor na samoj d-osi 0 j X
d dq
+ = X
r
dobijamo
( )( )

=
=
+ + =
dq d
dq d
dq dq d
X X
X X
j j X

sin
cos
sin cos 0 X
r

Page 9 of 52 Metode regulacije EP primenom mikroprocesora- skripta

2.3. AM model u domenu

Jednaine elektrinog podsistema asinhronog motora u domenu glase:

dt
d
i R u
dt
d
i R u
s
s s s
s
s s s

+ =
+ =

r r
r
r r
r r
r
r r
dt
d
i R
dt
d
i R

+ =
+ + =
0
0

s u indeksu promenjiva i parametar pripadaju statorskom kolu
r u indeksu promenjiva i parametar pripadaju pripada rotorskom kolu
dt
d
dt
d
r
r

, indukovana EMS usled promene fluksa


r r r r
, indukovana EMS usled rotacije rotora u odnosu na stac. ose
Jednaine fluksni obuhvata u domenu:

r m s s s
r m s s s
i L i L
i L i L

+ =
+ =

s m r r r
s m r r r
i L i L
i L i L

+ =
+ =

U gornjim jednainama u predstavlja napon, i je struja , je fluks u maini,
r
je
ugaona brzina and R je statorka otpornost.
Parametri induktivnosti su L
s
induktivnost statora (Lxs+Lm), L
r
rotor inductance
(Lxr+Lm), and L
m
magnetizaciona induktivnost. Ove vrednosti nisu vie vremenski
zavisne i za jedan nivo zasienja magentnog kola predstavljaju konstante!

2.4. IM model in dq reference frame
Analysis and control of induction machine in stationary reference frame is still
complicated because all variables are still sinusoidal quantities, even in stationary
operation state. For constant machine speed and load, angular frequency of all
variables is equal to the frequency of the rotating field. By using Park transformation,
all variables (voltages, currents and fluxes) in synchronously rotating reference frame
appears as constants. A set of variables are transformed in dq reference frame
which rotates in synchronism with magnetic field angular frequency
e
.



X X
r r
(

=
dq dq
dq dq
dq
cos sin
sin cos
,

+ =
t
dq dq dq
dt
0
) 0 ( .
Finally, equations of induction machine in synchronously rotating reference frame may
be expressed as:

ds dq
qs
qs s qs
qs dq
ds
ds s ds
dt
d
i R u
dt
d
i R u
+

+ =

+ =


dr r dq
qr
qr r
qr r dq
dr
dr r
dt
d
i R
dt
d
i R
+

+ =

+ =
) ( 0
) ( 0



Supposing magnetically linear system, the flux linkages may be expressed as:

qr m qs s qs
dr m ds s ds
i L i L
i L i L
+ =
+ =

qs m qr r qr
ds m dr r dr
i L i L
i L i L
+ =
+ =
(2.6.)
Page 10 of 52 Metode regulacije EP primenom mikroprocesora- skripta

In Fig. 6, a transformation of original phase windings to the equivalent windings in
rotating dq system is illustrated. One must note following angles:

dq
- angle between rotating reference frame (magnetic field) and stator,

r
- angle between rotor and stator,

k
- angle between rotating reference frame and rotor, or slip angle.
Their relations are given by following:

r dq k
=

+ = + =
t
dq dq dq
t
r r r
dt dt
0 0
) 0 ( ) 0 (


Fig. 2.4. Equivalent machine windings in dq reference frame.
Electromagnetic torque may be evaluated, knowing that only mutual perpendicular
magnetic fields components of stator and rotor are producing torque, from following:
) (
2
3
) (
2
3
ds qr qs dr
r
m
ds qs qs ds el
i i
L
L
p i i p m = =
Page 11 of 52 Metode regulacije EP primenom mikroprocesora- skripta

3. Indirektna vektroska kontrola (IFOC)

3.1. Strujno kontrolisani naponski invertor redukcija reda
AM modela

3.1.1. Potpuni model AM fluks rotora i struja statora promenjive stanja

Model asinhrone maine je mogue izgraditi na osnovu razliitih promenjivih stanja.
Kada pogon poseduje strujno regulisani naponski invertor (CRVSI) pogodno je za
promenjive stanja odabrati upravo vektor struje statora i vektor fluksa rotora.
Jednaine naponskog balansa namotaja statora i rotora, kao i jednaine fluksnih
obuhvata, izraene preko kompleksnih vektora napona, struja i flukseva glase:

r r dq
r
r r
dq s
j
dt
d
R
j
dt
d
R

r
r
r
r
r
r
r
) ( 0
s
s
s
+ + =
+ + =
i
i u
s
(2.7.)

r r m r r m s s
L L L L i i i i
s s
r r
r
r r
r
+ = + = , (2.8.)

gde su:
(

=
qs
ds
s
u
u
u
r
,
(

=
qs
ds
i
i
s
i
r
i
(

=
qr
dr
r

r
vektori napona,struje statora i fluksa rotora, u dq.
Korienjem sledeih jednakosti:

r
m r
r
L
L
s
i
i
r
r
r

=

,
r
r
m
s
L
L
L
r
r
r
+ =
s
i ,
r r dq r r
r
j R
dt
d

r
r
r
) ( = i ,

kompleksne jednaine maine postaju:

Statorske jednaine modela
s r r r
r
r
dq
R
T j
T R
k
T j
dt
d
T u i i
i
s s
s
r r
r r
r


+ + = +
1
) 1 ( , (2.9.)
Rotorske jednaine modela

s
i
r
r r
r
m r r r dq r
r
r
L T j
dt
d
T + = +

) ( , (2.10.)

gde su:
r
m
r r r s
m
r s
s
r
r
L
L
k k R R R
L
L L
L L
R
L
T
R
L
T = + = = = =

, , ) 1 ( , ,
2
2
r
.
Jednaina mehanikog podsistema je data sa
opt r
r
m
r
r
m
m
L
L
p dt
d
T = + ) (
2
3
s
i
r
r

, (2.11.)
u kojoj je elektromagnetni momenat prikazan kao vektorski proizvod fluksa rotora i
struje statora.
Blok dijagram toka kompleksnih signala u ovom modelu je prikazan na slici 2.3. Slian
model prikazan je i u literaturi [x]
Page 12 of 52 Metode regulacije EP primenom mikroprocesora- skripta


k
r
/ R

T
r
jT

L
m
T

T
r
jT
r
1/R

K
m
u
s

dq

k
m
opt
m
el
el. podsistem - stator
mehaniki
podsistem
T
m

i
s


i
s


el. podsistem - rotor

Sl. 3.1. Kompleksni model AM sa vektorima struje statora i fluksa rotora kao promenjivima stanja

U prikazanom modelu asinhronog motora jasno su razdvojena tri podsistema, dva
elektrina i jedan mehaniki. Blok
r r
T R k

/ predstavlja povratnu spregu rotora na stator.

3.1.2. Redukovani model AM uticaj regulacije struja statora

Elektrini podsistem jednaina statora je uglavnom povezan sa modelovanjem strujno
regulisanog naponskog invertora / current regulator voltage source inverter (CRVSI).
Zadatak CRVSI je da obezbedi takav vektor napona statora da, nezavisno od
parametara i reima rada motora, struje statora budu bliske ili jednake zadatim.
Ukoliko modelovanje rada strujno regulisanog naponskog invertora nije od interesa,
mogue je uprostiti model na slici 2.3. Moemo naprosto izbaciti ceo blok el.
podsistema statora i merene struje statora direktno koristiti na ulazu modela rotorskog
dela. Time se eliminie potreba za reavanjem jednaina naponskog balansa statora.

Ukoliko imamo idealan strujno regulisani naponski invertor, tada moemo smatrati da
su ostvarene (merene) i zadate struje statora jednake. U tom sluaju moemo koristiti
referentni vektor struje statora na ulazu rotorskog elektrinog podsistema.


k
r
/ R

T
r
jT

L
m
T

T
r
jT
r
1/R

K
m
u
s

dq

k
m
opt
m
el
el. podsistem - stator
mehaniki
podsistem
T
m

i
s


i
s


el. podsistem - rotor
i
s


Ne zanima nas vie! Direktno smo
ubacili struju koju elimo!!!!


Sl. 3.2. Strujno regulisani naponski invertor direktno kontrolie struju statora (a ne napon) i
nema vie potrebe za modelom naponskih jednaina statora time se model maine uproava !
Page 13 of 52 Metode regulacije EP primenom mikroprocesora- skripta


Eliminacijom jednaina naponskog balansa statora model elektrinog podsistema se
redukuje i svodi samo na jednu vektorsku jednacinu (2.22). Rasprezanjem (2.22) na
obe ose dobija se (2.24).

qs m dr r k qr
qr
r
ds m qr r k dr
dr
r
i L T
dt
d
T
i L T
dt
d
T
+ = +
+ + = +

,
(2.12.)

Izraz za ostvareni elektromagnetni momenat je takoe ukljuen u model:
[ ],
2
3
ds qr qs dr
r
m
el
i i
L
L
p m =
gde je uestanost klizanja
r dq k
= .
Redukovani model asinhronog motora je prikazan na slici 2.4. Zadavanjem
odgovarajuih referentnih veliina CRVSI mogue je u mainu utisnuti eljeni (bilo koji)
kompleksni vektor ulaznih struja statora (
s
i
r
), na eljenoj uestanost pobudnog polja
(
dq
). Ukoliko je poznata uestanost rotora (obezbedjeno merenje ili procena te
veliine) kontrolom uestanosti pobudnog polja se praktino kontrolie uestanost
klizanja
k
. Za promenjivu stanja i dalje je zadran vektor rotorskog fluksa (
r

r
). I dalje
vai jednaina mehanikog podsistema (2.23).

i
ds
L
m
T
r

dr

dq

k
m
opt
m
el
Elektrini podsistem
Mehaniki podsistem
i
qs
T
r
T
r

qr

qr

dr
T
m
K
m

dr
i
qs

qr
i
ds

Sl. 3.3. Redukovani model maine uz vektor fluksa rotora kao promenjivu stanja.

Kao direktna posledica merenja i kontrole vektora struje statora elektrini podsistem
modela maine je redukovan na samo dve jednaine i opis pojava u asinhronoj maini
je vidno uproen. Time i dalje nije obezbeeno raspregnuto upravljanje fluksom i
elektromagnetnim momentom. Da bi se ove dve upravljake konture raspregnule,
dodatni prorauni u kontroleru su neophodni.


Page 14 of 52 Metode regulacije EP primenom mikroprocesora- skripta

3.2. IFOC Teorijske osnove, analogni domen

Dakle, jednaine statora vie ne razmatramo, smatramo da moemo utisnuti bilo koji
vektor struje, zadate amplitude i faznog stava.
Ostaju jednaine naponska balansa rotora
dr k
qr
qr r dr r dq
qr
qr r
qr k
dr
dr r qr r dq
dr
dr r
dt
d
i R
dt
d
i R
dt
d
i R
dt
d
i R
+

+ = +

+ =

+ =

+ =


) ( 0
) ( 0

koje sadre rotorsku struju i rotorski fluks. Fluks je u redu da ostane, njega i hoemo
da kontriemo, ali rotorksa struja nam ne odgovara kao promenjiva poto je ne
moemo ni meriti ni kontrolisati. Na osnovu fluksnih obuhvata za, na primer, d-osu se
dobija
r
ds m dr
ds ds m dr r dr
L
i L
i i L i L

= + =
Ako ovo uvrstimo u naponski balans d-ose rotora, dalje vai
qr k
dr
r
ds m dr
r qr k
dr
dr r
dt
d
L
i L
R
dt
d
i R

+

=

+ = 0
Ako usvojimo vremensku konstantu rotora
r
r
r
R
L
T = dobijamo jednaine naponskog
balansa rotorskog kola koje su mnogo pogodnije za analizu.


qs m dr r k qr
qr
r
ds m qr r k dr
dr
r
i L T
dt
d
T
i L T
dt
d
T
+ = +
+ + = +

,


Ako gradimo FOC kontrolu orijentisanu kao fluksu rotora tada je naa elja da d-osu
naeg dq koordinatnog sistema postavimo na vektor fluksa rotora. Da bi to ostvarili,
moramo anulirati q-komponentu rotorskog fluksa u naim jednainama. Da bi tu uradili,
mi indirektno biramo klizanje takvo (pogledaj gornji izraz za q-osu)
dr r
qs m
k
T
i L

= ,
da bilo koja komponenta rotorskog fluksa u q osi mora vremenom nestati.
. 0 = +
qr
qr
r
dt
d
T


Dakle, rotor fluks nestaje iz q ose (
qr
= 0) i ceo vektor se podeava na d-osu.
Nadalje, uz uvaavanje injenice da je
qr
= 0 jednaine za d-osu postaju:

ds m dr
dr
r
i L
dt
d
T = +



Sada je jasno da je rotorski fluks kontrolisan sam d-strujom statora:
( ) ( ) p i
pT
L
p
ds
r
m
dr
+
=
1

Kada se fluks uspostavi, dobija se:
ds m dr
i L =
Dakle, amplituda rotorskog fluksa se kontrolie samo sa d komponentom struje statora.
U isto vreme, razvijeni elektromagnetni momenta glasi:

Page 15 of 52 Metode regulacije EP primenom mikroprocesora- skripta

.
2
3
,
r
m
T qs dr T el
L
L
p K i K T = =

to znai da se on kontrolie nezavisno od fluksa u maini, korienjem q komponente
vektora struje statora.
Gornje jednaine su osnova nezavisnog upravljanja fluksom i momentom asinhrone
maine. Pri tom, osnova ove strategije je kalkulacija klizanja, koja doprinosi indirektni
proraun poloaja fluksa rotora u odnosu na sam rotor. Na taj poloaj rotorksog fluksa
postavljamo i na referentni koordinatni sistem, dq sistem u kome d je d komponenta
struje paralelna sa fluksom i kontrolie ga, dok je q komponenta struje normalna na
fluks i pravi momenat. IFOC kalkulator klizanja je dat na sl. 4.1:


Fig. 3.4. Position of the synchronous reference frame calculation in IFOC.

ta je sa strujom rotora? Ako iskoristimo rotorske jednaine fluksni obuhvata za d-osu
dobijamo:
dt
di
L
L
i
T dt
di
ds
r
m
dr
r
dr
=
1

Ovo je stabilna diferencijalna jednaina prvog reda u kojoj moemo posmatrati
promenu d struje statora di
ds
/dt kao ulaz. Ako je i
ds
konstantno, konstantna komanda
fluksa rotora, tada i
dr
odlazi na nulu i ostaje nula, nevezano od ostalih tranzijenata.
Time je cela rotorska struja premetena u q osu, dok je ceo rotorski fluks u d-osi.
Dakle, ugao izmeu rotorske struje i fluksa je uvek 90 stepeni, i optimalni rad maine
je ostvaren.

3.3. IFOC Praktina implementacija (preview)

Pri praktinoj izradi IFOC upravljanja koristimo dva ulaza, vektor struje statora i poloaj
rotora, kao i jedan parametar, rotorsku vremensku konstantu - T
r
.
Praktina izrada IFOC upravljanja poinje proraunom amplitude rotorskog fluksa.

ds
r
m
dr
i
pT
L
+
=
1
i.e.
ds m dr
i L =


Zatim, rauna se referentna ugaona frekvencija klizanja rotora, i njen ugao:

dt
T
i L
k
dr r
qs m
k

= =



Konano, novi dq sistem se pozicionira dodavanjem ugla klizanja (koji ubija q-fluks) na
izmeren ugao rotora:

k r e


+ =

Page 16 of 52 Metode regulacije EP primenom mikroprocesora- skripta

Pozicija rotora
r

se obino direktno meri (enkoder, rezolver), ali se moe i estimirati


na osnovu izmerene ili proraunate brzine:


dt
r r

=


Znajui da se momenat kontrolie sa q (izlaz regulatora brzine), dok se fluks kontorie
za d-strujom statora (izlaz regulatora fluksa,konstanta ili sporo promenjiva veliina)
dobija se tipian blok dijagram regulisanog pogona po brzini sa asinhronim motorom u
kome se FOC ostvaruje na indirektan nain, in Fig. 4.2

Fig. 3.5. Indirect field oriented control (IFOC). Treba enkoder a ne tacho na slici!
From Fig. 8, it can be noted that IFOC structure basically needs following parts:
- three-phase voltage source inverter
- current measurement,
- rotor position measurement (or estimation),
- rotor flux angle estimation.
- current vector transformation from abc to dq reference frame
- two current controllers, working in dq frame, one for d and one for q axis,
- Reference voltage Vd
REF
, Vq
REF
transformation from dq back to V
REF
V
REF

- Space vector modulator with V
REF
and V
REF
as inputs

These parts and its implementation related discussion will be explained in the following
text.


Page 17 of 52 Metode regulacije EP primenom mikroprocesora- skripta

4. Merenje linijskih struja motora

Da bi se realizovalo IFOC upravljanje, kao to je ve napomenuto, potrebno je
poznavati poloaj magnetnog fluksa motora, kao i vrednosti struja faza motora. Poloaj
magnetnog fluksa motora dobijamo kao zbir poloaja vratila motora i estimirane
vrednosti ugla klizanja. S toga je neophodno merenje poloaja vratila motora. S druge
strane, da bi se vrila estimacija ugla klizanja i regulacija struja po d i q osi, nephodno
je poznavati stvarne vrednosti ovih struja. Stvarne vrednosti struja po d i q osi
dobijamo trnasformacijom struja faza motora, te iz toga sledi potreba za merenjem
istih. U ovom poglavlju bie objanjeni neki od naina merenja pomenutih veliina, te
osnovni principi prezentacije istih unutar samog DSP-a. Jedna praktina realizacija
merenja i obrada merenih signala bie objanjena u poglavlju 6.
Na sledeoj slici je prikazan blok dijagram jednog IFOC regulisanog pogona.

en
Prilagodna
kola
LEM
LEM
i


i
b

PI
PI
dq

SV
PWM

dq
abc


estimacija
ugla s
n
i
q
i
d

i


i


Clarke


Park

s
-

-

i
qref
V
qref
V
dref
V
ref
V
ref
InvPark


i
dref

PI
Reg brzine i
Slabljenje polja

-

n
ref
AD
konv.
QEP
Kontrolni sistem (uC ili DSP)
AM V~ V
DC
PWM
signali
Strujno regulisan
naponski invertor
Diodni
ispravlja

Sl. 4.1 Blok dijagram IFOC regulisanog pogona blokovi za generisanje referentnih vrednosti
momenta i fluksa, merenje linijskih struja (crveno) i merenje poloaja rotora (plavo)

Struju u naizmeninim pogonima treba meriti bipolarnim davaima (senzorima) i treba
ih procesirati kao bipolarni signal. Jedan od naina merenja struje je merenje LEM
sondom. Ovaj senzor radi na principu Hall-ovog efekta.
LEM sonda na svom izlazu daje naponski signal opsega
MAX
LEM
V , koji je proporcionalan
merenoj vrednosti struje. Naravno, za
MAX
LEM
V se ima za
MAX
I . Sledi da je pojaanje
LEM sonde:
Page 18 of 52 Metode regulacije EP primenom mikroprocesora- skripta

MAX
MAX
LEM
LEM
I
V
G = (4.1.1)
Ulaz AD konvertora DSP-a ima opseg (0
REF
AD
V ), pa je prethodno neophodno uskladiti
opseg signala sa senzora, opsegu ulaza AD konvertora. Takoe, radi to kvalitetnijeg
merenja, potrebno je iskoristiti ceo opseg AD konvertora. U tu svrhu koristimo
operacioni pojaava sa pojaanjem:
MAX
LEM
REF
AD
OP
V
V
G

=
2
(4.1.2)
i naponskim offset-om:
2
REF
AD
OFFSET
V
V = (4.1.3)
kako bi za minimalnu merenu struju na ulazu AD konvertora imali nulti napon, a za
maksimalnu merenu struju
REF
AD
V . Sada za naponski signal na ulazu AD konvertora
imamo:
( ) ( )
2
REF
AD
LEM OP OFFSET LEM OP IN
V
A I G G V A I G G V + = + = (4.1.4)
Potrbno pojaanje i naponski offset operacionog pojaavaa se dobijaju pravilnim
izborom otpornika R
1
, R
2
, R
3
i R
4
(Sl. 4.1.1).
Brojni rezultat AD konverzije moe se izraziti kao:
( )
REF
AD
REF
AD
LEM OP
REF
AD
IN
V
V
A I G G
V
V
RESULT ADC
4095
2
4095 _
|
|

\
|
+ = = (4.1.5)
Broj 4095 predstavlja maksimum brojnog opsega AD konvertora, pod pretpostavkom
da je AD konvertor 12-bitni, kao to jeste sluaj sa TI DSP TMS320F2808.
Dalje, uvrtavanjem (4.1.1) i (4.1.2) u (4.1.5) dobijamo:
( )
REF
AD
REF
AD
MAX
MAX
LEM
MAX
LEM
REF
AD
V
V
A I
I
V
V
V
RESULT ADC
4095
2 2
_
|
|

\
|
+

=
( )
2
4095
2
4095
_ + =
MAX
I
A I
RESULT ADC (4.1.6)
Rezultat konverzije se u sluaju TI DSP TMS320F2808 smeta u 16-bitni registar u Q15
formatu, tako to se nakon konverzije pomera za 4 bita u levo (tzv. levo poravnanje ili
poravnanje sa MSB bitom). Kako TI DSP TMS320F2808 obrauje 32-bitne podatke,
potrebno je dobijeni rezultat prevesti u fixed point Q24 (IQ8.24) format. Ovo se radi
pomeranjem rezultata za 9 bita u levo.
( )
00 0 00 0 200 0 _ _ xFFF xFFF
I
A I
x RESULT ADC NUMBER ADC
MAX
+ = = (4.1.7)
Sada je potrbno eliminisati offset, kako bi rezultat merenja imao bipolarnu vrednost.
Page 19 of 52 Metode regulacije EP primenom mikroprocesora- skripta

( ) OFFSET ADC NUMBER ADC kT I _ _ = (4.1.8)
gde je:
00 0 200 0
0
_ xFFF x
V
xFFF
V OFFSET ADC
REF
AD
OFFSET
= = (4.1.9)
pa dobijamo:
( )
( )
00 0xFFF
I
A I
kT I
MAX
= (4.1.10)
Kako ( ) [ ]
MAX MAX
I I A I , imamo da ( ) kT I zapisan u Q24 formatu ima opseg vrednosti
priblino 1.
Na sledeoj slici je data celokupna struktura procesiranja signala merene struje.

L
E
M
AD
<<13
V
AD
REF
+
-
R
1
R
2
R
4
R
3
+
-
I
MAX

OP
TI DSP TMS320F2808
V
LEM

V
IN

V
AD
REF
0
ADC_OFFSET

0x1FFE000

0x0000000 0x00FFF000

0xFF001000
I(kT)

Sl. 4.2. Struktura procesiranja signala merene struje
Za
REF
OFFSET
V pogodno je uzeti
REF
AD
V , jer nam je ova referentna vrednost napona lako
dostupna.
Gore izvrena analiza ne zavisi od naina na koji je izvreno galvansko odvajanje
signala struje. Ovo odvajanje je obino potrebno, pogotovo ako se koristi merni strujni
ant. U sluaju dodatnog kola za galvansku izolaciju, njegovo pojaanje je neophodno
ukljuiti u analizu i korigovati pojaanje operacionog pojaavaa.
Page 20 of 52 Metode regulacije EP primenom mikroprocesora- skripta

5. Merenje poloaja rotora inkrementalnim
enkoderom

Kao to je reeno, za realizaciju IFOC upravljanja, kao i za potrebe regulacije pozicije
rotora, neophodno je meriti poloaj rotora. Podatak o poloaju rotora moemo dobiti na
sledee naine:
integraljenjem signala sa meraa brzine kao to je npr. jednosmerni
tahogenerator,
brojanjem pridolih impulsa sa davaa kao to su inkrementalni enkoder ili
sinhroni tahogenerator i
sa stanovita praktine primene najjednostavniji nain je merenje poloaja
rotora apsolutnim enkoderom ili rezolverom, gde podatak o poloaju dobijamo
direktno sa meraa u obliku digitalne rei.
Inkrementalni enkoderi su se zbog relativno jednostavne implementacije, te
pristupanosti po ceni, pokazali kao najbolje reenje za veinu servo pogona, te e se u
daljem teksu razmatrati samo merenje poloaja rotora inkrementalnim enkoderom.
Princip rada optikog inkrementlnog enkodera dat je na sledeoj slici.

Sl. 5.1. Princip rada inkrementalnog enkodera
Disk sa prorezima rotira se zajedno sa vratilom motora i see svetlosni snop LED diode
koja je postavljena sa jedne strane diska. Nasuprot LED diodi postavljen je optiki
senzor, koji provodi u zavisnosti od osvetljenosti. Signal sa senzora se dalje obrauje u
uobliavakom kolu. Konano na izlazu kola za uobliavanje imamo povorku
pravougaonih impulsa. Izlaz inkrementanog enkodera se sastoji od dva ovakva signala
(signal A i signal B), fazno pomerena za 2 jedan u odnosu na drugi, zbog ega ovi
enkoderi jo nose i naziv kvadraturni enkoderi. Zahvaljujui ovom faznom pomeraju
mogue je odrediti smer obrtanja vratila motora u zavisnosti od toga koji od ova dva
signala prednjai. Trei izlazni signal inkrementalnog enkodera je index signal koji je
aktivan samo jednom po obrtaju, te nam daje informaciju o izvrenoj rotaciji. Ovaj
podatak slui za odrivanje apsolutne pozicije vratila pri putanju pogona u rad.
Pojedini enkoderi poseduju duplo vie izlaza, time to svaki signal ima i svoj
Page 21 of 52 Metode regulacije EP primenom mikroprocesora- skripta

komplementarni par. U ovom sluaju se mogu koristiti diferencijalni enkoder drajveri i
poveava se otpornost na uticaj uma.

A
B
index

Sl. 5.2. Izlaz inkrementalnog enkodera
Osnovni parametar inkrementalnog enkodera je broj impulsa po obrtaju. Poloaj vratila
motora se dobija kao:
N
n

2
= (4.2.1)
gde su:
N - rezolucija enkodera (broj impulsa po obrtaju)
n - broj pridolih impulsa i odreenom vremenskom intervalu
Broj pridolih impulsa ujedno predstavlja i brojnu vrednost ugla.
Signale za detekciju smera dobijamo na sledei nain:
+ + + = B A B A B A B A UP (4.2.2)
B A B A B A B A DOWN + + + = (4.2.3)
UP signal postoji kada faza A prednjai fazi B, odnosno pri okretanju vratila u jednom
smeru. U sluaju suprotnog smera, pojavljuje se DOWN signal.
Rezoluciju enkodera moemo poveati etiri puta podeavanjem brojake jedinice DSP-
a da broji i uzlaznu i silaznu ivicu impulsa. Tada jednaina (4.2.1) glasi:
N
n

=
4
2
(4.2.4)
Izlaz inkrementalnog enkodra se dovodi na brojaki ulaz DSP-a. Pogodno je podesiti
bazu brojaa (period registar) na vrednost jednaku rezoluciji enkodera, odnsono na
etiri puta veu vrednost. Tako, u svakom trenutku jednostavnim uitavanjem sadraja
brojaa dobijamo ekvivalentnu brojanu vrednost trenutnog ugla poloaja rotora od 0
do 2 .
Mogui merni opsezi signala pozicije za inkrementalni enkoder rezolucije od 1024
impulsa po obrtaju, dati su na sledeoj slici.
Page 22 of 52 Metode regulacije EP primenom mikroprocesora- skripta


t
(rad)

enc
(broj)
N
0
2
0
N/2

DSP
(broj)
0xFFF
0
0x7FF

4N
0
2N

Sl. 5.3. Merni opsezi signala pozicije

5.1. Procena brzine rotora na osnovu merenog poloaja


Procenu brzine pomou inkrementalnog enkodera moemo vriti sledeim metodama:
brojanjem pridolih impulsa tokom nekog fiksonog vremenskog perioda
(pogodno za velike brzine)
merenjem vremena izmeu dva susedna impulsa (pogodno za male brzine)
kombinovana metoda, gde se u toku vremenskog intervala odabiranja broje
pridoli impulsi, meri vreme od poetka intervala do pojave prvog impulsa kao i
vreme od poslednjeg impulsa do kraja intervala. Na taj nain se moe odrediti
srednja vrednost vremenskog intervala izmeu dva impulsa sa veom tanou
nego u prethodne dve metode.
Inkrementalni enkoderi imaju relativno veliku rezoluciju, te je u irokom opsegu brzina
mogue dovoljno precizno proceniti brzinu rotora brojanjem pridolih impulsa tokom
nekog fiksnog vremenskog perioda, te e dalje u tekstu biti objanjena samo ova
metoda.

Sl. 5.4. Grafiki prikaz pridolih impulsa u vremenskom intervalu T
Svaki novopridoli impuls predstavlja pomeraj od . Ukupni ugaoni pomeraj u periodi
T izmeu trenutaka T kT i kT se rauna pomou ukupnog broja pridolih impulsa.
( ) ( ) = n T kT kT (4.2.5)
gde je:
[ ] rad
N

2
= ili [ ] rad
N
=
4
2
(4.2.6)

Kako u digitalnim sistemima vrednost ugaonog poloaja rotora poznajemo samo za
trenutke odabiranja, srednju vrednost brzine rotora dobijamo sledeom
aproksimacijom:
( )
( ) ( )
[ ] s rad
T
n
T
kT T kT
t
s rad


=

=
d
d
(4.2.7)
t
kT-T kT
t
1
t
2
t
3
t
4
t
5

n
Page 23 of 52 Metode regulacije EP primenom mikroprocesora- skripta

Kao to je reeno, ako postavimo bazu brojaa na vrednost rezolucije enkodera,
odnosno na etiri puta veu vrednost, u DSP-u imamo ekvivalentu brojanu vrednost
ugla poloaja rotora, pa vai sledea relacija:
( ) ( ) ( ) ( )
T
T kT kT
N T
T kT kT
broj broj

=

=

4
2

broj
T N



=
4
2
(4.2.8)
gde su:
( ) T kT
broj
- ekvivalentna brojana vrednost ugla poloaja rotora u trenutku T kT
( ) kT
broj
- ekvivalentna brojana vrednost ugla poloaja rotora u trenutku kT
broj
- ekvivalentna brojana vrednost ugla prirataja u intervalu od T kT do kT

Za potrebe brzinske regulacije neophodno je uskladiti opsege vrednosti zadavane
reference i ekvivalentne brojane vrednosti merene brzine rotora.
ref ref ref
broj
ref
n
N
n
N N

=
60
4
60
2
2
4
2
4

(4.2.9)
Greka opisane metode raste sa opadanjem brzine, kao i u sluaju smanjivanja periode
odabiranja. Ovo se deava usled smanjenja pridolih impulsa u toku jedne periode, pa
je uticaj vemena od poetka periode do pojave prvog impulsa i od poslednjeg impulsa
do kraja periode na krajnji rezultat vei.
Jedan od naina da se smanji greka je da se do odreene brzine, brzina rauna
merenjem vremena izmeu dva uzastupna impulsa, a na brzinama veim od te zadate,
rauna brojanjem impusla u odrenom fiksnom vremeskom intervalu. Takoe, kao to
je i reeno, kombinovanom metodom se greka merenja minimalizuje.

Page 24 of 52 Metode regulacije EP primenom mikroprocesora- skripta

6. Space vector PWM modulator (SVPWM) for VSI

6.1. Introduction

One of the method for achieving a 3-phase sinusoidal voltage waveforms that are
refined of low-frequency harmonic content is space vector pulse-width modulation
(SVPWM). This modulation strategy is particularly designed to work with voltage
commands expressed in terms of transformed variables, so it is proper for vector
control. In this modulation method, voltage commands expressed in a stationary
reference frame are sampled at the beginning of each switching (PWM) cycle, and then
voltage source inverter is switched in such a way that the fast average of actual
voltages in stationary frame at the output are obtained over the ensuing switching
period. Also, in compare to ordinary sinusoidal modulation, SVPWM increase utilization
of DC bus, where it can use up to 90,6% of the inverter capability (linear modulation).
With the space vector modulator phase to phase voltage amplitude is exactly equal to
DC bus voltage, V
DC
, and consequently maximum phase to ground amplitude is
V
DC
/1.73.

6.2. Space Vector reference Inverse Park

Usually, it the IFOC vector drive only phase currents are transferred from to dq
coordinate system. These currents are than fed to the current regulators which have dq
voltage references on the outputs. Voltage references are than transferred from dq to
coordinate system using inversed transformation (Inverse Park)and fed to the space
vector module.

dq
REF
qf dq
REF
df
REF
f
dq
REF
qf dq
REF
df
REF
f
V V V
V V V

cos sin
sin cos
+ =
=



6.3. Space vector theory

6.3.1. Space vector definition

With a three-phase voltage source inverter, shown in Fig. 9, there are eight possible
operating states.
A B C
T
1
T
2
T
3
T
4
T
5
T
6
A
B
C
N
V
DC
V
AY
G

Fig. 6.1. Three phase voltage source inverter with load star connection.

Eight possible states of inverter switches create different phase to ground voltages, V
AG
,
V
BG
and V
CG
, which can be equal to V
DC
if an upper switch in leg is on or 0 if a lower
switch in leg is on. Once each of the phase to ground voltages are found, the phase to
star neutral voltages, V
AN
, V
BN
and V
CN
may be easily calculated using following
equations:

Page 25 of 52 Metode regulacije EP primenom mikroprocesora- skripta

( )
CG BG AG AN
V V V V + =
3
1
3
2
( )
CG AG BG BN
V V V V + =
3
1
3
2
( )
BG AG CG CN
V V V V + =
3
1
3
2

Using the Clarke transformation we can transform all eight available phase voltages V
XN

combinations into the coordinate system:

[ ]
C B C B A
V V V V V V V =
(

=
2
3
3
2
2
1
2
1
3
2



In order to keep the same amplitude of alpha and beta voltages as the amplitude of
phase voltages, the transformation with 2/3 coefficient is used (there is also
transformation with coefficient (2/3), invariant to the power). All possible voltages
are given in the next table relatively to the V
DC
.

vector S
A
S
B
S
C
V
AN
V
BN
V
CN
V

V

space vector
V
1
1 0 0 2/3 -1/3 -1/3 2/3 0 (2/3) e
j0
V
2
1 1 0 1/3

1/3

-2/3

1/3
3 / 3
(2/3) e
j/3

V
3
0 1 0 -1/3 2/3 -1/3 -1/3
3 / 3
(2/3) e
j2/3

V
4
0 1 1 -2/3 1/3 1/3 -2/3 0 (2/3) e
j3/3

V
5
0 0 1 -1/3 -1/3 2/3 -1/3
3 / 3
(2/3) e
j4/3

V
6
1 0 1 1/3 -2/3 1/3 1/3
3 / 3
(2/3) e
j5/3

V
0
0 0 0 0 0 0 0 0 0
V
7
1 1 1 0 0 0 0 0 0
Table 1. Available space vector states - 6 active and 2 zero states.
Each combination of voltages can be described with one voltage vector. There is
totally 6 active vectors and 2 zero vectors. Possible 6 active voltage vectors create a
hexagon in reference frame. All the possible voltage combinations must result
with the voltage vector within the given hexagon, shown in the Fig. 10.

Fig. 6.2. Space vector representation in reference frame.

All eight states can be represented by the following space vectors:
6 ... 1 ,
3
2
3 / ) 1 (
= =

k e V V
k j
DC k

r






Page 26 of 52 Metode regulacije EP primenom mikroprocesora- skripta

6.3.2. How to get arbitrary voltage vector in space-vector hexagon

Three phase inverter can create eight different states on its output, represented in eight
different space vectors V
0
-V
7
. All other combinations of output voltage must be created
using the combination of these available states. The Continuous Space Vector
Modulation technique is based on the fact that every vector V
ref
inside the
hexagon can be expressed as a weighted average combination of the two
adjacent active space vectors and the null-state vectors 0 and 7. Therefore, in
each switching cycle imposing the desired reference vector may be achieved by
switching between these 4 inverter states. Assuming that T
S
is sufficiently small, V
ref

can be considered approximately constant during this interval, and it is this vector that
generates the fundamental behavior of the machine (mean space vector V
ref
over one
switching period T
S
). Looking figure below one finds that, assuming V
ref
sto be laying in
sector k, the adjacent active vectors are V
k
and V
k+1
.
V
V
T
T
V
2
2
T
T
V
1
1
2
V
1
V
REF
V
Sector 1
Sector 2
Sector 3
Sector 4
Sector 5
Sector 6

Fig. 6.3. Average V
REF
in the first sector created using V
1
, V
2
and zero vectors.

In order to obtain optimum harmonic performance and the minimum number of
switching for each of the power semiconductor switches, 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 if the sequence begins with one zero-state and the
inverter poles are toggled until the other null-state is reached. To complete the cycle
the sequence is reversed, ending with the first zero-state. If, for instance, the reference
vector sits in sector 1, the state sequence has to be (0127210) whereas in sector 4 it is
(0547450).
The central part of the space vector modulation strategy represents the computation of
both the active and zero-state times for each modulation cycle. These may be
calculated by equalizing the applied average voltage to the desired value.
In the following, T
k
denotes half the on-time of vector V
k
. T
0
is half the null-state time.
Hence, the on-times are evaluated by the following equations:

dt V dt V dt V dt V dt V
s
k k
o
k k
o
k
o
k
o
o
O s
T
T T
T
T T
T
T
T k
T
T
T k
T
o
T
ref

+
+
+ +
+ +
+
+
+
+ + + =
2
2
7
2
2
1
2
2
2
0
2
0
1
1
r r r r r

2
1
s
k k o
T
T T T = + +
+


Taking into account that V
o
= V
7
= 0 and that V
ref
is assumed constant and the fact that
V
k
, V
k+1
are constant vectors, equation reduces to:

1 1
2
+ +
+ =
k k k k
s
ref
T V T V
T
V
v v v


Page 27 of 52 Metode regulacije EP primenom mikroprocesora- skripta

6.4. Space Vector Pulse-Width Modulation (SVPWM)

The space vector module can create the PWM switching pattern using directly the
referent alpha and beta voltage components, V

REF
and V

REF
. This technique is mostly
used for digital current control, giving to the linear current regulators full control over
the phase voltage dq components. These dq components, defined on the current
regulators outputs, are transfer to the stationary reference frame and passed
through to the space vector modulator. The main task of space vector modulator is to
calculate the needed vector times directly from V

REF
and V

REF
, and based on that to
find duty cycle for each inverter leg (or switches, because switches in the same inverter
leg are complementary) (Fig. 12).


Fig. 6.4. Space vector modulator using V

REF
and V

REF
.


6.4.1. Vector time calculation example for first sector

The connection between the references V

REF
and V

REF
and needed active and zero
vector times is the best to be understood in first sector, helping with Fig. 13. Reference
vector can be represented with its the components:


V V V
ref
r r r
+ = ,

or, in complex form:


jV V V
ref
+ =
r


On the other hand, the same vector (if inside the hexagon) can be created using the
two active space vectors. For the first segment, vector angle in the (0 - /3) range, the
two active vectors are
1
V
r
and
2
V
r
. Average value of the reference vector (over one T
s
)
can be defined using part time vector
1
V
r
and part time vector
2
V
r
.

1
2
1
1
) (
V
T
T
V
T
T
V
s s
AV
ref
r r r
+ =

Finally, each active vector can be defined in the complex frame:


)
3
sin(
3
2
)
3
cos(
3
2
0
3
2
2
1

DC DC
DC
V j V V
j V V
+ =
+ =
r
r


Page 28 of 52 Metode regulacije EP primenom mikroprocesora- skripta

V
V
T
T
V
2
2
T
T
V
1
1
2
V
1
V
REF
V
60
30
2
V
1
V
REF
V
30
60
)
3
cos(
3
2
DC
V
DC
V
3
2
)
3
sin(
3
2
DC
V

a) Reference vector generation b) active vectors in complex form
Fig .6.5. Reference vector in the first sector.


Using all three above equations we can get:

( )
|
|

\
|
+
|

\
|
+ = +
+ = +
2 2 1
1 2 1 1
2
3
3
2
2
1
3
2
T
V
j T T
V
V jT V T
V T V T jV V T
DC DC
s s
s


r r


Splitting the equation on real and imaginary part we get:

s
DC
s
DC
s s
DC
T
T
V
T
T
V V
T
T
T
T
V V
2 2
2 1
3
3
2
3
3
2
2
1
3
2
= =
|
|

\
|
+ =



and:

|
|

\
|
+ =
=
DC
s s
DC
DC
s
V
V
T T T
V
V
V
V
T T

3
2
1
2
3
3
1
2


Finally, the needed vector on-times are:

( )
DC
s
DC
s
V
V
T T
V V
V
T
T


3
3
2
3
2
1
=
=


In the case that T
1
and T
2
are defined as one half of PWM ontimes (because of the
double update mode of PWM peripheral unit of most C):

Page 29 of 52 Metode regulacije EP primenom mikroprocesora- skripta

( )
DC
s
DC
s
V
V
T
T
V V
V
T
T


2
3
2
1
2
3 2 /
3
2
1
=
|
|

\
|
=


6.4.2. Vector time calculation - all sectors

In this section, the generic relation between the V

REF
and V

REF
and needed space
vector times is derived and an equation that is valid for all the sectors is given. It is
presumed that a motor is in the star connection and that V

and V

voltages are
referenced to the motor phases. Splitting vector equations into its real and imaginary
part (using

jV V V
ref
+ =
r
and
3 / ) 1 (
3
2

=
k j
dc k
e V V
r
), it follows that:

|
|
|
|

\
|
(
(
(

+
(
(
(

=
(

+1
)
3
sin(
)
3
cos(
)
3
) 1 sin((
)
3
) 1 cos((
3
2
2
k k DC
s
T
k
k
T
k
k
V
T
V
V



T
k
and T
k+1
are defined as one half of vector ontimes. Solving the system of equations
we can get (if k=1, the same as equation for first sector):

( )
1 0
1
2
)
3
) 1 cos((
)
3
cos(
)
3
) 1 sin((
)
3
sin(
2 /
3
+
+
=
(

(
(
(


=
(

k k
s
DC
s
k
k
T T
T
T
V
V
k
k
k
k
V
T
T
T

k=1..6

Table with the predefined sine/cosine values for each sector can be written in 1.15
format, using 866 . 0 2 / 3 = , which is helpful for the implementation.

sector
(k)
)
3
sin(

k )
3
cos(

k )
3
) 1 sin((

k )
3
) 1 cos((

k
1 0.866=28377 -0.5=-16383 0 =0 1= 32767
2 0.866=28377 0.5=16383 -0.866=-28377 0.5=16383
3 0 1= 32767 -0.866=-28377 -0.5=-16383
4 -0.866=-28377 0.5=16383 0 -1= -32767
5 -0.866=-28377 -0.5=-16383 0.866=28377 -0.5=-16383
6 0 -1= -32767 0.866=28377 0.5=16383
Table 1. Table containing all needed pre-calculated trigonometrically results.



Page 30 of 52 Metode regulacije EP primenom mikroprocesora- skripta

6.5. Software implementation notes for SVPWM

Firstly, the sector number must be found from reference voltages V

REF
and V

REF
, by
using scheme illustrated in Fig. 14.

Fig. 6.6. Sector determination using the references V

REF
and V

REF
.

If detected sector is k, the active vectors V
k
and V
k+1
will be used. Next, the space
vector times must be calculated. In order to have minimum number of online
calculations, the following formula is used:

( )
1 0
1
2
)
3
) 1 cos(( 3
)
3
cos( 3
)
3
) 1 sin(( 3
)
3
sin( 3
2 /
+
+
=
(

(
(
(


=
(

k k
s
DC
s
k
k
T T
T
T
V
V
k
k
k
k
V
T
T
T

k=1,,6

In that case, the predefined trigonometric results are numbers are in 2 range, and
2.14 format must be used.


sector
(k)
)
3
sin(

k )
3
cos(

k )
3
) 1 sin((

k )
3
) 1 cos((

k
1 1.5=24575 -0.433=-14188 0 =0 0.866=28377
2 1.5=24575 0.433=14188 -1.5=-24575 0.433=14188
3 0 0.866=28377 -1.5=-24575 -0.433=-14188
4 -1.5=-24575 0.433=14188 0 -0.866=-28377
5 -1.5=-24575 -0.433=-14188 1.5=24575 -0.433=-14188
6 0 -0.866=-28377 1.5=24575 0.433=14188
Table 6.1. Table containing all needed trigonometrically results in 2.14 format.


Next, the calculated vector times needs to be distributed to particular PWM channels.
PWM channel times are generated depending of the current sector. Situation for the
first sector is shown in Fig. 15, where it is obvious that duty cycle for channel A has the
longest ontime, and the duty cycle for channel C has the shortest on-time. Connection
between the two vector times and zero time with the PWM channels on time is given in
the next set of equations. The equations are valid for first sector only, but it can be
Page 31 of 52 Metode regulacije EP primenom mikroprocesora- skripta

generalized for all sector based on this. On times of the channels are exactly half of the
total PWM channel on-time during the one PWM period.

SMALL
T
T
MIDDLE T
T
T
BIG T T
T
T
C
k B
k k A
= =
= + =
= + + =
+
+
2
2
2
0
1
0
1
0


For any sector situation it is similar. First, BIG, MIDDLE and SMALL time are calculated.

2
2
2
0
1
0
1
0
T
SMALL
T
T
MIDDLE
T T
T
BIG
k
k k
=
+ =
+ + =
+
+

And then distributed to the right channels based on the following table.

Sector
number
Loading PWM values
SECTOR 1 T
A
= BIG , T
B
= MIDDLE , T
C
= ZERO
SECTOR 2 T
A
= MIDDLE, T
B
= BIG, T
C
= ZERO
SECTOR 3 T
A
= ZERO , T
B
= BIG, T
C
= MIDDLE
SECTOR 4 T
A
= ZERO , T
B
= MIDDLE, T
C
= BIG
SECTOR 5 T
A
= MIDDLE , T
B
= ZERO, T
C
= BIG
SECTOR 6 T
A
= BIG , T
B
= ZERO, T
C
= MIDDLE
Table 6.2. PWM channels ontimes distribution for all sectors.


Fig. 6.7. Vector times versus PWM channel times for sector 1.


Page 32 of 52 Metode regulacije EP primenom mikroprocesora- skripta

7. Motor current regulators in dq reference frame

Motor currents are controlled in dq reference frame, as dc variables in stacionary
reference frame. Also, we usually have the motor phase parameters and we should
always try to regulate motor phase currents and give motor phase voltage references to
SVPWM.


7.1. Motor phase currents from measured line currents

The following figure represents the three phase load in the wye connection connected to
the voltage inverter.


I
A_LINE
I
B_LINE
I
C_LINE
T
1
T
2
T
3
T
4
T
5
T
6
A

B

C

Y
V
DC
V
Af
N

V
AN
V
BN
V
CN
A

B

C

I
Af
V
Bf
V
Cf
I
Bf
I
Cf

Figure 7.1. Line to Phase currents for wye connected motor

Phase currents in this case are equal to already measured inverter line currents.
LINE C f C LINE B f B LINE A f A
I I I I I I
_ _ _
= = =

The following figure represents the three phase load in the delta connection connected
to the voltage inverter.


I
A_LINE
I
B_LINE
I
C_LINE
T
1
T
2
T
3
T
4
T
5
T
6
A
B
C

V
DC
N

V
AN
V
BN
V
CN
A

B

C

V
Bf
V
Cf
I
Bf
I
Cf
I
Af
V
Af
Figure 7.2. Line to Phase currents for delta connected motor

Inverter line current now splits into the motor windings and phase currents can be
reconstructed only presuming the windings symmetry:
LINE A LINE C
f
C LINE C LINE B
f
B LINE B LINE A
f
A
I I I I I I I I I
_ _ _ _ _ _
3
1
3
1
,
3
1
3
1
,
3
1
3
1
= = =
In above equation (1/3)I
AN
-(1/3)I
BN
instead of (1/3)(I
AN
-I
BN
) should be used. This
approach takes more computation time, but it is the best way to avoid possible
numerical saturation. With the line current signals per unit, 1 equals to I
MAX
, the
second approach would overflow giving unpredictable result for high current values.
Page 33 of 52 Metode regulacije EP primenom mikroprocesora- skripta


7.2. Motor phase currents from abc to dq frame

Current vectors in and dq coordinate system are always calculated using motor
phase quantities, no matter what kind of winding connection is used.
For abc transformation (Clarke) coefficient 2/3 is used. As a consequence,
signals have the same amplitude as motor phase signals.

( )
( )
(

=
(

+ =
Cf Bf f
Cf Bf Af f
I I I
I I I I
2
3
3
2
2
1
3
2


For symmetrical system, the sum of all the voltages is zero, and final transformation
becomes:
( )
Cf Bf f
Af f
I I I
I I
=
=
3
3


Ones the rotor flux vector position is known the phase current vectors can be
transferred to the dq reference frame which rotates synchronously with the rotor flux
vector.
The current vector transformation to the dq coordinate system (Park transformation):

dq f dq f qf
dq f dq f df
I I I
I I I




cos sin
sin cos
+ =
+ =



These currents can be now fed to the current regulators which have dq voltage
references on the outputs. Voltage references are than transferred from dq to
coordinate system using inversed transformation (Inverse Park)and fed to the space
vector module.

dq
REF
qf dq
REF
df
REF
f
dq
REF
qf dq
REF
df
REF
f
V V V
V V V

cos sin
sin cos
+ =
=



7.3. Typical digital current control model

Ones transferred in dq coordinate system, current vector coordinates are DC signals in
steady state. That allows regulation of current vector coordinates without the phase leg,
typical for regulating the AC signals.


dq
PI reg
PI reg
dq



Space vector
modulator
abc

dq

I
Af

I
Bf

I
Cf

I
f

I
f

I
df

I
qf

V
df
REF

V
qf
REF

V
f
REF

V
f
REF

PWMA
PWMB
PWMC
I
df
REF

I
qf
REF


Figure 7.3. Typical digital current control scheme used in vector control drive

Page 34 of 52 Metode regulacije EP primenom mikroprocesora- skripta

7.4. Incremental dq current regulators with output limits

The motor phase currents are regulated in dq reference frame. There are two identical
and independent PI regulators, each controlling one current vector coordinate. The only
interaction between two regulators can occur when stator voltage vector saturates,
imposing the limit for outputs of both current regulators. In order to deal with the
saturation in more efficient way, the current regulators are designed in the incremental
form.
Discrete form of typical PI regulator:
err
z
K
err K out
i
p
1
1

+ =
can be calculated using the following discrete equation:

) ( ) ( ) (
) ( ) ( ) (
kT err K kT I kT out
kT err K T kT I kT I
p
i
+ =
+ =


As one can see, first integral portion of regulator output is created. Than, new output is
derived adding the proportional term. If output saturates, integral term can continue
integrating the error, leading to the well know wind-up problem.
Incremental PI form is derived from its discrete form:

err K err z K z out
i p
+ =

) 1 ( ) 1 (
1 1


Leading to the following discrete form:

[ ]err K z K out z out
i p
+ + =

) 1 (
1 1

In the case of incremental PI regulator, first incremental part is calculated, than output
position is added:

[ ]
) ( ) ( ) (
) ( ) ( ) ( ) (
kT Inc kT out kT out
kT err K T kT err kT err K kT Inc
i p
+ =
+ =

Limiting the regulator output is now easy:


LOW LOW
HIGH HIGH
LIMIT kT out LIMIT kT out if
LIMIT kT out LIMIT kT out if
kT Inc kT out kT out
= <
= >
+ =
) ( ) (
) ( ) (
) ( ) ( ) (


On the next two figures the models of incremental PI regulators used in d and q-axis
are shown. Both regulators structures are identical. The only differences are the limits.
For example, if the dq axis voltages represent the phase quantities of motor with delta
connected windings the limits can be defined using the following:

First, q voltage component should be limited to (for linear regime):

DC
HIGH
q
V LIMIT VQ V = _

Than, d component should be limited in that way to limit the total vector amplitude:

2 2
_
q DC
HIGH
d
V V LIMIT VD V =

Page 35 of 52 Metode regulacije EP primenom mikroprocesora- skripta

The idea to limit the V
qf
first, and than to have the rest of the voltages for d-axis
voltage is derived directly from motor stator steady state equations.

ds dq qs s qs
qs dq ds s ds
I R V
I R V
+ =
=


Due to the fact that rotor flux vector defines the d-xis, the stator flux vector should also
has
ds
non-zero while
qs
should be much smaller or close to zero. Now it is clear that
increes of the speed will have more influence on V
qs
voltage, via the
dq

ds
term.
Again, if there is not enough voltage to build up the machine flux on the given speed, it
is more logical to limit the V
qs
.
The generating mode is simetrical, low limits should be the same, with negative sign.

HIGH LOW
HIGH LOW
LIMIT VD LIMIT VD
LIMIT VQ LIMIT VQ
_ _
_ _
=
=




K
p

z
-1
+
-

K
i
+
-

I
df
REF

I
df
+
+
+
+
VD_LIMIT
HIGH


VD_LIMIT
LOW


z
-1

V
df
REF

Incremental part

Position part with limit


Figure 7.4. D-axis current PI regulator



K
p

z
-1
+
-

K
i
+
-

I
qf
REF

I
qf
+
+
+
+
VQ_LIMIT
HIGH


VQ_LIMIT
LOW


z
-1

V
qf
REF

Incremental part

Position part with limit


Figure 7.5.Q-axis current PI regulator

Page 36 of 52 Metode regulacije EP primenom mikroprocesora- skripta

7.5. Current regulators parameters evaluation

There is several different procedures to determine current regulator parameters.


i
i
p
sT
sT
K
+ 1
K
inv
s
s
s
K
+ 1

i
s

i
s
REF
PI regulator

inverter

stator

v
s
REF
V
s

b
I
1



Figure 7.4. Current regulator parameters evaluation

One gives:

inv
c b s
inv s
c b s
p
K
I L
K K
I
K

= =

Gain of SV module is

DC inv
V K =

Wanted current loop bandwidth:

c
= 2100 rad/s

Period of current control loop:

pwm
T T =

Then, parameters of normalized PI regulator are:
s i
T =

inv
c b s A
p p
K
I L
K K

= =
i
A
p
A
i
T
K
K =

For the digital automatic control system, with the period T, wanted PI integral action
becomes:

T K K
A
i i
=
In the case of following motor parameters, we can calculate needed proportional and
integral gains for current controllers:

- stator resistance: ] [ 1 , 9 =
S
R
- total leakage stator inductance: ] [ 065 , 0 H L
S
=

It gives stator circuit time constant: ] [ 1 , 7 ] [ 0071 , 0
1 , 9
065 , 0
ms s
R
L
S
S
S
= = = =


Defined base value for the current: ] [ 8 A I
b
=
Page 37 of 52 Metode regulacije EP primenom mikroprocesora- skripta

DC bus voltage is: ] [ 340 V V
DC
=
Wanted current loop bandwidth is: ] / [ 100 2 s rad
c
=
Switching PWM frequency is 16 kHz, so period of current loop is: ] [ 5 , 62
10 16
1
3
s T =

=
Finally, based on this values needed PI parameters for current controllers (prepared for
digital automatic control system) can be:

96096 , 0
340
100 2 8 065 , 0
=

= =

inv
c b s
p
K
I L
K
00846 , 0 10 5 , 62
0071 , 0
96096 , 0
6
= = =

T
T
K
K
i
p
i


In per unit representation, in 1.15 format this values are:

277 00846 , 0 32767
31487 96096 , 0 32767
= =
= =
i
p
K
K

i.e. values that must be entered in software are:
KP_GAIN = 0x7AFF (F1.15)
KI_GAIN = 0x115 (F1.15)

Another method (absolute value optimum) gives:

1071 . 0
2353 . 12
=
=
i
p
K
K


Page 38 of 52 Metode regulacije EP primenom mikroprocesora- skripta


8. Discrete IFOC control

8.1. IFOC overview
It is already shown that if the slip frequency of
dr r
qs m
k
T
i L

= is selected, the rotor flux


component in q-axis will be canceled , . 0 = +
qr
qr
r
dt
d
T


Result of that is alignment of rotor flux vector parallel with the d-axis of rotating frame.
Amplitude of rotor flux vector can be controlled only using the d-axis component of
stator current vector:
,
ds m dr
dr
r
i L
dt
d
T = +


In the same time, the electrical torque can be controlled independently, using the q
stator current component:
.
2
3
,
r
m
T qs dr T el
L
L
p K i K T = =
Above given equations are the base for indirect field oriented control of rotor vector flux
and independent control of electrical torque. Practical implementation of IFOC starts
with estimation of rotor flux amplitude

ds
r
m
dr
i
s T
L
+
=
1


Next, rotor slip frequency and slip angle are estimated:

dt
T
i L
k
dr r
qs m
k

= =



Finally, new dq frame angle is calculated using measured rotor angle and estimated slip
angle.

k r dq


+ =
Rotor position
r

can be directly measured from position sensor or estimated from rotor


speed information.
dt
r r

=



8.2. Implementation of discrete IFOC equations

IFOC can be implemented in microprocessor using discrete versions of above given
equations. Simple left Euler transformation can be used,
T
z
s
1
= .

8.2.1. Rotor flux amplitude estimation in 32-bit precision

Rotor flux amplitude estimation discrete model becomes:

Page 39 of 52 Metode regulacije EP primenom mikroprocesora- skripta

( )
1
1
1 1 1 1

\
|
+
=
+
=
+
=
z
T
T
T
T
z i L
z
T
T
T
T
i L
i
z
T
T
L
r r
ds m
r r
ds m
ds
r
m
dr

Instead of rotor flux amplitude, for IFOC is easier to use filtered D axis current:
1
1
1
1 '
1 1
) (
) (

|
|

\
|

= =
z
T
T
z i
T
T
L
z
z i
r
ds
r
m
dr
ds


Discrete version of D axis filters equation:

) ( ) ( 1 ) (
*
'
*
'
T kT i
T
T
T kT i
T
T
kT i
ds
r
ds
r
ds
+
|
|

\
|
=

It is essential to use 32 bit precision for i
ds
filter calculation. If there is no space or
calculation time, 16 bit version can be used, but parameters
|
|

\
|

*
1
r
T
T
and
*
r
T
T
must be
set to sum to precise 32768 (0x8000) value!. Not 32767!

For example:
] [ 097 , 0
*
s
R
L
T
r
r
r
= =
] [ 5 . 62
16000
1 1
s
f
T T
PWM
PWM
= = = =

Next, using 16-bit arithmetic we have:

4
*
10 4433 , 6
] [ 097 , 0
] [ 5 , 62

= =
s
s
T
T
r



In per unit representation, in 1.15 format, needed parameters has values:

15 0 21 10 4433 , 6 32768
4
15 . 1
*
x
T
T
F
r
= = =
|
|

\
|



FEB x x x
T
T
F
r
7 0 15 0 8000 0 1
15 . 1
*
= =
|
|

\
|

Note: 8000 0 15 0 7 0 x x FEB x = + !


8.2.2. Slip frequency and angle estimation in 32-bit precision

Slip frequency can be calculated using:

) (
) (
1
) (
' *
kT i
kT i
T
kT
ds
qs
r
k
=
But, in IFOC slip angle calculation is needed instead of slip frequency:

Page 40 of 52 Metode regulacije EP primenom mikroprocesora- skripta

) (
) (
) ( ) (
) (
) (
1
) (
) ( ) ( ) (
'
' *
kT i
kT i
T
T
T kT kT
kT i
kT i
T
kT
kT T T kT kT
ds
qs
r
k k
ds
qs
r
k
k k k
|
|

\
|
+ =

=
+ =




Additional correction of this equation is also needed, due to the fact that DSP is using
relative angle range

{ }
{ }
RADIANS REL
RAD
REL

1
,
1 , 1
=

+
+


Therefore, relative slip angle can be calculated as:

) (
) (
1
) ( ) (
'
kT i
kT i
T
T
T kT kT
ds
qs
r
k k
|
|

\
|
+ =



Angle must be kept and calculated in 32 bit precision, therefore used parameter is:

0x6B879 2
10 4433 , 6 1
31
4
31 . 1
=

=
|
|

\
|


F
r
T
T


Note:
Per unit division functions do not work if divider is bigger that numerous.
The best way to do the division is to shift numerous for N places right before division
call, making it smaller than divider. One must know what is the maximum possible
Iq/Id ratio to decide number of places to be shifted.
For example, the following 4 bits shift will allow Iq/Id ratio to be in the 0 16 range
which is usually more than enough.

[ ]
4
) (
4 ) (
1
) ( ) (
'
<<
(
(

>>
|
|

\
|
+ =
kT i
kT i
T
T
T kT kT
ds
qs
r
k k


Possibility that Iq/Id can be higher than 16 must also be included in C-code.

Temp16 = abs(Is_q_ref)>>MAX_IQ_ID_RATIO_LOG;
Temp16= ( Temp16 > Is_d_filt)? 0x7FFF : Temp16/Is_d_filt;

For I
q
/I
d
>16 the result will saturate but it will not result in negative slip frequency.

8.2.3. Rotor flux (dq frame) position estimation

Finally, new normalized rotor flux angle (1 range) is estimated summing the estimated
(calculated) slip position and measured (or estimated) rotor position.

) ( ) ( ) ( kT kT kT
k r dq
+ =

) (kT
k
- It is shown how slip angle can be calculated
) (kT
r
- Rotor angle can be directly measured from position sensor (encoder or
resolver).
Or, it can be integrated (summed) using the rotor speed information:
) ( ) 1 ( ) ( kT T kT kT
r r r
+ =


Page 41 of 52 Metode regulacije EP primenom mikroprocesora- skripta

8.3. Simplified block diagram of IFOC control algorithm


Initialize
S/W modules,
IFOC parameters
PWM modul and interrupt
ADC modul
QPEP modul
Start
Enable PWM
interrupt
Background
loop
PWM
interrupt
Return
Theta_Rotor=ReadEncoder()
read ADC module
(currents/DC bus voltage)
Execute for currents
CLARKE/ and PARK transf.
(with ThetaRFlux(kT-T))
Execute Current regulators
with voltage limit.
Execute IFOC slip calculator
Theta_Slip(kT)
ThetaRFlux(kT)=
ThetaSlip+ThetaRotor
Execute Inverse Park for
ref. voltages with
ThetaRFlux(kT)
Execute SVGEN
module
Update PWM registers
PWM intterupt

Figure 8.1. Basic IFOC algorithm

8.4. IFOC quasi C-code implementation

We have to implement:

) ( ) ( 1 ) (
*
'
*
'
T kT i
T
T
T kT i
T
T
kT i
ds
r
ds
r
ds
+
|
|

\
|
= (all variables and coeff: 1.15 format)

) (
) (
1
) ( ) (
'
kT i
kT i
T
T
T kT kT
ds
qs
r
k k
|
|

\
|
+ =

(
k
and
r
T
T

1
in 1.31, currents in 1.15)

) ( ) ( ) ( kT kT kT
k r dq
+ = ( ; 15 . 1 : ) (kT
dq
: ) ( ), ( kT kT
k r
1.31)

C code to be implemented ..


Page 42 of 52 Metode regulacije EP primenom mikroprocesora- skripta

9. Speed regulator

Speed regulator is designed in incremental form.
The speed regulator accepts the rotor speed measured via AC tachometer, and the
speed reference from the speed ramp. The output of speed regulator is wanted
electrical torque, or q-axis current reference. Having the real torque command on the
output of speed regulator enhances the speed response and overall system dynamics
and it is one of the advantages of IFOC control structure.




K
p

z
-1
+
-

K
i
+
-

n
R
REF

n
R

+
+
+
+
IQ_LIMIT

-IQ_LIMIT

z
-1

I
q
REF


Figure 8.1. Speed regulator block diagram

The parameters of the speed regulators are set during the experiment.

9.1. Speed regulator parameters calculation procedure

There is couple of procedures to determine current regulator parameters.
To be defined ...

9.2. Maximum Q phase current calculation current limit

In order to achieve the best dynamic it is necessary to calculate q phase current limit.
To be defined ...


10. Field weakening flux control

In order to reach high speeds rotor flux weakening procedure must be defined. Simple
feed-forward 1/w based method is not enough; some kind of flux controller based on dc
voltage margin must be defined.

To be defined ...

Page 43 of 52 Metode regulacije EP primenom mikroprocesora- skripta

11. Induction motor parameters and data

IFOC structure is based on motor parameter which must be initially defined and if
needed , on line estimated.
11.1. Initial Induction motor parameters and data

11.1.1. IM no load test

Rs, Lm, nominal D axis current can be established from motor non-load test.
To be defined ...

11.1.2. IM load test
Rr, Lr, Ls can be established from load test.
To be defined ...

Page 44 of 52 Metode regulacije EP primenom mikroprocesora- skripta

12. Influence of Tr parameter error on IFOC

12.1. Dobro odabran paramater Tr*= Tr

IFOC control with sensor has only one important machine parameter, which is the
rotor time constant. In order to determine exact rotor flux angle, Tr must be know.
U sluaju dobro podeene vrednosti parametra koriene u kontroleru (T
r
*
=T
r
)
procenjena vrednost poloaja rotorskog fluksa je tana i statorske struje se pravilno
orijentiu u odnosu na rotorski fluks. Ako se u ovom sluaju zadre konstantne
vrednosti struja statora I
ds0
i I
qs0
, posle prelaznih procesa su ostvarene sledee
stacionarne vrednosti komponenti fluksa rotora:
0 0 ds m dr
I L = ,
0
0
=
qr
, (3.13.)
uz konstantnu uestanost klizanja:
0
0
0
1
ds
qs
r
k
I
I
T
= . (3.14.)

12.2. Pogreno odabran paramater Tr* Tr

In real motor application the Tr is variable and depends upon flux saturation level and
rotor temperature.
) (
) (
e temperatur R
level saturation L
T
r
r
r
=
Therefore, in order to have correct IFOC alignment, the online estimation of rotor time
constant must be provided. If not, when motor gets hot, speed will be correct but the
motor losses will increase because the DQ frame is not aligned properly and the
nominal flux is not produced.
Ako parametar T
r
*
korien u modelu rotorskog kola nije u skladu sa stvarnom
vremenskom konstantom rotora T
r
, pri utisnutim I
ds0
i I
qs0
vie ne vae jednaine za
ostvareni rotorski fluks date u (3.1). Izraunata uestanost klizanja
0
0
*
0
1
ds
qs
r
k
I
I
T
= , (3.15.)
je razliita od potrebne (3.2) i nove stacionarne vrednosti komponenti rotorskog
fluksa se mogu dobiti na osnovu (3.4). Sistem jednaina stacionarne radne take za
rotorsko kolo je dobijen na osnovu (2.24) eliminacijom komponenti prelaznog
procesa:
0 0 0 0
1 1
ds m
r
qr k dr
r
I L
T T
= ,
Page 45 of 52 Metode regulacije EP primenom mikroprocesora- skripta

0 0 0 0
1 1
qs m
r
dr k qr
r
I L
T T
= + . (3.16.)
Reavanjem (3.4) za stacionarne vrednosti komponenti vektora rotorskog fluksa se
dobija:
2
0
0 0 0
0
) ( 1
r k
qs r k ds
m dr
T
I T I
L

+
+
= ,
2
0
0 0 0
0
) ( 1
r k
ds r k qs
m qr
T
I T I
L

= . (3.17.)
Jednaina (3.5) pokazuje da komponente rotorskog fluksa u pogonu sa pogrenom T
r
*

nisu jednake zadatim, i da zavise od obe komponente statorske struje. U izrazima
(3.6) jasno su razdvojene zadata vrednost komponente vektora rotorskog fluksa i
odstupanje nastalo usled nepodeene vrednosti parametra rotorskog kola:
0
2
0
0
*
0 0
) ( 1
) 1 (
qs
r k
r k
r
r
m ds m dr
I
T
T
T
T
L I L

+
+ = ,
0
2
0
*
0
) ( 1
1
) 1 ( 0
qs
r k
m
r
r
qr
I
T
L
T
T

+
+ = .


0,0 0,5 1,0 1,5 2,0
0,80
0,85
0,90
0,95
1,00

dr0
/
rn
I
qs0
/I
ds0


0,0 0,5 1,0 1,5 2,0
-0,10
-0,08
-0,06
-0,04
-0,02
0,00

qr0
/
rn
I
qs0
/I
ds0

Sl. 3.2. Fluksa rotora u pogonu sa relativnom grekom T
r
/T
r
*
= 1.25 pri promeni odnosa I
qs0
/I
ds0
.


0,0 0,5 1,0 1,5 2,0
1,00
1,05
1,10
1,15
1,20
1,25

dr0
/
rn
I
qs0
/I
ds0


0,0 0,5 1,0 1,5 2,0
0,00
0,05
0,10
0,15
0,20

qr0
/
rn
I
qs0
/I
ds0

Page 46 of 52 Metode regulacije EP primenom mikroprocesora- skripta

Sl. 3.2. Fluksa rotora u pogonu sa relativnom grekom T
r
/T
r
*
= 0.75 pri promeni odnosa I
qs0
/I
ds0
.
) (
2
3
0 0 0 0
0
ds qr qs dr
I I
L
L
p m
r
m
el
= , (3.18.)
gde je m
el0
stacionarna vrednost momenta nepodeenog sistema pri konstantnim zadatim
strujama statora I
ds0
i I
qs0
. Ako se komponente fluksa rotora uvrste, dobija se:
2
0
0
*
2
0
0
*
*
1
1
|
|

\
|
+
|
|

\
|
|
|

\
|
+
=
ds
qs
r
r
ds
qs
r
r
elo elo
I
I
T
T
I
I
T
T
m m (3.19.)
za stacionarnu vrednost ostvarenog momenta. Pritom, zadata vrednost glasi:
0 0
2
*
2
3
qs ds
r
m
elo
I I
L
L
p m = . (3.20.)

0,0 0,5 1,0 1,5 2,0
0,7
0,8
0,9
1,0
1,1
1,2
1,3
m
el 0
I
I
qs
ds
0
0
T r / T r =1.25
1.15
1.05
1
0.95
0.85
0.75
*

*

m
el 0

Sl. 3.6. Odnos vrednosti razvijenog i zadatog momenta za razliite odnose struja i T
r
/T
r
*

Page 47 of 52 Metode regulacije EP primenom mikroprocesora- skripta

13. Signal data ranges for 12-bit ADC

Analogue to digital converter (ADC) unit provides a most important interface between
the controller and the real system. Physical signals such are inverter currents, dc bus
voltage and temperature are analogue signals. All of these are represented by
measurement and conditioning electronic circuits as an electrical voltage between
V
REF
MIN
and V
REF
MAX
, which is directly proportional to the original signal. The purpose of
the ADC unit is to convert the analogue voltage in range of V
REF
MIN
-V
REF
MAX
into the
digital number, also of a specific range. Used measurement equipment and conditioning
analog circuits must be designed in that way to carry the whole signal analogue and
digital range without saturation and with minimal signal distortion. The relationship
between the analogue input voltage V
IN
, the number of binary digits n used to represent
the digital number and the digital number ADC_NUMBER that represents that analogue
voltage is given by:

( )
MIN
REF
n
MIN
REF
MAX
REF
IN
V
V V NUMBER ADC
V +


=
1 2
_


V
REF
MAX
and V
REF
MIN
are reference voltages which are used to limit the analogue voltage
range. Any input voltage beyond these references will deliver a saturated digital
number or if it pass maximum ratings according to the datasheet it can destroy the
controller unit (C).
If the ADC has a 12-bit resolution, with V
REF
MIN
connected to the analog signal ground
(V
REF
MIN
= 0) and V
REF
MAX
connected to the DSP analogue power supply (V
REF
MAX
= 3,3 V),
digital number is given by the following formula:

[ ]
[ ]
4095
3 , 3
_ =
V
V V
NUMBER ADC
IN


Although the ADC unit has 12-bits, which covers number range from 0 to 4095, the
result is usually stored as 16-bit number in order to make the number in the fractional
data range 1.15 which represents real number in range from -1.0 to 1.0 (with the
resolution 2
-15
). So, the 12-bit digital result is shifted left by 3 (multiplied by 8) in 16-
bit result register automatically via hardware (or for some C by software) giving the
result:

[ ]
[ ]
[ ]
[ ]
32760
3 , 3
8 4095
3 , 3
_ = =
V
V V
V
V V
RESULT ADC
IN IN


That means the ADC result can be immediately used as positive 1.15 number, in the
range 0-1.0 or more precisely, in the range of 0 32760/32767. In order to use the
maximum available ADC signal range and to obtain maximum conversion resoultion,
the input signal to be measured should be transformed via conditioning circuits to
exactly 0 -3.3V range.

13.1. DC bus voltage measurement

The DC bus voltage measurement is designed supposing a grid line voltage of 135 [V]
on a 120 [V] line (grid codes allows +10% overvoltage, and by this we include +12,5%
overvoltage), which gives maximum DC bus voltage of 22135 [V] = 381 [V], when
voltage doubler is used. The similar number is valid for grid line voltage of 242 [V]
(+5,2% overvoltage) on a 230 [V] line, without the voltage doubler. One must note
that at least 400 [V] on the DC link must be measurable, without the saturation.
Page 48 of 52 Metode regulacije EP primenom mikroprocesora- skripta

But, during the drive design one must consider possible fault situations. One of possible
fault situations is possible uncontrolled regenerative DC braking. If one wants to be able
to monitor the DC bus rise during this period, the DC bus maximum legible value must
be increased.
If we chose that maximum readable DC bus voltage by measurement circuits and ADC
converter (3,3 V at the input) is 600,6 [V] (50% higher than in normal operation range)
it gives voltage divider factor of 600,6/3,3 = 182. The selected voltage divider resistors
should be a precise resistors with 1% tolerance, both R
1
on the top and R
2
on the
bottom.
Connection between the DC bus voltage and DC bus voltage variable in software is:
] [
R2 R1
R1
3 . 3
1
] [
32767
32760
3 . 3
1
.) . ( V V V V u p V
DC IN DC

+
= =
DC bus voltage base is defined with the maximum readable DC bus voltage:
[V] 6 , 600 = =
MAX BASE
V V
Finally, we get Vdc_bus variable as positive fractional number, in the 1.15 range (0-
1.0):

base
DC
DC
V
V V
u p V
) (
.) . ( =

For practical drive application, the off-line calibration constant should be added.

( ) ( ) 1 _ .) . ( << = RESULT ADC K u p V
DCV DC


K
DCV
constant should be in 2.14 format (2), allowing numbers bigger and smaller than
1. That is why there is one shift to the left, transferring back the number is 1.15
format. (Note: F1.15*2.14 2.14 and 2.14<<1 1.15)

13.2. Inverter leg current measurement

The current signal is bipolar, so the current must be readable by ADC unit while flowing
in positive and negative directions. To accomplish that, current signal which can be
either positive or negative must be transferred and adjusted in 0-3,3 [V] positive range.
That means the current sense circuit must have offset adjustment, in order to set up
output voltage biased in the middle of the ADC power supply:
] [ 65 . 1
2
] [ 3 , 3
2
_ V
V V
OFFSET CURRENT
MAX
REF
= = =
The current sense circuit gain is adjusted to transfer the real current signals from I
MAX

range to the 3,3 [V] range. For 1 [kW] inverter application, the current shunt resister,
and maximum readable current is chosen to be:
] [ 60 = m R
SH
(standard value)
] [ 8 A I
MAX
=

This selection leads to the following current sense circuit gain:

4375 , 3
8 10 60 2
3 , 3
2
_
3
=

=

=

MAX SH
MAX
REF
I R
V
GAIN CURRENT

Although the 1% precise resisters are used in building the amplifier with needed offset
and gain, the off-line drive calibrations is usually needed for the best performance.
Also, during the stand still, periodical offset reading and filtering is also recommended.
Output current result can be expressed as:
Page 49 of 52 Metode regulacije EP primenom mikroprocesora- skripta

[ ]
MAX
REF
MAX
REF
SH
MAX
REF
IN
V
V
A I R GAIN CURRENT
V
V
NUMBER CURRENT
32760
2
_ 32760 _
|
|

\
|
+ = =

Separating the offset and the real signal:
[ ]
16380 32760
_
_ +

=
MAX
REF
SH
V
A I R GAIN CURRENT
NUMBER CURRENT

Offset is never exactly one half of the number range and it must be recalculated during
the stand still stage. That is why the offset variable is used , ADC_current_offset. To
make the best precision in filtering possible, the variable is kept in 32-bit.
[ ]
offset current ADC
V
A I R GAIN CURRENT
NUMBER CURRENT
MAX
REF
SH
_ _ 32760
_
_ +

=

After the current sample is ready, the offset must be removed. Presuming that the
offset is removed entirely, the variable now holds:
[ ] 16380
_

= A I
V
R GAIN CURRENT
CURRENT
MAX
REF
SH


Setting up the IBASE value in the software to be:
] [ 8 A I I
MAX BASE
= =

we get:
[ ]
SH
MAX
REF
BASE
BASE
R GAIN CURRENT
V
I
I
A I
CURRENT

= =
_ 2
, 16380
Clearly, this number is now in 16380 range, which is not convenient for further signal
processing. The best is to have all the voltage and current measured signals in 1.15
format, 32767 range representing fractional numbers in 1. So, in order to use the
current sample in 1.15 format, and further to process it with maximum numerical
precision for 16 bit variables, one extra left shift is needed (multiplication by 2).
Finally,
[ ]
16380 2 .) . ( =
BASE
I
A I
u p CURRENT
To accomplish this, the new current sample is calculated using this equation.

( ) 1 _ _ _ .) . ( << = offset current ADC NUMBER CURRENT u p CURRENT

For practical drive application, the off-line calibration constant should be added.

( ) ( ) 2 _ _ _ .) . ( << = offset current ADC NUMBER CURRENT K u p CURRENT
C


K
C
constant is kept in 2.14 format (2), which allows numbers bigger and smaller than
1. That is why second shift left is also needed, in total two shifts left.

14. Appendix- Motor phase voltage and currents

The terminal quantities that are typically measured or estimated from the voltage
inverter side are the line currents and phase to ground voltage. Line currents are
measured using up to three current sensors which can be placed on different places:
connected on inverter outputs, or inverters legs bellow the bottom IGBT or in the DC
bus circuit. But, in each combination, the currents sensor is in the path of inverter line
Page 50 of 52 Metode regulacije EP primenom mikroprocesora- skripta

current. On the other hand, the inverter output voltage is usually estimated using
commanded PWM pattern, which is relatively to the DC bus ground.
From the motor side, the winding (motor phase) voltage and current are required. The
different links between the motor phase quantities with the terminal quantities from the
inverter side are discussed in the chapter.

14.1. Motor phase windings connected in the wye connection

The following figure represents the three phase load in the star connection connected to
the voltage inverter.


I
A_LINE
I
B_LINE
I
C_LINE
T
1
T
2
T
3
T
4
T
5
T
6
A

B

C

Y
V
DC
V
Af
N

V
AN
V
BN
V
CN
A

B

C

I
Af
V
Bf
V
Cf
I
Bf
I
Cf

Figure 6.1.

Phase currents in this case are equal to already measured inverter line currents.
LINE C f C LINE B f B LINE A f A
I I I I I I
_ _ _
= = =
Phase voltages can be reconstructed using inverter line to ground voltages.
BN AN CN f C
CN AN BN f B
CN BN AN f A
V V V V
V V V V
V V V V
3
1
3
1
3
2
3
1
3
1
3
2
3
1
3
1
3
2
=
=
=

In above equation (1/3)V
BN
-(1/3)V
CN
instead of (1/3)(V
BN
+V
CN
) should be used. This
approach takes more computation time, but it is the best way to avoid possible
numerical saturation which can be a problem for add/sub operations, especially if the
voltages are higher than half of the V
BASE
.


14.2. Motor phase windings connected in the delta connection

The following figure represents the three phase load in the delta connection connected
to the voltage inverter.

Page 51 of 52 Metode regulacije EP primenom mikroprocesora- skripta


I
A_LINE
I
B_LINE
I
C_LINE
T
1
T
2
T
3
T
4
T
5
T
6
A
B
C

V
DC
N

V
AN
V
BN
V
CN
A

B

C

V
Bf
V
Cf
I
Bf
I
Cf
I
Af
V
Af

Figure 6.2.

Inverter line current now splits into the motor windings and phase currents can be
reconstructed only presuming the windings symmetry:
LINE A LINE C f C
LINE C LINE B f B
LINE B LINE A f A
I I I
I I I
I I I
_ _
_ _
_ _
3
1
3
1
3
1
3
1
3
1
3
1
=
=
=

In above equation (1/3)I
AN
-(1/3)I
BN
instead of (1/3)(I
AN
-I
BN
) should be used. This
approach takes more computation time, but it is the best way to avoid possible
numerical saturation. With the line current signals per unit, 1 equals to I
MAX
, the
second approach would overflow giving unpredictable result for high current values.

Phase voltages can be reconstructed using inverter line to ground voltages.
AN CN f C
CN BN f B
BN AN f A
V V V
V V V
V V V
=
=
=



14.3. Phase voltages and currents in coordinate system

Voltage and current vectors in and dq coordinate system are always calculated using
motor phase quantities, no matter what kind of winding connection is used.
For abc transformation (Clarke) coefficient 2/3 is used. As a consequence,
signals have the same amplitude as motor phase signals.

( )
( )
(

=
(

+ =
Cf Bf f
Cf Bf Af f
V V V
V V V V
2
3
3
2
2
1
3
2


For symmetrical system, the sum of all the voltages is zero, and final transformation
becomes:
( )
Cf Bf f
Af f
V V V
V V
=
=
3
3


The same is valid for phase currents and final equation to be used is:
Page 52 of 52 Metode regulacije EP primenom mikroprocesora- skripta

( )
Cf Bf f
Af f
I I I
I I
=
=
3
3



14.4. Phase voltages and currents in dq coordinate system

Ones the rotor flux vector position is known the phase voltage and current vectors can
be transferred to the dq reference frame which rotates synchronously with the rotor
flux vector.

The current vector transformation to the dq coordinate system (Park transformation):

dq f dq f qf
dq f dq f df
I I I
I I I




cos sin
sin cos
+ =
+ =


Voltages vector can also be transformed in dq coordinates system but this is typically
not used in IFOC.
dq f dq f qf
dq f dq f df
V V V
V V V




cos sin
sin cos
+ =
+ =


Usually, only phase currents are transferred from to dq coordinate system. These
currents are than fed to the current regulators which have dq voltage references on the
outputs. Voltage references are than transferred from dq to coordinate system using
inversed transformation (Inverse Park)and fed to the space vector module.
dq
REF
qf dq
REF
df
REF
f
dq
REF
qf dq
REF
df
REF
f
V V V
V V V

cos sin
sin cos
+ =
=

You might also like