Anda di halaman 1dari 16

COPPE / UFRJ

PROGRAMA DE ENGENHARIA ELTRICA










CPE 713 MICROPROCESSADORES APLICADO
A ELETRNICA DE POTNCIA

MODULAO SPACE VECTOR EM LINGUAGEM C









PROFESSOR L. G. B. ROLIM




ALUNO: SAMUEL ALVES DE SOUZA


15/12/2011

CPE713 Terceiro Trabalho Entrega 07/11/11

1) Escrever uma funo em C para calcular os valores instantneos dos sinais de
referncia para modulao space vector, com as seguintes caractersticas:
os parmetros de entrada so as coordenadas v e v do vetor resultante a ser
sintetizado, com amplitudes normalizadas (-1,0 <{v , v}<1,0).
os parmetros de sada so as referncias (ndices de modulao) ma , mb e mc
normalizadas (-1,0 <{ma , mb , mc}<1,0) a serem comparadas com as portadoras
triangulares para comandar cada fase de um inversor.

2) Criar um projeto no CCS para testar a funo do item 1 e medir seu
desempenho (tempo mdio de execuo) usando o simulador para CPU da famlia
C2000.

Bibliografia:
[1] http://dx.doi.org/10.1109/ISIE.1999.798657
[2] http://dx.doi.org/10.1109/IECON.1999.822220
[3] http://dx.doi.org/10.1590/S0103-17592005000100002
[4] http://dx.doi.org/10.1109/CERMA.2009.42


























1) Cdigo em linguagem C:

/ * 3o. Tr abal ho CPE713 2011_03
SPACE VECTOR PWM
Pr of . L. G. B. Rol i m
Al uno: Samuel Al ves de Souza */

#i ncl ude <mat h. h> / / ut i l i zado par a cal cul o seno/ coseno
#def i ne np 1000 / / t amanho do vet or de dados par a gr f i co

f l oat v[np]; / / vet or de dados par a gr f i co
unsi gned i nt p=0; / / i ni ci al i zao do pont ei r o do vet or de dados
unsi gned i nt set or =0; / / set or do space vect or
f l oat w=377. 0; / / f r equenci a emr ad/ s
f l oat k1=1. 0; / / t enso val pha e vbet ha nor mal i zada
f l oat t =0. 0; / / t empo emsegundos
f l oat val pha; / / t enso Val pha nor mal i zada
f l oat vbet ha; / / t enso Vbet a nor mal i zada
f l oat t ang; / / t angent e=Vbet a/ Val pha
f l oat t emp_1; / / val or t empor r i o
f l oat t emp_2; / / val or t empor r i o
f l oat x; / / t empo x cl cul o ndi ce modul ao ( r azo c cl i ca) f ase a
f l oat y; / / t empo y cl cul o ndi ce modul ao ( r azo c cl i ca) f ase b
f l oat z; / / t empo z cl cul o ndi ce modul ao ( r azo c cl i ca) f ase c
f l oat ma; / / ndi ce de modul ao ( r azo c cl i ca) f ase a
f l oat mb; / / ndi ce de modul ao ( r azo c cl i ca) f ase b
f l oat mc; / / ndi ce de modul ao ( r azo c cl i ca) f ase c
f l oat t 1; / / t empo de apl i cao vet or espaci al bsi co
f l oat t 2; / / t empo de apl i cao vet or espaci al bsi co
f l oat t s=0. 0005; / / t s=1/ f s f s=2 kHz f r equenci a de chaveament o

