Prius IPM controller

Dependencies:   mbed

Fork of analoghalls5_5 by N K

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers referencesynthesizers.cpp Source File

referencesynthesizers.cpp

00001 #include "includes.h"
00002 #include "meta.h"
00003 #include "sensors.h"
00004 #include "lut.h"
00005 #include "core.h"
00006 
00007 void SynchronousReferenceSynthesizer::GetReference(float angle, float throttle, float *ref_d, float *ref_q) {
00008     *ref_d = 0.00f;
00009     *ref_q = _max_phase_current * throttle;
00010 }
00011 
00012 float ReferenceSynthesizer::LutSin(float theta) {
00013     if (theta < 0.0f) theta += 360.0f;
00014     if (theta >= 360.0f) theta -= 360.0f;
00015     return sinetab[(int) theta] * 2.0f - 1.0f;
00016 }
00017 
00018 float ReferenceSynthesizer::LutCos(float theta) {
00019     return LutSin(90.0f - theta);
00020 }