Prius IPM controller

Dependencies:   mbed

Fork of analoghalls5_5 by N K

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers transforms.cpp Source File

transforms.cpp

00001 #include "includes.h"
00002 #include "transforms.h"
00003 #include "fastmath.h"
00004 
00005 void Transforms::Clarke(float a, float b, float *alpha, float *beta) {    
00006     *alpha = a;
00007     *beta = (a + 2.0f * b)/sqrt(3.0f);
00008 }
00009 
00010 void Transforms::InverseClarke(float alpha, float beta, float *a, float *b) {
00011     *a = alpha;
00012     *b = -0.5 * alpha + sqrt(3.0f) / 2.0f * beta;
00013 }
00014 
00015 void Transforms::Parke(float beta, float alpha, float theta, float *d, float *q) {
00016     float cos = FastCos(theta);
00017     float sin = FastSin(theta);
00018     *d = alpha * cos + beta * sin;
00019     *q = -alpha * sin + beta * cos;
00020 }
00021 
00022 void Transforms::InverseParke(float d, float q, float theta, float *alpha, float *beta) {
00023     float cos = FastCos(theta);
00024     float sin = FastSin(theta);
00025     *alpha = cos * d - sin * q;
00026     *beta = sin * d + cos * q;                                
00027 }