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
该步骤应在主 ISR 中完成。该组件需要在适当的抽取率下调用此函数。抽取率由 spintac_velocity.h 头文件中声明的 ST_ISR_TICKS_PER_SPINTAC_TICK 确定;有关更多信息,请参阅Topic Link Label5.8.1.4。调用 SpinTAC 速度识别函数之前,必须更新速度反馈。另外需要注意,本示例按照图 8-4 的流程图执行步骤,确保系统已准备好进行惯性识别。
CTRL_Obj *obj = (CTRL_Obj *)ctrlHandle; // Get pointer to CTRL object
_iq speedFeedback = EST_getFm_pu(obj->estHandle); // Get the mechanical speed in pu/s
_iq iqReference = 0;
if(gMotorVars.SpinTAC.VelIdRun != false) {
// if beginning the SpinTAC Velocity Identify process
// set the speed reference to zero
gMotorVars.SpeedRef_krpm = 0;
// wait until the actual speed is zero
if((_IQabs(speedFeedback) < _IQ(ST_MIN_ID_SPEED_PU))
&& (STVELID_getEnable(stVelIdHandle) == false)) {
gMotorVars.Flag_enableForceAngle = true;
EST_setFlag_enableForceAngle(obj->estHandle, gMotorVars.Flag_enableForceAngle);
// set the GoalSpeed
STVELID_setVelocityPositive(stVelIdHandle, gMotorVars.VelIdGoalSpeed);
// set the Torque Ramp Time
STVELID_setTorqueRampTime_sec(stVelIdHandle, gMotorVars.VelIdTorqueRampTime);
// Enable SpinTAC Velocity Identify
STVELID_setEnable(stVelIdHandle, true);
// Set a positive speed reference to FAST to provide direction information
gMotorVars.SpeedRef_krpm = _IQ(0.001);
CTRL_setSpd_ref_krpm(ctrlHandle, gMotorVars.SpeedRef_krpm);
}
}
// Run SpinTAC Velocity Identify
STVELID_setVelocityFeedback(stVelIdHandle, speedFeedback);
STVELID_run(stVelIdHandle);
if(STVELID_getDone(stVelIdHandle) != false) {
// If inertia identification is successful
// update the inertia setting of SpinTAC Velocity Controller
// EXAMPLE:
// STVELCTL_setInertia(stVelCtlHandle, STVELID_getInertiaEstimate(stVelIdHandle));
gMotorVars.VelIdRun = false;
// return the speed reference to zero
gMotorVars.SpeedRef_krpm = _IQ(0.0);
CTRL_setSpd_ref_krpm(ctrlHandle, gMotorVars.SpeedRef_krpm);
}
else if((STVELID_getErrorID(stVelIdHandle) != false)
&& (STVELID_getErrorID(stVelIdHandle) != ST_ID_INCOMPLETE_ERROR)) {
// if not done & in error, wait until speed is less than 1RPM to exit
if(_IQabs(speedFeedback) < _IQ(ST_MIN_ID_SPEED_PU)) {
gMotorVars.VelIdRun = false;
// return the speed reference to zero
gMotorVars.SpeedRef_krpm = _IQ(0.0);
CTRL_setSpd_ref_krpm(ctrlHandle, gMotorVars.SpeedRef_krpm);
}
}
// Set the Iq reference that came out of SpinTAC Identify
iqReference = STVELID_getTorqueReference(stVelIdHandle);
CTRL_setIq_ref_pu(ctrlHandle, iqReference);