voi d mai n(voi d)
{
while(1)
{

/ * si mul a ger ao dos par amet r os de ent r ada: val pha e vbet ha
obs. : val pha e vbet ha nor mal i zados por Vdc/ r ai z( 3
val pha ( - 1, +1) e vbet ha( - 1, +1) */
val pha=k1*cos(w*t );
vbet ha=k1*si n(w*t );
t ang=vbet ha/val pha;

/ * t empos ( x, y e z) de apl i cao dos vet or es espaci as bsi cos
t omados como f r ao do per odo de chaveament o */
t emp_1=vbet ha/2;
t emp_2=0. 8660254*val pha;
x=vbet ha;
y=t emp_1+t emp_2;
z=t emp_1-t emp_2;

/ * i dent i f i ca set or */
if ((val pha==0)&&(vbet ha==0))
set or =0;
else if ((val pha>0)&&(t ang>=0)&&(t ang<=1. 73205))
set or =1;
else if ((val pha>0)&&(t ang>1. 73205))
set or =2;
else if ((val pha<0)&&(t ang<=-1. 73205))
set or =2;
else if ((val pha<0)&&(t ang<=0)&&(t ang>-1. 73205))
set or =3;
else if ((val pha<0)&&(t ang>0)&&(t ang<=1. 73205))
set or =4;
else if ((val pha<0)&&(t ang>1. 73205))
set or =5;
else if ((val pha>0)&&(t ang<=-1. 73205))
set or =5;
else
set or =6;

/ * Cl cul o dos par met r os de sa da; ndi ces de modul ao
( r azo c cl i ca) ma, mb e mc */
switch(set or ){
case 1: / * set or 1: t 1=- z, t 2=x ( ma, mb, mc) */
t 1=-z;
t 2=x;
ma=(1-t 1-t 2)/2; / * t aon=( 1- t 1- t 2) / 2 */
mb=ma+t 1; / * t bon=t aon+t 1 */
mc=mb+t 2; / * t con=t bon+t 2 */
break;

case 2: / * set or 2: t 1=z, t 2=y ( mb, ma, mc) */
t 1=z;
t 2=y;
mb=(1-t 1-t 2)/2; / * t bon=( 1- t 1- t 2) / 2 */
ma=mb+t 1; / * t aon=t bon+t 1 */
mc=ma+t 2; / * t con=t aon+t 2 */
break;

case 3: / * set or 3: t 1=x, t 2=- y ( mb, mc, ma) */
t 1=x;
t 2=-y;
mb=(1-t 1-t 2)/2; / * t bon=( 1- t 1- t 2) / 2 */
mc=mb+t 1; / * t con=t bon+t 1 */
ma=mc+t 2; / * t aon=t con+t 2 */
break;

case 4: / * set or 4: t 1=- x, t 2=z ( mc, mb, ma) */
t 1=-x;
t 2=z;
mc=(1-t 1-t 2)/2; / * t con=( 1- t 1- t 2) / 2 */
mb=mc+t 1; / * t bon=t con+t 1 */
ma=mb+t 2; / * t aon=t bon+t 2 */
break;

case 5: / * set or 5: t 1=- y, t 2=- z ( mc, ma, mb) */
t 1=-y;
t 2=-z;
mc=(1-t 1-t 2)/2; / * t con=( 1- t 1- t 2) / 2 */
ma=mc+t 1; / * t aon=t con+t 1 */
mb=ma+t 2; / * t bon=t aon+t 2 */
break;
case 6: / * set or 6: t 1=y, t 2=- x ( ma, mc, mb) */
t 1=y;
t 2=-x;
ma=(1-t 1-t 2)/2; / * t aon=( 1- t 1- t 2) / 2 */
mc=ma+t 1; / * t con=t aon+t 1 */
mb=mc+t 2; / * t bon=t con+t 2 */
break;
}

t =t +0. 00005;
v[p]=ma;
if(++p==np) p=0;

}
}
-


































2) Tempo mdio de execuo no TMS320F28335 usando o simulador Texas:


O tempo mdio de execuo foi aproximadamente 782 ciclos de clock.

















3) Grficos:

As entradas v e v so componentes do vetor espacial resultante e so
normalizadas pela mxima magnitude da tenso de fase ( ) 3 (Vcc .


Entrada (-1,0 <v ,<1,0).




Entrada (-1,0 <v <1,0).





Setor







As sadas so os ndices de modulao normalizados.


Sada (-1,0 <ma <1,0)





Sada (-1,0 <mb <1,0)





Sada (-1,0 <mc <1,0)










4) Observaes;

Para desenvolvimento deste trabalho trabalho revisado a teoria de modulao
space vector, sendo utilizado as apresentaes das aulas da disciplina Controle
de Mquinas Eltricas ( prof. Walter), o livro Modern Power Eletronics and AC
Dives (Bimal K. Bose) ed. 2002 e o material da Texas Instruments referente ao
bloco space vector (segue em anexo).

