PMSM_Controller_data.c 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. /*
  2. * File: PMSM_Controller_data.c
  3. *
  4. * Code generated for Simulink model 'PMSM_Controller'.
  5. *
  6. * Model version : 1.1455
  7. * Simulink Coder version : 9.4 (R2020b) 29-Jul-2020
  8. * C/C++ source code generated on : Fri May 27 11:51:11 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_TrqLimKb
  32. * Referenced by: '<S88>/Constant2'
  33. */
  34. 1024,
  35. /* Variable: cf_TrqLimKi
  36. * Referenced by: '<S88>/Constant1'
  37. */
  38. 9,
  39. /* Variable: cf_TrqLimKp
  40. * Referenced by: '<S88>/Constant4'
  41. */
  42. 154,
  43. /* Variable: cf_idKp
  44. * Referenced by: '<S95>/Constant3'
  45. */
  46. 17877,
  47. /* Variable: cf_iqKp
  48. * Referenced by: '<S95>/Constant7'
  49. */
  50. 19765,
  51. /* Variable: cf_nKp
  52. * Referenced by: '<S87>/Constant4'
  53. */
  54. 154,
  55. /* Variable: cf_idKb
  56. * Referenced by: '<S95>/Constant6'
  57. */
  58. 81,
  59. /* Variable: cf_idKi
  60. * Referenced by: '<S95>/Constant4'
  61. */
  62. 81,
  63. /* Variable: cf_iqKb
  64. * Referenced by: '<S95>/Constant1'
  65. */
  66. 73,
  67. /* Variable: cf_iqKi
  68. * Referenced by: '<S95>/Constant8'
  69. */
  70. 73,
  71. /* Variable: cf_nKb
  72. * Referenced by: '<S87>/Constant11'
  73. */
  74. 147,
  75. /* Variable: cf_nKi
  76. * Referenced by: '<S87>/Constant1'
  77. */
  78. 147,
  79. /* Variable: cf_lastIqGain
  80. * Referenced by: '<S70>/Gain'
  81. */
  82. 16384,
  83. /* Variable: i_hall_offset
  84. * Referenced by: '<S15>/Constant2'
  85. */
  86. -480,
  87. /* Variable: dz_OpenStepVol
  88. * Referenced by: '<S29>/Constant5'
  89. */
  90. 1280,
  91. /* Variable: f_lpf_idq
  92. * Referenced by: '<S48>/Constant'
  93. */
  94. 26214U,
  95. /* Variable: f_lpf_vdq
  96. * Referenced by: '<S76>/Constant'
  97. */
  98. 655U,
  99. /* Variable: i_pwm_count
  100. * Referenced by: '<S61>/Constant1'
  101. */
  102. 3000U
  103. };
  104. /* Constant parameters (default storage) */
  105. const ConstP rtConstP = {
  106. /* Pooled Parameter (Expression: r_sin_M1)
  107. * Referenced by:
  108. * '<S58>/r_sin_M1'
  109. * '<S82>/r_sin_M1'
  110. */
  111. { 0, 286, 572, 857, 1143, 1428, 1713, 1997, 2280, 2563, 2845, 3126, 3406, 3686,
  112. 3964, 4240, 4516, 4790, 5063, 5334, 5604, 5872, 6138, 6402, 6664, 6924, 7182,
  113. 7438, 7692, 7943, 8192, 8438, 8682, 8923, 9162, 9397, 9630, 9860, 10087,
  114. 10311, 10531, 10749, 10963, 11174, 11381, 11585, 11786, 11982, 12176, 12365,
  115. 12551, 12733, 12911, 13085, 13255, 13421, 13583, 13741, 13894, 14044, 14189,
  116. 14330, 14466, 14598, 14726, 14849, 14968, 15082, 15191, 15296, 15396, 15491,
  117. 15582, 15668, 15749, 15826, 15897, 15964, 16026, 16083, 16135, 16182, 16225,
  118. 16262, 16294, 16322, 16344, 16362, 16374, 16382, 16384, 16382, 16374, 16362,
  119. 16344, 16322, 16294, 16262, 16225, 16182, 16135, 16083, 16026, 15964, 15897,
  120. 15826, 15749, 15668, 15582, 15491, 15396, 15296, 15191, 15082, 14968, 14849,
  121. 14726, 14598, 14466, 14330, 14189, 14044, 13894, 13741, 13583, 13421, 13255,
  122. 13085, 12911, 12733, 12551, 12365, 12176, 11982, 11786, 11585, 11381, 11174,
  123. 10963, 10749, 10531, 10311, 10087, 9860, 9630, 9397, 9162, 8923, 8682, 8438,
  124. 8192, 7943, 7692, 7438, 7182, 6924, 6664, 6402, 6138, 5872, 5604, 5334, 5063,
  125. 4790, 4516, 4240, 3964, 3686, 3406, 3126, 2845, 2563, 2280, 1997, 1713, 1428,
  126. 1143, 857, 572, 286, 0, -286, -572, -857, -1143, -1428, -1713, -1997, -2280,
  127. -2563, -2845, -3126, -3406, -3686, -3964, -4240, -4516, -4790, -5063, -5334,
  128. -5604, -5872, -6138, -6402, -6664, -6924, -7182, -7438, -7692, -7943, -8192,
  129. -8438, -8682, -8923, -9162, -9397, -9630, -9860, -10087, -10311, -10531,
  130. -10749, -10963, -11174, -11381, -11585, -11786, -11982, -12176, -12365,
  131. -12551, -12733, -12911, -13085, -13255, -13421, -13583, -13741, -13894,
  132. -14044, -14189, -14330, -14466, -14598, -14726, -14849, -14968, -15082,
  133. -15191, -15296, -15396, -15491, -15582, -15668, -15749, -15826, -15897,
  134. -15964, -16026, -16083, -16135, -16182, -16225, -16262, -16294, -16322,
  135. -16344, -16362, -16374, -16382, -16384, -16382, -16374, -16362, -16344,
  136. -16322, -16294, -16262, -16225, -16182, -16135, -16083, -16026, -15964,
  137. -15897, -15826, -15749, -15668, -15582, -15491, -15396, -15296, -15191,
  138. -15082, -14968, -14849, -14726, -14598, -14466, -14330, -14189, -14044,
  139. -13894, -13741, -13583, -13421, -13255, -13085, -12911, -12733, -12551,
  140. -12365, -12176, -11982, -11786, -11585, -11381, -11174, -10963, -10749,
  141. -10531, -10311, -10087, -9860, -9630, -9397, -9162, -8923, -8682, -8438,
  142. -8192, -7943, -7692, -7438, -7182, -6924, -6664, -6402, -6138, -5872, -5604,
  143. -5334, -5063, -4790, -4516, -4240, -3964, -3686, -3406, -3126, -2845, -2563,
  144. -2280, -1997, -1713, -1428, -1143, -857, -572, -286, 0 },
  145. /* Pooled Parameter (Expression: r_cos_M1)
  146. * Referenced by:
  147. * '<S58>/r_cos_M1'
  148. * '<S82>/r_cos_M1'
  149. */
  150. { 16384, 16382, 16374, 16362, 16344, 16322, 16294, 16262, 16225, 16182, 16135,
  151. 16083, 16026, 15964, 15897, 15826, 15749, 15668, 15582, 15491, 15396, 15296,
  152. 15191, 15082, 14968, 14849, 14726, 14598, 14466, 14330, 14189, 14044, 13894,
  153. 13741, 13583, 13421, 13255, 13085, 12911, 12733, 12551, 12365, 12176, 11982,
  154. 11786, 11585, 11381, 11174, 10963, 10749, 10531, 10311, 10087, 9860, 9630,
  155. 9397, 9162, 8923, 8682, 8438, 8192, 7943, 7692, 7438, 7182, 6924, 6664, 6402,
  156. 6138, 5872, 5604, 5334, 5063, 4790, 4516, 4240, 3964, 3686, 3406, 3126, 2845,
  157. 2563, 2280, 1997, 1713, 1428, 1143, 857, 572, 286, 0, -286, -572, -857,
  158. -1143, -1428, -1713, -1997, -2280, -2563, -2845, -3126, -3406, -3686, -3964,
  159. -4240, -4516, -4790, -5063, -5334, -5604, -5872, -6138, -6402, -6664, -6924,
  160. -7182, -7438, -7692, -7943, -8192, -8438, -8682, -8923, -9162, -9397, -9630,
  161. -9860, -10087, -10311, -10531, -10749, -10963, -11174, -11381, -11585,
  162. -11786, -11982, -12176, -12365, -12551, -12733, -12911, -13085, -13255,
  163. -13421, -13583, -13741, -13894, -14044, -14189, -14330, -14466, -14598,
  164. -14726, -14849, -14968, -15082, -15191, -15296, -15396, -15491, -15582,
  165. -15668, -15749, -15826, -15897, -15964, -16026, -16083, -16135, -16182,
  166. -16225, -16262, -16294, -16322, -16344, -16362, -16374, -16382, -16384,
  167. -16382, -16374, -16362, -16344, -16322, -16294, -16262, -16225, -16182,
  168. -16135, -16083, -16026, -15964, -15897, -15826, -15749, -15668, -15582,
  169. -15491, -15396, -15296, -15191, -15082, -14968, -14849, -14726, -14598,
  170. -14466, -14330, -14189, -14044, -13894, -13741, -13583, -13421, -13255,
  171. -13085, -12911, -12733, -12551, -12365, -12176, -11982, -11786, -11585,
  172. -11381, -11174, -10963, -10749, -10531, -10311, -10087, -9860, -9630, -9397,
  173. -9162, -8923, -8682, -8438, -8192, -7943, -7692, -7438, -7182, -6924, -6664,
  174. -6402, -6138, -5872, -5604, -5334, -5063, -4790, -4516, -4240, -3964, -3686,
  175. -3406, -3126, -2845, -2563, -2280, -1997, -1713, -1428, -1143, -857, -572,
  176. -286, 0, 286, 572, 857, 1143, 1428, 1713, 1997, 2280, 2563, 2845, 3126, 3406,
  177. 3686, 3964, 4240, 4516, 4790, 5063, 5334, 5604, 5872, 6138, 6402, 6664, 6924,
  178. 7182, 7438, 7692, 7943, 8192, 8438, 8682, 8923, 9162, 9397, 9630, 9860,
  179. 10087, 10311, 10531, 10749, 10963, 11174, 11381, 11585, 11786, 11982, 12176,
  180. 12365, 12551, 12733, 12911, 13085, 13255, 13421, 13583, 13741, 13894, 14044,
  181. 14189, 14330, 14466, 14598, 14726, 14849, 14968, 15082, 15191, 15296, 15396,
  182. 15491, 15582, 15668, 15749, 15826, 15897, 15964, 16026, 16083, 16135, 16182,
  183. 16225, 16262, 16294, 16322, 16344, 16362, 16374, 16382, 16384 },
  184. /* Computed Parameter: vec_hallToPos_Value
  185. * Referenced by: '<S11>/vec_hallToPos'
  186. */
  187. { 7, 5, 1, 0, 3, 4, 2, 7 }
  188. };
  189. /*
  190. * File trailer for generated code.
  191. *
  192. * [EOF]
  193. */