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: SVM/SVM.cpp
- Revision:
- 5:51c6560bf624
- Parent:
- 0:4e1c4df6aabd
- Child:
- 6:4ee1cdc43aa8
--- a/SVM/SVM.cpp Sat Mar 12 08:04:51 2016 +0000
+++ b/SVM/SVM.cpp Sat Mar 12 18:45:22 2016 +0000
@@ -7,10 +7,11 @@
_inverter = inverter;
_V_Bus = V_Bus;
}
-void SPWM::Update_DTC(float V_Alpha, float V_Beta){
- float DTC_A = V_Alpha/_V_Bus + .5f;
- float DTC_B = 0.5f*(-V_Alpha + 1.73205080757f*V_Beta)/_V_Bus + .5f;
- float DTC_C = 0.5f*(-V_Alpha - 1.73205080757f*V_Beta)/_V_Bus + .5f;
+
+void SPWM::Update_DTC(float V_A, float V_B, float V_C){
+ float DTC_A = V_A/_V_Bus + .5f;
+ float DTC_B = V_B/_V_Bus + .5f;
+ float DTC_C = V_C/_V_Bus + .5f;
if(DTC_A > .95f) DTC_A = .95f;
else if(DTC_A < .05f) DTC_A = .05f;
@@ -19,4 +20,24 @@
if(DTC_C > .95f) DTC_C = .95f;
else if(DTC_C < .05f) DTC_C = .05f;
_inverter->SetDTC(DTC_A, DTC_B, DTC_C);
- }
\ No newline at end of file
+ }
+
+SVPWM::SVPWM(Inverter *inverter, float V_Bus){
+ _inverter = inverter;
+ _V_Bus = V_Bus;
+ }
+
+void SVPWM::Update_DTC(float V_A, float V_B, float V_C){
+ float DTC_A = V_A/_V_Bus + .5f;
+ float DTC_B = V_B/_V_Bus + .5f;
+ float DTC_C = V_C/_V_Bus + .5f;
+
+ if(DTC_A > .95f) DTC_A = .95f;
+ else if(DTC_A < .05f) DTC_A = .05f;
+ if(DTC_B > .95f) DTC_B = .95f;
+ else if(DTC_B < .05f) DTC_B = .05f;
+ if(DTC_C > .95f) DTC_C = .95f;
+ else if(DTC_C < .05f) DTC_C = .05f;
+ _inverter->SetDTC(DTC_A, DTC_B, DTC_C);
+ }
+
\ No newline at end of file