it works!
Dependencies: mbed-dev-f303 FastPWM3
Diff: FOC/foc.cpp
- Revision:
- 30:db9081ac5658
- Parent:
- 29:0dbc822dd29a
--- a/FOC/foc.cpp Mon Jun 12 17:41:00 2017 +0000 +++ b/FOC/foc.cpp Mon Aug 28 22:01:59 2017 +0000 @@ -106,8 +106,8 @@ //v_q_ff = 0; limit_norm(&controller->d_int, &controller->q_int, V_BUS/(K_Q*KI_Q)); // Limit integrators to prevent windup - controller->v_d = K_SCALE*I_BW*i_d_error + K_SCALE*I_BW*controller->d_int;// + v_d_ff; - controller->v_q = K_SCALE*I_BW*i_q_error + K_SCALE*I_BW*controller->q_int;// + v_q_ff; + controller->v_d = K_SCALE*I_BW*i_d_error + KI_D*K_SCALE*I_BW*controller->d_int;// + v_d_ff; + controller->v_q = K_SCALE*I_BW*i_q_error + KI_Q*K_SCALE*I_BW*controller->q_int;// + v_q_ff; //controller->v_q = 4.0f;; //controller->v_d = 0.0f; @@ -143,7 +143,7 @@ controller->loop_count = 0; //printf("%.2f %.2f %.2f\n\r", controller->i_a, controller->i_b, controller->i_c); - //printf("%f\n\r", controller->theta_elec); + printf("%f %f %f\n\r", controller->i_a, controller->i_b, controller->i_c); //pc.printf("%f %f %f\n\r", controller->i_a, controller->i_b, controller->i_c); //pc.printf("%f %f\n\r", controller->i_d, controller->i_q); //pc.printf("%d %d\n\r", controller->adc1_raw, controller->adc2_raw);