crdnt.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. #include "typedefine.h"
  25. /************************************************************************
  26. Compiler Directives
  27. *************************************************************************/
  28. #ifdef _CRDNT_C_
  29. #define _CRDNT_EXT
  30. #else
  31. #define _CRDNT_EXT extern
  32. #endif
  33. /************************************************************************
  34. Definitions & Macros (#define ...)
  35. *************************************************************************/
  36. #define CRD_CLARK_OUT_DEFAULT \
  37. { \
  38. 0, 0 \
  39. } // Default value of CLARKOUT
  40. #define CRD_PARK_OUT_DEFAULT \
  41. { \
  42. 0, 0 \
  43. } // Default value of PARKOUT
  44. #define CRD_IPARK_OUT_DEFAULT \
  45. { \
  46. 0, 0 \
  47. } // Default value of IPARKOUT
  48. #define CRD_ICLARK_OUT_DEFAULT \
  49. { \
  50. 0, 0, 0 \
  51. } // Default value of ICLARKOUT
  52. /************************************************************************
  53. TypeDefs & Structure defines (N/A)
  54. *************************************************************************/
  55. /************************************************************************
  56. fuction Clarke TypeDefs & Structure defines
  57. *************************************************************************/
  58. typedef struct
  59. { // Input of crd_voClark
  60. SWORD swAPu;
  61. SWORD swBPu;
  62. SWORD swCPu;
  63. } CRD_CLARK_IN;
  64. typedef struct
  65. { // outputs of crd_voClark
  66. SWORD swAlphaPu;
  67. SWORD swBetaPu;
  68. } CRD_CLARK_OUT;
  69. /************************************************************************
  70. function Park TypeDefs & Structure defines
  71. *************************************************************************/
  72. typedef struct
  73. { // Input of crd_voPark
  74. SWORD swAlphaPu;
  75. SWORD swBetaPu;
  76. UWORD uwThetaPu; // Q15
  77. } CRD_PARK_IN;
  78. typedef struct
  79. { // outputs of crd_voPark
  80. SWORD swDPu;
  81. SWORD swQPu;
  82. } CRD_PARK_OUT;
  83. /************************************************************************
  84. function Inverse park TypeDefs & Structure defines
  85. *************************************************************************/
  86. typedef struct
  87. { // Input of crd_voIpark
  88. SWORD swDPu;
  89. SWORD swQPu;
  90. UWORD uwThetaPu; // Q15
  91. } CRD_IPARK_IN;
  92. typedef struct
  93. { // outputs of crd_voIpark
  94. SWORD swAlphaPu;
  95. SWORD swBetaPu;
  96. } CRD_IPARK_OUT;
  97. /************************************************************************
  98. function Inverse clark TypeDefs & Structure defines
  99. *************************************************************************/
  100. typedef struct
  101. { // Input of crd_voIclark
  102. SWORD swIClarkAlfaPu;
  103. SWORD swIClarkBetaPu;
  104. } CRD_ICLARK_IN;
  105. typedef struct
  106. { // Output of crd_voIclark
  107. SWORD swIClarkaPu;
  108. SWORD swIClarkbPu;
  109. SWORD swIClarkcPu;
  110. } CRD_ICLARK_OUT;
  111. /************************************************************************
  112. Constant Table
  113. *************************************************************************/
  114. /************************************************************************
  115. Exported Variables:
  116. *************************************************************************/
  117. #ifdef _CRDNT_C_
  118. _CRDNT_EXT CRD_CLARK_OUT crd_stCurClarkOut = CRD_CLARK_OUT_DEFAULT;
  119. _CRDNT_EXT CRD_CLARK_OUT crd_stVltClarkOut = CRD_CLARK_OUT_DEFAULT;
  120. _CRDNT_EXT CRD_PARK_OUT crd_stCurParkOut = CRD_PARK_OUT_DEFAULT;
  121. _CRDNT_EXT CRD_PARK_OUT crd_stVltParkOut = CRD_PARK_OUT_DEFAULT;
  122. _CRDNT_EXT CRD_IPARK_OUT crd_stCurIParkOut = CRD_IPARK_OUT_DEFAULT;
  123. _CRDNT_EXT CRD_IPARK_OUT crd_stVltIParkOut = CRD_IPARK_OUT_DEFAULT;
  124. _CRDNT_EXT CRD_ICLARK_OUT crd_stCurIClarkOut = CRD_ICLARK_OUT_DEFAULT;
  125. _CRDNT_EXT CRD_ICLARK_OUT crd_stVltIClarkOut = CRD_ICLARK_OUT_DEFAULT;
  126. #else
  127. _CRDNT_EXT CRD_CLARK_OUT crd_stCurClarkOut;
  128. _CRDNT_EXT CRD_CLARK_OUT crd_stVltClarkOut;
  129. _CRDNT_EXT CRD_PARK_OUT crd_stCurParkOut;
  130. _CRDNT_EXT CRD_PARK_OUT crd_stVltParkOut;
  131. _CRDNT_EXT CRD_IPARK_OUT crd_stCurIParkOut;
  132. _CRDNT_EXT CRD_IPARK_OUT crd_stVltIParkOut;
  133. _CRDNT_EXT CRD_ICLARK_OUT crd_stCurIClarkOut;
  134. _CRDNT_EXT CRD_ICLARK_OUT crd_stVltIClarkOut;
  135. #endif
  136. /************************************************************************
  137. RAM ALLOCATION:
  138. *************************************************************************/
  139. #define crd_stClarkIn (*(CRD_CLARK_IN *)TBC_BUFFER)
  140. #define crd_stParkIn (*(CRD_PARK_IN *)TBC_BUFFER)
  141. #define crd_stIParkIn (*(CRD_IPARK_IN *)TBC_BUFFER)
  142. #define crd_stIClarkIn (*(CRD_ICLARK_IN *)TBC_BUFFER)
  143. /************************************************************************
  144. Exported Function Call Prototypes (N/A)
  145. *************************************************************************/
  146. #ifdef _CRDNT_C_
  147. _CRDNT_EXT void crd_voClark(CRD_CLARK_IN *in, CRD_CLARK_OUT *out);
  148. _CRDNT_EXT void crd_voPark(CRD_PARK_IN *in, CRD_PARK_OUT *out);
  149. _CRDNT_EXT void crd_voIPark(CRD_IPARK_IN *in, CRD_IPARK_OUT *out);
  150. _CRDNT_EXT void crd_voIClark(CRD_ICLARK_IN *in, CRD_ICLARK_OUT *out);
  151. #else
  152. _CRDNT_EXT void crd_voClark(CRD_CLARK_IN *in, CRD_CLARK_OUT *out);
  153. _CRDNT_EXT void crd_voPark(CRD_PARK_IN *in, CRD_PARK_OUT *out);
  154. _CRDNT_EXT void crd_voIPark(CRD_IPARK_IN *in, CRD_IPARK_OUT *out);
  155. _CRDNT_EXT void crd_voIClark(CRD_ICLARK_IN *in, CRD_ICLARK_OUT *out);
  156. #endif
  157. /************************************************************************
  158. Flag Define (N/A)
  159. *************************************************************************/
  160. /***********************************************************************/
  161. #endif
  162. /************************************************************************
  163. Copyright (c) 2018 Welling Motor Technology(Shanghai) Co. Ltd.
  164. All rights reserved.
  165. *************************************************************************
  166. End of this File (EOF):
  167. !!!!!!Do not put anything after this part!!!!!!!!!!!
  168. *************************************************************************/