This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

spintac velocity control problem

I want to use spintac to control the velocity, and this is achieved, but I can not change the acceleration, below is my code :

void ST_runVelCtl(ST_Handle handle,OBSERVER_Handle observerHandle, CTRL_Handle ctrlHandle,ENC_Handle encHandle)
{
    _iq speedFeedback, iqReference;
    ST_Obj *stObj = (ST_Obj *)handle;
    CTRL_Obj *ctrlObj = (CTRL_Obj *)ctrlHandle;

    speedFeedback = _IQmpy(ENC_getFilteredSpeed(encHandle), _IQ(ST_SPEED_KRPM_PER_PU));

    STVELCTL_setVelocityReference(stObj->velCtlHandle, gMotorVars.SpeedRef_krpm);
    STVELCTL_setAccelerationReference(stObj->velCtlHandle,_IQmpy(MAX_ACCEL_KRPMPS_SF,gMotorVars.MaxAccel_krpmps));    // Internal ramp generator does not provide Acceleration Reference
    STVELCTL_setVelocityFeedback(stObj->velCtlHandle, speedFeedback);
    STVELCTL_run(stObj->velCtlHandle);

    // select SpinTAC Velocity Controller
    iqReference = STVELCTL_getTorqueReference(stObj->velCtlHandle);

    // Set the Iq reference that came out of SpinTAC Velocity Control
    CTRL_setIq_ref_pu(ctrlHandle, iqReference);
}

I am using  encoder to get the velocity. the velocity can be changed accuartly.

  • notice in the projects it is done through
    // set the speed acceleration
    CTRL_setMaxAccel_pu(ctrlHandle,_IQmpy(MAX_ACCEL_KRPMPS_SF,gMotorVars.MaxAccel_krpmps));
  • When we created the sensored labs we decided not to include Velocity Move since it was redundant with lab 6a.  

    If you compare the code from lab 12b with the code from lab 6a, you should be able to add in Velocity Move code so that you can realize the benefits of this more advanced profile generation.