Prius IPM controller

Dependencies:   mbed

Fork of analoghalls5_5 by N K

meta/modulators.cpp

Committer:
bwang
Date:
2015-03-09
Revision:
14:1cc975207995
Parent:
13:79e247e54d78
Child:
17:d754b71a1290

File content as of revision 14:1cc975207995:

#include "includes.h"
#include "core.h"
#include "meta.h"
#include "fastmath.h"
#include "transforms.h"

void SinusoidalModulator::Update(float valpha, float vbeta) {
    //--hack to make duty cycles positive
    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);
}