Procurou-se seguir a sequncia apresentada pela Texas, porm a determinao
do setor foi definido fazer de outra forma e foram encontados erros nas tabela 69,
70 e 71, sendo necessrio fazer todo o desenvolvimento para localizar o erro e
ento o programa em linguagem C funcionar adequadamente.

Sequncia do cdigo C desenvolvido:

1-Gerao das componentes valpha e vbetha normalizadas (-1, +1);

2-Cculo de x, y e z (trs valores possveis de tempo de aplicao dos vetores
espaciais) ;

3-Determinao do setor aonde se localiza o vetor espacial resultante (baseado
nos valores da tangente e nos sinais de valpha e vbetha);

4-Clculo de t1 e t2 (tempos de aplicao) dos vetores espaciais bsicos
normalizados pelo perodo t ( t1+t2+t0).

5-Clculo dos ndices de moduo (razes cclicas) taon, tbon e tcon;

6-Atribuio dos ndices de modulao as pernas (braos) do inversor.


Background Information
SVGEN_DQ 197
Background Information
The Space Vector Pulse Width Modulation (SVPWM) refers to a special switching se-
quence of the upper three power devices of a three-phase voltage source inverters
(VSI) used in application such as AC induction and permanent magnet synchronous
motor drives. This special switching scheme for the power devices results in 3 pseudo-
sinusoidal currents in the stator phases.
motor phases
VDC
+
a c b
Q6 Q4 Q2
Q5 Q3 Q1
V
a
V
b
V
c
c a b
Figure 27. Power Circuit Topology for a Three-Phase VSI
It has been shown that SVPWM generates less harmonic distortion in the output volt-
ages or currents in the windings of the motor load and provides more efficient use of
DC supply voltage, in comparison to direct sinusoidal modulation technique.
c a b
VDC
a
A
b
B
c
C
Z
Z Z
N
ACI or PMSM
Figure 28. Power Bridge for a Three-Phase VSI
For the three phase power inverter configurations shown in Figure 27 and Figure 28,
there are eight possible combinations of on and off states of the upper power transis-
tors. These combinations and the resulting instantaneous output line-to-line and
phase voltages, for a dc bus voltage of V
DC,
are shown in Table 68.
Background Information
198 SPRU456
Table 68. Device On/Off Patterns and Resulting Instantaneous Voltages of a
3-Phase Power Inverter
c b a V
AN
V
BN
V
CN
V
AB
V
BC
V
CA
0 0 0 0 0 0 0 0 0
0 0 1 2V
DC
/3 V
DC
/3 V
DC
/3 V
DC
0 V
DC
0 1 0 V
DC
/3 2V
DC
/3 V
DC
/3 V
DC
V
DC
0
0 1 1 V
DC
/3 V
DC
/3 2V
DC
/3 0 V
DC
V
DC
1 0 0 V
DC
/3 V
DC
/3 2V
DC
/3 0 V
DC
V
DC
1 0 1 V
DC
/3 2V
DC
/3 V
DC
/3 V
DC
V
DC
0
1 1 0 2V
DC
/3 V
DC
/3 V
DC
/3 V
DC
0 V
DC
1 1 1 0 0 0 0 0 0
The quadrature quantities (in the (,) frame) corresponding to these 3 phase voltages
are given by the general Clarke transform equation:
V
sa
+ V
AN
V
sb
+(2V
BN
)V
AN
) 3

In matrix from the above equation is also expressed as,

V
sa
V
sb
+
2
3

1
0
*
1
2
3

2
*
1
2
*
3

V
AN
V
BN
V
CN

Due to the fact that only 8 combinations are possible for the power switches, V
s
and
V
s
can also take only a finite number of values in the (,) frame according to the sta-
tus of the transistor command signals (c,b,a). These values of V
s
and V
s
for the corre-
sponding instantaneous values of the phase voltages (V
AN
, V
BN,
V
CN
) are listed in
Table 69.
Table 69. Switching Patterns, Corresponding Space Vectors and their (,)
Components
c b a V
s
V
s
Vector
0 0 0 0 0 O
0
0 0 1 0 U
0
0 1 0 U
120
0 1 1 U
60
1 0 0 U
240
1 0 1 U
300
1 1 0 0 U
180
1 1 1 0 0 O
111
2
3
V
DC
V
DC
3

