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.

TMS320F280049C: Acceleration Control in MotorControl Lab is05

Part Number: TMS320F280049C
Other Parts Discussed in Thread: MOTORWARE

Hey TI - i have  a  F280049C MCU with a DRV8343s driver.  I am running CCS vs  9.3.0.00012  and MotorControl 2_01_00_00.   

I am able to identify my motor using Lab is05 without issue.  Once the motor is identified (and without exiting), i restart the motor by setting the motorVars.flagRunIdentAndOnLine flag = true.  No issues, the motor starts and goes to motorVars.speedRef_Hz speed setting.  The problem i have is the motorVars.accelerationMax_Hzps does not work (i.e., it does not control motor acceleration/deceleration).  Can you please tell me how i can control motor acceleration/deceleration in this lab? 

I tried setting acceleration using EST_setAccel_rps2(estHandle,(float32_t)2.0) without success.

I also set the following in the main loop:

if(HAL_getTimerStatus(halHandle, HAL_CPU_TIMER1))
{
motorVars.timerCnt_1ms++;

HAL_clearTimerFlag(halHandle, HAL_CPU_TIMER1);
Accel = EST_getAccel_rps2(estHandle);

}

The Accel return value seems to be some random number  (i.e., this function does not seem to be returning the acceleration setting).

Thanks!

Brett

  • Hey TI - i found a work around.

    I am not sure about the get and setAccel_rps2 functions.  The set seems to work on deceleration but not on acceleration. I assume these functions are not implemented?

    I was able to get full control by changing the following line

    float32_t  speed_maxDelta_Hz = (motorVars.speedRef_Hz/userParams.trajFreq_Hz);

    to 

    float32_t  speed_maxDelta_Hz = (motorVars.accelerationMax_Hzps/userParams.trajFreq_Hz);

    Brett

  • Brett Nourrcier said:
    motorVars.accelerationMax_Hzps does not work (i.e., it does not control motor acceleration/deceleration)

    You have to set speed via motorVars.speedRef.Hz up or down to control PI speed. One problem is the PI speed control oscillates up/down 80Hz-97Hz unless speed is input >97Hz. The integral seems ridiculously low.

  • Brett Nourrcier said:
    I was able to get full control by changing the following line

    Yet this value was set very low in user.h was suggested trouble shooting guide to make 20Hzps.

    //! \brief Defines maximum acceleration for the estimation speed profiles, Hz/sec
    //!
    #define USER_MAX_ACCEL_Hzps ((float32_t)(20.0))//2.0

  • Thanks GI.  I can control speed down to ~ 0 without issue.  One of the issues I found with out of the box TI speed control (with MotorControl) is the controller definitely relies on the USER_MOTOR_INERTIA_Kpgm2 setting (which was/is not the case on the MotorWare implementation).  The default value for inertia did not work well with my motor. 

    Brett

  • Brett Nourrcier said:
    Thanks GI.  I can control speed down to ~ 0 without issue

    That user.h parameter was a restriction in real time is05.js acceleration Hz/s. If you tried to enter real time value greater than 2Hz/sec it would be ignored. Where did you make the acceleration change you show above 1st post, mainISR calls?

    Brett Nourrcier said:
    The default value for inertia did not work well with my motor.

    The formula below with Wb/ seems to struggle with user.h entry of inertia. We bypass it via // (user.c) code to check for user.h motor inertia entry, let it fall through to default inertia formula. It seems the division (Wb/Math2Pi) is not exactly correct for VLI motors, PI oscillates badly disrupts inverter drive DC bus voltage. Formula below is not default, rather the one for known manufactures motor type inertia. 

    pUserParams->Kctrl_Wb_p_kgm2 = (float32_t)3.0 *
    pUserParams->motor_numPolePairs *
    
    pUserParams->motor_ratedFlux_Wb /
    (float32_t) (2.0 * USER_MOTOR_INERTIA_Kgm2);

  • Hey GI - I made the change in the is05_motor_id.c program.  In the background loop where the trajectory generator is updated, the EST_setMaxDelta_spd_Hz function is called.  The original call was made with

    speed_maxDelta_Hz = motorVars.speedRef_Hz /userParams.trajFreq_Hz. 

    I changed it to 

    speed_maxDelta_Hz = (motorVars.accelerationMax_Hzps/userParams.trajFreq_Hz)

    and I get accel control.

    As to your inertia comment, the default setting for Kctrl_Wb_p_kgm2 had the flux set too low for my motor;  I could not get high end speeds .  Once I figured that out, I changed user.c to eliminate the USER_MOTOR if statements (they were all defined the same) and went to the following:

        if ((USER_MOTOR_INERTIA_Kgm2 == NULL)) {
            pUserParams->BWc_rps = MATH_TWO_PI * (float32_t)100.0;
            pUserParams->BWdelta = (float32_t)8.0;
            // 3.0 * pUserParams->motor_numPolePairs * 0.1 / (2.0 * 0.00001);
            pUserParams->Kctrl_Wb_p_kgm2 = (float32_t)3.0 *
                                           pUserParams->motor_numPolePairs *
                                           (float32_t)(0.001) /
                                           (float32_t)(2.0 * 0.000001);
        } else {
            pUserParams->BWc_rps = MATH_TWO_PI * 100.0;
            pUserParams->BWdelta = (float32_t)8.0;
            // 3.0 * numPolesPairs * rotorFlux_Wb / (2.0 * J_kg_m2);
            pUserParams->Kctrl_Wb_p_kgm2 = (float32_t)3.0 *
                                           pUserParams->motor_numPolePairs *
                                           pUserParams->motor_ratedFlux_Wb /
                                        (float32_t) (2.0 * USER_MOTOR_INERTIA_Kgm2);
        }

    and then started tweaking the inertia value in user.h.  The tweaking was all trial and error but I could watch Idq_ref_A.value[1] and it seemed to be a good indicator that the controller was working correctly.  It would oscillate bad when it went out of control.

    Brett

  • You may use the lab is07 after the motor is identified properly by using is05. The identified motor parameters must be set in the user.h as the operation steps in the lab guide. You just need to change motorVars.accelerationMax_Hzps to adjust the acceleration. Of course, you might tune the Kp and Ki of the speed controller if you want to get a good control performance as well. The calculation code of the gains of the speed controller using the inertia and control bandwidth is just for reference. It's not must have and the best result, you should tune these gains based on the real system.