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.
Fork of priustroller_2 by
Diff: meta/modulators.cpp
- Revision:
- 14:1cc975207995
- Parent:
- 13:79e247e54d78
- Child:
- 15:d754b71a1290
diff -r 79e247e54d78 -r 1cc975207995 meta/modulators.cpp
--- a/meta/modulators.cpp Mon Mar 09 01:40:43 2015 +0000
+++ b/meta/modulators.cpp Mon Mar 09 02:06:06 2015 +0000
@@ -1,15 +1,21 @@
#include "includes.h"
#include "core.h"
#include "meta.h"
-#include "sensors.h"
-#include "lut.h"
+#include "fastmath.h"
+#include "transforms.h"
-void SinusoidalModulator::Update(float va, float vb) {
+void SinusoidalModulator::Update(float valpha, float vbeta) {
//--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);
+ float dtcA = valpha;
+ float dtcB = ((-valpha + sqrt(3.0f) * vbeta) / 2.0f);
+ float dtcC = ((-valpha - sqrt(3.0f) * vbeta) / 2.0f);
_inverter->SetDtcA(dtcA * 0.5f + 0.5f);
_inverter->SetDtcB(dtcB * 0.5f + 0.5f);
_inverter->SetDtcC(dtcC * 0.5f + 0.5f);
+}
+
+void SvmModulator::Update(float valpha, float vbeta) {
+ float va, vb, vc;
+ InverseClarke(valpha, vbeta, &va, &vb);
+ vc = -(va + vb);
}
\ No newline at end of file
