temp repo

Dependencies:   mbed

Fork of priustroller_2 by N K

Committer:
bwang
Date:
Mon Mar 16 15:40:07 2015 +0000
Revision:
35:83cf9564bd0c
Parent:
34:bfe180de813a
Set for 3A Iq, 0A Id, Ki = 1e-3, Kp = Kd = 0, loop still oscillates but is passable

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) {
nki 34:bfe180de813a 8 *ref_d = 0.00f;
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 }