Teaching Your PI Controller to Behave (Part II)


Dave Wilson, Motion Products Evangelist, Texas Instruments

In my previous blog on this topic, we briefly reviewed the history of the PI controller and presented two forms that are commonly used today.  Regardless of which form you use, the frequency responses look identical.  But for our analysis, let’s focus on the series form of the PI controller as shown below.

If you have ever done a frequency stability analysis of a control system, you probably understand why Ka is so important, since it sets the gain of the PI control loop, which in turn has a pronounced effect on system stability.  But it turns out that the inflection point in the graph (the “zero” frequency) also plays a significant but perhaps more subtle role in the performance of the system.  To understand this, we will need to dive into a little math (hopefully not too much) to derive the transfer function for the PI controller, and understand how the controller’s “zero” plays a role in the overall system response.  We can define the “s-domain” transfer function from the error signal to the controller output as:

                                                                           Equ. 1

From this expression, we can clearly see the pole at s = 0, as well as the zero at s = Kb (rad/sec).  So, why is the value of this zero so important?  To answer this question, let’s drop the PI controller into the heart of a current mode controller which is controlling a motor, as shown below. 

We will use a first-order approximation of the motor winding to be a simple series circuit containing a resistor, an inductor, and a back-EMF voltage source.  Assuming that the back-EMF voltage is a constant for now (since it usually changes slowly with respect to the current), we can define the small-signal transfer function from motor voltage to motor current as:

                                                                                                                                    Equ. 2

If we also assume that the bus voltage and PWM gain scaling are included in the Ka term, we can now define the “loop gain” as the product of the PI controller transfer function and the V-to-I transfer function of the RL circuit:

                               Equ. 3

To find the total system response (closed-loop gain), we must use the following expression which you probably remember from your college control systems class:

     assuming that the feedback gain H(s) = 1.                                         Equ. 4

Substituting equation 3 into equation 4 yields:

                                                         Equ. 5

I realize the expression is getting bigger instead of smaller, but don’t freak out just yet.  With a little bit of algebraic prowess, we can reduce this expression to the following:

                                                Equ. 6

The denominator is a second order expression in “s” which means there are two poles in the transfer function.  If we are not careful with how we select Ka and Kb, we can easily end up with complex poles (Yuck!)  Depending on how close those complex poles are to the jw axis, our system could have some really nasty resonant peaks.  So let’s assume right away that we want to select Ka and Kb in such a way as to avoid complex poles.  In other words, can we put the denominator in factored form so that it looks like this:

                Equ. 7

where C and D are real numbers.

If we multiply out the expression on the right side of the equation, and compare the results with the left side of the equation, we see that in order to obtain real poles, the following conditions must be satisfied:

                                                                                                                                  Equ. 8

and,

                                                                                                            Equ. 9

As a first attempt to solve equations 8 and 9, let’s simply equate the terms on both sides of equation 9.  In other words,

                                                                                                   Equ. 10

The reason I recommended these substitutions will now become clear.  If we replace the denominator of equation 6 with its factored equivalent expression as shown in equation 7, and then make the substitutions recommended in equation 10, we get the following:

                                                                                      Equ. 11

Notice anything interesting about this expression?  It turns out that the “D” substitution results in a pole which cancels out the zero in the closed-loop gain expression!  By choosing C and D correctly, we not only end up with real poles, but we can create a closed-loop system response that has only ONE real pole and NO zeros!  No peaky frequency responses or resonant conditions!  Just a beautiful single-pole low-pass roll off response!

But wait…there’s more!  (At this point I feel like an announcer for a cheap infomercial!)  By substituting the expressions for C and D recommended in equation 10 back into equation 8, we get the following equality:

                                                                                                                                                      Equ. 12

Recall that Kb is the frequency at which the controller zero occurs.  So in order to get the response described in equation 11, all we have to do is to set Kb (the controller zero frequency) to be equal to the pole of the plant it is controlling!

