Hello,
i am using InstaSPIN motion with eQEP sensor and it works well for our application.
now, i am building a torque control (act as dynamometer) leveraging lab 12-b to remove speed control.
i disabled SpinTAC speed control:
STVELCTL_setEnable(stObj->velCtlHandle, false);
comment out:
STVELCTL_setBandwidth_radps(stObj->velCtlHandle, gMotorVars.SpinTAC.VelCtlBw_radps);
STVELCTL_setOutputMaximums(stObj->velCtlHandle, _IQmpy(gMotorVars.SpinTAC.VelCtlOutputMax_A, _IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A)), _IQmpy(gMotorVars.SpinTAC.VelCtlOutputMin_A, _IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A)));
ST_setupVelCtl(stHandle);
ST_setupPosConv(stHandle);
inside ISR, i comment out these speed control too:
if(stCnt++ >= ISR_TICKS_PER_SPINTAC_TICK) {
ST_runPosConv(stHandle, encHandle, ctrlHandle);
// ST_runPosMove(stHandle);
// ST_runPosCtl(stHandle, ctrlHandle);
ST_runVelCtl(stHandle, ctrlHandle);
stCnt = 1;
}
then, i add this function to update torque from gMotorVars.IqRef_A just like lab 4.
void updateIqRef(CTRL_Handle handle)
{
_iq iq_ref = _IQmpy(gMotorVars.IqRef_A,_IQ(1.0/USER_IQ_FULL_SCALE_CURRENT_A));
// Set the Iq reference that use to come out of the PI speed control
CTRL_setIq_ref_pu(handle, iq_ref);
return;
} // end of updateIqRef() function
with these changes, i am able to spin the motor as i changed the gMotorVars.IqRef_A from debug window and i can turn the motor counter direction and see lab supply current increases.
this is all good.
now, i would like to limit the maximum torque (current) that this dynamometer can apply for a given values of gMotorVars.IqRef_A.
for example, if i set gMotorVars.IqRef_A (IQ24) = 0.2 and start rotate the reverse direction, i would like to limit the max current of the motor consumption to say 0.5A.
how can i do that?
i defined USER_MOTOR_MAX_CURRENT limit to 0.5 as suggested by spruhj1h.pdf page 226, but it does not seems to limit to 0.5A when i turn the motor in opposite direction.
was this parameter USER_MOTOR_MAX_CURRENT only used by speed control loop for saturation?
I debugged some more in CTRL_runOnline_User of ctrlEQP.h file, i see this:
_iq maxVsMag = CTRL_getMaxVsMag_pu(handle);
this maxVsMag returns 0.5 as i set which is good.
but when it ran the PID it does not honor my max value. i can counter rotate the motor shaft and i can see current higher than 0.5 A consumption.
maybe i miss understand something here.
can you please advise?
Thanks,
Henry