a fork of priustroller

Dependencies:   mbed

Fork of priustroller_current by N K

Committer:
bwang
Date:
Mon Mar 09 02:06:06 2015 +0000
Revision:
14:1cc975207995
Parent:
11:dccbaa9274c5
Child:
27:846c08fb3697
added stubs for SVM, modulation scheme is still the same as last time

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bwang 11:dccbaa9274c5 1 #include "includes.h"
bwang 11:dccbaa9274c5 2 #include "transforms.h"
bwang 11:dccbaa9274c5 3 #include "fastmath.h"
bwang 11:dccbaa9274c5 4
bwang 11:dccbaa9274c5 5 void Transforms::Clarke(float a, float b, float *alpha, float *beta) {
bwang 11:dccbaa9274c5 6 *alpha = a;
bwang 11:dccbaa9274c5 7 *beta = (a + 2.0f * b)/sqrt(3.0f);
bwang 11:dccbaa9274c5 8 }
bwang 11:dccbaa9274c5 9
bwang 14:1cc975207995 10 void Transforms::InverseClarke(float alpha, float beta, float *a, float *b) {
bwang 14:1cc975207995 11 *a = alpha;
bwang 14:1cc975207995 12 *b = -0.5 * alpha + sqrt(3.0f) / 2.0f * beta;
bwang 14:1cc975207995 13 }
bwang 14:1cc975207995 14
bwang 11:dccbaa9274c5 15 void Transforms::Parke(float alpha, float beta, float theta, float *d, float *q) {
bwang 11:dccbaa9274c5 16 float cos = FastCos(theta);
bwang 11:dccbaa9274c5 17 float sin = FastSin(theta);
bwang 11:dccbaa9274c5 18 *d = alpha * cos + beta * sin;
bwang 11:dccbaa9274c5 19 *q = -alpha * sin + beta * cos;
bwang 11:dccbaa9274c5 20 }
bwang 11:dccbaa9274c5 21
bwang 11:dccbaa9274c5 22 void Transforms::InverseParke(float d, float q, float theta, float *alpha, float *beta) {
bwang 11:dccbaa9274c5 23 float cos = FastCos(theta);
bwang 11:dccbaa9274c5 24 float sin = FastSin(theta);
bwang 11:dccbaa9274c5 25 *alpha = cos * d - sin * q;
bwang 11:dccbaa9274c5 26 *beta = sin * d + cos * q;
bwang 11:dccbaa9274c5 27 }