-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathipark.c
32 lines (23 loc) · 1.03 KB
/
ipark.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*=====================================================================================
File name: IPARK.C (IQ version)
Originator: Digital Control Systems Group
Texas Instruments
Dsscription: Inverse Park Transformation
=====================================================================================
History:
-------------------------------------------------------------------------------------
04-15-2005 Version 3.20
-------------------------------------------------------------------------------------*/
#include "IQmathLib.h" // Include header for IQmath library
// Don't forget to set a proper GLOBAL_Q in "IQmathLib.h" file
#include "dmctype.h"
#include "ipark.h"
void ipark_calc(IPARK *v)
{
_iq Cosine,Sine;
// Using look-up IQ sine table
Sine = _IQsinPU(v->Angle);
Cosine = _IQcosPU(v->Angle);
v->Alpha = _IQmpy(v->Ds,Cosine) - _IQmpy(v->Qs,Sine);
v->Beta = _IQmpy(v->Qs,Cosine) + _IQmpy(v->Ds,Sine);
}