EasyManuals Logo

Texas Instruments C28 Series Student Guide

Texas Instruments C28 Series
342 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #183 background imageLoading...
Page #183 background image
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

Table of Contents

Other manuals for Texas Instruments C28 Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments C28 Series and is the answer not in the manual?

Texas Instruments C28 Series Specifications

General IconGeneral
BrandTexas Instruments
ModelC28 Series
CategoryComputer Hardware
LanguageEnglish

Related product manuals