AC Induction Motor Example
The next few slides shows the coding of one particular block, PARK Transform, using floating-
point and "IQmath" approaches in C and C++:
AC Induction Motor Example
AC Induction Motor Example
Park Transform
Park Transform
-
-
floating
floating
-
-
point C code
point C code
#include
#include
“
“
math.h
math.h
”
”
#define TWO_PI 6.28318530717959
#define TWO_PI 6.28318530717959
void park_calc(PARK *v)
void park_calc(PARK *v)
{
{
float
float
cos
cos
_
_
ang
ang
, sin_
, sin_
ang
ang
;
;
sin_
sin_
ang
ang
= sin(TWO_PI * v
= sin(TWO_PI * v
-
-
>
>
ang
ang
);
);
cos
cos
_
_
ang
ang
=
=
cos
cos
(TWO_PI * v
(TWO_PI * v
-
-
>
>
ang
ang
);
);
v
v
-
-
>de = (v
>de = (v
-
-
>
>
ds
ds
*
*
cos
cos
_
_
ang
ang
) + (v
) + (v
-
-
>
>
qs
qs
* sin_
* sin_
ang
ang
);
);
v
v
-
-
>
>
qe
qe
= (v
= (v
-
-
>
>
qs
qs
*
*
cos
cos
_
_
ang
ang
)
)
-
-
(v
(v
-
-
>
>
ds
ds
* sin_
* sin_
ang
ang
);
);
}
}
AC Induction Motor Example
AC Induction Motor Example
Park Transform
Park Transform
-
-
converting to “
converting to “
IQmath
IQmath
” C code
” C code
#include
#include
“
“
math.h
math.h
”
”
#define TWO_PI 6.28318530717959
#define TWO_PI 6.28318530717959
void park_calc(PARK *v)
void park_calc(PARK *v)
{
{
float
float
cos
cos
_
_
ang
ang
, sin_
, sin_
ang
ang
;
;
sin_
sin_
ang
ang
= sin(TWO_PI * v
= sin(TWO_PI * v
-
-
>
>
ang
ang
);
);
cos
cos
_
_
ang
ang
=
=
cos
cos
(TWO_PI * v
(TWO_PI * v
-
-
>
>
ang
ang
);
);
v
v
-
-
>de = (v
>de = (v
-
-
>
>
ds
ds
*
*
cos
cos
_
_
ang
ang
) + (v
) + (v
-
-
>
>
qs
qs
* sin_
* sin_
ang
ang
);
);
v
v
-
-
>
>
qe
qe
= (v
= (v
-
-
>
>
qs
qs
*
*
cos
cos
_
_
ang
ang
)
)
-
-
(v
(v
-
-
>
>
ds
ds
* sin_
* sin_
ang
ang
);
);
}
}
#include “IQmathLib.h”
_IQ(6.28318530717959)
_iq
_IQsin(_IQmpy(TWO_PI , v->ang));
_IQcos(_IQmpy(TWO_PI , v->ang));
_IQmpy(v->ds , cos_ang) + _IQmpy(v->qs , sin_ang);
_IQmpy(v->qs , cos_ang) - _IQmpy(v->ds , sin_ang);
C28x - Numerical Concepts & IQmath
8 - 27
Содержание C28 Series
Страница 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Страница 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Страница 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Страница 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Страница 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Страница 275: ...Appendix eZdsp F2812 eZdsp F2812 Connector Header and Pin Diagram C28x Appendix A eZdsp F2812 A 3 ...
Страница 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Страница 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Страница 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Страница 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Страница 281: ...Appendix JP7 JP8 JP11 JP12 Boot Mode Select JP9 PLL Disable DS1 DS2 LEDs C28x Appendix A eZdsp F2812 A 9 ...
Страница 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...