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.

PID controller for current Loop - Why is it just PI and not PID?

I noticed that the default PID loop code for Current loop as well as Speed loop is called PID but only the P term and I term are used in all the Instaspin labs. Is there a reason why the D term was not used or deemed not necessary? Anyone had trouble tuning it with just the P and I?

I can imagine the D-term not being necessary for motors with very high inductance because the current cant rise fast enough anyways. But for very low inductance motors, I am having trouble tuning the current controller. The current controller is basic and deep down in instaspin. There is no spintac for that, the spintac is only for speed controller and position controller. I followed the steps in lab 5A and the waveform looks good for small currents but for higher current commands the overshoot/ringing is very high, it doesn't nocely get to the commanded current, the ringing is of the order of 200% of the commanded current. So, I think the D-term is what we are missing in the current controller code. 

Any comments? 

  • Hi Subrat Nayak,

    Theoretically, from a stability analysis of a field oriented control system, you don't need the D-term.  If you look at the phase plots of the current controller, you have 90 degrees of phase margin already without the D term, which represents an overdamped system.  Since the D term can result in a "glitchy" control system, we usually leave it set to zero.  You can find out more information about this from my blog series on this topic:

    https://e2e.ti.com/blogs_/b/motordrivecontrol/archive/2015/07/20/teaching-your-pi-controller-to-behave-part-i

    However, this conclusion is based on a small-signal linear analysis.  Once you include sampling effects, you start to see an erosion of your phase margin due to the sample-and-hold delays associated with the sampling process.  In such a case, adding a D term might be helpful for your phase margin, but it may make your system response more noisy.  The best way to deal with this effect in my opinion is to increase your sampling frequency so that you get less than 45 degrees of phase margin erosion from the sample-and-hold delays at your 0 dB frequency.  This of course means that you should also increase your PWM frequency.  For low inductance motors, we have run the PWM frequency up to about 50 kHz in the past, with good results.

    Please let me know if you have any other questions...

    Regards,

    Dave

     

  • From the description it seems like the current loop for the low inductance motor at higher current command has low phase margin (higher ringing/overshoot). Increasing the sampling frequency, as Dave suggested, will improve the phase margin erosion caused by the sampling and calculation delay, and so the overshoot is reduced.  

    In this case another approach can be to use a 2 pole- 2 zero controller format (K, fz1, fz2, fp1, fp2) instead of a PI/PID. Then reduce the frequency of the low frequency zero fz1 (in frequency domain this is usually placed below the loop crossover point in order to maintain good phase margin) to achieve higher phase margin and then adjust/lower the high frequency pole (fp2) to maintain good gain margin. The low freq pole fp1 will be at zero freq (integrator). The other zero (fz2) can be at a freq lower than fp2 (or even lower than the crossover frequency) if additional phase lift is needed at the crossover point. Otherwise fz2 can be placed at a frequency higher than fp2.

    Shamim

  • I am running my pwm at 60khz. Even at 60 khz, the current waveforms aren't smooth. I probably need 120khz or some thing high, which is going to increase my switching losses and i may even damage my controller but I am down to try that at some point.

    As of now, though its not smooth, when i zoom in on current waveforms, its a typical ramp up and ramp down for an inductive circuit, the motor is still controllable. 

    My problem is that when I enter a big difference in current command, lets say from 10% to 50%, the current controller does its best and manages to over shoot so the instantaneous currents get as high as 200% which is not safe for my controller design so It's hitting the TripZone on the processor and shuts down pwm.

    I think the D-Term may help reduce such huge over shoot. My P-term may be little too aggressive.  

    Has anyone tried a D-term on the current controller on a motor controller and motor?

     

  • Hi Shamim, my pwm freq is already at 60khz and i am sampling at 10khz. I could increase it to 20khz sampling rate ie 20khz current control loop.

    As far as the controller, Have you implemented such a controller on a real hardware or just suggesting it based on theoretical analysis?
  • I have not tried using the D-term, so I really couldn't tell you what the effect might be.  I would start out with a small value for D at first and see if you observe an incremental improvement in overshoot.  But also watch your system noise, since the D path in a PID controller is essentially a high-pass filter.

    Alternatively, you may want to reduce the bandwidth of the current controller by reducing the default value of P.  Incidentally, the bandwidth for a series PI controller like what we use to control current is equal to P/Ls (in rad/sec).  So if you can't move the sampling frequency up and out of the way of your current controller bandwidth, you may have to lower the current controller's bandwidth.

    Another possible solution would be to slew-limit your Iq_ref variable.  Since the current controller cannot respond instantaneously to a step transient anyway, then why allow the input signal to have these extra high frequency components?  All of the high frequency harmonics in a step function input which are above the current controller bandwidth only serve to increase the integrated error, which must be dumped at a later time in the form of overshoot.

    Finally, InstaSPIN-FOC uses static integrator clamping.  I highly recommend dynamic integrator clamping, which can significantly reduce overshoot.  This topic is also discussed in my blog series on PI controllers.

    Regards,

    Dave

     

  • Subrat,

    If your PWM is 60kHz, can you run the sampling loop at the same frequency? For faster loop bandwidth (current control loop bandwidth) this will improve the phase margin.

    About the controller I mentioned , I do it all the time for power supply control loop. Depending on the power supply power stage model (current loop or voltage loop) we implemented and tested many types of controllers: PI, PID, 2p2z with real zeros, 3p3z with real zeros, 2p2z with complex pair of zeros, 3p3z with complex pole-zero pair. You can look at a few of my application reports related to this:

    TI Application Reports

    tidu249.pdf (page 19-20), tidu405 (page 12), spraab3, slua416

    Shamim