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