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.

Calculation of Kp series gain in lab 5a is incorrect



in lab 5a, calculating Kp series gain, i get wrong values for Marathon ACIM from labs manual:

I use a BW 1/20 ISR freq. in my user.h, ISR is USER_ISR_FREQ_HZ = USER_PWM_FRE_KHZ*1000/USER_NUM_PWM_TICKS_PER_ISR_TICK=15*1000/3=5000,

Ls=0.04114207, ==> Kp series = Ls*2PI*5000/20=64.625812 (high number?)

Kp series(pu)=64.625812*Lsf/Vsf

Isf=USER_ADC_FULL_SCALE_CURRENT_A/USER_IQ_FULL_SCALE_CURRENT_A = 19.89/10 = 1.989

Vsf=USER_ADC_FULL_SCALE_V/USER_IQ_FULL_SCALE_V=409.6/450 = 0.910222

KpSeries (pu) = 64.625812*1.989/0.910222 = 141.219076. ==> Wrong???

Now we know what happens when we use this large value, the motor goes crazy (vibratrion).  I think the calculations i did for Kp series = 64.62 is wrong, it should not be this high. When i put 141.2 in gMotorVars.Kp_Idq, the motor was not doing good.

Please help.

  • Hi Michael,

    Even though it doesn't explicitly say this, the equations in Lab 5a were designed to work with a permanent magnet machine.  For an AC induction machine, the following changes must be made to the parameter values:

    1.  For the d axis current controller, the "R" value you should use is "Rs".  However, for the q axis controller, the "R" value should be "Rs + Rr".

    2.  For both the d and q axis controllers, the "L" value should be Ls times the leakage factor of the ACIM machine.  In other words:

                                  L = Ls(1-Lm2/(LsLr))

    I intend to update sections in the User's Manual and Lab examples dealing with PI tuning to make them clearer.  In the meantime, I have written a 10-part blog series on PI tuning which you may find hepful:

    http://e2e.ti.com/blogs_/b/motordrivecontrol/archive/2013/02/28/teaching-your-pi-controller-to-behave-part-i.aspx

    Regards,

    Dave

     

  • Hello Dave, first I would like to thank you for taking the time to help me.

    After reading your response, I have some questions: using the values from user.h, I assume the Ls in your equation above is the Ls_q = Ls_d? How do I calculate or find Lm? I know that Lm is the magnetizing inductance, any relationship between it and Ls, Lr? I'm trying to run the procedures of lab5a with all the equations shown in the manual using values from user.h. also, the L = Ls(1-Lm2/(LsLr)) in this equation, is the L that is used in calculating Kp_series(pu)=(Rs/L)Ti, this L is from your equation, or should it be Ls? Now you see why I'm confused. I need to move on to the remaining labs, i don't want this lab to hold me, but i do need to understand it. When I first run lab 5a, the following values are calculated, Kp=1.1428, and Ki=0.049586, Ki is the same value i got when i ran the calculations, I would like to know how the program calculated Kp, what equations did it use, it knows I have an ACIM, and how do they relate to the equations you gave me above? I would like to make sense of it, and understand it.  From proj_lab05a.c, we have this as you know:

    float_t Ls_d = EST_getLs_d_H(obj->estHandle);

    float_t Ls_q = EST_getLs_q_H(obj->estHandle);

    float_t Rs = EST_getRs_Ohm(obj->estHandle);

    float_t RoverLs_d = Rs/Ls_d;

    float_t RoverLs_q = Rs/Ls_q;

    float_t fullScaleCurrent = EST_getFullScaleCurrent(obj->estHandle);

    float_t fullScaleVoltage = EST_getFullScaleVoltage(obj->estHandle);

    float_t ctrlPeriod_sec = CTRL_getCtrlPeriod_sec(handle);

    _iq Kp_Id = _IQ((0.25*Ls_d*fullScaleCurrent)/(ctrlPeriod_sec*fullScaleVoltage));

    _iq Ki_Id = _IQ(RoverLs_d*ctrlPeriod_sec);

    _iq Kp_Iq = _IQ((0.25*Ls_q*fullScaleCurrent)/(ctrlPeriod_sec*fullScaleVoltage));

    _iq Ki_Iq = _IQ(RoverLs_q*ctrlPeriod_sec);

    I can calculate correctly Ki_Id, but I'm still having problem with Kp using your equation.

    Please help

  • Hello Michael,

    I will attempt to answer your questions...

    After reading your response, I have some questions:   using the values from user.h, I assume the Ls in your equation above is the Ls_q = Ls_d?  Yes.  We assume that an ACIM is a "smooth airgap" device, and as such does not posess any saliency, or produce any reluctance torque.

    How do I calculate or find Lm? I know that Lm is the magnetizing inductance, any relationship between it and Ls, Lr?  Lm is related to both Ls and Lr via the leakage inductances of the stator and rotor respectively.  Specifically,

                              Lm = Ls - Lsl  = Lr - Lrl

    The easiest way to get Lm is to find it on the data sheet for your motor.  If it is not available, you can run the MotorID algorithm which comes with InstaSPIN-FOC to measure its value.

    the L = Ls(1-Lm2/(LsLr)) in this equation, is the L that is used in calculating Kp_series(pu)=(Rs/L)Ti, this L is from your equation, or should it be Ls?  It is from this equation.  If you use Ls, you will end up with a value that is way too high, as you have already discovered.

    I need to move on to the remaining labs, i don't want this lab to hold me, but i do need to understand it.  Please remember that all of the labs (and associated equations) were designed to work with a PMSM motor.  We currently don't have a step-by-step procedure for tuning the PI parameters for an ACIM.  If you are trying to work your way through the labs with an AC Induction Motor, I fear you will continue to run into problems and discrepancies, especially when you try to tune the speed loop.

     I would like to know how the program calculated Kp.  For the current loop, the following equation relates the value of Kp to the bandwidth of the controller (in rad/sec):

                    Kp (unscaled) = L*bandwidth

    The "L" value is the series inductance from my previous posting, and is NOT Ls.  So it turns out that you have some latitude with how this value is set.  In the Lab manual, the rule of thumb is to set Kp to be less than 1/20 of the ISR frequency:

                   Kp (unscaled) = 2pL/(20Ts), where Ts is the sampling period of the current loop controller.

    Finally,

                   Kp (scaled) = Kp(unscaled) * Isf/Vsf

    Best Regards,

    Dave

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • Hi Dave


    In the software code ,the low pass filter expression is Y(n+1)=(1-beta_lp_pu)*Y(n)+beta_lp_pu*X(n) . beta_lp_pu=  = _IQ(pUserParams->offsetPole_rps/(float_t)pUserParams->ctrlFreq_Hz) . 

    I think the low pass filter is 1/(Ts+1) in s domain . When I using bilinearity method of transformation ,but I just got y[n] = b0*x[n] + b1*x[n-1] - a1*y[n-1] .  a1=beta_lp_pu-1 , b1=beta_lp_pu  and b0=0 . Maybe my issue is the relationship between "T" and beta_lp_pu . 

    BYW  what's the method used to transformate s domain to discrete domain ? pulse response not political reform or others ?

    when design speed loop I think Kspd_filter is constant ,please correct me . and how to set the constant or what's elements determine the value of Kspd_filter .

  • Hi fanqiang,

    You are correct.  This particular low-pass filter has the s-domain form of 1 / (1+tau*s), where tau is the time constant of the filter.  Specifically, beta_Ip_pu = 1 - exp(-T / tau), where T is the sampling period for the filter.

    This filter was not designed using the bilinear transformation.  It falls into the category of waveform invariant filters, and in this case, it is a step-invariant filter.  The design procedure is actually fairly simple:

    1.  Figuratively speaking, design an analog prototype filter that does what you want it to do.  In this case, it is a simple single-pole low-pass filter.

    2.  For a step-invariant filter, apply a step function input to your prototype filter and see what output you get.  For a step input, a single-pole low-pass filter will have the familiar output of y(t) = 1 - exp(-t / tau).

    3.  Take the z transform of the output waveform.  From a z-transform table, we see that the z-transform of the above output is Y(z) = z (1 - exp(-T / tau)) / [(z - 1)(z - exp(-T / tau))]

    4.  Define the z-transform of the input waveform.  From a z-transform table, we see that the z-transform of a step input is X(z) = z / (z - 1)

    5.  Define the z-domain transfer function of the filter.  Using the values from steps 3 and 4, we get:

                  H(z) = Y(z) / X(z).  After simplifying, we get:  H(z) = k / (z + k - 1), where k = 1 - exp(-T / tau) = beta_Ip_pu

    6.  Take the inverse transform of the above expression to obtain the difference equation for the filter:

                   y(n + 1) = (1 - k) y(n) + k  x(n), which is the form of the equation you listed above.

    Waveform invariant filters are popular because they are simple and typically execute faster than bilinear transformed filters.  Also, they do not suffer from frequency warping as the bilinear transformed filters do.  The frequency response for this filter will be exactly -20dB/decade, just like its analog prototype.  But this causes a problem near the Nyquist frequency since the response has not gone all the way to zero at this point.  As a result, you will see some aliasing in your frequency response as you get near the Nyquist frequency which will cause the filter response to flatten out.  This is usually not a big deal, but you should be aware of this none-the-less.

    To answer your second question, the speed filter is usually set to a constant value and left alone for a given application.  By default, I believe we usually set the pole to somewhere around 300 rad/s.  This pole is usually set emperically.  Lower pole values provide better noise rejection (obviously), but limit the possible bandwidth you can obtain from the speed loop.

    Best Regards,

    Dave

     

  • Hi Dave 

    thanks for your reply . 

    Dave (Wisconsin) Wilson said:

    Define the z-domain transfer function of the filter.  Using the values from steps 3 and 4, we get:

                  H(z) = Y(z) / X(z).  After simplifying, we get:  H(z) = k / (z + k - 1), where k = 1 - exp(-T / tau) = beta_Ip_pu

    as you said k = 1 - exp(-T / tau) = beta_Ip_pu . but in the software code beta_lp_pu=  = _IQ(pUserParams->offsetPole_rps/(float_t)pUserParams->ctrlFreq_Hz) .  I think T (the sampling period for the filter ) equal to 1/ctrlFreq_Hz and tau=1/offsetPole_rps . by taylor 1 - exp(-T / tau)=T / tau . Please correct me . 

    another two questions

    1.  I confused about that in your blog and the User's Guide you always talk about a series path topology of a PI controller . But in the software code it's parallel a path topology of a PI controller I think .  The default PID controller parameters is a "rule of thumb"  used  to initialize the Speed PI controllers and  current PI controllers . my question: about the default parameters it's different between  " parallel path topology of a PI controller " and " series  path topology of a PI controller " ,right ?

    2. 

    // compute the Kp gain
    // Scale Kp instead of output to prevent saturation issues
    if(CTRL_getFlag_enableDcBusComp(handle))
    {
    Kp_Id = _IQmpy(Kp_Id,EST_getOneOverDcBus_pu(obj->estHandle));
    }

    In my knowledge ,  if the Vbus goes higher, the Kp will reduce. If Vbus goes lower, the Kp goes higher to compensate for the lower voltage present on the bus for the inverter duty cycle to use.  

    can I replace  EST_getOneOverDcBus_pu with gMotorVars.VdcBus_kV = _IQmpy(gAdcData.dcBus,_IQ(USER_IQ_FULL_SCALE_VOLTAGE_V/1000.0)) ?  if the answer is yes  I think it's possible for me to simulate the effect of the DC bus compensation . can you give some guidance about simulating it ?

    Best Regards,

    fanqiang

  • Hi fanqiang

    I will attempt to answer your questions:

     I think T (the sampling period for the filter ) equal to 1/ctrlFreq_Hz and tau=1/offsetPole_rps . by taylor 1 - exp(-T / tau)=T / tau . Please correct me . 

    ANS:  There are two different filters.  One is used to determine the offset values of the input voltages during initialization.  It has a very large value for tau.  Another one is used to filter the velocity signal during real-time operation.  I'm not sure which one you are talking about.  And no, 1 - exp(-T / tau) is NOT equal to T / tau.  It is only true in the limit when the value (T / tau) approaches zero (i.e., an analog system).

    I confused about that in your blog and the User's Guide you always talk about a series path topology of a PI controller . But in the software code it's parallel a path topology of a PI controller I think .  The default PID controller parameters is a "rule of thumb"  used  to initialize the Speed PI controllers and  current PI controllers . my question: about the default parameters it's different between  " parallel path topology of a PI controller " and " series  path topology of a PI controller " ,right ?

    ANS:  I talk about the series PI controller topology because the tuning values for P and I in a series structure actually mean something, especially for current loop control.  It turns out that InstaSPIN-FOC uses series type controllers for the current loops, but a PARALLEL structure for the speed loop.  Since I did not write the actual code, I really don't have a good explanation why the speed PI controller is different from the current PI structure.  I suspect it has something to do with legacy code that was reused.  The P value stays the same regardless of whether a series or parallel structure is used.  But the I term is different between a series or parallel structure.  Iseries = Iparallel / P.

    In my knowledge ,  if the Vbus goes higher, the Kp will reduce. If Vbus goes lower, the Kp goes higher to compensate for the lower voltage present on the bus for the inverter duty cycle to use.  

    ANS:  Yes, this is true.

    can I replace  EST_getOneOverDcBus_pu with gMotorVars.VdcBus_kV = _IQmpy(gAdcData.dcBus,_IQ(USER_IQ_FULL_SCALE_VOLTAGE_V/1000.0)) ?  if the answer is yes  I think it's possible for me to simulate the effect of the DC bus compensation . can you give some guidance about simulating it ?

    ANS:  I don't think so, but I will defer to those more familiar with the code details since I was not part of the software effort.  With regard to simulating the effect of DC bus compensation, You need to remember that the goal of DC bus compensation is to produce the same "effective" voltage on the motor regardless of bus voltage.  "Effective" voltage is defined is the volt-second product of the PWM signal over each PWM cycle.  So if the bus voltage changes, the PWM on-time pulse must change proportionally to make up for it to yield the same volt-second product.  You can find more information about this in my control system presentation, slides #6 and 7.

    http://e2e.ti.com/group/motor/m/pdf_presentations/665546.aspx

    Best Regards,

    Dave