N K
/
GaNtroller
a fork of priustroller
Fork of priustroller_current by
meta/meta.h@11:dccbaa9274c5, 2015-03-08 (annotated)
- Committer:
- bwang
- Date:
- Sun Mar 08 08:37:38 2015 +0000
- Revision:
- 11:dccbaa9274c5
- Child:
- 14:1cc975207995
--Initial Commit: 03-08-2015 new context-based code; no more timers (=easier debugging)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 11:dccbaa9274c5 | 1 | #ifndef __META_H |
bwang | 11:dccbaa9274c5 | 2 | #define __META_H |
bwang | 11:dccbaa9274c5 | 3 | |
bwang | 11:dccbaa9274c5 | 4 | #include "includes.h" |
bwang | 11:dccbaa9274c5 | 5 | #include "core.h" |
bwang | 11:dccbaa9274c5 | 6 | #include "sensors.h" |
bwang | 11:dccbaa9274c5 | 7 | #include "filters.h" |
bwang | 11:dccbaa9274c5 | 8 | |
bwang | 11:dccbaa9274c5 | 9 | class Modulator { |
bwang | 11:dccbaa9274c5 | 10 | public: |
bwang | 11:dccbaa9274c5 | 11 | Modulator(Inverter *inverter) {_inverter = inverter;} |
bwang | 11:dccbaa9274c5 | 12 | virtual void Update(float va, float vb) = 0; |
bwang | 11:dccbaa9274c5 | 13 | protected: |
bwang | 11:dccbaa9274c5 | 14 | Inverter* _inverter; |
bwang | 11:dccbaa9274c5 | 15 | }; |
bwang | 11:dccbaa9274c5 | 16 | |
bwang | 11:dccbaa9274c5 | 17 | class SinusoidalModulator: public Modulator { |
bwang | 11:dccbaa9274c5 | 18 | public: |
bwang | 11:dccbaa9274c5 | 19 | SinusoidalModulator(Inverter *inverter):Modulator(inverter) {} |
bwang | 11:dccbaa9274c5 | 20 | virtual void Update(float va, float vb); |
bwang | 11:dccbaa9274c5 | 21 | }; |
bwang | 11:dccbaa9274c5 | 22 | |
bwang | 11:dccbaa9274c5 | 23 | class ReferenceSynthesizer { |
bwang | 11:dccbaa9274c5 | 24 | public: |
bwang | 11:dccbaa9274c5 | 25 | ReferenceSynthesizer(float max_phase_current) {_max_phase_current = max_phase_current;} |
bwang | 11:dccbaa9274c5 | 26 | virtual void GetReference(float angle, float throttle, float *ref_d, float *ref_q) {*ref_d = 0; *ref_q = 0;} |
bwang | 11:dccbaa9274c5 | 27 | protected: |
bwang | 11:dccbaa9274c5 | 28 | static float LutSin(float theta); |
bwang | 11:dccbaa9274c5 | 29 | static float LutCos(float theta); |
bwang | 11:dccbaa9274c5 | 30 | protected: |
bwang | 11:dccbaa9274c5 | 31 | float _max_phase_current; |
bwang | 11:dccbaa9274c5 | 32 | }; |
bwang | 11:dccbaa9274c5 | 33 | |
bwang | 11:dccbaa9274c5 | 34 | class SynchronousReferenceSynthesizer : public ReferenceSynthesizer { |
bwang | 11:dccbaa9274c5 | 35 | public: |
bwang | 11:dccbaa9274c5 | 36 | SynchronousReferenceSynthesizer(float max_phase_current):ReferenceSynthesizer(max_phase_current) {} |
bwang | 11:dccbaa9274c5 | 37 | virtual void GetReference(float angle, float throttle, float *ref_d, float *ref_q); |
bwang | 11:dccbaa9274c5 | 38 | }; |
bwang | 11:dccbaa9274c5 | 39 | |
bwang | 11:dccbaa9274c5 | 40 | #endif |
bwang | 11:dccbaa9274c5 | 41 |