PMSM_Controller_data.c 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /*
  2. * File: PMSM_Controller_data.c
  3. *
  4. * Code generated for Simulink model 'PMSM_Controller'.
  5. *
  6. * Model version : 1.1460
  7. * Simulink Coder version : 9.4 (R2020b) 29-Jul-2020
  8. * C/C++ source code generated on : Sat May 28 14:25:47 2022
  9. *
  10. * Target selection: ert.tlc
  11. * Embedded hardware selection: ARM Compatible->ARM Cortex-M
  12. * Code generation objectives:
  13. * 1. Execution efficiency
  14. * 2. RAM efficiency
  15. * Validation result: Not run
  16. */
  17. #include "PMSM_Controller.h"
  18. /* Block parameters (default storage) */
  19. P rtP = {
  20. /* Variable: n_hall_count_ps
  21. * Referenced by:
  22. * '<S14>/z_maxCntRst'
  23. * '<S20>/z_counter'
  24. * '<S20>/UnitDelay2'
  25. */
  26. 1000000U,
  27. /* Variable: n_polePairs
  28. * Referenced by: '<S20>/cf_speedCoef1'
  29. */
  30. 4U,
  31. /* Variable: cf_Fw_Kb
  32. * Referenced by: '<S74>/Constant5'
  33. */
  34. 102,
  35. /* Variable: cf_Fw_Ki
  36. * Referenced by: '<S74>/Constant2'
  37. */
  38. 512,
  39. /* Variable: cf_TrqLimKb
  40. * Referenced by: '<S88>/Constant2'
  41. */
  42. 1024,
  43. /* Variable: cf_TrqLimKi
  44. * Referenced by: '<S88>/Constant1'
  45. */
  46. 9,
  47. /* Variable: cf_TrqLimKp
  48. * Referenced by: '<S88>/Constant4'
  49. */
  50. 154,
  51. /* Variable: cf_idKp
  52. * Referenced by: '<S95>/Constant3'
  53. */
  54. 17877,
  55. /* Variable: cf_iqKp
  56. * Referenced by: '<S95>/Constant7'
  57. */
  58. 19765,
  59. /* Variable: cf_nKp
  60. * Referenced by: '<S87>/Constant4'
  61. */
  62. 154,
  63. /* Variable: V_modulation
  64. * Referenced by:
  65. * '<S51>/Constant'
  66. * '<S95>/Constant2'
  67. * '<S74>/Constant3'
  68. */
  69. 15565,
  70. /* Variable: cf_idKb
  71. * Referenced by: '<S95>/Constant6'
  72. */
  73. 81,
  74. /* Variable: cf_idKi
  75. * Referenced by: '<S95>/Constant4'
  76. */
  77. 81,
  78. /* Variable: cf_iqKb
  79. * Referenced by: '<S95>/Constant1'
  80. */
  81. 73,
  82. /* Variable: cf_iqKi
  83. * Referenced by: '<S95>/Constant8'
  84. */
  85. 73,
  86. /* Variable: cf_nKb
  87. * Referenced by: '<S87>/Constant11'
  88. */
  89. 147,
  90. /* Variable: cf_nKi
  91. * Referenced by: '<S87>/Constant1'
  92. */
  93. 147,
  94. /* Variable: f_adc_curr_ceof
  95. * Referenced by: '<S52>/Constant'
  96. */
  97. 1543,
  98. /* Variable: cf_lastIqGain
  99. * Referenced by: '<S70>/Gain'
  100. */
  101. 16384,
  102. /* Variable: i_hall_offset
  103. * Referenced by: '<S15>/Constant2'
  104. */
  105. -480,
  106. /* Variable: i_dqMax
  107. * Referenced by:
  108. * '<S76>/Constant1'
  109. * '<S76>/Constant2'
  110. * '<S76>/Constant3'
  111. * '<S76>/Constant5'
  112. * '<S87>/Constant6'
  113. */
  114. 4800,
  115. /* Variable: id_fieldWeakMax
  116. * Referenced by: '<S74>/Constant6'
  117. */
  118. -1600,
  119. /* Variable: dz_OpenStepVol
  120. * Referenced by: '<S29>/Constant5'
  121. */
  122. 1280,
  123. /* Variable: f_lpf_idq
  124. * Referenced by: '<S48>/Constant'
  125. */
  126. 26214U,
  127. /* Variable: f_lpf_vdq
  128. * Referenced by: '<S76>/Constant'
  129. */
  130. 655U,
  131. /* Variable: i_pwm_count
  132. * Referenced by: '<S61>/Constant1'
  133. */
  134. 3000U
  135. };
  136. /* Constant parameters (default storage) */
  137. const ConstP rtConstP = {
  138. /* Pooled Parameter (Expression: r_sin_M1)
  139. * Referenced by:
  140. * '<S58>/r_sin_M1'
  141. * '<S82>/r_sin_M1'
  142. */
  143. { 0, 286, 572, 857, 1143, 1428, 1713, 1997, 2280, 2563, 2845, 3126, 3406, 3686,
  144. 3964, 4240, 4516, 4790, 5063, 5334, 5604, 5872, 6138, 6402, 6664, 6924, 7182,
  145. 7438, 7692, 7943, 8192, 8438, 8682, 8923, 9162, 9397, 9630, 9860, 10087,
  146. 10311, 10531, 10749, 10963, 11174, 11381, 11585, 11786, 11982, 12176, 12365,
  147. 12551, 12733, 12911, 13085, 13255, 13421, 13583, 13741, 13894, 14044, 14189,
  148. 14330, 14466, 14598, 14726, 14849, 14968, 15082, 15191, 15296, 15396, 15491,
  149. 15582, 15668, 15749, 15826, 15897, 15964, 16026, 16083, 16135, 16182, 16225,
  150. 16262, 16294, 16322, 16344, 16362, 16374, 16382, 16384, 16382, 16374, 16362,
  151. 16344, 16322, 16294, 16262, 16225, 16182, 16135, 16083, 16026, 15964, 15897,
  152. 15826, 15749, 15668, 15582, 15491, 15396, 15296, 15191, 15082, 14968, 14849,
  153. 14726, 14598, 14466, 14330, 14189, 14044, 13894, 13741, 13583, 13421, 13255,
  154. 13085, 12911, 12733, 12551, 12365, 12176, 11982, 11786, 11585, 11381, 11174,
  155. 10963, 10749, 10531, 10311, 10087, 9860, 9630, 9397, 9162, 8923, 8682, 8438,
  156. 8192, 7943, 7692, 7438, 7182, 6924, 6664, 6402, 6138, 5872, 5604, 5334, 5063,
  157. 4790, 4516, 4240, 3964, 3686, 3406, 3126, 2845, 2563, 2280, 1997, 1713, 1428,
  158. 1143, 857, 572, 286, 0, -286, -572, -857, -1143, -1428, -1713, -1997, -2280,
  159. -2563, -2845, -3126, -3406, -3686, -3964, -4240, -4516, -4790, -5063, -5334,
  160. -5604, -5872, -6138, -6402, -6664, -6924, -7182, -7438, -7692, -7943, -8192,
  161. -8438, -8682, -8923, -9162, -9397, -9630, -9860, -10087, -10311, -10531,
  162. -10749, -10963, -11174, -11381, -11585, -11786, -11982, -12176, -12365,
  163. -12551, -12733, -12911, -13085, -13255, -13421, -13583, -13741, -13894,
  164. -14044, -14189, -14330, -14466, -14598, -14726, -14849, -14968, -15082,
  165. -15191, -15296, -15396, -15491, -15582, -15668, -15749, -15826, -15897,
  166. -15964, -16026, -16083, -16135, -16182, -16225, -16262, -16294, -16322,
  167. -16344, -16362, -16374, -16382, -16384, -16382, -16374, -16362, -16344,
  168. -16322, -16294, -16262, -16225, -16182, -16135, -16083, -16026, -15964,
  169. -15897, -15826, -15749, -15668, -15582, -15491, -15396, -15296, -15191,
  170. -15082, -14968, -14849, -14726, -14598, -14466, -14330, -14189, -14044,
  171. -13894, -13741, -13583, -13421, -13255, -13085, -12911, -12733, -12551,
  172. -12365, -12176, -11982, -11786, -11585, -11381, -11174, -10963, -10749,
  173. -10531, -10311, -10087, -9860, -9630, -9397, -9162, -8923, -8682, -8438,
  174. -8192, -7943, -7692, -7438, -7182, -6924, -6664, -6402, -6138, -5872, -5604,
  175. -5334, -5063, -4790, -4516, -4240, -3964, -3686, -3406, -3126, -2845, -2563,
  176. -2280, -1997, -1713, -1428, -1143, -857, -572, -286, 0 },
  177. /* Pooled Parameter (Expression: r_cos_M1)
  178. * Referenced by:
  179. * '<S58>/r_cos_M1'
  180. * '<S82>/r_cos_M1'
  181. */
  182. { 16384, 16382, 16374, 16362, 16344, 16322, 16294, 16262, 16225, 16182, 16135,
  183. 16083, 16026, 15964, 15897, 15826, 15749, 15668, 15582, 15491, 15396, 15296,
  184. 15191, 15082, 14968, 14849, 14726, 14598, 14466, 14330, 14189, 14044, 13894,
  185. 13741, 13583, 13421, 13255, 13085, 12911, 12733, 12551, 12365, 12176, 11982,
  186. 11786, 11585, 11381, 11174, 10963, 10749, 10531, 10311, 10087, 9860, 9630,
  187. 9397, 9162, 8923, 8682, 8438, 8192, 7943, 7692, 7438, 7182, 6924, 6664, 6402,
  188. 6138, 5872, 5604, 5334, 5063, 4790, 4516, 4240, 3964, 3686, 3406, 3126, 2845,
  189. 2563, 2280, 1997, 1713, 1428, 1143, 857, 572, 286, 0, -286, -572, -857,
  190. -1143, -1428, -1713, -1997, -2280, -2563, -2845, -3126, -3406, -3686, -3964,
  191. -4240, -4516, -4790, -5063, -5334, -5604, -5872, -6138, -6402, -6664, -6924,
  192. -7182, -7438, -7692, -7943, -8192, -8438, -8682, -8923, -9162, -9397, -9630,
  193. -9860, -10087, -10311, -10531, -10749, -10963, -11174, -11381, -11585,
  194. -11786, -11982, -12176, -12365, -12551, -12733, -12911, -13085, -13255,
  195. -13421, -13583, -13741, -13894, -14044, -14189, -14330, -14466, -14598,
  196. -14726, -14849, -14968, -15082, -15191, -15296, -15396, -15491, -15582,
  197. -15668, -15749, -15826, -15897, -15964, -16026, -16083, -16135, -16182,
  198. -16225, -16262, -16294, -16322, -16344, -16362, -16374, -16382, -16384,
  199. -16382, -16374, -16362, -16344, -16322, -16294, -16262, -16225, -16182,
  200. -16135, -16083, -16026, -15964, -15897, -15826, -15749, -15668, -15582,
  201. -15491, -15396, -15296, -15191, -15082, -14968, -14849, -14726, -14598,
  202. -14466, -14330, -14189, -14044, -13894, -13741, -13583, -13421, -13255,
  203. -13085, -12911, -12733, -12551, -12365, -12176, -11982, -11786, -11585,
  204. -11381, -11174, -10963, -10749, -10531, -10311, -10087, -9860, -9630, -9397,
  205. -9162, -8923, -8682, -8438, -8192, -7943, -7692, -7438, -7182, -6924, -6664,
  206. -6402, -6138, -5872, -5604, -5334, -5063, -4790, -4516, -4240, -3964, -3686,
  207. -3406, -3126, -2845, -2563, -2280, -1997, -1713, -1428, -1143, -857, -572,
  208. -286, 0, 286, 572, 857, 1143, 1428, 1713, 1997, 2280, 2563, 2845, 3126, 3406,
  209. 3686, 3964, 4240, 4516, 4790, 5063, 5334, 5604, 5872, 6138, 6402, 6664, 6924,
  210. 7182, 7438, 7692, 7943, 8192, 8438, 8682, 8923, 9162, 9397, 9630, 9860,
  211. 10087, 10311, 10531, 10749, 10963, 11174, 11381, 11585, 11786, 11982, 12176,
  212. 12365, 12551, 12733, 12911, 13085, 13255, 13421, 13583, 13741, 13894, 14044,
  213. 14189, 14330, 14466, 14598, 14726, 14849, 14968, 15082, 15191, 15296, 15396,
  214. 15491, 15582, 15668, 15749, 15826, 15897, 15964, 16026, 16083, 16135, 16182,
  215. 16225, 16262, 16294, 16322, 16344, 16362, 16374, 16382, 16384 },
  216. /* Computed Parameter: vec_hallToPos_Value
  217. * Referenced by: '<S11>/vec_hallToPos'
  218. */
  219. { 7, 5, 1, 0, 3, 4, 2, 7 }
  220. };
  221. /*
  222. * File trailer for generated code.
  223. *
  224. * [EOF]
  225. */