11

Dependencies:   mbed-dev-f303 FastPWM3

Committer:
yezhong
Date:
Sun Jun 12 12:31:38 2022 +0000
Revision:
54:4ce8f97be6ae
Parent:
52:8fff6f1a3f50
1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yezhong 52:8fff6f1a3f50 1
benkatz 22:60276ba87ac6 2 #include "foc.h"
benkatz 26:2b865c00d7e9 3 using namespace FastMath;
yezhong 52:8fff6f1a3f50 4
yezhong 52:8fff6f1a3f50 5
benkatz 22:60276ba87ac6 6 void abc( float theta, float d, float q, float *a, float *b, float *c){
benkatz 25:f5741040c4bb 7 /// Inverse DQ0 Transform ///
benkatz 22:60276ba87ac6 8 ///Phase current amplitude = lengh of dq vector///
benkatz 22:60276ba87ac6 9 ///i.e. iq = 1, id = 0, peak phase current of 1///
benkatz 37:c0f352d6e8e3 10 float cf = FastCos(theta);
benkatz 37:c0f352d6e8e3 11 float sf = FastSin(theta);
benkatz 37:c0f352d6e8e3 12
benkatz 37:c0f352d6e8e3 13 *a = cf*d - sf*q; // Faster Inverse DQ0 transform
benkatz 37:c0f352d6e8e3 14 *b = (0.86602540378f*sf-.5f*cf)*d - (-0.86602540378f*cf-.5f*sf)*q;
benkatz 37:c0f352d6e8e3 15 *c = (-0.86602540378f*sf-.5f*cf)*d - (0.86602540378f*cf-.5f*sf)*q;
benkatz 22:60276ba87ac6 16 }
benkatz 22:60276ba87ac6 17
benkatz 26:2b865c00d7e9 18
benkatz 22:60276ba87ac6 19 void dq0(float theta, float a, float b, float c, float *d, float *q){
benkatz 25:f5741040c4bb 20 /// DQ0 Transform ///
benkatz 22:60276ba87ac6 21 ///Phase current amplitude = lengh of dq vector///
benkatz 22:60276ba87ac6 22 ///i.e. iq = 1, id = 0, peak phase current of 1///
benkatz 22:60276ba87ac6 23
benkatz 37:c0f352d6e8e3 24 float cf = FastCos(theta);
benkatz 37:c0f352d6e8e3 25 float sf = FastSin(theta);
benkatz 26:2b865c00d7e9 26
benkatz 37:c0f352d6e8e3 27 *d = 0.6666667f*(cf*a + (0.86602540378f*sf-.5f*cf)*b + (-0.86602540378f*sf-.5f*cf)*c); ///Faster DQ0 Transform
benkatz 37:c0f352d6e8e3 28 *q = 0.6666667f*(-sf*a - (-0.86602540378f*cf-.5f*sf)*b - (0.86602540378f*cf-.5f*sf)*c);
benkatz 37:c0f352d6e8e3 29
benkatz 22:60276ba87ac6 30 }
benkatz 22:60276ba87ac6 31
benkatz 22:60276ba87ac6 32 void svm(float v_bus, float u, float v, float w, float *dtc_u, float *dtc_v, float *dtc_w){
benkatz 25:f5741040c4bb 33 /// Space Vector Modulation ///
benkatz 25:f5741040c4bb 34 /// u,v,w amplitude = v_bus for full modulation depth ///
benkatz 22:60276ba87ac6 35
benkatz 22:60276ba87ac6 36 float v_offset = (fminf3(u, v, w) + fmaxf3(u, v, w))/2.0f;
benkatz 31:61eb6ae28215 37 *dtc_u = fminf(fmaxf(((u -v_offset)/v_bus + .5f), DTC_MIN), DTC_MAX);
benkatz 31:61eb6ae28215 38 *dtc_v = fminf(fmaxf(((v -v_offset)/v_bus + .5f), DTC_MIN), DTC_MAX);
benkatz 31:61eb6ae28215 39 *dtc_w = fminf(fmaxf(((w -v_offset)/v_bus + .5f), DTC_MIN), DTC_MAX);
benkatz 22:60276ba87ac6 40
benkatz 22:60276ba87ac6 41 }
yezhong 52:8fff6f1a3f50 42
benkatz 25:f5741040c4bb 43 void zero_current(int *offset_1, int *offset_2){ // Measure zero-offset of the current sensors
benkatz 22:60276ba87ac6 44 int adc1_offset = 0;
benkatz 22:60276ba87ac6 45 int adc2_offset = 0;
benkatz 22:60276ba87ac6 46 int n = 1024;
benkatz 25:f5741040c4bb 47 for (int i = 0; i<n; i++){ // Average n samples of the ADC
benkatz 27:501fee691e0e 48 TIM1->CCR3 = (PWM_ARR>>1)*(1.0f); // Write duty cycles
benkatz 27:501fee691e0e 49 TIM1->CCR2 = (PWM_ARR>>1)*(1.0f);
benkatz 27:501fee691e0e 50 TIM1->CCR1 = (PWM_ARR>>1)*(1.0f);
benkatz 26:2b865c00d7e9 51 ADC1->CR2 |= 0x40000000; // Begin sample and conversion
benkatz 22:60276ba87ac6 52 wait(.001);
benkatz 22:60276ba87ac6 53 adc2_offset += ADC2->DR;
benkatz 22:60276ba87ac6 54 adc1_offset += ADC1->DR;
benkatz 22:60276ba87ac6 55 }
benkatz 22:60276ba87ac6 56 *offset_1 = adc1_offset/n;
benkatz 22:60276ba87ac6 57 *offset_2 = adc2_offset/n;
benkatz 22:60276ba87ac6 58 }
yezhong 52:8fff6f1a3f50 59
benkatz 22:60276ba87ac6 60 void reset_foc(ControllerStruct *controller){
benkatz 28:8c7e29f719c5 61 TIM1->CCR3 = (PWM_ARR>>1)*(0.5f);
benkatz 28:8c7e29f719c5 62 TIM1->CCR1 = (PWM_ARR>>1)*(0.5f);
benkatz 28:8c7e29f719c5 63 TIM1->CCR2 = (PWM_ARR>>1)*(0.5f);
benkatz 28:8c7e29f719c5 64 controller->i_d_ref = 0;
benkatz 28:8c7e29f719c5 65 controller->i_q_ref = 0;
benkatz 28:8c7e29f719c5 66 controller->i_d = 0;
benkatz 28:8c7e29f719c5 67 controller->i_q = 0;
benkatz 37:c0f352d6e8e3 68 controller->i_q_filt = 0;
benkatz 22:60276ba87ac6 69 controller->q_int = 0;
benkatz 22:60276ba87ac6 70 controller->d_int = 0;
benkatz 28:8c7e29f719c5 71 controller->v_q = 0;
benkatz 28:8c7e29f719c5 72 controller->v_d = 0;
benkatz 22:60276ba87ac6 73 }
yezhong 52:8fff6f1a3f50 74
yezhong 52:8fff6f1a3f50 75
benkatz 37:c0f352d6e8e3 76 void commutate(ControllerStruct *controller, ObserverStruct *observer, GPIOStruct *gpio, float theta){
benkatz 37:c0f352d6e8e3 77 /// Observer Prediction ///
benkatz 37:c0f352d6e8e3 78 observer->i_d_est += DT*(observer->i_d_dot);
benkatz 37:c0f352d6e8e3 79 observer->i_q_est += DT*(observer->i_q_dot);
benkatz 37:c0f352d6e8e3 80
benkatz 25:f5741040c4bb 81 /// Commutation Loop ///
benkatz 25:f5741040c4bb 82 controller->loop_count ++;
benkatz 25:f5741040c4bb 83 if(PHASE_ORDER){ // Check current sensor ordering
benkatz 25:f5741040c4bb 84 controller->i_b = I_SCALE*(float)(controller->adc2_raw - controller->adc2_offset); // Calculate phase currents from ADC readings
benkatz 22:60276ba87ac6 85 controller->i_c = I_SCALE*(float)(controller->adc1_raw - controller->adc1_offset);
benkatz 22:60276ba87ac6 86 }
benkatz 22:60276ba87ac6 87 else{
benkatz 25:f5741040c4bb 88 controller->i_b = I_SCALE*(float)(controller->adc1_raw - controller->adc1_offset);
benkatz 22:60276ba87ac6 89 controller->i_c = I_SCALE*(float)(controller->adc2_raw - controller->adc2_offset);
benkatz 22:60276ba87ac6 90 }
benkatz 26:2b865c00d7e9 91 controller->i_a = -controller->i_b - controller->i_c;
benkatz 22:60276ba87ac6 92
benkatz 26:2b865c00d7e9 93 float s = FastSin(theta);
benkatz 26:2b865c00d7e9 94 float c = FastCos(theta);
benkatz 44:efcde0af8390 95 dq0(controller->theta_elec, controller->i_a, controller->i_b, controller->i_c, &controller->i_d, &controller->i_q); //dq0 transform on currents
benkatz 44:efcde0af8390 96 //controller->i_d = 0.6666667f*(c*controller->i_a + (0.86602540378f*s-.5f*c)*controller->i_b + (-0.86602540378f*s-.5f*c)*controller->i_c); ///Faster DQ0 Transform
benkatz 44:efcde0af8390 97 //controller->i_q = 0.6666667f*(-s*controller->i_a - (-0.86602540378f*c-.5f*s)*controller->i_b - (0.86602540378f*c-.5f*s)*controller->i_c);
benkatz 37:c0f352d6e8e3 98
benkatz 37:c0f352d6e8e3 99 controller->i_q_filt = 0.95f*controller->i_q_filt + 0.05f*controller->i_q;
benkatz 37:c0f352d6e8e3 100 observer->i_d_m = controller->i_d;
benkatz 37:c0f352d6e8e3 101 observer->i_q_m = controller->i_q;
benkatz 37:c0f352d6e8e3 102
benkatz 37:c0f352d6e8e3 103 observer->e_d = observer->i_d_m - observer->i_d_est;
benkatz 37:c0f352d6e8e3 104 observer->e_q = observer->i_q_m - observer->i_q_est;
benkatz 37:c0f352d6e8e3 105 observer->e_d_int += observer->e_d;
benkatz 37:c0f352d6e8e3 106 observer->e_q_int += observer->e_q;
benkatz 37:c0f352d6e8e3 107
benkatz 37:c0f352d6e8e3 108 observer->i_d_est += K_O*observer->e_d + .001f*observer->e_d_int;
benkatz 37:c0f352d6e8e3 109 observer->i_q_est += K_O*observer->e_q + .001f*observer->e_q_int;
benkatz 37:c0f352d6e8e3 110
benkatz 37:c0f352d6e8e3 111
benkatz 38:67e4e1453a4b 112 float scog12 = FastSin(12.0f*theta);
benkatz 38:67e4e1453a4b 113 float scog1 = s;
benkatz 38:67e4e1453a4b 114 float cogging_current = 0.25f*scog1 - 0.3f*scog12;
benkatz 25:f5741040c4bb 115
benkatz 25:f5741040c4bb 116 /// PI Controller ///
benkatz 22:60276ba87ac6 117 float i_d_error = controller->i_d_ref - controller->i_d;
benkatz 38:67e4e1453a4b 118 float i_q_error = controller->i_q_ref - controller->i_q + cogging_current;
benkatz 37:c0f352d6e8e3 119
benkatz 37:c0f352d6e8e3 120 float v_d_ff = 2.0f*(controller->i_d_ref*R_PHASE - controller->dtheta_elec*L_Q*controller->i_q_ref); //feed-forward voltages
benkatz 37:c0f352d6e8e3 121 float v_q_ff = 2.0f*(controller->i_q_ref*R_PHASE + controller->dtheta_elec*(L_D*controller->i_d_ref + WB));
benkatz 37:c0f352d6e8e3 122
benkatz 22:60276ba87ac6 123 controller->d_int += i_d_error;
benkatz 22:60276ba87ac6 124 controller->q_int += i_q_error;
benkatz 22:60276ba87ac6 125
benkatz 22:60276ba87ac6 126 //v_d_ff = 0;
benkatz 22:60276ba87ac6 127 //v_q_ff = 0;
benkatz 22:60276ba87ac6 128
benkatz 31:61eb6ae28215 129 limit_norm(&controller->d_int, &controller->q_int, V_BUS/(K_SCALE*I_BW*KI_Q)); // Limit integrators to prevent windup
benkatz 31:61eb6ae28215 130 controller->v_d = K_SCALE*I_BW*i_d_error + K_SCALE*I_BW*KI_D*controller->d_int;// + v_d_ff;
benkatz 31:61eb6ae28215 131 controller->v_q = K_SCALE*I_BW*i_q_error + K_SCALE*I_BW*KI_Q*controller->q_int;// + v_q_ff;
benkatz 22:60276ba87ac6 132
benkatz 34:51647c6c500d 133 //controller->v_q = 4.0f;
benkatz 28:8c7e29f719c5 134 //controller->v_d = 0.0f;
benkatz 28:8c7e29f719c5 135
benkatz 22:60276ba87ac6 136 //controller->v_d = v_d_ff;
benkatz 22:60276ba87ac6 137 //controller->v_q = v_q_ff;
benkatz 22:60276ba87ac6 138
benkatz 44:efcde0af8390 139 limit_norm(&controller->v_d, &controller->v_q, OVERMODULATION*controller->v_bus); // Normalize voltage vector to lie within curcle of radius v_bus
benkatz 44:efcde0af8390 140 abc(controller->theta_elec, controller->v_d, controller->v_q, &controller->v_u, &controller->v_v, &controller->v_w); //inverse dq0 transform on voltages
benkatz 26:2b865c00d7e9 141
benkatz 44:efcde0af8390 142 //controller->v_u = c*controller->v_d - s*controller->v_q; // Faster Inverse DQ0 transform
benkatz 44:efcde0af8390 143 //controller->v_v = (0.86602540378f*s-.5f*c)*controller->v_d - (-0.86602540378f*c-.5f*s)*controller->v_q;
benkatz 44:efcde0af8390 144 //controller->v_w = (-0.86602540378f*s-.5f*c)*controller->v_d - (0.86602540378f*c-.5f*s)*controller->v_q;
benkatz 22:60276ba87ac6 145 svm(controller->v_bus, controller->v_u, controller->v_v, controller->v_w, &controller->dtc_u, &controller->dtc_v, &controller->dtc_w); //space vector modulation
yezhong 52:8fff6f1a3f50 146
benkatz 37:c0f352d6e8e3 147 observer->i_d_dot = 0.5f*(controller->v_d - 2.0f*(observer->i_d_est*R_PHASE - controller->dtheta_elec*L_Q*observer->i_q_est))/L_D; //feed-forward voltage
benkatz 37:c0f352d6e8e3 148 observer->i_q_dot = 0.5f*(controller->v_q - 2.0f*(observer->i_q_est*R_PHASE + controller->dtheta_elec*(L_D*observer->i_d_est + WB)))/L_Q;
benkatz 22:60276ba87ac6 149
benkatz 25:f5741040c4bb 150 if(PHASE_ORDER){ // Check which phase order to use,
benkatz 31:61eb6ae28215 151 TIM1->CCR3 = (PWM_ARR)*(1.0f-controller->dtc_u); // Write duty cycles
benkatz 31:61eb6ae28215 152 TIM1->CCR2 = (PWM_ARR)*(1.0f-controller->dtc_v);
benkatz 31:61eb6ae28215 153 TIM1->CCR1 = (PWM_ARR)*(1.0f-controller->dtc_w);
benkatz 22:60276ba87ac6 154 }
benkatz 22:60276ba87ac6 155 else{
benkatz 32:ccac5da77844 156 TIM1->CCR3 = (PWM_ARR)*(1.0f-controller->dtc_u);
benkatz 32:ccac5da77844 157 TIM1->CCR1 = (PWM_ARR)*(1.0f-controller->dtc_v);
benkatz 32:ccac5da77844 158 TIM1->CCR2 = (PWM_ARR)*(1.0f-controller->dtc_w);
benkatz 22:60276ba87ac6 159 }
yezhong 52:8fff6f1a3f50 160
benkatz 25:f5741040c4bb 161 controller->theta_elec = theta; //For some reason putting this at the front breaks thins
benkatz 22:60276ba87ac6 162
yezhong 52:8fff6f1a3f50 163
benkatz 31:61eb6ae28215 164 if(controller->loop_count >400){
benkatz 22:60276ba87ac6 165 //controller->i_q_ref = -controller->i_q_ref;
benkatz 26:2b865c00d7e9 166 controller->loop_count = 0;
benkatz 22:60276ba87ac6 167
benkatz 28:8c7e29f719c5 168 //printf("%.2f %.2f %.2f\n\r", controller->i_a, controller->i_b, controller->i_c);
benkatz 31:61eb6ae28215 169 //printf("%f\n\r", controller->dtheta_mech*GR);
benkatz 22:60276ba87ac6 170 //pc.printf("%f %f %f\n\r", controller->i_a, controller->i_b, controller->i_c);
benkatz 22:60276ba87ac6 171 //pc.printf("%f %f\n\r", controller->i_d, controller->i_q);
benkatz 22:60276ba87ac6 172 //pc.printf("%d %d\n\r", controller->adc1_raw, controller->adc2_raw);
benkatz 26:2b865c00d7e9 173 }
benkatz 22:60276ba87ac6 174 }
benkatz 26:2b865c00d7e9 175
benkatz 26:2b865c00d7e9 176
benkatz 26:2b865c00d7e9 177 void torque_control(ControllerStruct *controller){
benkatz 28:8c7e29f719c5 178 float torque_ref = controller->kp*(controller->p_des - controller->theta_mech) + controller->t_ff + controller->kd*(controller->v_des - controller->dtheta_mech);
benkatz 26:2b865c00d7e9 179 //float torque_ref = -.1*(controller->p_des - controller->theta_mech);
benkatz 26:2b865c00d7e9 180 controller->i_q_ref = torque_ref/KT_OUT;
benkatz 37:c0f352d6e8e3 181 controller->i_d_ref = 0.0f;
benkatz 26:2b865c00d7e9 182 }
yezhong 52:8fff6f1a3f50 183
yezhong 52:8fff6f1a3f50 184
benkatz 22:60276ba87ac6 185 /*
benkatz 22:60276ba87ac6 186 void zero_encoder(ControllerStruct *controller, GPIOStruct *gpio, ){
benkatz 22:60276ba87ac6 187
benkatz 22:60276ba87ac6 188 }
yezhong 52:8fff6f1a3f50 189 */
yezhong 52:8fff6f1a3f50 190 /**********************************WYC 2021.10.22*****************************************/
yezhong 52:8fff6f1a3f50 191 float PID_operator (ControllerStruct *controller){
yezhong 52:8fff6f1a3f50 192 //printf("piding");
yezhong 52:8fff6f1a3f50 193 // calculate the time from the last call
yezhong 52:8fff6f1a3f50 194 unsigned long timestamp_now = controller->loop_count; //check the loop_count
yezhong 52:8fff6f1a3f50 195 float Ts = (timestamp_now - controller->timestamp_prev) * DT;
yezhong 52:8fff6f1a3f50 196 //printf("ts:%f\n",Ts);
yezhong 52:8fff6f1a3f50 197
yezhong 52:8fff6f1a3f50 198 // quick fix for strange cases (micros overflow)
yezhong 52:8fff6f1a3f50 199 if(Ts <= 0 || Ts > 0.5f) Ts = 0.001;
yezhong 52:8fff6f1a3f50 200
yezhong 52:8fff6f1a3f50 201 // u(s) = (P + I/s + Ds)e(s)
yezhong 52:8fff6f1a3f50 202 // Discrete implementations
yezhong 52:8fff6f1a3f50 203 // proportional part
yezhong 52:8fff6f1a3f50 204 // u_p = P *e(k)
yezhong 52:8fff6f1a3f50 205 float error = controller->error;
yezhong 52:8fff6f1a3f50 206 float proportional = controller->kp * error;
yezhong 52:8fff6f1a3f50 207 // Tustin transform of the integral part
yezhong 52:8fff6f1a3f50 208 // u_ik = u_ik_1 + I*Ts/2*(ek + ek_1)
yezhong 52:8fff6f1a3f50 209 float integral = controller->integral_prev + controller->ki*Ts*0.5f*(error + controller->error_prev);
yezhong 52:8fff6f1a3f50 210 // antiwindup - limit the output
yezhong 52:8fff6f1a3f50 211 limit(&integral, -(controller->LIMIT), controller->LIMIT);
yezhong 52:8fff6f1a3f50 212 // Discrete derivation
yezhong 52:8fff6f1a3f50 213 // u_dk = D(ek - ek_1)/Ts
yezhong 52:8fff6f1a3f50 214 float derivative = controller->kd*(error - controller->error_prev)/Ts;
yezhong 52:8fff6f1a3f50 215
yezhong 52:8fff6f1a3f50 216 // sum all the components
yezhong 52:8fff6f1a3f50 217 float output = proportional + integral + derivative;
yezhong 52:8fff6f1a3f50 218 // antiwindup - limit the output variable
yezhong 52:8fff6f1a3f50 219
yezhong 52:8fff6f1a3f50 220 //limit(&output, -(controller->LIMIT), controller->LIMIT);
yezhong 52:8fff6f1a3f50 221
yezhong 52:8fff6f1a3f50 222 /*
yezhong 52:8fff6f1a3f50 223 // if output ramp defined
yezhong 52:8fff6f1a3f50 224 if(output_ramp > 0){
yezhong 52:8fff6f1a3f50 225 // limit the acceleration by ramping the output
yezhong 52:8fff6f1a3f50 226 float output_rate = (output - output_prev)/Ts;
yezhong 52:8fff6f1a3f50 227 if (output_rate > output_ramp)
yezhong 52:8fff6f1a3f50 228 output = output_prev + output_ramp*Ts;
yezhong 52:8fff6f1a3f50 229 else if (output_rate < -output_ramp)
yezhong 52:8fff6f1a3f50 230 output = output_prev - output_ramp*Ts;
yezhong 52:8fff6f1a3f50 231 }
yezhong 52:8fff6f1a3f50 232 */
yezhong 52:8fff6f1a3f50 233 // saving for the next pass
yezhong 52:8fff6f1a3f50 234 controller->integral_prev = integral;
yezhong 52:8fff6f1a3f50 235 controller->output_prev = output;
yezhong 52:8fff6f1a3f50 236 controller->error_prev = error;
yezhong 52:8fff6f1a3f50 237 controller->timestamp_prev = timestamp_now;
yezhong 52:8fff6f1a3f50 238 return output;
yezhong 52:8fff6f1a3f50 239 }
yezhong 52:8fff6f1a3f50 240 /*********WYC ADD 2021.10.22**********/
yezhong 52:8fff6f1a3f50 241
yezhong 52:8fff6f1a3f50 242 void velocity_control(ControllerStruct *controller){
yezhong 52:8fff6f1a3f50 243
yezhong 52:8fff6f1a3f50 244 controller->ki = controller->kd;
yezhong 52:8fff6f1a3f50 245 controller->kd = 0;
yezhong 52:8fff6f1a3f50 246 controller->error = (controller->v_des - controller->dtheta_mech);
yezhong 52:8fff6f1a3f50 247
yezhong 52:8fff6f1a3f50 248 float current_sp = PID_operator (controller);
yezhong 52:8fff6f1a3f50 249 controller->i_q_ref = current_sp; //wyc 2021.07.26 compared with the program in mbed,old motor with no "-"in the front of "torque_des"
yezhong 52:8fff6f1a3f50 250 //printf("iq:%f\n",controller->i_q_des);
yezhong 52:8fff6f1a3f50 251 controller->i_d_ref = 0.0f;
yezhong 52:8fff6f1a3f50 252
yezhong 52:8fff6f1a3f50 253 }
yezhong 52:8fff6f1a3f50 254 /*********WYC ADD 2021.10.22**********/
yezhong 52:8fff6f1a3f50 255
yezhong 52:8fff6f1a3f50 256
yezhong 52:8fff6f1a3f50 257
yezhong 52:8fff6f1a3f50 258 /*********YZ ADD 2021.10.22**********/
yezhong 52:8fff6f1a3f50 259
yezhong 52:8fff6f1a3f50 260 void Position_control(ControllerStruct *controller){
yezhong 52:8fff6f1a3f50 261
yezhong 52:8fff6f1a3f50 262 controller->ki = controller->kd;
yezhong 52:8fff6f1a3f50 263 controller->kd = 0;
yezhong 52:8fff6f1a3f50 264 controller->error = (controller->p_des - controller->theta_mech);
yezhong 52:8fff6f1a3f50 265
yezhong 52:8fff6f1a3f50 266 float current_Position = PID_operator (controller);
yezhong 52:8fff6f1a3f50 267 controller->i_q_ref=current_Position; //YZ 2021.07.26 compared with the program in mbed,old motor with no "-"in the front of "torque_des"
yezhong 52:8fff6f1a3f50 268 //printf("iq:%f\n",controller->i_q_des);
yezhong 52:8fff6f1a3f50 269 controller->i_d_ref = 0.0f;
yezhong 52:8fff6f1a3f50 270
yezhong 52:8fff6f1a3f50 271 }
yezhong 52:8fff6f1a3f50 272 /*********YZ ADD 2021.10.22**********/