Bayley Wang
/
priustroller_3
temp repo
Fork of priustroller_2 by
meta/meta.h@35:83cf9564bd0c, 2015-03-16 (annotated)
- Committer:
- bwang
- Date:
- Mon Mar 16 15:40:07 2015 +0000
- Revision:
- 35:83cf9564bd0c
- Parent:
- 14:1cc975207995
Set for 3A Iq, 0A Id, Ki = 1e-3, Kp = Kd = 0, loop still oscillates but is passable
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 | 14:1cc975207995 | 12 | virtual void Update(float valpha, float vbeta) = 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 | 14:1cc975207995 | 20 | virtual void Update(float valpha, float vbeta); |
bwang | 14:1cc975207995 | 21 | }; |
bwang | 14:1cc975207995 | 22 | |
bwang | 14:1cc975207995 | 23 | class SvmModulator: public Modulator { |
bwang | 14:1cc975207995 | 24 | public: |
bwang | 14:1cc975207995 | 25 | SvmModulator(Inverter *inverter):Modulator(inverter) {} |
bwang | 14:1cc975207995 | 26 | virtual void Update(float valpha, float vbeta); |
bwang | 11:dccbaa9274c5 | 27 | }; |
bwang | 11:dccbaa9274c5 | 28 | |
bwang | 11:dccbaa9274c5 | 29 | class ReferenceSynthesizer { |
bwang | 11:dccbaa9274c5 | 30 | public: |
bwang | 11:dccbaa9274c5 | 31 | ReferenceSynthesizer(float max_phase_current) {_max_phase_current = max_phase_current;} |
bwang | 11:dccbaa9274c5 | 32 | virtual void GetReference(float angle, float throttle, float *ref_d, float *ref_q) {*ref_d = 0; *ref_q = 0;} |
bwang | 11:dccbaa9274c5 | 33 | protected: |
bwang | 11:dccbaa9274c5 | 34 | static float LutSin(float theta); |
bwang | 11:dccbaa9274c5 | 35 | static float LutCos(float theta); |
bwang | 11:dccbaa9274c5 | 36 | protected: |
bwang | 11:dccbaa9274c5 | 37 | float _max_phase_current; |
bwang | 11:dccbaa9274c5 | 38 | }; |
bwang | 11:dccbaa9274c5 | 39 | |
bwang | 11:dccbaa9274c5 | 40 | class SynchronousReferenceSynthesizer : public ReferenceSynthesizer { |
bwang | 11:dccbaa9274c5 | 41 | public: |
bwang | 11:dccbaa9274c5 | 42 | SynchronousReferenceSynthesizer(float max_phase_current):ReferenceSynthesizer(max_phase_current) {} |
bwang | 11:dccbaa9274c5 | 43 | virtual void GetReference(float angle, float throttle, float *ref_d, float *ref_q); |
bwang | 11:dccbaa9274c5 | 44 | }; |
bwang | 11:dccbaa9274c5 | 45 | |
bwang | 11:dccbaa9274c5 | 46 | #endif |
bwang | 11:dccbaa9274c5 | 47 |