temp repo

Dependencies:   mbed

Fork of priustroller_2 by N K

Committer:
bwang
Date:
Sun Mar 08 08:37:38 2015 +0000
Revision:
11:dccbaa9274c5
Child:
34:bfe180de813a
--Initial Commit: 03-08-2015 new context-based code; no more timers (=easier debugging)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bwang 11:dccbaa9274c5 1 #include "includes.h"
bwang 11:dccbaa9274c5 2 #include "meta.h"
bwang 11:dccbaa9274c5 3 #include "sensors.h"
bwang 11:dccbaa9274c5 4 #include "lut.h"
bwang 11:dccbaa9274c5 5 #include "core.h"
bwang 11:dccbaa9274c5 6
bwang 11:dccbaa9274c5 7 void SynchronousReferenceSynthesizer::GetReference(float angle, float throttle, float *ref_d, float *ref_q) {
bwang 11:dccbaa9274c5 8 *ref_d = 0.0f;
bwang 11:dccbaa9274c5 9 *ref_q = _max_phase_current * throttle;
bwang 11:dccbaa9274c5 10 }
bwang 11:dccbaa9274c5 11
bwang 11:dccbaa9274c5 12 float ReferenceSynthesizer::LutSin(float theta) {
bwang 11:dccbaa9274c5 13 if (theta < 0.0f) theta += 360.0f;
bwang 11:dccbaa9274c5 14 if (theta >= 360.0f) theta -= 360.0f;
bwang 11:dccbaa9274c5 15 return sinetab[(int) theta] * 2.0f - 1.0f;
bwang 11:dccbaa9274c5 16 }
bwang 11:dccbaa9274c5 17
bwang 11:dccbaa9274c5 18 float ReferenceSynthesizer::LutCos(float theta) {
bwang 11:dccbaa9274c5 19 return LutSin(90.0f - theta);
bwang 11:dccbaa9274c5 20 }