user.h 72 KB

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