temp repo

Dependencies:   mbed

Fork of priustroller_2 by N K

meta/meta.h

Committer:
bwang
Date:
2015-03-08
Revision:
11:dccbaa9274c5
Child:
14:1cc975207995

File content as of revision 11:dccbaa9274c5:

#ifndef __META_H
#define __META_H

#include "includes.h"
#include "core.h"
#include "sensors.h"
#include "filters.h"

class Modulator {
public:
    Modulator(Inverter *inverter) {_inverter = inverter;}
    virtual void Update(float va, float vb) = 0;
protected:
    Inverter* _inverter;
};

class SinusoidalModulator: public Modulator {
public:
    SinusoidalModulator(Inverter *inverter):Modulator(inverter) {}
    virtual void Update(float va, float vb);
};

class ReferenceSynthesizer {
public:
    ReferenceSynthesizer(float max_phase_current) {_max_phase_current = max_phase_current;}
    virtual void GetReference(float angle, float throttle, float *ref_d, float *ref_q) {*ref_d = 0; *ref_q = 0;}
protected:
    static float LutSin(float theta);
    static float LutCos(float theta);
protected:
    float _max_phase_current;
};

class SynchronousReferenceSynthesizer : public ReferenceSynthesizer {
public:
    SynchronousReferenceSynthesizer(float max_phase_current):ReferenceSynthesizer(max_phase_current) {}
    virtual void GetReference(float angle, float throttle, float *ref_d, float *ref_q);
};

#endif