V
DC
3
V
DC
3
V
DC
3

*
V
DC
3
*
V
DC
3

V
DC
3
*
V
DC
3

*
2
3
V
DC
Background Information
SVGEN_DQ 199
These values of V
s
and V
s,
listed in Table 69, are called the (,) components of the
basic space vectors corresponding to the appropriate transistor command signal
(c,b,a). The space vectors corresponding to the signal (c,b,a) are listed in the last col-
umn in Table 69. For example, (c,b,a)=001 indicates that the space vector is U
0
.The
eight basic space vectors defined by the combination of the switches are also shown
in Figure 29.
b
a
U
120
(010)
U
240
(100)
U
60
(011)
U
300
(101)
U
180
(110) U
0
(001)
O
111
(111) O
0
(000)
Figure 29. Basic Space Vectors
Projection of the stator reference voltage vector U
out
The objective of Space Vector PWM technique is to approximate a given stator refer-
ence voltage vector U
out
by combination of the switching pattern corresponding to the
basic space vectors. The reference vector U
out
is represented by its (,) components,
Ualfa and Ubeta. Figure 30 shows the reference voltage vector, its (,) components
and two of the basic space vectors, U
0
and U
60
. The figure also indicates the resultant
and components for the space vectors U
0
and U
60
. V
s
represents the sum of
the components of U
0
and U
60
, while V
s
represents the sum of the components
of U
0
and U
60
. Therefore,

V
sb
+0 )
V
DC
3

+
V
DC
3

V
sa
+
2V
DC
3
)
V
DC
3
+ V
DC
Background Information
200 SPRU456
0
b
V
sb
U
60
(011)
Ubeta
U
out
T
3
T
U
60
T
1
T
U
0
Ualfa
U
0
(001) V
sa
a
60
Figure 30. Projection of the Reference Voltage Vector
For the case in Figure 30, the reference vector U
out
is in the sector contained by U
0
and
U
60.
Therefore U
out
is represented by U
0
and U
60
. So we can write,

T + T
1
)T
3
)T
0
U
out
+
T
1
T
U
0
)
T
3
T
U
60
where, T
1
and T
3
are the respective durations in time for which U
0
and U
60
are applied
within period T. T
0
is the time duration for which the null vector is applied. These time
durations can be calculated as follows:

U
beta
+
T
3
T
|U
60
| sin
U
alfa
+
T
1
T
|U
0
| )
T
3
T
|U
60
| cos
(60)
(60)
From Table 69 and Figure 30 it is evident that the magnitude of all the space vectors
is 2V
DC
/3. When this is normalized by the maximum phase voltage(line to neutral),
V
DC
/3, the magnitude of the space vectors become 2/3 i.e., the normalized magni-
tudes are |U
0
| = |U
60
| =2/3. Therefore, from the last two equations the time durations
are calculated as,
T
1
+
T
2

U
alfa
*U
beta

T
3
+ TU
beta
Where, Ualfa and Ubeta also represent the normalized (,) components of U
out
with
respect to the maximum phase voltage(V
DC
/3). The rest of the period is spent in applying
the null vector T
0
. The time durations, as a fraction of the total T, are given by,
t1 +
T
1
T

3

U
alfa
*U
beta

t2 +
T
3
T
+ U
beta
Background Information
SVGEN_DQ 201
In a similar manner, if U
out
is in sector contained by U
60
and U
120,
then by knowing
|U60| = |U120| = 2/3 (normalized with respect to V
DC
/3), the time durations can be
derived as,
t1 +
T
2
T
+
1
2

* 3

U
alfa
) U
beta

t2 +
T
3
T
+
1
2

U
alfa
)U
beta

where, T
2
is the duration in time for which U
120
is applied within period T
Now, if we define 3 variables X, Y and Z according to the following equations,
Y +
1
2

U
alfa
)U
beta

Z +
1
2

* 3

U
alfa
)U
beta

