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.

LAUNCHXL-F280049C: Universal MCSDK PU mode defined

Guru 56143 points
Part Number: LAUNCHXL-F280049C


Hello all,

Build:  CCS12.3 Compiler 22.6.0.LTS

I find an odd define that no symbol exists in the project build for MOTOR1_PUMODE. This seems to deal with how motor currents get created when PUMODE is defined. Below code snip (motor_common.c).

If we set user_motor1.h PU (0.5), is motor in PU mode? Can incorrect PUMODE explain why motor currents have no effect to spin heavy rotor when PU (0.5) full sine wave?  The default PUMODE was set for current reconstruction UMCSDK download as #define USER_M1_MAX_VS_MAG_PU       (0.576). So set ~MAG_ PU for full sine wave but the defined PUMODE (snip) did not change. There is no documentation about PUMODE define being enabled or disabled.

#else   // !MOTOR1_ISBLDC
    float32_t Ls_d_H = objUser->motor_Ls_d_H;
    float32_t Ls_q_H = objUser->motor_Ls_q_H;
#if defined(_FULL_FAST_LIB)
    float32_t Rs_Ohm = objUser->motor_Rs_Ohm;
    float32_t RdoverLd_rps = Rs_Ohm / Ls_d_H;
    float32_t RqoverLq_rps = Rs_Ohm / Ls_q_H;
#else   // !(_FULL_FAST_LIB)
    float32_t Rs_d_Ohm = objUser->motor_Rs_d_Ohm;
    float32_t Rs_q_Ohm = objUser->motor_Rs_q_Ohm;
    float32_t RdoverLd_rps = Rs_d_Ohm / Ls_d_H;
    float32_t RqoverLq_rps = Rs_q_Ohm / Ls_q_H;
#endif  // !(_FULL_FAST_LIB)

    float32_t BWc_rps = objUser->BWc_rps;
    float32_t currentCtrlPeriod_sec =
                (float32_t)objUser->numCtrlTicksPerCurrentTick /
                objUser->ctrlFreq_Hz;
//_____________________________________________________________________

#if !defined(MOTOR1_PUMODE)
    float32_t outMax_V = objUser->Vd_sf *
                         objUser->maxVsMag_V;

    float32_t Kp_Id = Ls_d_H * BWc_rps;
    float32_t Ki_Id = 0.25f * RdoverLd_rps * currentCtrlPeriod_sec;

    float32_t Kp_Iq = Ls_q_H * BWc_rps;
    float32_t Ki_Iq = 0.25f * RqoverLq_rps * currentCtrlPeriod_sec;

    // set the Id controller
    PI_setGains(obj->piHandle_Id, Kp_Id, Ki_Id);
    PI_setUi(obj->piHandle_Id, 0.0f);
    PI_setRefValue(obj->piHandle_Id, 0.0f);
    PI_setFbackValue(obj->piHandle_Id, 0.0f);
    PI_setFfwdValue(obj->piHandle_Id, 0.0f);
    PI_setMinMax(obj->piHandle_Id, -outMax_V, outMax_V);

    // set the Iq controller
    PI_setGains(obj->piHandle_Iq, Kp_Iq, Ki_Iq);
    PI_setUi(obj->piHandle_Iq, 0.0f);
    PI_setRefValue(obj->piHandle_Iq, 0.0f);
    PI_setFbackValue(obj->piHandle_Iq, 0.0f);
    PI_setFfwdValue(obj->piHandle_Iq, 0.0f);
    PI_setMinMax(obj->piHandle_Iq, 0.0f, 0.0f);
#else   // MOTOR1_PUMODE
    float32_t outMax_pu = objUser->Vd_sf;

    float32_t Kp_Id = Ls_d_H * BWc_rps / objUser->current_sf / 4096.0f;
    float32_t Ki_Id = 0.25f * RdoverLd_rps * currentCtrlPeriod_sec;

    float32_t Kp_Iq = Ls_q_H * BWc_rps / objUser->current_sf / 4096.0f;
    float32_t Ki_Iq = 0.25f * RqoverLq_rps * currentCtrlPeriod_sec;

    // set the Id controller
    PI_setGains(obj->piHandle_Id, Kp_Id, Ki_Id);
    PI_setUi(obj->piHandle_Id, 0.0f);
    PI_setRefValue(obj->piHandle_Id, 0.0f);
    PI_setFbackValue(obj->piHandle_Id, 0.0f);
    PI_setFfwdValue(obj->piHandle_Id, 0.0f);
    PI_setMinMax(obj->piHandle_Id, -outMax_pu, outMax_pu);

    // set the Iq controller
    PI_setGains(obj->piHandle_Iq, Kp_Iq, Ki_Iq);
    PI_setUi(obj->piHandle_Iq, 0.0f);
    PI_setRefValue(obj->piHandle_Iq, 0.0f);
    PI_setFbackValue(obj->piHandle_Iq, 0.0f);
    PI_setFfwdValue(obj->piHandle_Iq, 0.0f);
    PI_setMinMax(obj->piHandle_Iq, 0.0f, 0.0f);
#endif  // MOTOR1_PUMODE

  • Hi,

    What MCSDK software project are you using? You mention the universal_motorcontrol_lab, but I don't see MOTOR1_PUMODE define used anywhere in the project.

    Best,

    Kevin

  • Hi Kevin,

    Yet another version UMCSDK exists though the code above should be in the same C file perhaps removed the symbol.

    This is UMCSDK 4.0 states SDK4.0 top of C files (motor_common.c). Also noticed FWC was being enabled when bypass motor ID == true and sets SVM_MIN_C. Seemed odd to me it defaulted to FWC being enabled in code below. Seemingly is causing other motor startup issues set to false as SVM mode remained MIN_C for FWC (motor1_drive.c).

        if(objUser->flag_bypassMotorId == true)
        {
    #if defined(MOTOR1_DCLINKSS)
            obj->svmMode = SVM_COM_C;
    #else  // !(MOTOR1_DCLINKSS)
            obj->svmMode = SVM_MIN_C;
    #endif  // !(MOTOR1_DCLINKSS)
            obj->flagEnableFWC = false;  //was true
        }
        else
        {
            obj->svmMode = SVM_COM_C;
            obj->flagEnableFWC = false;
        }

  • Hi Genatco,

    If MOTOR1_FWC is not enabled FWC is not utilized regardless of flagEnableFWC = 1. The FWC related code will not be compiled.

    Best,

    Kevin

  • Oddly the FWC symbol was set MOTOR1_FWC_N yet the FWC flag was being set enabled and SVM_MIN_C was the mode during motor ID. That caused high side V phase NFET to rapidly over heat under high current drive. With SVM_COM_C far less heat dissipation on that NFET. So it was just setting the wrong PWM algorithm and SVM_MIN_C is used for FWC mode? The text doesn't say such but seems a logical deduction.

    I modified the code snip to stop that from occurring, since flag_bypassMotorId was set enabled during motor run time SVM_MIN_C.

        /* Motor ID should not enable FWC */
        //if(objUser->flag_bypassMotorId == false) // was true
        if(motorVars_M1.flagEnableFWC == true)
        {
    #if defined(MOTOR1_DCLINKSS)
            obj->svmMode = SVM_COM_C;
    #else   // !(MOTOR1_DCLINKSS)
            obj->svmMode = SVM_MIN_C;
    #endif  // !(MOTOR1_DCLINKSS)
            obj->flagEnableFWC = true;  //was true
        }
        else
        {
            obj->svmMode = SVM_COM_C;
            obj->flagEnableFWC = false;
        }