crdnt.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /************************************************************************
  2. Project: Welling Motor Control Paltform
  3. Filename: crdnt.h
  4. Partner Filename: crdnt.c
  5. Description: The header file of crdnt.c
  6. Complier: IAR Embedded Workbench for ARM 7.80, IAR Systems.
  7. CPU TYPE : GD32F3x0
  8. *************************************************************************
  9. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  10. All rights reserved.
  11. *************************************************************************
  12. *************************************************************************
  13. Revising History (ECL of this file):
  14. ************************************************************************/
  15. /************************************************************************
  16. Beginning of File, do not put anything above here except notes
  17. Compiler Directives:
  18. *************************************************************************/
  19. #ifndef CRDNT_H
  20. #define CRDNT_H
  21. /************************************************************************
  22. Modules used (included header files)
  23. *************************************************************************/
  24. /************************************************************************
  25. Compiler Directives
  26. *************************************************************************/
  27. #ifdef _CRDNT_C_
  28. #define _CRDNT_EXT
  29. #else
  30. #define _CRDNT_EXT extern
  31. #endif
  32. /************************************************************************
  33. Definitions & Macros (#define ...)
  34. *************************************************************************/
  35. #define CRD_CLARK_OUT_DEFAULT \
  36. { \
  37. 0, 0 \
  38. } // Default value of CLARKOUT
  39. #define CRD_PARK_OUT_DEFAULT \
  40. { \
  41. 0, 0 \
  42. } // Default value of PARKOUT
  43. #define CRD_IPARK_OUT_DEFAULT \
  44. { \
  45. 0, 0 \
  46. } // Default value of IPARKOUT
  47. #define CRD_ICLARK_OUT_DEFAULT \
  48. { \
  49. 0, 0, 0 \
  50. } // Default value of ICLARKOUT
  51. /************************************************************************
  52. TypeDefs & Structure defines (N/A)
  53. *************************************************************************/
  54. /************************************************************************
  55. fuction Clarke TypeDefs & Structure defines
  56. *************************************************************************/
  57. typedef struct
  58. { // Input of crd_voClark
  59. SWORD swAPu;
  60. SWORD swBPu;
  61. SWORD swCPu;
  62. } CRD_CLARK_IN;
  63. typedef struct
  64. { // outputs of crd_voClark
  65. SWORD swAlphaPu;
  66. SWORD swBetaPu;
  67. } CRD_CLARK_OUT;
  68. /************************************************************************
  69. function Park TypeDefs & Structure defines
  70. *************************************************************************/
  71. typedef struct
  72. { // Input of crd_voPark
  73. SWORD swAlphaPu;
  74. SWORD swBetaPu;
  75. UWORD uwThetaPu; // Q15
  76. } CRD_PARK_IN;
  77. typedef struct
  78. { // outputs of crd_voPark
  79. SWORD swDPu;
  80. SWORD swQPu;
  81. } CRD_PARK_OUT;
  82. /************************************************************************
  83. function Inverse park TypeDefs & Structure defines
  84. *************************************************************************/
  85. typedef struct
  86. { // Input of crd_voIpark
  87. SWORD swDPu;
  88. SWORD swQPu;
  89. UWORD uwThetaPu; // Q15
  90. } CRD_IPARK_IN;
  91. typedef struct
  92. { // outputs of crd_voIpark
  93. SWORD swAlphaPu;
  94. SWORD swBetaPu;
  95. } CRD_IPARK_OUT;
  96. /************************************************************************
  97. function Inverse clark TypeDefs & Structure defines
  98. *************************************************************************/
  99. typedef struct
  100. { // Input of crd_voIclark
  101. SWORD swIClarkAlfaPu;
  102. SWORD swIClarkBetaPu;
  103. } CRD_ICLARK_IN;
  104. typedef struct
  105. { // Output of crd_voIclark
  106. SWORD swIClarkaPu;
  107. SWORD swIClarkbPu;
  108. SWORD swIClarkcPu;
  109. } CRD_ICLARK_OUT;
  110. /************************************************************************
  111. Constant Table
  112. *************************************************************************/
  113. /************************************************************************
  114. Exported Variables:
  115. *************************************************************************/
  116. #ifdef _CRDNT_C_
  117. _CRDNT_EXT CRD_CLARK_OUT crd_stCurClarkOut = CRD_CLARK_OUT_DEFAULT;
  118. _CRDNT_EXT CRD_CLARK_OUT crd_stVltClarkOut = CRD_CLARK_OUT_DEFAULT;
  119. _CRDNT_EXT CRD_PARK_OUT crd_stCurParkOut = CRD_PARK_OUT_DEFAULT;
  120. _CRDNT_EXT CRD_PARK_OUT crd_stVltParkOut = CRD_PARK_OUT_DEFAULT;
  121. _CRDNT_EXT CRD_IPARK_OUT crd_stCurIParkOut = CRD_IPARK_OUT_DEFAULT;
  122. _CRDNT_EXT CRD_IPARK_OUT crd_stVltIParkOut = CRD_IPARK_OUT_DEFAULT;
  123. _CRDNT_EXT CRD_ICLARK_OUT crd_stCurIClarkOut = CRD_ICLARK_OUT_DEFAULT;
  124. _CRDNT_EXT CRD_ICLARK_OUT crd_stVltIClarkOut = CRD_ICLARK_OUT_DEFAULT;
  125. #else
  126. _CRDNT_EXT CRD_CLARK_OUT crd_stCurClarkOut;
  127. _CRDNT_EXT CRD_CLARK_OUT crd_stVltClarkOut;
  128. _CRDNT_EXT CRD_PARK_OUT crd_stCurParkOut;
  129. _CRDNT_EXT CRD_PARK_OUT crd_stVltParkOut;
  130. _CRDNT_EXT CRD_IPARK_OUT crd_stCurIParkOut;
  131. _CRDNT_EXT CRD_IPARK_OUT crd_stVltIParkOut;
  132. _CRDNT_EXT CRD_ICLARK_OUT crd_stCurIClarkOut;
  133. _CRDNT_EXT CRD_ICLARK_OUT crd_stVltIClarkOut;
  134. #endif
  135. /************************************************************************
  136. RAM ALLOCATION:
  137. *************************************************************************/
  138. #define crd_stClarkIn (*(CRD_CLARK_IN *)TBC_BUFFER)
  139. #define crd_stParkIn (*(CRD_PARK_IN *)TBC_BUFFER)
  140. #define crd_stIParkIn (*(CRD_IPARK_IN *)TBC_BUFFER)
  141. #define crd_stIClarkIn (*(CRD_ICLARK_IN *)TBC_BUFFER)
  142. /************************************************************************
  143. Exported Function Call Prototypes (N/A)
  144. *************************************************************************/
  145. #ifdef _CRDNT_C_
  146. _CRDNT_EXT void crd_voClark(CRD_CLARK_IN *in, CRD_CLARK_OUT *out);
  147. _CRDNT_EXT void crd_voPark(CRD_PARK_IN *in, CRD_PARK_OUT *out);
  148. _CRDNT_EXT void crd_voIPark(CRD_IPARK_IN *in, CRD_IPARK_OUT *out);
  149. _CRDNT_EXT void crd_voIClark(CRD_ICLARK_IN *in, CRD_ICLARK_OUT *out);
  150. #else
  151. _CRDNT_EXT void crd_voClark(CRD_CLARK_IN *in, CRD_CLARK_OUT *out);
  152. _CRDNT_EXT void crd_voPark(CRD_PARK_IN *in, CRD_PARK_OUT *out);
  153. _CRDNT_EXT void crd_voIPark(CRD_IPARK_IN *in, CRD_IPARK_OUT *out);
  154. _CRDNT_EXT void crd_voIClark(CRD_ICLARK_IN *in, CRD_ICLARK_OUT *out);
  155. #endif
  156. /************************************************************************
  157. Flag Define (N/A)
  158. *************************************************************************/
  159. /***********************************************************************/
  160. #endif
  161. /************************************************************************
  162. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  163. All rights reserved.
  164. *************************************************************************
  165. End of this File (EOF):
  166. !!!!!!Do not put anything after this part!!!!!!!!!!!
  167. *************************************************************************/