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.

TMS320F280049: Speed Control Code Modification

Part Number: TMS320F280049
Other Parts Discussed in Thread: C2000WARE-MOTORCONTROL-SDK, C2000WARE

I initially developed a motor drive using the is10 code v3.00.01.00. That drive was for a speed control application. I want to build on that base code and add field weakening and the ability to switch from speed to torque mode as needed for future applications. Basically the goal is to have a common code set from which we can pick and choose which control type we want. A new SDK version has been released since the initial development.

Should I update this code from is10 v3.00.01.00

        if(EST_doSpeedCtrl(estHandle))
        {
            counterSpeed++;

            if(counterSpeed >= userParams.numCtrlTicksPerSpeedTick)
            {
                counterSpeed = 0;

                PI_run_series(piHandle_spd,
                              estInputData.speed_ref_Hz,
                              estOutputData.fm_lp_rps * MATH_ONE_OVER_TWO_PI,
                              0.0,
                              (float32_t *)(&(Idq_ref_A.value[1])));
            }
        }
        else
        {
            Idq_ref_A.value[1] = 0.0;
        }

To this code from is13 v3.01.00.00

        counterSpeed++;

        if(counterSpeed >= userParams.numCtrlTicksPerSpeedTick)
        {
            if(motorVars.flagEnableSpeedCtrl == true)
            {
                counterSpeed = 0;

                PI_run_series(piHandle_spd,
                              estInputData.speed_ref_Hz,
                              estOutputData.fm_lp_rps * MATH_ONE_OVER_TWO_PI,
                              0.0,
                              (float32_t *)(&(motorVars.IsRef_A)));
            }
            else  // Torque Control
            {
                motorVars.IsRef_A = IdqSet_A.value[1];
            }
        }
And in general do I need to add code that toggles between the differences in is10 and is13 when implementing field weakening from a common code base or is the is13 meant to handle this inherently in that disabling the FWC flag will control the motor similarly to is10. This would be ideal but there are differences where this doesn't seem to be the case. For example, the PI_run_series function has two different inputs depending on the lab, is10 vs is13, and the code version (eg is10 has Idq_ref_A.value[1] and is13 uses motorVars.IsRef_A). Similar situation for the torque control portion of the code.
Thanks.
  • You may download and install the latest MotorControlSDK. There is a new Universal Motor Control Lab that includes all of the requirements you mentioned above. The detailed introduction about the lab can be found in the lab user’s guide as the link below, you can refer to this lab to implement the torque and speed control with field weakening control.

    C2000WARE-MOTORCONTROL-SDK: https://www.ti.com/tool/C2000WARE-MOTORCONTROL-SDK

    Universal Project and Lab User’s Guide: https://www.ti.com/lit/ug/spruj26/spruj26.pdf

    Example lab project at the folder: C:\ti\c2000\C2000Ware_MotorControl_SDK_3_03_00_00\solutions\universal_motorcontrol_lab\f28002x

  • Thanks for pointing me to this latest iteration of code. I've been looking this over and if we start on a new project I will consider starting from this code as a baseline. But for now, I don't think migrating from our existing code base to the universal code is practical. I've diff'd the is10 and is13 code for the version we built or code from, v3.00.01.00, and the latest version, v3.03.00.00. Much of the code is identical, but there are some differences I have questions about (like the one above). Instead of trying to put them all in this thread, I'll create separate specific questions about each.