N K
/
analoghalls6
motor spins
Fork of analoghalls5 by
Embed:
(wiki syntax)
Show/hide line numbers
referencesynthesizers.cpp
00001 #include "includes.h" 00002 #include "meta.h" 00003 #include "lut.h" 00004 00005 void SynchronousReferenceSynthesizer::GetReference(float angle, float *ref_d, float *ref_q) { 00006 *ref_d = _max_phase_current * LutSin(angle); 00007 *ref_q = 0.0f; 00008 } 00009 00010 float ReferenceSynthesizer::LutSin(float theta) { 00011 if (theta < 0.0f) theta += 360.0f; 00012 if (theta >= 360.0f) theta -= 360.0f; 00013 return sinetab[(int) theta] * 2.0f - 1.0f; 00014 } 00015 00016 float ReferenceSynthesizer::LutCos(float theta) { 00017 return LutSin(90.0f - theta); 00018 }
Generated on Fri Jul 15 2022 12:15:05 by 1.7.2