ZHCU083I January 2013 – October 2021 TMS320F2802-Q1 , TMS320F28026-Q1 , TMS320F28026F , TMS320F28027-Q1 , TMS320F28027F , TMS320F28027F-Q1 , TMS320F28052-Q1 , TMS320F28052F , TMS320F28052F-Q1 , TMS320F28052M , TMS320F28052M-Q1 , TMS320F28054-Q1 , TMS320F28054F , TMS320F28054F-Q1 , TMS320F28054M , TMS320F28054M-Q1 , TMS320F2806-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28068F , TMS320F28068M , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M-Q1
定义控制器 (CTRL) 对象。控制器对象实现所有 FOC 算法和估算器功能。
typedef struct _CTRL_Obj_
{
CTRL_Version version; //!< the controller version
CTRL_State_e state; //!< the current state of the controller
CTRL_State_e prevState; //!< the previous state of the controller
CTRL_ErrorCode_e errorCode; //!< the error code for the controller
CLARKE_Handle clarkeHandle_I; //!< the handle for the current Clarke transform
CLARKE_Obj clarke_I; //!< the current Clarke transform object
CLARKE_Handle clarkeHandle_V; //!< the handle for the voltage Clarke transform
CLARKE_Obj clarke_V; //!< the voltage Clarke transform object
EST_Handle estHandle; //!< the handle for the parameter estimator
PARK_Handle parkHandle; //!< the handle for the Park object
PARK_Obj park; //!< the Park transform object
PID_Handle pidHandle_Id; //!< the handle for the Id PID controller
PID_Obj pid_Id; //!< the Id PID controller object
PID_Handle pidHandle_Iq; //!< the handle for the Iq PID controller
PID_Obj pid_Iq; //!< the Iq PID controller object
PID_Handle pidHandle_spd; //!< the handle for the speed PID controller
PID_Obj pid_spd; //!< the speed PID controller object
IPARK_Handle iparkHandle; //!< the handle for the inverse Park transform
IPARK_Obj ipark; //!< the inverse Park transform object
SVGEN_Handle svgenHandle; //!< the handle for the space vector generator
SVGEN_Obj svgen; //!< the space vector generator object
TRAJ_Handle trajHandle_Id; //!< the handle for the Id trajectory generator
TRAJ_Obj traj_Id; //!< the Id trajectory generator object
TRAJ_Handle trajHandle_spd; //!< handle for the speed trajectory generator
TRAJ_Obj traj_spd; //!< the speed trajectory generator object
TRAJ_Handle trajHandle_spdMax; //!< handle for max speed traj generator
TRAJ_Obj traj_spdMax; //!< the max speed trajectory generator object
MOTOR_Params motorParams; //!< the motor parameters
uint_least32_t waitTimes[CTRL_numStates];
//!< an array of wait times for each state, estimator clock counts
uint_least32_t counter_state; //!< the state counter
uint_least16_t numIsrTicksPerCtrlTick; //!< # of isr ticks per controller tick
uint_least16_t numCtrlTicksPerCurrentTick;
//!< # of controller ticks per current controller tick
uint_least16_t numCtrlTicksPerSpeedTick;
//!< # of controller ticks per speed controller tick
uint_least16_t numCtrlTicksPerTrajTick;
//!< # of controller ticks per trajectory tick
uint_least32_t ctrlFreq_Hz; //!< Defines the controller frequency, Hz
uint_least32_t trajFreq_Hz; //!< Defines the trajectory frequency, Hz
_iq trajPeriod_sec; //!< Defines the trajectory period, sec
float_t ctrlPeriod_sec; //!< Defines the controller period, sec
_iq maxVsMag_pu; //!< the maximum voltage vector that is allowed, pu
MATH_vec2 Iab_in; //!< the Iab input values
MATH_vec2 Iab_filt; //!< the Iab filtered values
MATH_vec2 Idq_in; //!< the Idq input values
MATH_vec2 Vab_in; //!< the Vab input values
_iq spd_out; //!< the speed output value
MATH_vec2 Vab_out; //!< the Vab output values
MATH_vec2 Vdq_out; //!< the Vdq output values
float_t Rhf; //!< the Rhf value
float_t Lhf; //!< the Lhf value
float_t RoverL; //!< the R/L value
_iq Kp_Id; //!< the desired Kp_Id value
_iq Kp_Iq; //!< the desired Kp_Iq value
_iq Kp_spd; //!< the desired Kp_spd value
_iq Ki_Id; //!< the desired Ki_Id value
_iq Ki_Iq; //!< the desired Ki_Iq value
_iq Ki_spd; //!< the desired Ki_spd value
_iq Kd_Id; //!< the desired Kd_Id value
_iq Kd_Iq; //!< the desired Kd_Iq value
_iq Kd_spd; //!< the desired Kd_spd value
_iq Ui_Id; //!< the desired Ui_Id value
_iq Ui_Iq; //!< the desired Ui_Iq value
_iq Ui_spd; //!< the desired Ui_spd value
MATH_vec2 Idq_ref; //!< the Idq reference values, pu
_iq IdRated; //!< the Id rated current, pu
_iq spd_ref; //!< the speed reference, pu
_iq spd_max; //!< the maximum speed, pu
uint_least16_t counter_current; //!< the isr counter
uint_least16_t counter_isr; //!< the isr counter
uint_least16_t counter_speed; //!< the speed counter
uint_least16_t counter_traj; //!< the traj counter
bool flag_enableCtrl; //!< a flag to enable the controller
bool flag_enableDcBusComp;
//!< a flag to enable the DC bus compensation in the controller
bool flag_enablePowerWarp; //!< a flag to enable PowerWarp
bool flag_enableOffset;
//!< a flag to enable offset estimation after idle state
bool flag_enableSpeedCtrl; //!< a flag to enable the speed controller
bool flag_enableUserMotorParams;
//!< a flag to use known motor parameters from user.h file
} CTRL_Obj;