temp repo

Dependencies:   mbed

Fork of priustroller_2 by N K

Revision:
13:79e247e54d78
Parent:
11:dccbaa9274c5
Child:
14:1cc975207995
--- a/meta/modulators.cpp	Sun Mar 08 09:02:59 2015 +0000
+++ b/meta/modulators.cpp	Mon Mar 09 01:40:43 2015 +0000
@@ -4,8 +4,12 @@
 #include "sensors.h"
 #include "lut.h"
 
-void SinusoidalModulator::Update(float va, float vb) {    
-    _inverter->SetDtcA(va);
-    _inverter->SetDtcB(((-va + sqrt(3.0f) * vb) / 2.0f));
-    _inverter->SetDtcC(((-va - sqrt(3.0f) * vb) / 2.0f));
+void SinusoidalModulator::Update(float va, float vb) {
+    //--hack to make duty cycles positive
+    float dtcA = va;
+    float dtcB = ((-va + sqrt(3.0f) * vb) / 2.0f);
+    float dtcC = ((-va - sqrt(3.0f) * vb) / 2.0f);
+    _inverter->SetDtcA(dtcA * 0.5f + 0.5f);
+    _inverter->SetDtcB(dtcB * 0.5f + 0.5f);
+    _inverter->SetDtcC(dtcC * 0.5f + 0.5f);
 }
\ No newline at end of file