X + U
beta
Then for the first example, when U
out
is in sector contained by U
0
and U
60,
t1= Z, t2=X.
For the second example, when U
out
is in sector contained by U
60
and U
120
, t1=Z, t2=Y.
In a similar manner t1 and t2 can be calculated for the cases when U
out
is in sectors
contained by other space vectors. For different sectors the expressions for t1 and t2
in terms of X, Y and Z are listed in Table 70.
Table 70. t1 and t2 Definitions for Different Sectors in Terms of X, Y and Z
Variables
Sector U
0
, U
60
U
60
, U
120
U
120
, U
180
U
180
, U
240
U
240
, U
300
U
300
, U
0
t1 Z Z X X Y Y
t2 X Y Y Z Z X
In order to know which of the above variables apply, the knowledge of the sector con-
taining the reference voltage vector is needed. This is achieved by first converting the
(,) components of the reference vector U
out
into a balanced three phase quantities.
That is, Ualfa and Ubeta are converted to a balanced three phase quantities V
ref1
, V
ref1
and V
ref1
according to the following inverse clarke transformation:

V
ref1
+ U
beta
V
ref2
+
*U
beta
)U
alfa
3

2
V
ref3
+
*U
beta
*U
alfa
3

2
Note that, this transformation projects the quadrature or component, Ubeta, into
V
ref1.
This means that the voltages V
ref1
V
ref2
and V
ref3
are all phase advanced by 90
O
when compared to the corresponding voltages generated by the conventional inverse
clarke transformation which projects the component, Ualfa, into phase voltage V
AN
.
The following equations describe the (,) components and the reference voltages:
Background Information
202 SPRU456

U
alfa
+sinwt
U
beta
+cos wt
V
ref1
+cos wt
V
ref2
+cos(wt *120 )
V
ref3
+cos(wt )120 )
Note that, the above voltages are all normalized by the maximum phase volt-
age(V
DC
/3).
90
7FFFh
0
8000h
U
beta
U
alfa
Figure 31. (,) Components of Stator Reference Voltage
120
7FFFh
0
8000h
V
ref1
V
ref2
V
ref3
Figure 32. Voltages V
ref1
V
ref2
and V
ref3
From the last three equations the following decisions can be made on the sector infor-
mation:
If V
ref1
> 0 then a=1, else a=0
If V
ref2
> 0 then b=1, else b=0
If V
ref3
> 0 then c=1, else c=0
The variable sector in the code is defined as, sector = 4c+2b+a
For example, in Figure 29 a=1 for the vectors U
300
, U
0
and U
60
. For these vectors the
phase of V
ref1
are t=300, t=0 and t=60 respectively. Therefore, V
ref1
> 0 when a=1.
The (,) components, Ualfa and Ubeta, defined above represent the output phase
voltages V
AN
, V
BN
and V
CN
. The following equations describe these phase voltages:

V
AN
+sinwt
V
BN
+sin(wt ) )
V
CN
+sin(wt * )
120
120
The Space Vector PWM module is divided in several parts:
- Determination of the sector
- Calculation of X, Y and Z
Background Information
SVGEN_DQ 203
- Calculation of t
1
and t
2
- Determination of the duty cycle taon, tbon and tcon
- Assignment of the duty cycles to Ta, Tb and Tc
The variables t
aon
, t
bon
and t
con
are calculated using the following equations:

t
aon
+
PWMPRD *t
1
*t
2
2
t
bon
+ t
aon
)t
1
t
con
+ T
bon
)t
2
Then the right duty cycle (txon) is assigned to the right motor phase (in other words,
to Ta, Tb and Tc) according to the sector. Table 71 depicts this determination.
Table 71. Assigning the Right Duty Cycle to the Right Motor Phase
Sector U
0
, U
60
U
60
, U
120
U
120
, U
180
U
180
, U
240
U
240
, U
300
U
300
, U
0
Ta taon tbon tcon tcon tbon taon
Tb tbon taon taon tbon tcon tcon
Tc tcon tcon tbon taon taon tbon
Example:
Sector contained by U
0
and U
60
.
T
t
t
t
PWM1
PWM3
PWM5
t
Ta
Tc
Tb
tcon
tbon
taon
T
0
4 T
6
2 T
6
2 T
0
4 T
0
4 T
6
4 T
4
4 T
0
4
V
0
V
6
V
4
V
7
V
7
V
6
V
4
V
0
Figure 33. PWM Patterns and Duty Cycles for Sector Contained by U
0
and
U
60
Table 72. Variable Cross Ref Table
Variables in the Equations Variables in the Code
a r1
b r2
c r3
V
ref1
Va