FOC Implementation for putting multirotor motors in robots

Dependencies:   FastPWM3 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CurrentRegulator.h Source File

CurrentRegulator.h

00001 #ifndef CURRENTREGULATOR_H
00002 #define CURRENTREGULATOR_H
00003 
00004 #include "Inverter.h"
00005 #include "SVM.h"
00006 #include "PositionSensor.h"
00007 
00008 class CurrentRegulator{
00009     public:
00010         CurrentRegulator(Inverter *inverter, PositionSensor *position_sensor, PositionSensor *velocity_sensor, float L, float Kp, float Ki);
00011         void UpdateRef(float D, float Q);
00012         void Commutate();
00013         void Reset();
00014         virtual float GetQ();
00015     private:
00016         float IQ_Ref, ID_Ref, V_Q, V_D, V_Alpha, V_Beta, V_A, V_B, V_C, I_Q, I_D, IQ_Old,ID_Old,I_A, I_B, I_C, I_Alpha, I_Beta, theta_elec, _Kp, _Ki, _L;
00017         float Q_Integral, D_Integral, Q_Error, D_Error, Int_Max, DTC_Max, Q_Max;
00018         void SampleCurrent();
00019         void SetVoltage();
00020         void Update();
00021         void SendSPI();
00022         Inverter* _Inverter;
00023         PositionSensor* _PositionSensor;
00024         PositionSensor* _VelocitySensor;
00025         SVM* PWM;
00026         //Serial* pc;
00027         int count;
00028             
00029     
00030     
00031     };
00032     
00033     
00034 #endif