Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-dev-f303 FastPWM3
Diff: CurrentRegulator/CurrentRegulator.cpp
- Revision:
- 5:51c6560bf624
- Parent:
- 4:c023f7b6f462
- Child:
- 6:4ee1cdc43aa8
diff -r c023f7b6f462 -r 51c6560bf624 CurrentRegulator/CurrentRegulator.cpp
--- a/CurrentRegulator/CurrentRegulator.cpp Sat Mar 12 08:04:51 2016 +0000
+++ b/CurrentRegulator/CurrentRegulator.cpp Sat Mar 12 18:45:22 2016 +0000
@@ -11,12 +11,15 @@
_Inverter = inverter;
PWM = new SPWM(inverter, 2.0);
_PositionSensor = position_sensor;
- IQ_Ref = 1;
+ IQ_Ref = .5;
ID_Ref = 0;
V_Q = 0;
V_D = 0;
V_Alpha = 0;
V_Beta = 0;
+ V_A = 0;
+ V_B = 0;
+ V_C = 0;
I_Q = 0;
I_D = 0;
I_A = 0;
@@ -76,11 +79,15 @@
V_Q = Q_Integral + _Kp*Q_Error;
V_D = D_Integral + _Kp*D_Error;
+
+
}
void CurrentRegulator::SetVoltage(){
InvPark(V_D, V_Q, theta_elec, &V_Alpha, &V_Beta);
- PWM->Update_DTC(V_Alpha, V_Beta);
+ InvClarke(V_Alpha, V_Beta, &V_A, &V_B, &V_C);
+ PWM->Update_DTC(V_A, V_B, V_C);
+ //PWM->Update_DTC(V_Alpha, V_Beta);
}