user.h 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179
  1. /************************************************************************
  2. Project: Welling Motor Control Paltform
  3. Filename: user.h
  4. Partner Filename: Null
  5. Description: User parameters
  6. Complier: IAR Embedded Workbench for ARM 7.80, IAR Systems.
  7. CPU TYPE : STM32F30x
  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. ************************************************************************/
  15. #ifndef USER_H
  16. #define USER_H
  17. /************************************************************************
  18. Compiler Directives
  19. *************************************************************************/
  20. #include "typedefine.h"
  21. #include "syspar.h"
  22. /************************************************************************
  23. Definitions & Macros
  24. *************************************************************************/
  25. /*======================================================================*
  26. Update Time
  27. 2021-06-21 13:47:04
  28. *=======================================================================*/
  29. /*======================================================================*
  30. Software version
  31. *=======================================================================*/
  32. #define SOFTWARE_VERSION 0x1C10
  33. #define SOFTWARE_VERSION_WELLING 0x0001
  34. /*======================================================================*
  35. Software version
  36. *=======================================================================*/
  37. /*======================================================================*
  38. Assist Mode
  39. *=======================================================================*/
  40. #define CADENCE_ASSIST 1
  41. #define TORQUE_ASSIST 2
  42. #define ASSIST_MODE TORQUE_ASSIST
  43. /*======================================================================*
  44. Motor Number Selection
  45. *=======================================================================*/
  46. #define MOTOR_WELLING_MTB 0x19
  47. #define MOTOR_WELLING_MTB35_V3 0x21
  48. #define MOTOR_LUNGU_WELLING_HAL_BAFANG 0x30
  49. #define MOTOR_LUNGU_WELLING_HAL_POLE8_250W 0x31
  50. #define MOTOR_LUNGU_WELLING_HAL_POLE8_250W_LowRatio 0x32
  51. #define MOTOR_LUNGU_WELLING_HAL_POLE8_250W_958Ratio 0x33
  52. #define MOTOR_LUNGU_WELLING_HAL_POLE8_250W_517Ratio 0x34
  53. #define MOTOR_LUNGU_WELLING_HAL_POLE8_350W 0x40
  54. #define MOTOR_LUNGU_WELLING_HAL_POLE8_350W_958Ratio 0x41
  55. #define MOTOR_LUNGU_WELLING_HAL_POLE8_500W 0x50
  56. #define MOTOR_LUNGU_WELLING_HAL_POLE8_500W_958Ratio 0x51
  57. #define MOTOR_LUNGU_WELLING_HAL_POLE8_750W 0x60
  58. #define MOTOR_LUNGU_WELLING_HAL_POLE8_1000W 0x70
  59. #define MOTOR_VOLANS 0x80
  60. #define MOTOR_VOLANS_PLUS 0x81
  61. #define MOTOR_PEGASI 0x82
  62. #define MOTOR_PEGASI_PLUS 0x83
  63. /* Select Motor */
  64. #if( (IPM_POWER_SEL == IPM_POWER_1000W_12G) ||(IPM_POWER_SEL ==IPM_POWER_1000W_MINI_12G))
  65. #define MOTOR_ID_SEL MOTOR_LUNGU_WELLING_HAL_POLE8_1000W
  66. #elif( (IPM_POWER_SEL == IPM_POWER_750W_12G)||(IPM_POWER_SEL ==IPM_POWER_750W_MINI_12G))
  67. #define MOTOR_ID_SEL MOTOR_LUNGU_WELLING_HAL_POLE8_750W
  68. #elif (IPM_POWER_SEL == IPM_POWER_500W_12G)
  69. #define MOTOR_ID_SEL MOTOR_LUNGU_WELLING_HAL_POLE8_500W
  70. #elif(IPM_POWER_SEL ==IPM_POWER_350W_MINI_12G)
  71. #define MOTOR_ID_SEL MOTOR_LUNGU_WELLING_HAL_POLE8_350W_958Ratio
  72. #elif (IPM_POWER_SEL == IPM_POWER_500W_9G)
  73. #define MOTOR_ID_SEL MOTOR_LUNGU_WELLING_HAL_POLE8_500W//MOTOR_LUNGU_WELLING_HAL_POLE8_500W_958Ratio
  74. #elif (IPM_POWER_SEL == IPM_POWER_350W_9G)
  75. #define MOTOR_ID_SEL MOTOR_LUNGU_WELLING_HAL_POLE8_350W_958Ratio
  76. #elif ((IPM_POWER_SEL == IPM_POWER_250W_6G)||(IPM_POWER_SEL == IPM_POWER_350W_6G))
  77. #define MOTOR_ID_SEL MOTOR_VOLANS_PLUS
  78. #else
  79. #define MOTOR_ID_SEL MOTOR_VOLANS_PLUS
  80. #endif
  81. /*======================================================================*
  82. Motor Parameters
  83. *=======================================================================*/
  84. #if (MOTOR_ID_SEL == MOTOR_WELLING_MTB)
  85. #define M_POLE_PAIRS 7 // unit:Null,Pole pairs
  86. #define M_RS_OHM 170 // unit: 0.1mOhm, Phase resistance
  87. #define M_MATERIAL Al // unit:Null
  88. #define M_LD_NOLOAD_MH 11000 // unit: 0.01uH, D axis inductance
  89. #define M_LQ_NOLOAD_MH 11500 // unit: 0.01uH, Q axis inductance
  90. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  91. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  92. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  93. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  94. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  95. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  96. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  97. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  98. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  99. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  100. #define M_JD 500 // unit: 10-7Kg*m2, Rotational inertia
  101. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  102. #define M_FLUX_WB 5360 // unit: 0.001mWb, Flux linkage
  103. #define M_ID_MAX_AP 0 //-25 // unit: 0.01A, Max d axis current
  104. #define M_ID_MIN_AP -300 // unit: 0.01A, Min d axis current
  105. #define M_IS_PEAK_MAX_AP 5500 // unit: 0.01A, Max phase current(below base speed)
  106. #define M_POWER_MAX_WT 600 // unit: W, Max power
  107. #define M_R_SPD_RPM 5000 // unit: r/min, rate spd
  108. #define M_R_PWR_WT 250 // unit: W, rate power
  109. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  110. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  111. #define M_MAX_TOR_NM 30 // unit: 0.1Nm, Max tor
  112. #endif
  113. #if (MOTOR_ID_SEL == MOTOR_WELLING_MTB35_V3)
  114. #define M_POLE_PAIRS 7 // unit:Null,Pole pairs
  115. #define M_RS_OHM 170 // unit: 0.1mOhm, Phase resistance
  116. #define M_MATERIAL Al // unit:Null
  117. #define M_LD_NOLOAD_MH 10500 // unit: 0.01uH, D axis inductance
  118. #define M_LQ_NOLOAD_MH 11700 // unit: 0.01uH, Q axis inductance
  119. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  120. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  121. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  122. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  123. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  124. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  125. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  126. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  127. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  128. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  129. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  130. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  131. #define M_FLUX_WB 8565 // unit: 0.001mWb, Flux linkage
  132. #define M_ID_MAX_AP 0 //-25 // unit: 0.01A, Max d axis current
  133. #define M_ID_MIN_AP -300 // unit: 0.01A, Min d axis current
  134. #define M_IS_PEAK_MAX_AP 5000 // unit: 0.01A, Max phase current(below base speed)
  135. #define M_POWER_MAX_WT 600 // unit: W, Max power
  136. #define M_R_SPD_RPM 5000 // unit: r/min, rate spd
  137. #define M_R_PWR_WT 250 // unit: W, rate power
  138. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  139. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  140. #define M_MAX_TOR_NM 20 // unit: 0.1Nm, Max tor
  141. #endif
  142. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_BAFANG)
  143. #define M_POLE_PAIRS 10 // unit:Null,Pole pairs
  144. #define M_RS_OHM 480 // 1360 // unit: 0.1mOhm, Phase resistance
  145. #define M_MATERIAL Al // unit:Null
  146. #define M_LD_NOLOAD_MH 8491 // 13300 // unit: 0.01uH, D axis inductance
  147. #define M_LQ_NOLOAD_MH 9161 // 14350 // unit: 0.01uH, Q axis inductance
  148. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  149. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  150. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  151. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  152. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  153. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  154. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  155. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  156. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  157. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  158. #define M_JD 5000 // 15000 // unit: 10-7Kg*m2, Rotational inertia
  159. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  160. #define M_FLUX_WB 11008 // 13777 // unit: 0.001mWb, Flux linkage
  161. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  162. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  163. #define M_IS_PEAK_MAX_AP 5000 // unit: 0.01A, Max phase current(below base speed)
  164. #define M_POWER_MAX_WT 600 // unit: W, Max power
  165. #define M_R_SPD_RPM 5000 // unit: r/min, rate spd
  166. #define M_R_PWR_WT 250 // unit: W, rate power
  167. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  168. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  169. #define M_MAX_TOR_NM 20 // unit: 0.1Nm, Max tor
  170. #endif
  171. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W)
  172. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  173. #define M_RS_OHM 335 // unit: 0.1mOhm, Phase resistance
  174. #define M_MATERIAL Al // unit:Null
  175. #define M_LD_NOLOAD_MH 9900 // unit: 0.01uH, D axis inductance
  176. #define M_LQ_NOLOAD_MH 10300 // unit: 0.01uH, Q axis inductance
  177. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  178. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  179. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  180. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  181. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  182. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  183. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  184. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  185. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  186. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  187. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  188. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  189. #define M_FLUX_WB 6250 // unit: 0.001mWb, Flux linkage //5513455*vlinepeak/(p*n)
  190. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  191. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  192. #define M_IS_PEAK_MAX_AP 4200 // unit: 0.01A, Max phase current(below base speed)
  193. #define M_POWER_MAX_WT 550 // unit: W, Max power
  194. #define M_R_SPD_RPM 3076 // unit: r/min, rate spd
  195. #define M_R_PWR_WT 250 // unit: W, rate power
  196. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  197. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  198. #define M_MAX_TOR_NM 30 // unit: 0.1Nm, Max tor
  199. #endif
  200. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W_LowRatio)
  201. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  202. #define M_RS_OHM 1260 // unit: 0.1mOhm, Phase resistance
  203. #define M_MATERIAL Al // unit:Null
  204. #define M_LD_NOLOAD_MH 51580 // unit: 0.01uH, D axis inductance
  205. #define M_LQ_NOLOAD_MH 59220 // unit: 0.01uH, Q axis inductance
  206. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  207. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  208. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  209. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  210. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  211. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  212. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  213. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  214. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  215. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  216. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  217. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  218. #define M_FLUX_WB 24000 // unit: 0.001mWb, Flux linkage //5513455*vlinepeak/(p*n)
  219. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  220. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  221. #define M_IS_PEAK_MAX_AP 4200 // unit: 0.01A, Max phase current(below base speed)
  222. #define M_POWER_MAX_WT 550 // unit: W, Max power
  223. #define M_R_SPD_RPM 860 // unit: r/min, rate spd
  224. #define M_R_PWR_WT 250 // unit: W, rate power
  225. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  226. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  227. #define M_MAX_TOR_NM 95 // unit: 0.1Nm, Max tor
  228. #endif
  229. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W_517Ratio)
  230. #define M_POLE_PAIRS 10 // unit:Null,Pole pairs
  231. #define M_RS_OHM 815 // unit: 0.1mOhm, Phase resistance
  232. #define M_MATERIAL Al // unit:Null
  233. #define M_LD_NOLOAD_MH 18000 // unit: 0.01uH, D axis inductance
  234. #define M_LQ_NOLOAD_MH 19000 // unit: 0.01uH, Q axis inductance
  235. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  236. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  237. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  238. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  239. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  240. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  241. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  242. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  243. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  244. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  245. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  246. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  247. #define M_FLUX_WB 13000 // unit: 0.001mWb, Flux linkage //5513455*vlinepeak/(p*n)
  248. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  249. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  250. #define M_IS_PEAK_MAX_AP 4200 // unit: 0.01A, Max phase current(below base speed)
  251. #define M_POWER_MAX_WT 550 // unit: W, Max power
  252. #define M_R_SPD_RPM 860 // unit: r/min, rate spd
  253. #define M_R_PWR_WT 250 // unit: W, rate power
  254. #define M_R_IRMS_A 1300 // unit: 0.01A, rate Irms
  255. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  256. #define M_MAX_TOR_NM 67 // unit: 0.1Nm, Max tor
  257. #endif
  258. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W_958Ratio)
  259. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  260. #define M_RS_OHM 448 // unit: 0.1mOhm, Phase resistance
  261. #define M_MATERIAL Al // unit:Null
  262. #define M_LD_NOLOAD_MH 14820 // unit: 0.01uH, D axis inductance
  263. #define M_LQ_NOLOAD_MH 16320 // unit: 0.01uH, Q axis inductance
  264. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  265. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  266. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  267. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  268. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  269. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  270. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  271. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  272. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  273. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  274. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  275. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  276. #define M_FLUX_WB 9050 // unit: 0.001mWb, Flux linkage //5513455*vlinepeak/(p*n)
  277. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  278. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  279. #define M_IS_PEAK_MAX_AP 4200 // unit: 0.01A, Max phase current(below base speed)
  280. #define M_POWER_MAX_WT 550 // unit: W, Max power
  281. #define M_R_SPD_RPM 1920 // unit: r/min, rate spd
  282. #define M_R_PWR_WT 250 // unit: W, rate power
  283. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  284. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  285. #define M_MAX_TOR_NM 46 // unit: 0.1Nm, Max tor
  286. #endif
  287. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_350W)
  288. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  289. #define M_RS_OHM 240 // unit: 0.1mOhm, Phase resistance
  290. #define M_MATERIAL Al // unit:Null
  291. #define M_LD_NOLOAD_MH 5850 // unit: 0.01uH, D axis inductance
  292. #define M_LQ_NOLOAD_MH 6200 // unit: 0.01uH, Q axis inductance
  293. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  294. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  295. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  296. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  297. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  298. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  299. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  300. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  301. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  302. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  303. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  304. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  305. #define M_FLUX_WB 4861 // unit: 0.001mWb, Flux linkage //5513455*vlinepeak/(p*n)
  306. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  307. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  308. #define M_IS_PEAK_MAX_AP 5000 // unit: 0.01A, Max phase current(below base speed)
  309. #define M_POWER_MAX_WT 650 // unit: W, Max power
  310. #define M_R_SPD_RPM 3900 // unit: r/min, rate spd
  311. #define M_R_PWR_WT 350 // unit: W, rate power
  312. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  313. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  314. #define M_MAX_TOR_NM 40 // unit: 0.1Nm, Max tor
  315. #endif
  316. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_350W_958Ratio)
  317. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  318. #define M_RS_OHM 448 // unit: 0.1mOhm, Phase resistance
  319. #define M_MATERIAL Al // unit:Null
  320. #define M_LD_NOLOAD_MH 14820 // unit: 0.01uH, D axis inductance
  321. #define M_LQ_NOLOAD_MH 16320 // unit: 0.01uH, Q axis inductance
  322. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  323. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  324. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  325. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  326. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  327. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  328. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  329. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  330. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  331. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  332. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  333. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  334. #define M_FLUX_WB 9050 // unit: 0.001mWb, Flux linkage //5513455*vlinepeak/(p*n)
  335. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  336. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  337. #define M_IS_PEAK_MAX_AP 5000 // unit: 0.01A, Max phase current(below base speed)
  338. #define M_POWER_MAX_WT 650 // unit: W, Max power
  339. #define M_R_SPD_RPM 3900 // unit: r/min, rate spd
  340. #define M_R_PWR_WT 350 // unit: W, rate power
  341. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  342. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  343. #define M_MAX_TOR_NM 46 // unit: 0.1Nm, Max tor
  344. #endif
  345. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_500W)
  346. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  347. #define M_RS_OHM 160 // unit: 0.1mOhm, Phase resistance
  348. #define M_MATERIAL Al // unit:Null
  349. #define M_LD_NOLOAD_MH 4000 // unit: 0.01uH, D axis inductance
  350. #define M_LQ_NOLOAD_MH 4250 // unit: 0.01uH, Q axis inductance
  351. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  352. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  353. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  354. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  355. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  356. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  357. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  358. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  359. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  360. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  361. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  362. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  363. #define M_FLUX_WB 4462 // unit: 0.001mWb, Flux linkage
  364. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  365. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  366. #define M_IS_PEAK_MAX_AP 5000 // unit: 0.01A, Max phase current(below base speed)
  367. #define M_POWER_MAX_WT 1000 // unit: W, Max power
  368. #define M_R_SPD_RPM 4710 // unit: r/min, rate spd
  369. #define M_R_PWR_WT 500 // unit: W, rate power
  370. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  371. #define M_R_UDC_v 480 // unit: 0.1V, rate Udc
  372. #define M_MAX_TOR_NM 40 // unit: 0.1Nm, Max tor
  373. #endif
  374. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_500W_958Ratio)
  375. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  376. #define M_RS_OHM 448 // unit: 0.1mOhm, Phase resistance
  377. #define M_MATERIAL Al // unit:Null
  378. #define M_LD_NOLOAD_MH 14820 // unit: 0.01uH, D axis inductance
  379. #define M_LQ_NOLOAD_MH 16320 // unit: 0.01uH, Q axis inductance
  380. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  381. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  382. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  383. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  384. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  385. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  386. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  387. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  388. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  389. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  390. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  391. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  392. #define M_FLUX_WB 9050 // unit: 0.001mWb, Flux linkage //5513455*vlinepeak/(p*n)
  393. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  394. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  395. #define M_IS_PEAK_MAX_AP 5000 // unit: 0.01A, Max phase current(below base speed)
  396. #define M_POWER_MAX_WT 1000 // unit: W, Max power
  397. #define M_R_SPD_RPM 3900 // unit: r/min, rate spd
  398. #define M_R_PWR_WT 500 // unit: W, rate power
  399. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  400. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  401. #define M_MAX_TOR_NM 46 // unit: 0.1Nm, Max tor
  402. #endif
  403. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_750W)
  404. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  405. #define M_RS_OHM 160 // unit: 0.1mOhm, Phase resistance
  406. #define M_MATERIAL Al // unit:Null
  407. #define M_LD_NOLOAD_MH 4000 // unit: 0.01uH, D axis inductance
  408. #define M_LQ_NOLOAD_MH 4250 // unit: 0.01uH, Q axis inductance
  409. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  410. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  411. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  412. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  413. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  414. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  415. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  416. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  417. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  418. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  419. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  420. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  421. #define M_FLUX_WB 4462 // unit: 0.001mWb, Flux linkage
  422. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  423. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  424. #define M_IS_PEAK_MAX_AP 7500 // unit: 0.01A, Max phase current(below base speed)
  425. #define M_POWER_MAX_WT 1200 // unit: W, Max power
  426. #define M_R_SPD_RPM 4710 // unit: r/min, rate spd
  427. #define M_R_PWR_WT 750 // unit: W, rate power
  428. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  429. #define M_R_UDC_v 480 // unit: 0.1V, rate Udc
  430. #define M_MAX_TOR_NM 50 // unit: 0.1Nm, Max tor
  431. #endif
  432. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_1000W)
  433. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  434. #define M_RS_OHM 167 // unit: 0.1mOhm, Phase resistance
  435. #define M_MATERIAL Al // unit:Null
  436. #define M_LD_NOLOAD_MH 4400 // unit: 0.01uH, D axis inductance
  437. #define M_LQ_NOLOAD_MH 4750 // unit: 0.01uH, Q axis inductance
  438. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  439. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  440. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  441. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  442. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  443. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  444. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  445. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  446. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  447. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  448. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  449. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  450. #define M_FLUX_WB 6517 // unit: 0.001mWb, Flux linkage
  451. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  452. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  453. #define M_IS_PEAK_MAX_AP 7500 // unit: 0.01A, Max phase current(below base speed)
  454. #define M_POWER_MAX_WT 1200 // unit: W, Max power
  455. #define M_R_SPD_RPM 3978 // unit: r/min, rate spd
  456. #define M_R_PWR_WT 1000 // unit: W, rate power
  457. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  458. #define M_R_UDC_v 480 // unit: 0.1V, rate Udc
  459. #define M_MAX_TOR_NM 50 // unit: 0.1Nm, Max tor
  460. #endif
  461. #if (MOTOR_ID_SEL == MOTOR_VOLANS)
  462. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  463. #define M_RS_OHM 1160 // unit: 0.1mOhm, Phase resistance
  464. #define M_MATERIAL Al // unit:Null
  465. #define M_LD_NOLOAD_MH 32500 // unit: 0.01uH, D axis inductance
  466. #define M_LQ_NOLOAD_MH 38000 // unit: 0.01uH, Q axis inductance
  467. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  468. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  469. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  470. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  471. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  472. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  473. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  474. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  475. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  476. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  477. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  478. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  479. #define M_FLUX_WB 17035 // unit: 0.001mWb, Flux linkage
  480. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  481. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  482. #define M_IS_PEAK_MAX_AP 3500 // unit: 0.01A, Max phase current(below base speed)
  483. #define M_POWER_MAX_WT 4680 // unit: W, Max power
  484. #define M_R_SPD_RPM 1200 // unit: r/min, rate spd
  485. #define M_R_PWR_WT 250 // unit: W, rate power
  486. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  487. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  488. #define M_MAX_TOR_NM 50 // unit: 0.1Nm, Max tor
  489. #endif
  490. #if (MOTOR_ID_SEL == MOTOR_VOLANS_PLUS)
  491. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  492. #define M_RS_OHM 1235 // unit: 0.1mOhm, Phase resistance
  493. #define M_MATERIAL Al // unit:Null
  494. #define M_LD_NOLOAD_MH 26500 // unit: 0.01uH, D axis inductance
  495. #define M_LQ_NOLOAD_MH 34400 // unit: 0.01uH, Q axis inductance
  496. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  497. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  498. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  499. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  500. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  501. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  502. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  503. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  504. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  505. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  506. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  507. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  508. #define M_FLUX_WB 20727 // unit: 0.001mWb, Flux linkage
  509. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  510. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  511. #define M_IS_PEAK_MAX_AP 3500 // unit: 0.01A, Max phase current(below base speed)
  512. #define M_POWER_MAX_WT 4680 // unit: W, Max power
  513. #define M_R_SPD_RPM 1200 // unit: r/min, rate spd
  514. #define M_R_PWR_WT 250 // unit: W, rate power
  515. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  516. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  517. #define M_MAX_TOR_NM 50 // unit: 0.1Nm, Max tor
  518. #endif
  519. #if (MOTOR_ID_SEL == MOTOR_PEGASI)
  520. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  521. #define M_RS_OHM 1235 // unit: 0.1mOhm, Phase resistance
  522. #define M_MATERIAL Al // unit:Null
  523. #define M_LD_NOLOAD_MH 26500 // unit: 0.01uH, D axis inductance
  524. #define M_LQ_NOLOAD_MH 34400 // unit: 0.01uH, Q axis inductance
  525. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  526. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  527. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  528. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  529. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  530. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  531. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  532. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  533. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  534. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  535. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  536. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  537. #define M_FLUX_WB 20727 // unit: 0.001mWb, Flux linkage
  538. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  539. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  540. #define M_IS_PEAK_MAX_AP 3500 // unit: 0.01A, Max phase current(below base speed)
  541. #define M_POWER_MAX_WT 5400 // unit: W, Max power
  542. #define M_R_SPD_RPM 1200 // unit: r/min, rate spd
  543. #define M_R_PWR_WT 250 // unit: W, rate power
  544. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  545. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  546. #define M_MAX_TOR_NM 50 // unit: 0.1Nm, Max tor
  547. #endif
  548. #if (MOTOR_ID_SEL == MOTOR_PEGASI_PLUS)
  549. #define M_POLE_PAIRS 8 // unit:Null,Pole pairs
  550. #define M_RS_OHM 820 // unit: 0.1mOhm, Phase resistance
  551. #define M_MATERIAL Al // unit:Null
  552. #define M_LD_NOLOAD_MH 18900 // unit: 0.01uH, D axis inductance
  553. #define M_LQ_NOLOAD_MH 24300 // unit: 0.01uH, Q axis inductance
  554. #define M_LD_TURN1_ID_AP 200 // unit: 0.01A,
  555. #define M_LD_TURN1_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  556. #define M_LD_TURN2_ID_AP 700 // unit: 0.01A,
  557. #define M_LD_TURN2_LD_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  558. #define M_LD_MIN_MH M_LD_NOLOAD_MH // unit: 0.01uH,D axis inductance
  559. #define M_LQ_TURN1_IQ_AP 200 // unit: 0.01A,
  560. #define M_LQ_TURN1_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  561. #define M_LQ_TURN2_IQ_AP 700 // unit: 0.01A,
  562. #define M_LQ_TURN2_LQ_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  563. #define M_LQ_MIN_MH M_LQ_NOLOAD_MH // unit: 0.01uH,Q axis inductance
  564. #define M_JD 1000 // unit: 10-7Kg*m2, Rotational inertia
  565. #define M_MAGNETIC_MATERIAL Ferrite // unit:Null
  566. #define M_FLUX_WB 19939 // unit: 0.001mWb, Flux linkage
  567. #define M_ID_MAX_AP 0 // unit: 0.01A, Max d axis current
  568. #define M_ID_MIN_AP -157 // unit: 0.01A, Min d axis current
  569. #define M_IS_PEAK_MAX_AP 3500 // unit: 0.01A, Max phase current(below base speed)
  570. #define M_POWER_MAX_WT 8160 // unit: W, Max power
  571. #define M_R_SPD_RPM 1500 // unit: r/min, rate spd
  572. #define M_R_PWR_WT 500 // unit: W, rate power
  573. #define M_R_IRMS_A 2500 // unit: 0.01A, rate Irms
  574. #define M_R_UDC_v 360 // unit: 0.1V, rate Udc
  575. #define M_MAX_TOR_NM 50 // unit: 0.1Nm, Max tor
  576. #endif
  577. /*======================================================================*
  578. Alarm threshold value & time of duration define
  579. *=======================================================================*/
  580. /* Over current */
  581. #if ((IPM_POWER_SEL == IPM_POWER_1000W_12G)||(IPM_POWER_SEL ==IPM_POWER_1000W_MINI_12G))
  582. #define ALM_OVR_CNT_VAL 9000 // unit: 0.01A, Threshold value
  583. #define ALM_OVR_CNT_TM 500 // unit: us, Time of duration(TBC)
  584. #elif( (IPM_POWER_SEL == IPM_POWER_750W_12G) ||(IPM_POWER_SEL ==IPM_POWER_750W_MINI_12G))
  585. #define ALM_OVR_CNT_VAL 9000 // unit: 0.01A, Threshold value
  586. #define ALM_OVR_CNT_TM 500 // unit: us, Time of duration(TBC)
  587. #elif (IPM_POWER_SEL == IPM_POWER_350W_MINI_12G)
  588. #define ALM_OVR_CNT_VAL 6000 // unit: 0.01A, Threshold value
  589. #define ALM_OVR_CNT_TM 500 // unit: us, Time of duration(TBC)
  590. #elif (IPM_POWER_SEL == IPM_POWER_500W_12G)
  591. #define ALM_OVR_CNT_VAL 9000 // unit: 0.01A, Threshold value
  592. #define ALM_OVR_CNT_TM 500 // unit: us, Time of duration(TBC)
  593. #elif (IPM_POWER_SEL == IPM_POWER_500W_9G)
  594. #define ALM_OVR_CNT_VAL 6000 // unit: 0.01A, Threshold value
  595. #define ALM_OVR_CNT_TM 500 // unit: us, Time of duration(TBC)
  596. #elif (IPM_POWER_SEL == IPM_POWER_350W_9G)
  597. #define ALM_OVR_CNT_VAL 6000 // unit: 0.01A, Threshold value
  598. #define ALM_OVR_CNT_TM 500 // unit: us, Time of duration(TBC)
  599. #elif ((IPM_POWER_SEL == IPM_POWER_250W_6G)||(IPM_POWER_SEL == IPM_POWER_350W_6G))
  600. #define ALM_OVR_CNT_VAL 7000 // unit: 0.01A, Threshold value
  601. #define ALM_OVR_CNT_TM 500 // unit: us, Time of duration(TBC)
  602. #else
  603. #define ALM_OVR_CNT_VAL 5000 // unit: 0.01A, Threshold value
  604. #define ALM_OVR_CNT_TM 500 // unit: us, Time of duration(TBC)
  605. #endif
  606. /* Phase loss */
  607. #define ALM_PHS_LOSS_VAL 100 // unit: 0.01A, Threshold value
  608. #define ALM_PHS_LOSS_TM 5 // unit: s, Time of duration(TBC)
  609. /* Rotor lock */
  610. #define ALM_ROTOR_LOCK_SPD_K 50 // unit: %, Q10, Ratio of resistance power and motor input power
  611. #define ALM_ROTOR_LOCK_TM 3 // unit: s, Time of duration(TBC)
  612. #if ((MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W_LowRatio) ||(MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W_517Ratio))
  613. #define ALM_ROTOR_LOCK_SPD 40 // unit: rpm, Threshold value
  614. #elif ((MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_350W)||(MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_350W_958Ratio)||(MOTOR_ID_SEL ==MOTOR_LUNGU_WELLING_HAL_POLE8_250W_958Ratio) ||(MOTOR_ID_SEL ==MOTOR_LUNGU_WELLING_HAL_POLE8_500W_958Ratio))
  615. #define ALM_ROTOR_LOCK_SPD 40 // unit: rpm, Threshold value
  616. #else
  617. #define ALM_ROTOR_LOCK_SPD 100 // unit: rpm, Threshold value
  618. #endif
  619. #if (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V)
  620. /* Over voltage */
  621. #define ALM_OVR_VLT_LVL1_VAL 590 // unit: 0.1V, Threshold value level3
  622. #define ALM_OVR_VLT_LVL1_TM 5 // unit: ms, Time of duration level3(TBS)
  623. /* Under voltage */
  624. #define ALM_UNDR_VLT_LVL1_VAL 400 // unit: 0.1V, Threshold value level2
  625. #define ALM_UNDR_VLT_LVL1_TM 1000 // unit: ms, Time of duration level2(TBS)
  626. /* Recover time & value of over voltage */
  627. #define ALM_OVR_VLT_REC_VAL 580 // unit: 0.1V
  628. #define ALM_OVR_VLT_REC_TM 100 // unit: ms, Time of duration(TBC)
  629. #define ALM_OVR_VLT_REC_TM1 150 // unit: ms, Time of duration(TBC)
  630. /* Recover time & value of under voltage */
  631. #define ALM_UNDR_VLT_REC_VAL 410 // unit: 0.1V
  632. #define ALM_UNDR_VLT_REC_TM 200 // unit: ms, Time of duration(TBC)
  633. #define ALM_UNDR_VLT_REC_TM1 400 // unit: ms, Time of duration(TBC)
  634. #elif (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V)
  635. /* Over voltage */
  636. #define ALM_OVR_VLT_LVL1_VAL 460 // unit: 0.1V, Threshold value level3
  637. #define ALM_OVR_VLT_LVL1_TM 5 // unit: ms, Time of duration level3(TBS)
  638. /* Under voltage */
  639. #define ALM_UNDR_VLT_LVL1_VAL 300 // unit: 0.1V, Threshold value level2
  640. #define ALM_UNDR_VLT_LVL1_TM 1000 // unit: ms, Time of duration level2(TBS)
  641. /* Recover time & value of over voltage */
  642. #define ALM_OVR_VLT_REC_VAL 450 // unit: 0.1V
  643. #define ALM_OVR_VLT_REC_TM 100 // unit: ms, Time of duration(TBC)
  644. #define ALM_OVR_VLT_REC_TM1 150 // unit: ms, Time of duration(TBC)
  645. /* Recover time & value of under voltage */
  646. #define ALM_UNDR_VLT_REC_VAL 320 // unit: 0.1V
  647. #define ALM_UNDR_VLT_REC_TM 200 // unit: ms, Time of duration(TBC)
  648. #define ALM_UNDR_VLT_REC_TM1 400 // unit: ms, Time of duration(TBC)
  649. #else
  650. /* Over voltage */
  651. #define ALM_OVR_VLT_LVL1_VAL 460 // unit: 0.1V, Threshold value level3
  652. #define ALM_OVR_VLT_LVL1_TM 5 // unit: ms, Time of duration level3(TBS)
  653. /* Under voltage */
  654. #define ALM_UNDR_VLT_LVL1_VAL 300 // unit: 0.1V, Threshold value level2
  655. #define ALM_UNDR_VLT_LVL1_TM 1000 // unit: ms, Time of duration level2(TBS)
  656. /* Recover time & value of over voltage */
  657. #define ALM_OVR_VLT_REC_VAL 450 // unit: 0.1V
  658. #define ALM_OVR_VLT_REC_TM 100 // unit: ms, Time of duration(TBC)
  659. #define ALM_OVR_VLT_REC_TM1 150 // unit: ms, Time of duration(TBC)
  660. /* Recover time & value of under voltage */
  661. #define ALM_UNDR_VLT_REC_VAL 320 // unit: 0.1V
  662. #define ALM_UNDR_VLT_REC_TM 200 // unit: ms, Time of duration(TBC)
  663. #define ALM_UNDR_VLT_REC_TM1 400 // unit: ms, Time of duration(TBC)
  664. #endif
  665. /* Over speed */
  666. #define ALM_OVR_SPD_VAL 2500 // unit: rpm, Threshold value
  667. #define ALM_OVR_SPD_TM 100 // unit: ms, Time of duration(TBS)
  668. /* ADC self detecting */
  669. #define ALM_ADC_DETE_LOW_VAL 155 // unit: 0.01V, ADC offset Voltage min
  670. #define ALM_ADC_DETE_HIG_VAL 175 // unit: 0.01V, ADC offset Voltage max
  671. /* IPM over heat */
  672. #define ALM_IPM_OVR_HEAT_VAL 105 // unit: Ce, Threshold value
  673. #define ALM_IPM_OVR_TM 2 // unit: s, Time of duration(TBS)
  674. #define PWRLIM_START_THRESHOLD_TEMP 85 // Q0,Ce
  675. /* MOTOR over heat */
  676. #define ALM_MOTOR_OVR_HEAT_VAL 110 // unit: Ce, Threshold value
  677. #define ALM_MOTOR_OVR_TM 2 // unit: s, Time of duration(TBS)
  678. #define PWRLIM_START_THRESHOLD_MOTOR_TEMP 95 // Q0,Ce
  679. /* Stop time of three phase short force */
  680. #define ALM_THR_PHS_SHRT_FRC_TM 200 // unit: ms, Time of duration(TBC)
  681. /* Stop time of pwm off */
  682. #define ALM_PWM_OFF_TM 200 // unit: ms, Time of duration(TBC)
  683. #define ALM_PWMOFF_SHRT1_SW_TM 100 // unit: ms, Time of duration(TBC)
  684. /* Stop time of three phase short */
  685. #define ALM_THR_PHS_SHRT_NORM_TM 100 // unit: ms, Time of duration(TBC)
  686. #define ALM_SHRT_PWMOFF_SW_TM 100 // unit: ms, Time of duration(TBC)
  687. /* Stop Minimum Current */
  688. #define ALM_STOP_IPM_OVER_CUR_TM 100 // unit: ms, Time of duration(TBC)
  689. /* Recover time of global */
  690. #define ALM_REC_ALL_TM 200 // unit: ms, Time of duration(TBC)
  691. /* Recover time of IPM OC */
  692. #define ALM_IPM_OC_REC_TM 1000//100 // unit: ms, Time of duration(TBC)
  693. /* Recover time & value of IPM over heat */
  694. #define ALM_IPM_OVR_HEAT_REC_VAL 85 // unit: Ce, Threshold value
  695. #define ALM_IPM_OVR_REC_TM 60 // unit: s, Time of duration(TBC)
  696. #define ALM_IPM_OVR_REC_TM1 120 // unit: s, Time of duration(TBC)
  697. /* Recover time & value of MOTOR over heat */
  698. #define ALM_MOTOR_OVR_HEAT_REC_VAL 95 // unit: Ce, Threshold value
  699. #define ALM_MOTOR_OVR_REC_TM 60 // unit: s, Time of duration(TBC)
  700. #define ALM_MOTOR_OVR_REC_TM1 120 // unit: s, Time of duration(TBC)
  701. /* Ebike sensor fault detect*/
  702. #define ALM_MOTORSPD_MIN_RPM 150 // unit: rpm
  703. #define ALM_TROQ_MIN_Nm 50 // unit: 0.1Nm
  704. #define ALM_BIKESPD_FLT_TS 15 // unit: s
  705. #define ALM_CADENCE_FLT_TS 10 // unit: s
  706. #define ALM_TORQ_MAX_VOL 30 // unit: 0.1V
  707. #define ALM_TORQ_MIN_VOL 1 // unit: 0.1V
  708. #define ALM_TORQ_FLT_TS 1 // unit: s
  709. #define ALM_THROTTLE_MAX_VOL 30 // unit: 0.1V
  710. #define ALM_THROTTLE_MIN_VOL 3 // unit: 0.1V
  711. #define ALM_THROTTLE_FLT_TS 1 // unit: s
  712. #define ALM_NTC_MAX_VOL 32 // unit: 0.1V
  713. #define ALM_NTC_MIN_VOL 3 // unit: 0.1V
  714. #define ALM_MOTORNTC_FLT_TS 1 // unit: s
  715. #define ALM_PCBNTC_FLT_TS 1 // unit: s
  716. /* Ebike sensor fault recover*/
  717. #define ALM_BIKE_REC_ALL_TM 1000 // unit: ms
  718. #define ALM_BIKESPD_REC_TM 200 // unit: ms
  719. #define ALM_CADENCE_REC_TM 200 // unit: ms
  720. #define ALM_TORQ_REC_TM 200 // unit: ms
  721. #define ALM_THROTTLE_REC_TM 200 // unit: ms
  722. #define ALM_MOTORNTC_REC_TM 200 // unit: ms
  723. #define ALM_PCBNTC_REC_TM 200 // unit: ms
  724. #define Sel_TORQ_VOL ((ULONG) 2*4096/33) // unit: 0.1V
  725. /*======================================================================*
  726. Motor start
  727. *=======================================================================*/
  728. /* Start mode */
  729. #define START_ALIGN 0 // Motor start with three stage
  730. #define START_MODE START_ALIGN // Motor start mode
  731. /* InitPosDet mode */
  732. #define INITPOS_ALIGN 0 // Motor start with three stage
  733. #define INITPOS_MODE INITPOS_ALIGN // Motor initposdet mode
  734. /* Park time & current */
  735. #define ALIGN_CUR_AP 1000 // 1500 // Huawei // unit: 0.01A, Park current value
  736. #define ALIGN_RAMP_TM_MS 500 // unit: ms, Time of current ramp
  737. #define ALIGN_HOLD_TM_MS 2000 // unit: ms, Time of current hold
  738. #define ALIGN_ANG_INIT 0 // unit: deg, Park angle init
  739. /* Drag speed & current */
  740. #define DRAG_CUR_AP 1000 // 1500 // 1500 //100 Huawei // unit: 0.01A, Drag current value
  741. #define DRAG_VOL_AP 10 // 0.1v
  742. #define DRAG_SPD_HZ 20 // unit: Hz, Final speed of drag
  743. #define DRAG_SPD_RAMP_TM_MS 4000 // unit: ms, Time of speed from 0Hz to target Hz
  744. /* Open to close */
  745. #define OPEN2CLZ_CUR_RAMP_TM_MS 5000 // 5000//1000 Huawei // unit: ms, Time of current from drag value to 0
  746. /* Close loop */
  747. /* stop loop */
  748. #define STOP_SPD_REF_RPM 100 // unit: rpm, Speed reference value when status go to stop
  749. /*======================================================================*
  750. Flux observer
  751. *=======================================================================*/
  752. #define OBS_SPD_PLL_M 10 // Flux observer m coefficient
  753. #define OBS_SPD_PLL_BANDWIDTH_HZ 150 // Huawei // Flux observer PLL bandwidth
  754. #define OBS_FLUX_PI_DAMPRATIO 10 // 5 bafang 5, yuanxian 10// unit:0.1, Flux observer PI regulator dampratio
  755. #define OBS_FLUX_PI_CROSSFREQ_HZ 10 // 5 // unit:Hz, Flux observer PI regulator crossfrequency
  756. /*======================================================================*
  757. Current loop PI regulation
  758. *=======================================================================*/
  759. #define ACR_PI_BANDWIDTH_FLX 200 // unit: Hz, Current loop bandwidth when flux observer run
  760. #define ACR_CUR_FLX_FBK_LPF_FRQ 8000 // unit: Hz, Frequency of current feedback LPF when flux observer run
  761. #define ACR_CUR_OUT_LIM 37837 // Q15, 2/sqrt(3)*Vdc for current output limit //18919
  762. #define ACR_RA_COEF 3 // Coefficient of Active Resistance
  763. #define ACR_UDCP_OUT_LIM 18918 // Q15, 2/3*Vdc for Udcp output limit //18918 //21845 //10923
  764. /*======================================================================*
  765. Speed loop PI regulation
  766. *=======================================================================*/
  767. #define ASR_PI_BANDWIDTH 8 // 16 //3 // unit: Hz, Speed loop bandwidth
  768. #define ASR_PI_M 16 // 8 //6 //
  769. #define ASR_SPD_FBK_LPF_FRQ 50 //
  770. #define ASR_SPD_INER_RATE 1 //
  771. /*=====================================================================*
  772. PWM generation
  773. *=======================================================================*/
  774. #define PWM_MAX_DUTY_CYLE_IPM 900// 900// 900 // 938 // unit: 0.1%,Max duty cyle for compare value
  775. #define PWM_7SVM_TO_5SVM_DUTY_IPM 700 // unit: 0.1%, Switch ratio from 7 to 5 svpwm
  776. #define PWM_MIN_SAMPLE_DUTY1_IPM 5 * 10000 / PWM_PERIOD_US // unit: 0.1%, 5us TWO MIN ZERO VECTOR = two sample current steady time
  777. #define PWM_MIN_SAMPLE_DUTY2_IPM 10 * 10000 / PWM_PERIOD_US // unit: 0.1%, 10us TWO (one sample current steady time + one sample time)
  778. #define PWM_MIN_SAMPLE_DUTY3_IPM \
  779. 12 * 10000 / PWM_PERIOD_US // unit: 0.1%, 12 us TWO (one Singel Resistance sample current steady time + one sample time)
  780. #define PWM_SAMPLE_TOSTEADY_IPM 8 * 10000 / PWM_PERIOD_US // unit: 0.1%, 4us TWO sample current to steady time
  781. #define PWM_SAMPLE_SINGELRESIS_IPM 1 * 10000 / PWM_PERIOD_US // unit: 0.1%, 1us TWO singel Resistance sample time
  782. #define PWM_1ST_SAMPLE_CTS_IPM 50 // 25 // unit: Null, first current sample counts
  783. #define PWM_2ND_SAMPLE_CTS_IPM 280 // 220 // unit: Null, second current sample counts
  784. #define PWM_OVR_MDL_MIN_PHS 0 // SVPWM over modulation: min phase error
  785. #define PWM_OVR_MDL_MIN_AMP 1 // SVPWM over modulation: min amplitude error
  786. #define PWM_OVR_MDL_OPTIMUM 2 // SVPWM over modulation: amplitude and phase optimum
  787. #define PWM_OVR_MDL_SEL PWM_OVR_MDL_MIN_PHS //
  788. /*======================================================================*
  789. Flux Weakening
  790. *=======================================================================*/
  791. #define FW_VDC_MIN_CALC_TM 20 // unit: ms,50Hz=>20ms, period of Vdc fluctuate
  792. #define FW_VDC_LPF_FRQ 50 // unit: Hz, Frequency of Vdc LPF
  793. #define FW_PWM_MAX_DUTY_CYLE_IPM 900 // unit: 0.1%,PWM max duty cyle for flux weakening
  794. #define FW_ID_PI_OUT_MIN 800 // unit: 0.01A, Min Id of PI outunit: 0.01A, Current Limit
  795. #define FW_ID_MIN_LIM_RATIO 80 // Q0:1%, Ratio of Min d axis current (Charactoristic current)
  796. #define FW_ID_KP_PU 16384 // Q16, Kp for d axis current
  797. #define FW_ID_KI_PU 20 // Q16, Ki for d axis current
  798. #define FW_CHAR_CUR_CROSS_FREQ 2 // Q0,unit: SQRT(1/2piR)
  799. #define FW_CHAR_CUR_DAMP_RATIO 2 // Q0,unit: SQRT(pi/2R)
  800. /*======================================================================*
  801. Constant Voltage Braking Parameter define
  802. *=======================================================================*/
  803. #if (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V)
  804. #define CVB_CONSTANT_VOL_BRAKE_V 580 // unit:0.1V,Voltage limit of Constant Voltage Brake
  805. #define CVB_CONSTANT_SPD_LOW_RPM 5000 // unit:rpm
  806. #elif (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V)
  807. #define CVB_CONSTANT_VOL_BRAKE_V 450 // unit:0.1V,Voltage limit of Constant Voltage Brake
  808. #define CVB_CONSTANT_SPD_LOW_RPM 5000 // unit:rpm
  809. #else
  810. #define CVB_CONSTANT_VOL_BRAKE_V 450 // unit:0.1V,Voltage limit of Constant Voltage Brake
  811. #define CVB_CONSTANT_SPD_LOW_RPM 5000 // unit:rpm
  812. #endif
  813. /*======================================================================*
  814. Power limit
  815. *=======================================================================*/
  816. #if (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_1000W)
  817. #define ALM_ROTOR_LOCK_IQ_ABS 6300 // 6300 // unit: 0.01A, Threshold value
  818. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_750W)
  819. #define ALM_ROTOR_LOCK_IQ_ABS 6300 // 6300 // unit: 0.01A, Threshold value
  820. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_500W)
  821. #define ALM_ROTOR_LOCK_IQ_ABS 4500 // 6300 // unit: 0.01A, Threshold value
  822. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_500W_958Ratio)
  823. #define ALM_ROTOR_LOCK_IQ_ABS 4500 // 6300 // unit: 0.01A, Threshold value
  824. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_350W)
  825. #define ALM_ROTOR_LOCK_IQ_ABS 4500 // 4500 // unit: 0.01A, Threshold value
  826. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_350W_958Ratio)
  827. #define ALM_ROTOR_LOCK_IQ_ABS 4500 // 4500 // unit: 0.01A, Threshold value
  828. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W)
  829. #define ALM_ROTOR_LOCK_IQ_ABS 3200 // 4500 // unit: 0.01A, Threshold value
  830. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W_LowRatio)
  831. #define ALM_ROTOR_LOCK_IQ_ABS 3200 // 4500 // unit: 0.01A, Threshold value
  832. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W_517Ratio)
  833. #define ALM_ROTOR_LOCK_IQ_ABS 3200 // 4500 // unit: 0.01A, Threshold value
  834. #elif (MOTOR_ID_SEL == MOTOR_LUNGU_WELLING_HAL_POLE8_250W_958Ratio)
  835. #define ALM_ROTOR_LOCK_IQ_ABS 3200 // 4500 // unit: 0.01A, Threshold value
  836. #else
  837. #define ALM_ROTOR_LOCK_IQ_ABS 3200 // 4500 // unit: 0.01A, Threshold value
  838. #endif
  839. /*======================================================================*
  840. Idc and Power limit
  841. *=======================================================================*/
  842. #if ((IPM_POWER_SEL == IPM_POWER_250W_6G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  843. #define IDCLIMIQSTART (((ULONG)1500 << 14) / IBASE);
  844. #define IDCLIMIQEND (((ULONG)1600 << 14) / IBASE);
  845. #define PWRLIM_VAL (15*360+200) // unit: 0.1w, Power limit value
  846. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  847. // #define IDCLIMIQSTART (((ULONG)2500 << 14) / IBASE);
  848. //#define IDCLIMIQEND (((ULONG)2600 << 14) / IBASE);
  849. //#define PWRLIM_VAL (25*360+200) // unit: 0.1w, Power limit value
  850. //#define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  851. #elif ((IPM_POWER_SEL == IPM_POWER_250W_6G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  852. #define IDCLIMIQSTART (((ULONG)1200 << 14) / IBASE);
  853. #define IDCLIMIQEND (((ULONG)1300 << 14) / IBASE);
  854. #define PWRLIM_VAL (12*480+200) // unit: 0.1w, Power limit value
  855. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  856. #elif ((IPM_POWER_SEL == IPM_POWER_350W_6G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  857. #define IDCLIMIQSTART (((ULONG)1500 << 14) / IBASE);
  858. #define IDCLIMIQEND (((ULONG)1600 << 14) / IBASE);
  859. #define PWRLIM_VAL (18*360+200) // unit: 0.1w, Power limit value
  860. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  861. // #define IDCLIMIQSTART (((ULONG)2500 << 14) / IBASE);
  862. //#define IDCLIMIQEND (((ULONG)2600 << 14) / IBASE);
  863. //#define PWRLIM_VAL (25*360+200) // unit: 0.1w, Power limit value
  864. //#define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  865. #elif ((IPM_POWER_SEL == IPM_POWER_350W_6G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  866. #define IDCLIMIQSTART (((ULONG)1200 << 14) / IBASE);
  867. #define IDCLIMIQEND (((ULONG)1300 << 14) / IBASE);
  868. #define PWRLIM_VAL (14*480+200) // unit: 0.1w, Power limit value
  869. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  870. #elif ((IPM_POWER_SEL == IPM_POWER_350W_9G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  871. #define IDCLIMIQSTART (((ULONG)1800 << 14) / IBASE);
  872. #define IDCLIMIQEND (((ULONG)1900 << 14) / IBASE);
  873. #define PWRLIM_VAL (18*360+200) // unit: 0.1w, Power limit value
  874. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  875. #elif ((IPM_POWER_SEL == IPM_POWER_350W_9G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  876. #define IDCLIMIQSTART (((ULONG)1400 << 14) / IBASE);
  877. #define IDCLIMIQEND (((ULONG)1500 << 14) / IBASE);
  878. #define PWRLIM_VAL (14*480+200) // unit: 0.1w, Power limit value
  879. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  880. #elif ((IPM_POWER_SEL == IPM_POWER_500W_9G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  881. #define IDCLIMIQSTART (((ULONG)2500 << 14) / IBASE);
  882. #define IDCLIMIQEND (((ULONG)2600 << 14) / IBASE);
  883. #define PWRLIM_VAL (25*360+500) // unit: 0.1w, Power limit value
  884. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  885. #elif ((IPM_POWER_SEL == IPM_POWER_500W_9G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  886. #define IDCLIMIQSTART (((ULONG)2000 << 14) / IBASE);
  887. #define IDCLIMIQEND (((ULONG)2100 << 14) / IBASE);
  888. #define PWRLIM_VAL (20*480+500) // unit: 0.1w, Power limit value
  889. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  890. #elif ((IPM_POWER_SEL == IPM_POWER_500W_12G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  891. #define IDCLIMIQSTART (((ULONG)2500 << 14) / IBASE);
  892. #define IDCLIMIQEND (((ULONG)2600 << 14) / IBASE);
  893. #define PWRLIM_VAL (25*360+500) // unit: 0.1w, Power limit value
  894. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  895. #elif ((IPM_POWER_SEL == IPM_POWER_500W_12G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  896. #define IDCLIMIQSTART (((ULONG)2000 << 14) / IBASE);
  897. #define IDCLIMIQEND (((ULONG)2100 << 14) / IBASE);
  898. #define PWRLIM_VAL (20*480+500) // unit: 0.1w, Power limit value
  899. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  900. #elif((IPM_POWER_SEL ==IPM_POWER_350W_MINI_12G)&& (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  901. #define IDCLIMIQSTART (((ULONG)1800 << 14) / IBASE);
  902. #define IDCLIMIQEND (((ULONG)1900 << 14) / IBASE);
  903. #define PWRLIM_VAL (18*360+500) // unit: 0.1w, Power limit value
  904. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  905. #elif ((IPM_POWER_SEL == IPM_POWER_350W_MINI_12G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  906. #define IDCLIMIQSTART (((ULONG)1400 << 14) / IBASE);
  907. #define IDCLIMIQEND (((ULONG)1500 << 14) / IBASE);
  908. #define PWRLIM_VAL (14*480+500) // unit: 0.1w, Power limit value
  909. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  910. #elif (((IPM_POWER_SEL == IPM_POWER_750W_12G)||(IPM_POWER_SEL ==IPM_POWER_750W_MINI_12G)) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  911. #define IDCLIMIQSTART (((ULONG)3000 << 14) / IBASE);
  912. #define IDCLIMIQEND (((ULONG)3100 << 14) / IBASE);
  913. #define PWRLIM_VAL (30*360+500) // unit: 0.1w, Power limit value
  914. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  915. #elif (((IPM_POWER_SEL == IPM_POWER_750W_12G)||(IPM_POWER_SEL ==IPM_POWER_750W_MINI_12G)) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  916. #define IDCLIMIQSTART (((ULONG)2500 << 14) / IBASE);
  917. #define IDCLIMIQEND (((ULONG)2600 << 14) / IBASE);
  918. #define PWRLIM_VAL (25*480+500) // unit: 0.1w, Power limit value
  919. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  920. #elif ((IPM_POWER_SEL == IPM_POWER_1000W_12G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  921. #define IDCLIMIQSTART (((ULONG)3000 << 14) / IBASE);
  922. #define IDCLIMIQEND (((ULONG)3100 << 14) / IBASE);
  923. #define PWRLIM_VAL (30*360+500) // unit: 0.1w, Power limit value
  924. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  925. #elif ((IPM_POWER_SEL == IPM_POWER_1000W_12G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  926. #define IDCLIMIQSTART (((ULONG)3000 << 14) / IBASE);
  927. #define IDCLIMIQEND (((ULONG)3100 << 14) / IBASE);
  928. #define PWRLIM_VAL (30*480) // unit: 0.1w, Power limit value
  929. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  930. #elif ((IPM_POWER_SEL == IPM_POWER_1000W_MINI_12G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_36V))
  931. #define IDCLIMIQSTART (((ULONG)3000 << 14) / IBASE);
  932. #define IDCLIMIQEND (((ULONG)3100 << 14) / IBASE);
  933. #define PWRLIM_VAL (30*360+500) // unit: 0.1w, Power limit value
  934. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  935. #elif ((IPM_POWER_SEL == IPM_POWER_1000W_MINI_12G) && (IPM_VOLTAGE_SEL == IPM_VOLTAGE_48V))
  936. #define IDCLIMIQSTART (((ULONG)3000 << 14) / IBASE);
  937. #define IDCLIMIQEND (((ULONG)3100 << 14) / IBASE);
  938. #define PWRLIM_VAL (30*480) // unit: 0.1w, Power limit value
  939. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  940. #else
  941. #define IDCLIMIQSTART (((ULONG)1500 << 14) / IBASE);
  942. #define IDCLIMIQEND (((ULONG)1600 << 14) / IBASE);
  943. #define PWRLIM_VAL (15*360+500) // unit: 0.1w, Power limit value
  944. #define PWRLIM_ERR 500 // unit: 0.1w, Start power limit when "VAL - ERR"
  945. #endif
  946. #define PWRLIM_LPF_FRQ 400 // unit: Hz, Frequency of LPF in input power of motor
  947. #define PWR_IQ_LIMIT_KP_PU 120 // Q15
  948. #define PWR_IQ_LIMIT_KI_PU 100 // Q15
  949. /*======================================================================*
  950. Deadband compensation
  951. *=======================================================================*/
  952. #define DBC_K_COEF 120 // unit:0.1V/A Deadband compensation slope coefficient
  953. /*======================================================================*
  954. Communication type define
  955. *=======================================================================*/
  956. #define UART_MONITOR 0 //
  957. #define UART_HOST 1 //
  958. #define UART_TYPE UART_HOST //
  959. /*==============================================================================
  960. Speed & Acc Constant parameters define
  961. ==============================================================================*/
  962. #define USER_MOTOR_45RPM2PU SPD_RPM2PU(45) // 45rpm,Q15
  963. #define USER_MOTOR_100RPM2PU SPD_RPM2PU(100)
  964. #define USER_MOTOR_200RPM2PU SPD_RPM2PU(200)
  965. #define USER_MOTOR_300RPM2PU SPD_RPM2PU(300)
  966. #define USER_MOTOR_400RPM2PU SPD_RPM2PU(400)
  967. #define USER_MOTOR_600RPM2PU SPD_RPM2PU(600) // 600rpm,Q15
  968. #define USER_MOTOR_800RPM2PU SPD_RPM2PU(800) // 800rpm,Q15
  969. #define USER_MOTOR_1000RPM2PU SPD_RPM2PU(1000) // 1000rpm,Q15
  970. #define USER_MOTOR_1500RPM2PU SPD_RPM2PU(1500) // 6000rpm,Q15
  971. #define USER_MOTOR_4000RPM2PU SPD_RPM2PU(4000) // 6000rpm,Q15
  972. #define USER_MOTOR_5500RPM2PU SPD_RPM2PU(5500)
  973. #define USER_MOTOR_100RPMPS2PU_Q29 SPD_ACC_RPM2PU(100) // 100rpm/s,(0x40000000/FTBS_Hz/cof_uwVbRpm*100)
  974. #define USER_MOTOR_240RPMPS2PU_Q29 SPD_ACC_RPM2PU(200) // 240rpm/s
  975. #define USER_MOTOR_1000RPMPS2PU_Q29 SPD_ACC_RPM2PU(1000) // 1000rpm/s
  976. #define USER_MOTOR_2000RPMPS2PU_Q29 SPD_ACC_RPM2PU(2000) // 2000rpm/s
  977. #define USER_MOTOR_3000RPMPS2PU_Q29 SPD_ACC_RPM2PU(3000) // 3000rpm/s
  978. /*=======================================================================
  979. TBS&TBC Time Cnts Define
  980. =======================================================================*/
  981. #define TBCCNT_500us (((ULONG)500 * FTBC_HZ) / 1000000)
  982. #define TBCCNT_1ms (((ULONG)1 * FTBC_HZ) / 1000)
  983. #define TBCCNT_5ms (((ULONG)5 * FTBC_HZ) / 1000)
  984. #define TBCCNT_10ms (((ULONG)10 * FTBC_HZ) / 1000)
  985. #define TBCCNT_50ms (((ULONG)50 * FTBC_HZ) / 1000)
  986. #define TBCCNT_32ms (((ULONG)32 * FTBC_HZ) / 1000)
  987. #define TBCCNT_60ms (((ULONG)60 * FTBC_HZ) / 1000)
  988. #define TBCCNT_100ms (((ULONG)100 * FTBC_HZ) / 1000)
  989. #define TBCCNT_150ms (((ULONG)150 * FTBC_HZ) / 1000)
  990. #define TBCCNT_200ms (((ULONG)200 * FTBC_HZ) / 1000)
  991. #define TBCCNT_250ms (((ULONG)250 * FTBC_HZ) / 1000)
  992. #define TBCCNT_300ms (((ULONG)300 * FTBC_HZ) / 1000)
  993. #define TBCCNT_400ms (((ULONG)400 * FTBC_HZ) / 1000)
  994. #define TBCCNT_500ms (((ULONG)500 * FTBC_HZ) / 1000)
  995. #define TBCCNT_100ms (((ULONG)100 * FTBC_HZ) / 1000)
  996. #define EVE1MSCNT_1ms (((ULONG)1 * EVENT_1MS_HZ) / 1000)
  997. #define EVE1MSCNT_5ms (((ULONG)5 * EVENT_1MS_HZ) / 1000)
  998. #define EVE1MSCNT_10ms (((ULONG)10 * EVENT_1MS_HZ) / 1000)
  999. #define EVE1MSCNT_20ms (((ULONG)20 * EVENT_1MS_HZ) / 1000)
  1000. #define EVE1MSCNT_50ms (((ULONG)50 * EVENT_1MS_HZ) / 1000)
  1001. #define EVE1MSCNT_100ms (((ULONG)100 * EVENT_1MS_HZ) / 1000)
  1002. #define EVE1MSCNT_200ms (((ULONG)200 * EVENT_1MS_HZ) / 1000)
  1003. #define EVE10MSCNT_3s ((ULONG)3 * EVENT_1MS_HZ / 10)
  1004. #define EVE10MSCNT_5s ((ULONG)5 * EVENT_1MS_HZ / 10)
  1005. #define EVE10MSCNT_10s ((ULONG)10 * EVENT_1MS_HZ / 10)
  1006. /************************************************************************
  1007. Comment Table
  1008. *************************************************************************/
  1009. // /*======================================================================*
  1010. // High Frequency Signal Injection
  1011. // *=======================================================================*/
  1012. // #define HFI_FREQ1_HZ 1200 // unit: Hz, Inject signal frequency 1
  1013. // #define HFI_AMP1_VT 600 // unit: 0.1v, Inject signal voltage 1
  1014. // #define HFI_FREQ2_HZ 1400 // unit: Hz, Inject signal frequency 2
  1015. // #define HFI_AMP2_VT 700 // unit: 0.1v, Inject signal voltage 2
  1016. // #define HFI_TM_INIPOS_MS 60 // unit: ms, Initial position detection time
  1017. // #define HFI_WAITTM_INIPOS_MS 6 // unit: ms, Wait time after initial position detection
  1018. // #define HFI_AMP_POR_VT 700 // unit: 0.1v, Polarity detection voltage amplitude
  1019. // #define HFI_TM_POR_PULS_MS 1 // unit: ms, Polarity detection voltage pulse time
  1020. // #define HFI_WAITTM_POR_PULS_MS 12 // Wunit: ms, ait time after voltage pulse
  1021. // #define HFI_DELTA_CUR_MAG_POR_OK_AP 20 // unit: 0.01A, delta current for polarity detection ok
  1022. // #define HFI_CUR_LPF_HZ 500 // unit: Hz, Cut-off frequency of current lpf
  1023. // #define HFI_CUR_HPF_HZ 50 // unit: Hz, Cut-off frequency of current hpf
  1024. // #define HFI_PLL_DAMPING_RATIO 35 // unit: Null, Pll damping ratio
  1025. // #define HFI_PLL_CROSS_FREQ_HZ 20 // unit: Hz, Pll cross frequency
  1026. // #define HFI_SPD_LPF_HZ 8 // unit: Hz, Cut-off frequency of spd lpf
  1027. // #define HFI_MAG_SATR_AP 240 // unit: 0.01A, Magnetic saturation current
  1028. /************************************************************************
  1029. TypeDefs & Structure defines
  1030. *************************************************************************/
  1031. /************************************************************************
  1032. Exported Variables:
  1033. *************************************************************************/
  1034. /************************************************************************
  1035. RAM ALLOCATION:
  1036. *************************************************************************/
  1037. /************************************************************************
  1038. Exported Function Call Prototypes (N/A)
  1039. *************************************************************************/
  1040. /************************************************************************
  1041. Local Function Call Prototypes (N/A)
  1042. *************************************************************************/
  1043. /************************************************************************
  1044. Head files (N/A)
  1045. *************************************************************************/
  1046. #include <stdlib.h>
  1047. #include "CodePara.h"
  1048. #include "classB.h"
  1049. #include "hwsetup.h"
  1050. #include "mathtool.h"
  1051. #include "main.h"
  1052. #include "spdctrFSM.h"
  1053. #include "glbcof.h"
  1054. #include "crdnt.h"
  1055. #include "tbc.h"
  1056. #include "tbs.h"
  1057. #include "tbt.h"
  1058. #include "alarm.h"
  1059. #include "adc.h"
  1060. #include "spi_master.h"
  1061. #include "i2c_master.h"
  1062. #include "spdctrmode.h"
  1063. #include "acr.h"
  1064. #include "asr.h"
  1065. #include "asr_new.h"
  1066. #include "torqobs.h"
  1067. #include "LoadObsTheta.h"
  1068. #include "obs.h"
  1069. #include "dbc.h"
  1070. #include "uart_monitor.h"
  1071. #include "flxwkn.h"
  1072. #include "spdflxwkn.h"
  1073. #include "pwm.h"
  1074. #include "brake.h"
  1075. #include "hfinj.h"
  1076. #include "pwrlim.h"
  1077. #include "bootloader.h"
  1078. #include "brake.h"
  1079. #include "macroequ.h"
  1080. #include "alignstartup.h"
  1081. #include "switchhall.h"
  1082. #include "LoadObsTheta.h"
  1083. /************************************************************************
  1084. Flag Define (N/A)
  1085. *************************************************************************/
  1086. #endif
  1087. /*************************************************************************
  1088. Copyright (c) 2019 Welling Motor Technology(Shanghai) Co. Ltd.
  1089. All rights reserved.
  1090. *************************************************************************
  1091. End of this File (EOF)!
  1092. Do not put anything after this part!
  1093. *************************************************************************/