fluxweaken.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /************************************************************************
  2. Project: Welling FAN Motor Developing platform
  3. Filename: fluxweaken.h
  4. Partner Filename: fluxweaken.c
  5. Description: Partner file of fluxweaken.c
  6. Complier: IAR Embedded Workbench for ARM 7.80, IAR Systems.
  7. CPU TYPE : ST32F0xx
  8. *************************************************************************
  9. Copyright (c) 2019 Welling Motor Technology(Shanghai) Co. Ltd.
  10. All rights reserved.
  11. *************************************************************************
  12. *************************************************************************
  13. Revising History (ECL of this file):
  14. 20191225, by cyf, create this file;
  15. ************************************************************************/
  16. #include "typedefine.h"
  17. #include "macroequ.h"
  18. /************************************************************************
  19. Beginning of File, do not put anything above here except notes
  20. Compiler Directives:
  21. *************************************************************************/
  22. #ifndef FWCTRl_H
  23. #define FWCTRl_H
  24. /************************************************************************
  25. Compiler Directives (N/A)
  26. *************************************************************************/
  27. #ifdef _FWCTRL_C_
  28. #define FWCTRl_EXT
  29. #else
  30. #define FWCTRl_EXT extern
  31. #endif
  32. /************************************************************************
  33. Definitions & Macros
  34. *************************************************************************/
  35. /************************************************************************
  36. Constant Table (N/A) Is = 0.6A ,Iq^2 = Is^2 - Id^2
  37. *************************************************************************/
  38. //#if (USER_MOTOR_ID == USER_HUAWEI_V2)
  39. #define FW_CNTS 17
  40. static const SWORD fw_swIqLimTab[FW_CNTS] = {
  41. 10240, // 0,id = 0A ,Iqlimit = 0.6A
  42. 10240, // 1,id = -0.025A
  43. 10240, // 2,id = -0.05A
  44. 10240, // 3,id = -0.075A
  45. 10240, // 4,id = -0.1A
  46. 10240, // 5,id = -0.125A
  47. 10240, // 6,id = -0.15A
  48. 10240, // 7,id = -0.175A
  49. 10240, // 8,id = -0.2A
  50. 10240, // 9,id = -0.225A
  51. 10240, // 10,id = -0.25A
  52. 10240, // 11,id = -0.275A
  53. 10240, // 12,id = -0.3A
  54. 10240, // 13,id = -0.325A
  55. 10240, // 14,id = -0.35A
  56. 10240, // 15,id = -0.375A
  57. 10240, // 16,id = -0.4A
  58. };
  59. //#endif
  60. /************************************************************************
  61. TypeDefs & Structure defines (N/A)
  62. *************************************************************************/
  63. typedef struct
  64. {
  65. UWORD uwUdcCnt;
  66. UWORD uwUdcMinPu;
  67. UWORD uwUdcPu;
  68. SWORD swEnable;
  69. SWORD swIdFwoutPu;
  70. SLONG slIdFwoutPu;
  71. SWORD swFwIqLimPu;
  72. SWORD swVolErrPu;
  73. UWORD uwFwCoefPu; // Q14
  74. } FW_OUT;
  75. typedef struct
  76. {
  77. UWORD uwKpPu; // Q14
  78. UWORD uwKitPu; // Q14
  79. SWORD swIdMinPu; // Q14
  80. SWORD swIdCharacterPu; // Q14
  81. SWORD swIqMinPu;
  82. SWORD swIqMaxPu;
  83. } FW_COFIN;
  84. typedef struct
  85. {
  86. UWORD uwKpPu; // Q14
  87. UWORD uwKitPu; // Q14
  88. SWORD swIdMinPu; // Q14
  89. SWORD swIdCharacterPu; // Q14
  90. SWORD swIqMinPu;
  91. SWORD swIqMaxPu;
  92. } FW_COF;
  93. typedef struct
  94. {
  95. SWORD swPwmalphaPu; // Q14
  96. SWORD swPwmbetaPu; // Q14
  97. UWORD uwUdcPu; // Q14
  98. } FW_IN;
  99. /************************************************************************
  100. Exported Variables
  101. *************************************************************************/
  102. #ifdef _FWCTRL_C_
  103. FWCTRl_EXT FW_OUT fw_stFluxWeakeningOutPu;
  104. FWCTRl_EXT FW_COF fw_stFluxWeakeningCoefPu;
  105. #else
  106. FWCTRl_EXT FW_OUT fw_stFluxWeakeningOutPu;
  107. FWCTRl_EXT FW_COF fw_stFluxWeakeningCoefPu;
  108. #endif
  109. /************************************************************************
  110. RAM ALLOCATION:
  111. *************************************************************************/
  112. #define fw_stFluxWeakeningInPu (*(FW_IN *)TBC_BUFFER)
  113. #define fw_stFluxWeakeningCoefInPu (*(FW_COFIN *)MN_BUFFER)
  114. /************************************************************************
  115. Exported Function Call Prototypes
  116. *************************************************************************/
  117. #ifdef _FWCTRL_C_
  118. FWCTRl_EXT void fw_voFluxWeakeningGen(FW_IN *IN, FW_COF *COF, FW_OUT *OUT);
  119. FWCTRl_EXT void fw_voFluxWeakeningCoef(FW_COFIN *COFIN, FW_COF *COF);
  120. FWCTRl_EXT void fw_voInit(void);
  121. #else
  122. FWCTRl_EXT void fw_voFluxWeakeningGen(FW_IN *IN, FW_COF *COF, FW_OUT *OUT);
  123. FWCTRl_EXT void fw_voFluxWeakeningCoef(FW_COFIN *COFIN, FW_COF *COF);
  124. FWCTRl_EXT void fw_voInit(void);
  125. #endif
  126. /************************************************************************
  127. Local Function Call Prototypes (N/A)
  128. *************************************************************************/
  129. /************************************************************************
  130. Flag Define (N/A)
  131. *************************************************************************/
  132. #endif
  133. /************************************************************************
  134. Copyright (c) 2019 Welling Motor Technology(Shanghai) Co. Ltd.
  135. All rights reserved.
  136. *************************************************************************
  137. End of this File (EOF)!
  138. Do not put anything after this part!
  139. *************************************************************************/