SPRUHJ1I 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
As can be seen, both ID and IQ current controllers are initialized with the same gains, calculated from RoverL and Lhf. The 0.25 factor is also introduced in the proportional gain of these two controllers. This factor is to set the proportional gain to ¼ of the theoretical limit. In applications where the motor needs to be run at much higher speeds compared to its rated speed, that is, with field weakening, the proportional gains of both Id and Iq current controllers need to be scaled up to 4 times to get the gains to the theoretical limit. A simple way to scale these gains up to 4 is by using the following code example:
_iq Kp_Id = CTRL_getKp(handle,CTRL_Type_PID_Id);
_iq Kp_Iq = CTRL_getKp(handle,CTRL_Type_PID_Iq);
CTRL_setKp(handle,CTRL_Type_PID_Id, _IQmpy(Kp_Id, _IQ(4.0)));
CTRL_setKp(handle,CTRL_Type_PID_Iq, _IQmpy(Kp_Iq, _IQ(4.0)));
If the user would like to confirm that the current controller gains are set after the RoverL time constant has set the current controller, the following code example can be used:
// declare global variables for the Id controller gains
_iq gKp_Id, gKi_Id, gKd_Id;
// declare global variables for the Iq controller gains
_iq gKp_Iq, gKi_Iq, gKd_Iq;
// get the current controller gains for the Id controller
CTRL_g etGains(ctrlHandle,CTRL_Type_PID_Id,&gKp_Id,&gKi_Id,&gKd_Id);
// get the current controller gains for the Iq controller
CTRL_g etGains(ctrlHandle,CTRL_Type_PID_Iq,&gKp_Iq,&gKi_Iq,&gKd_Iq);
If the user chooses to bypass the gains set by the RoverL constant and decides to use their own gains, user simply needs to use the following functions to set the current controller gains, which are implemented in ctrl.h:
void CTRL_setKi(CTRL_Handle handle,const CTRL_Type_e ctrlType,const _iq Ki);
void CTRL_setKp(CTRL_Handle handle,const CTRL_Type_e ctrlType,const _iq Kp);
void CTRL_setGains(CTRL_Handle handle,const CTRL_Type_e ctrlType,
const _iq Kp,const _iq Ki,const _iq Kd);