So, now that we know how to set Kb, what about Ka?  Let’s rewrite the closed-loop system response G(s), making all of the substitutions we have discussed up to now, and see what we get:

                                     Equ. 13

So we see that Ka directly sets the bandwidth of the control system which is scaled by the motor’s inductance.  It turns out that numerically, Ka equals the inductive impedance at whatever the bandwidth cutoff frequency is.

In summary, what have we learned?  Even if you didn’t follow all the math, there are some simple rules you can use to help you design your PI controller for your current loop:

1.  Kb sets the zero of the PI controller.  When controlling a plant parameter with only one real pole in its transfer function (e.g., the current in a motor), Kb should be set to the value of this pole.  Doing so will result in pole/zero cancellation, and create a closed-loop response that also only has a single real pole.  If the PI controller is part of a larger control loop, Kb is not visible to the outside world since it is only used for pole-zero cancellation within the PI control loop itself.

2.  Ka sets the BANDWIDTH of the closed-loop system response.  As seen by equation 13, the higher Ka is, the higher the current loop bandwidth will be.  We will discuss how to select an appropriate bandwidth in a later blog.

<Whew!>  I think I blew out enough brain cells for one blog.  I realize that this got a little “mathy,” but hopefully you could follow along with my equations.  More importantly, I hope you understand what these equations are trying to tell you about how to design your PI current control loop.  In my next blog, I want to discuss how to design a cascaded PI velocity loop which contains a PI current controller within it.  In the meantime…

Keep Those Motors Spinning,

www.ti.com/motorblog

 

 

 

 

 

 

 

 

 

 

  • Thank you for this post, It helped me to understand PI controller much better way.

  • equation 1,  wouldn't the pole a negative value?:

    KaKb(1+s/Kb) = 0

    KaKb + Ka*s = 0

    s= -KaKb/ka

    s= -Kb

    not sure if this makes any difference or not to your analysis.. i'm still on step 1, slowly going through in detail to learn  

  • Hello High Hopes,

    Technically you are correct.  The zero is a real number on the negative real axis of the s-plane, as your equation derivation shows.  I am guilty of numerical shorthand since I am only interested in the steady-state effect of this zero on the jw axis.

    On a 3-dimensional s-domain plot where the z-axis is amplitude, the zero looks like a funnel located at s = (-Kb, j0).  If you take a slice of this 3D plot along the jw axis (0, jw,z), you will get the frequency response of the system, as illustrated in my first figure.  As you can see, a zero at (-Kb, j0) causes a positive 20dB/decade inflection in the frequency response at a POSITIVE frequency equal to +Kb rad/sec.  That's why I (and many others) typically refer to poles and zeros as positive frequency values, even though they are located in the negative (left half) side of the s-plane.

    -Dave

  • Hello  Mr. Dave,

         Are there any difference, if I use the incremental form of PI regulator.

         I mean the output of the PI regulator is not the final output U(k),  just the increment deta_U refers to the last time output U(k-1), so the U(k) = U(k-1)+deta_U.

         Thanks!

    Eli

  • Hello Eli,

    Thanks for your question.  Unfortunately, I am not aware of the "incremental form" of the PI controller.  From your equation, it looks like you are simply calculating a delta output voltage and then adding it to the previous output voltage.  Could you provide more information on what the entire difference equation looks like, including how the delta output voltage is calculated?

    Thanks,

    Dave

  • Hello Mr.Dave

    Thanks for your post. I am building my own motor control system now, and in order to eliminate noise, the phase A\B current sample signals go through a 2nd-order Butterworth lowpass filter before going to DSP. Would this filter change the way of designing the current PI, cause I assume it adds a two pole transfer function into the current control loop which changes the forrmer unit feedback loop into a more complex one.

    Thanks!

    Mat

  • Thanks for you teaching, great useful.

  • sir, i can't find part III of Teaching Your PI Controller to Behave.

  • Thank You, Sir,

    This Post is very nice.

    Ashutosh

  • Hello Dave,

    I want to convert Kp/Ki to PU, but I do not how to do it.

    Can you give me some advice?

    Thanks!