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.

Acceleration problem in lab5a

Other Parts Discussed in Thread: MOTORWARE

Hi Chris and all,

We made a PMSM motor controller based on TMDSHVMTRPFCKIT for EV application. Motorware lab5a is used for torque controlling. A resolver is used to calculate electrical angle and made necessary changed  in CTRL_runOnLine_User function to get electrical angle from resolver. System is working and going well smoothly (Both in load and no load condition). But I have a few problems regarding the acceleration.

In load condition when we applied high Iq_ref value (ex: 10.00) we hope to get the maximum input current immediately (ex : 10Amps) which respect to that Iq_ref and acceleration. But it has not happened. We could see that the input current value was increasing slow from a value of say 3Amps and after awhile  it will reach to that max current slowly (ex: 10Amp). 

I have changed gMaxCurrentSlope = _IQ(127.99);

Are there any parameters which effect the acceleration?

What is the use of USER_NUM_CTRL_TICKS_PER_SPEED_TICK which allows to execute CTRL_doSpeedCtrl(handle)  in CTRL_runOnLine_User . Since we are controlling current, what is the purpose of controlling speed in CTRL_runOnLine_User ? Same question for USER_NUM_CTRL_TICKS_PER_TRAJ_TICK.

Thanks.

  • "What is the use of USER_NUM_CTRL_TICKS_PER_SPEED_TICK which allows to execute CTRL_doSpeedCtrl(handle) in CTRL_runOnLine_User ."

    it lets you run the SPEED controller at a lower rate than the current. The default is to run the SPEED controller at 1 KHz. For more precise applications (especially in servo) you may need to increase. For your application it doesn't matter at all.

    "Since we are controlling current, what is the purpose of controlling speed in CTRL_runOnLine_User ? "
    There is none.

    "Same question for USER_NUM_CTRL_TICKS_PER_TRAJ_TICK."
    TRAJECTORY is what feeds the SPEED controller reference based on the starting speed, reference speed, and acceleration. You aren't using the speed controller so this doesn't matter.

    However, you may choose to use a TRAJ module on the front end of your IqRef_A variable. If you want to control the rate of change of the IqRef you could do this...but more likely you just want to use the throttle input to command Iq (though you may want to use some sort of front end logic to limit the reference or change in the reference allowed to smooth things out).

    USER_MAX_CURRENT_SLOPE is only used during identification and only controls the rate of change of Id, not the torque producing Iq.

    For your problem I would first look at the PI controller for Iq.
    When you are expecting maximum torque are you getting a maximum IqRef_A set as the reference to the controller?
    How does the controller respond with it's output? If it's not quickly saturating to a Vq maximum then you may need to look at the tuning of the controller. Another option would be to remove the Iq PI controller entirely and just command Vq. This will give you more direct command of the voltage to the inverter, but it removes the current limitation (which can be a bit dangerous). It is better if you can get Iq PI controller to respond like you want first.

    Try increasing the Kp value by up to 4x to start.

    Also be aware that as you inject current the Rs and Ls values are changing, so the R and L used for the current controller tuning are changing as well, hence the gains required for well tuned control are changing.
  • Thank you Chris for your quick response,

    Where should I increase Kp in motorware code. A Should I change it in forever loop?
  • in proj_lab05a they are updated through the function

    updateKpKiGains
  • Chris,

    I tried with 4xKp_Idq and 6xKp_Idq. But I could not see any significant improvement of acceleration.

    Motor does not try to draw current when starting load is high. We dont see that the motor gets its maximum current that can be given at starting in a heavy load condition. And we only see motor current increasing for same Iq_ref command when the speed is slowly increasing.

    Should I change Ki_Idq with Kp_Idq ?

    How can we debug this issue?

    Thank you.
  • look first at the inputs and outputs of the Iq controller to debug the issue.

    For your problem I would first look at the PI controller for Iq.
    When you are expecting maximum torque are you getting a maximum IqRef_A set as the reference to the controller?
    How does the controller respond with it's output? If it's not quickly saturating to a Vq maximum then you may need to look at the tuning of the controller.
  • Chris,

    I did this simple test and I got these results.

    First I added a variable to get the reference value of PI controller to the watch window by addingit inside the CTRL_runOnLine_User in ctrl.h. 

    // get the feedback value
    fbackValue = CTRL_getIq_in_pu(handle);
    iq_ref_to_cc = refValue;

    // set minimum and maximum for Id controller output
    outMax = _IQsqrt(_IQmpy(maxVsMag,maxVsMag) - _IQmpy(CTRL_getVd_out_pu(handle),CTRL_getVd_out_pu(handle)));
    outMin = -outMax;

    // set the minimum and maximum values
    PID_setMinMax(obj->pidHandle_Iq,outMin,outMax);

    // run the Iq PID controller
    PID_run(obj->pidHandle_Iq,refValue,fbackValue,CTRL_getVq_out_addr(handle));

    I aso added Idq_in.value[1], iq_ref_to_cc, gMotorVars.Kp_Idq, gMotorVars.Speed_krpm,gMotorVars.IqRef_A to the watch window. 

    1st test

    Without applying full load, I set gMotorVars.IqRef_A = 2.0. motor started rotate. I saw that reference value to current controller is iq_ref_to_cc = 0.0799999. And feedback to the current controller Idq_in[1] = 0.07960. looks like reference is very close to feedback. And input current to motor controller from the voltage source was 1.7Amps.  RPM =560.

    2nd test

    Then I reset  gMotorVars.IqRef_A = 0.0 and applied around  x10 large load to the motor and applied gMotorVars.IqRef_A = 2.0 again. Then I saw the same numbers on watch window as before. But motor did not spin and input current from source was 0amps. RPM = 0.

    I have few problems.

    1) Why the reference value to the current controller is not equal directly to  gMotorVars.IqRef_A  ?

    2) Are there any conditioning or scaling in between gMotorVars.IqRef_A and reference to current controller.

    3) Why the feedback for the current controller is same as reference current when the motor does not draw any current in test 2?

  • CTRL_getIq_in_pu
    pu is per unit
    0.08 per unit amps * IQ_CURRENT = 2.0 A
    so I'm guessing your IQ_CURRENT is set to 25A in user.h?

    I don't know what this refValue is
    iq_ref_to_cc = refValue;

    I would look at the output of the PID Iq controller to see if it's saturating to the outMax

    I would guess that your setting of 2A is much too low for the 10x load
  • Thank you for explaining gMotorVars.IqRef_A and Idq_in_pu. Yes  #define USER_IQ_FULL_SCALE_CURRENT_A        (25.0) .

    iq_ref_to_cc  is just a added extern variable to get reference value to watch window directly. 

        // configure and run the Iq controller

        // compute the Kp gain

        // Scale Kp instead of output to prevent saturation issues

        if(CTRL_getFlag_enableDcBusComp(handle))

          {

            Kp_Iq = _IQmpy(Kp_Iq,EST_getOneOverDcBus_pu(obj->estHandle));

          }

        PID_setKp(obj->pidHandle_Iq,Kp_Iq);

        // get the reference value

        if(CTRL_getFlag_enableSpeedCtrl(handle))

          {

            refValue = CTRL_getSpd_out_pu(handle);

          }

        else

          {

            // get the Iq reference value

            refValue = CTRL_getIq_ref_pu(handle);

          }

        // get the feedback value

        fbackValue = CTRL_getIq_in_pu(handle);

        iq_ref_to_cc = refValue;

        // set minimum and maximum for Id controller output

        outMax = _IQsqrt(_IQmpy(maxVsMag,maxVsMag) - _IQmpy(CTRL_getVd_out_pu(handle),CTRL_getVd_out_pu(handle)));

        outMin = -outMax;

    "I would look at the output of the PID Iq controller to see if it's saturating to the outMax"  I will check this and update you.

    Chris, what my thinking was Idq_in.value[1] is the feedback (Measured) value for current controller and Idq_ref.value[1] (iq_ref_to_cc = refValue;) is the commanded (reference) value for current controller. 

    "I would guess that your setting of 2A is much too low for the 10x load" I agree with you. Surely 2A setting should be a very low value for x10 load.

    But if the motor can draw 1.7A current from the source in less or no load condition for the iq_ref  2A setting, why the motor can not draw same amount of current  from source (0Amp) in x10 load for the same iq_ref 2.0A setting. It is true that the 2A setting is much too low for 10x load as you have mentioned. But shouldn't that draw the current(1.7A)  relative to 2A setting and produce some torque with respect to 2A setting (surely that can not rotate the motor with x10 load) ?

    In my 2nd test I saw that the Idq_in.value[1] (should be a measured value in pu) is very close to  Idq_ref.value[1] (should be a commanded value in pu) when the motor doesn't get any current. I was expecting very low value in Idq_in.value[1]. Is that possible? 

  • I would encourage you to measure the phase currents directly and not rely on input measurement of your power supply. this will give you much better insight into what is happening with the motor.

    I still haven't seen that you have plotted the input IqRef vs. the output Vq