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.

Torque Control using Project 20

Other Parts Discussed in Thread: MOTORWARE

I'm working on some firmware that is based on lab20 using Motorware 16. Normally this project is a speed controlled project, but I was wondering how you could use the new control structure in lab20 to do torque control. I see the flag_enableSpeedCtrl, and flag_enableCurrentCtrl variables. I've set the current control variable to 1 and the speed control variable to 0. At this point I'm not sure what variable to set to control the current or if the method described above is activating just the torque controller and disabling the speed control portion. Any help would be greatly appreciated.

Thanks,

  • Drew,
    I recommend using the proj_lab11 or 11a based example. This completely gets rid of the need to have CTRL (which is where the two flags you mention are used). In these projects everything is in-lined so you can see exactly what is being called and when. There isn't anything "hidden" in a CTRL object.

    it will make it simpler to just replace refValue that is coming from the output of the Speed Controller with your own torque reference (or a torque reference coming from a TRAJ output).

    // calculate Iq controller limits, and run Iq controller
    outMax_pu = _IQsqrt(_IQ(USER_MAX_VS_MAG_PU * USER_MAX_VS_MAG_PU) - _IQmpy(gVdq_out_pu.value[0],gVdq_out_pu.value[0]));
    PID_setMinMax(pidHandle[2],-outMax_pu,outMax_pu);
    PID_run(pidHandle[2],refValue,fbackValue,&(gVdq_out_pu.value[1]));
  • if you do stick with proj_lab20

    setting flag_enableSpeedCtrl to FALSE will disconnect the output of the speed controller form the input to the Iq PI controller.

    notice in lab05a all we do is:
    // Dis-able the Library internal PI. Iq has no reference now
    CTRL_setFlag_enableSpeedCtrl(ctrlHandle, false);

    and then take note of the function:

    updateIqRef

    which sets the IqRef as well as makes sure the Speed setting matches the sign of the IqRef, which is critical