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.

CCS/TMS320F28027F: INSTA -FOC PMSM torque calculation

Part Number: TMS320F28027F


Tool/software: Code Composer Studio

Hi,

In order to calculate the electrical torque (Te = 1.5 * PP * flux * Iq), I use the following function included in the SDK:

_iq USER_computeTorque_Flux_Iq_pu_to_Nm_sf(void)
{
  float_t FullScaleFlux = (USER_IQ_FULL_SCALE_VOLTAGE_V/(float_t)USER_EST_FREQ_Hz);
  float_t FullScaleCurrent = (USER_IQ_FULL_SCALE_CURRENT_A);
  float_t maxFlux = (USER_MOTOR_RATED_FLUX*((USER_MOTOR_TYPE==MOTOR_Type_Induction)?0.05:0.7));
  float_t lShift = -ceil(log(FullScaleFlux/maxFlux)/log(2.0));

  return(_IQ(FullScaleFlux/(2.0*MATH_PI)*FullScaleCurrent*USER_MOTOR_NUM_POLE_PAIRS*1.5*pow(2.0,lShift)));
}

However, I don't understand what the function of the lShift variable is and the reason of the power at the end of the last line.

Also, is there a function similar to the above that calculates Iq for a known electrical torque? If not, what should be taken into account to correctly perform the operations?

Thanks in advance.

  • This function is used to get the conversion coefficient to calculate torque since the Iq and Flux is pu value in the instaSPIN-FOC project, uses the coefficient to convert the pu value to N.m for torque output. The function is related to the scale Flux to pu value in instaSPIN-FOC, the permanent magnetic torque calculation formula is as you mentioned.

    You might call USER_computeTorque_Nm() in user.c to calculate the electromagnetic torque which consists of the permanent magnetic torque proportional to the q-axis current and the reluctance torque proportional to the product of d-axis current and the q-axis current.
  • I can see the conversion to full scale Wb of flux and full scale A of current, but I am asking about the lShift variable and the power in the final expression:

    float_t lShift = -ceil(log(FullScaleFlux/maxFlux)/log(2.0));

    ..........*pow(2.0,lShift)

    Also, you did not answer my second question, knowing the PM torque from the function (using a PMSM), what opertaions do I have to perform to get the Iq? Is it just a division of motor PP, 1.5, and Flux in Wb? Or is that lShoift involved as well?
  • Please have a look at the USER_computeTorque_Nm(), you might understand the USER_computeTorque_Flux_Iq_pu_to_Nm_sf() totally. The USER_computeTorque_Flux_Iq_pu_to_Nm_sf() include pp*3/2 and convert Flux and Iq convert coefficient since Flux and Iq is pu value in USER_computeTorque_Nm().
  • Please answer my questions, or at least READ them please. This is the part I do not understand:

    float_t lShift = -ceil(log(FullScaleFlux/maxFlux)/log(2.0));

    ..........*pow(2.0,lShift)

    Is that a correction for the actual flux? If so, how can I revert it to get the Iq back from torque?
  • You don't need to get the Iq back from Torque, the Iq is converted from the motor feedback current in this torque calculation. As mentioned above, the formula is related to the Flux scale calculation in the FAST algorithm of instaSPIN-FOC that converts the Flux pu value to Wb, is just about the Flux scaling design, is not regard to a torque calculation mathematics formula. You might get the Flux by using EST_getFlux_VpHz(), and get the Iq from PID_getFbackValue(), please have a look at the both USER_computeTorque_Flux_Iq_pu_to_Nm_sf() and USER_computeTorque_Nm() again.
  • I do need to get an Iq set point for my application based of the output torque formula. That's why I need to undersand how it's fully calculated to be able to it backwards.
  • Anyone?
  • As mentioned above, the calculation formula in USER_computeTorque_Flux_Iq_pu_to_Nm_sf() is not a torque calculation formula, it is just used to convert the pu value of Flux to SI unit to calculate the torque in N.m, since the Flux is scaled to pu value in InstaSPIN-FOC using this method.

    Actually, you might use EST_getFlux_VpHz() or USER_computeFlux() as below to get the Flux as you required, and then use the torque formula, Te =1.5*p*(Flux*iq + (Ld-Lq)*Id*Iq) as use in USER_computeTorque_Nm().

    // get the flux in V/Hz in floating point
    gMotorVars.Flux_VpHz = EST_getFlux_VpHz(obj->estHandle);

    // get the flux in Wb in fixed point
    gMotorVars.Flux_Wb = USER_computeFlux(handle, gFlux_pu_to_Wb_sf);
  • Just wanted to check in and see if there is any update from your side, I haven’t heard from you for a week, so I’m assuming you were able to resolve your issue. Please let me know if you have any questions. We would like to close this thread if no any further questions. Thanks.
  • Just want to see if there is any further update on this question, if not, we would like to close this thread. Thanks.