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.

c2000 piccolo launchpad evaluation kit launchxl F28027F with Drv8301

Other Parts Discussed in Thread: INSTASPINUNIVERSALGUI

How to get the estimate torque value ? from the function USER_computeTorque_Nm(handle,gTorque_Flux_Iq_pu_to_Nm_sf,gTorque_Ls_Id_Iq_pu_to_Nm_sf) .

In GUI Composer i am getting a value of 0.005,0.001 like that, but when i am reading this function i am getting 5.0012, 1.0234,3.00076 different data like this.  When i call this function i will get direct torque or i will divide this value with some variable?. Please tell me to resolve the problem.

  • not quite following.

    in CCS Expressions window you can use the proj_lab##.js script to load the expressions. You will notice like most variables the gMotorVars.Torque_Nm is in Q24 .

    if you are trying to use this value in your own GUI Composer you will need to preprocess the variable using Divide_by_Q24_five_precision function as we did in the INSTASPINUNIVERSALGUI

    The torque is based on the current, so as the current changes the torque will change.
  • Hi,

    With which value i have to divide. I divide with 16777216 which is 2^24. but i got a zero torque. Tell me  with which value i have to divide.


  • gMotorVars.Torque_Nm = USER_computeTorque_Nm(handle,
    gTorque_Flux_Iq_pu_to_Nm_sf, gTorque_Ls_Id_Iq_pu_to_Nm_sf);


    Torque_Output = gMotorVars.Torque_Nm/16777216;

    //    2^24 = 16777216

    i have taken the torque like this. is this is the correct format to get torque?

  • Pattan,
    I don't understand where you are trying to use this value.

    gMotorVars.Torque_Nm will display as a natural "floating point number" in a CCS Expressions view when you view as an IQ24 value.

    Are you trying to view the torque in CCS Expressions?
    Are you trying to view the torque in GUI Composer? (here you would need to preprocess this value in GUI Composer by using Divide_by_Q24_five_precision function)

    Are you trying to use this torque value in code for some other reason? The value is in Q24 format. The value in Q24 representation does not need to be converted. You can read it as floating point decimal in Nm.
  • Hi,

    i am using serial communication between f28027F and my local micro controller. i am displaying torque, Motor Rotating RPM and Faults on LCD display. so i am reading all these values from the Code.

    when i call this below function i am not getting the float value (which is displaying in the GUI).

    gMotorVars.Torque_Nm = USER_computeTorque_Nm(handle,
    gTorque_Flux_Iq_pu_to_Nm_sf, gTorque_Ls_Id_Iq_pu_to_Nm_sf);

    gMotorVars.Torque_Nm is not giving the floating value of torque, which is displaying in GUI.

    so i divide the value with 2^24, then i am getting the float value like 0.0025346.

    Is my approach is correct or wrong?

  • gMotorVars.Torque_Nm
    is the floating point value represented in IQ24 number format

    When you view this variable in CCS Expressions as IQ24 format, you will see it as the correct floating point value of Newton-Meters of torque.

    If you are trying to use this value outside of CCS and display as a floating point value you need to process it. Here is the exact function we use to display it in the GUI Composer based interface:

    function Divide_by_Q24_five_precision(oldValue)
    {
    var toQ24 = new Number(oldValue/(Math.pow(2,24)));
    var n = toQ24.toPrecision(6);
    var s = n.toString();
    return (s)
    }


    So yes, we simply divide the "long value" of this variable by 2^24 to put it into IQ24 format.
    In this case we truncate to 6 bits of decimal and then return the string.


    are you using TI EVM right now with standard currents? If so, you should be getting valid Torque #s. If you are using custom HW with much higher currents your values could be rolling over the available fix point range. In that case you need to modify everything to KA, KV, etc. to be able to fit into the IQ24 format.