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
This should be done in the main ISR. This function needs to be called at the proper decimation rate for this component. The decimation rate is established by ST_ISR_TICKS_PER_SPINTAC_TICK declared in the spintac_velocity.h header file; for more information, see Section 5.7.1.4. Before calling the SpinTAC Velocity Identify function the speed feedback must be updated. It is also important to notice that this example implements the flowchart from Figure 8-4 in order to make sure the system is ready to identify inertia.
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);