None W08A_Control_RootLocus_Steps1thru5

Challenge

In this notebook, your challenge is to expand your tool set for sketching root locus plots to answer a very important question:

DOES the system ever go unstable for a positive root locus gain $K$, and if so, what gain $K$ will make the system go unstable?

The answer to this question improves the usefulness of the root locus for us-- as we design a controller that gives us behavior we like, it is critical to know whether and if we expect our system to go unstable under closed loop control. If we do suspect that our system can go unstable, knowing how close our design is to that stability limit is very valuable.

In the following sections, we will explore how we might answer this question.

Root Locus Sketching: Step 5

To reiterate, we're talking about drawing the root locus of this system:

Which has the closed loop transfer function $G_{cl}(s) = \frac{y(s)}{r(s)}=\frac{KG}{1+KGH}$.

The step we'll cover in this notebook is:

  • (5) If you suspect that the root locus crosses into the right half of the s-plane (based on the asymptote angles), calculate the crossing frequency (where the system crosses into unstable territory) and critical gain (gain that makes this happen) using the closed loop characteristic equation. Plug the point $s=s_{crossing}=j\omega_{crossing}$ into the open loop transfer function $G(s)H(s)$ to find the value of $K=K_{critical}$ that will result in an unstable system.

Example

Let's revisit the system we looked at for Monday's assignment:

$$G(s)H(s) =\frac{10}{(s+1)(s+2)(s+3)}$$

Our first for steps from this example are reproduced from Monday's assignment below:

Step 1

We find that $1+\frac{1}{(s+1)(s+2)(s+3)}=0$

Step 2

We can then write $\frac{-1}{K} = \frac{1}{(s+1)(s+2)(s+3)}$

Step 3

Now, we'd like to find segments of the root locus that lie on the real axis and show them on our sketch. First, let's plot the open loop poles and zeros:

Now, we sketch the root locus as being on the real axis wherever we find an odd number of poles and zeros of $G(s)H(s)$ to the right of that portion of the real axis as follows:

Step 4

Now our job is to find asymptotes, their intersection point, and their angles. We know that the two branches that started at s=-1 and s=-2 can't stay on the real axis forever... there are no zeros, so the number of asymptotes we expect from the plot is

$$a = n-m=3-0$$

So we need to find 3 asymptotes. It looks like we've already found 1 of them using step 3... to the left of s=-3, there are always 3 open loop poles to our right, so the root locus is always on the root locus there. But what happens to the two branches that originated at s=-1 and s=-2? They must somehow go to to infinity on the complex plane, and they'll do this by "breaking away" from the real axis somewhere between -2 and -1. The angles of the 3 asymptotes for our system are given by:

$$\theta_a = \frac{2k+1}{n-m}\pi$$

Which we evaluate for k=0, 1, and 2. This gives us the following three asymptote angles:

For k = 0, we get: $$\theta_1 = \frac{1}{3}\pi$$

For k=1, we get: $$\theta_2 = \frac{3}{3}\pi$$

And for k=2, we get: $$\theta_3 = \frac{5}{3}\pi$$

These asymptotes all meet at one place on the real axis. This place is found by computing:

$$\sigma_a = \frac{\sum poles -\sum zeros}{n-m} = \frac{(-1)(-2)(-3)}{3} = -2$$

So the asymptotes are at $60^\circ$, $180^\circ$ (which we alreaday found using step 3), and $300^\circ$, and they meet at $s=-2$. Let's draw these asymptotes on our root locus sketch:

Now, we know that the locus has to "break away" from the real axis to approach these asymptotes, and that it must do this between s=-1 and s=-2 somewhere. There is a manual method that can be used to accomplish this, but we will not cover it in this course. For getting a general idea of the root locus shape, it is not needed; simply draw the root locus breaking away and/or in to the real axis where appropriate given the information you have from Step 3. Note that the root locus will always enter and leave the real axis perpendicularly.

So this concludes our sketch. Let's use Octave to check our work, as usual.

In [1]:
s = tf('s');

GH = 1/((s+1)*(s+2)*(s+3))
rlocus(GH)
Transfer function 'GH' from input 'u1' to output ...

                1           
 y1:  ----------------------
      s^3 + 6 s^2 + 11 s + 6

Continuous-time model.
                                                                                                                           
                                                            Root Locus of GH                                               
                                                                                                                           
                  |----------------------------------------------------------------------------------------------------|   
                  |       +                  +                  +                   +          +----------------**&---+|   
                  |       *                  *                  *                   *          |###?###asymptote&&    ||   
                  |       *                  *                  *                   *          |%%%?%%%locus*&&&      ||   
                2 |-+**************************************************************************+---B---open loop poles+|   
                  |       *                  *                  *                   *                *** &&&           |   
                  |       *                  *                  *                   *              **  &&              |   
                  |       *                  *                  *                   *           ***  &&*               |   
                1 |-+******************************************************************************&&&***************+-|   
                  |       *                  *                  *                   *      ***   &&&   *               |   
                  |       *                  *                  *                   *   ***     &&     *               |   
                  |       *                  *                  *                   * **       &&      *               |   
                0 |####%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%B###################B@@@@@@@@@@&&&&&&&&B*************+-|   
                  |       *                  *                  *                   *   $$     @       *               |   
                  |       *                  *                  *                   *     $$$  @@      *               |   
                  |       *                  *                  *                   *        $$ @@     *               |   
                  |       *                  *                  *                   *          $$@@@   *               |   
               -1 |-+*****************************************************************************$@@@***************+-|   
                  |       *                  *                  *                   *               $@@*               |   
                  |       *                  *                  *                   *                 $@@              |   
                  |       *                  *                  *                   *                  * @@@           |   
               -2 |-+**************************************************************************************@@@*******+-|   
                  |       *                  *                  *                   *                  *     @@@       |   
                  |       *                  *                  *                   *                  *        @@     |   
                  |       +                  +                  +                   +                  +          @    |   
                  |----------------------------------------------------------------------------------------------------|   
                         -5                 -4                 -3                  -2                 -1                   
                                                     Real Axis     gain = [0, 28.5]                                        
                                                                                                                           

The thing that I asked you to notice on Monday about this system's root locus "eventually going unstable" is the focus of Step 5, which we will cover next.

Step 5: If you suspect that the root locus crosses into the right half of the s-plane, find out where and how

If the real part of an eigenvalue is positive, it means that the system will have a response whose magnitude increases exponentially, rather than decays exponentially. A system exhibiting this type of behavior is NOT BIBO stable. Therefore, the entire region to the right of the origin is unstable.

.

The root locus plot generated in the code cell above shows that at some value of $K$, the system will go unstable. This is BAD. Especially if you've approximated a $3^{rd}$ order system as a lower-order system, you may find yourself "unintentionally" crossing into unstable territory if you use a very high-gain or "stiff" controller. Let's unpack step 6 just a little by breaking it into two parts:

5a. If you suspect that the root locus crosses into the right half of the s-plane, (based on the asymptote angles)

5b. Find out where and how by calculating the crossing frequency (where the system crosses into unstable territory) and critical gain (gain that makes this happen) using the closed loop characteristic equation.

5a asks us to use our intuition to determine whether the system will ever go unstable. This is easier than it sounds. By plotting asymptotes in Step 4, we can see whether the asymptotes themselves cross into the right half of the s-plane. If they do, then we should suspect that eventually, our system goes unstable. Mathematically, "going unstable" means that at least one of (or more commonly, a complex conjugate pair of) the closed-loop eigenvalues will cross into the right half of the s-plane. We know that for this to happen, the real component of the "crossing" eigenvalue will be 0. This leads us to say that while we don't know exactly where the cross happens, we can write the value of $s$ where the system crosses into the unstable region.

Using the generalized form of a complex number in Cartesian Form to represent an eigenvalue:

$$s = \sigma + j\omega$$

The eigenvalue where the root locus cross the imaginary axis ($\sigma = 0$) is

$$s_{crossing}=j\omega_{crossing}$$

To solve for where this point is, exactly (in other words, what is $\omega_{crossing}$?), we can do the following:

  1. Substitute $s_{crossing} = j\omega_{crossing}$ into our closed loop characteristic equation $1+KG(s)H(s)=0$.
  1. Because we know that since $s_{crossing}$ is on the root locus, $\angle \left. G(s)H(s)\right|_{s=s_{crossing}}=\pm 180^\circ$
  1. The $K$ that generates the eigenvalue $s_{crossing}$ is called the "critical gain" ($K_{crit}$) and can be used in the characteristic equation: $1+\left.K_{crit}G(s)H(s)\right|_{s=j\omega_{crossing}}=0$, where $K_{crit}$ and $j\omega_{crossing}$ are both unknown.
  1. Because $G(s)H(s)$ has real and imaginary components, we will be able to solve for both $K$ and $\omega_{crossing}$.

This will allow us to find both where $s_{crossing}=j\omega_{crossing}$ is located, and the critical gain factor $K_{crit}$ that makes the system go unstable.

Example

Let's keep working with the example above, with:

$$G(s)H(s) =\frac{10}{(s+1)(s+2)(s+3)} = \frac{10}{s^3+6s^2+11s+6}$$

Now, we know that we can write our characteristic equation evaluated at the critical gain $K_{crit}$ and crossing point $s_{crossing}=j\omega_{crossing}$ as:

$$1+\left.K_{crossing}G(s)H(s)\right|_{s=j\omega_{crossing}}=0$$

Substituting our "open loop transfer function" in, and clearing fractions, we get:

$$s^3+6s^2+11s+6+10K = 0$$

Now, substituting $K=K_{crit}$ and $s = j\omega_{crossing}$ into this equation, we get:

$$(j\omega_{crossing})^3+6(j\omega_{crossing})^2+11(j\omega_{crossing})+6 +10K_{crit}=0$$

Collecting real and imaginary terms here gives us:

$$j(-\omega_{crossing}^3+11\omega_{crossing})+6(1-\omega_{crossing}^2)+10K_{crit}=0$$

We can write the real and imaginary parts of this equation as two separate equations as follows:

Real: $$ 6(1-\omega_{crossing}^2)+10K_{crit}=0$$ Imaginary: $$ j(-\omega_{crossing}^3+11\omega_{crossing})=0$$

Now, we have two equations and two unknowns. We can find $\omega_{crossing}$ from the imaginary part of the equation, since $K_{crit}$ doesn't appear as $\omega_{crossing} = 0,\sqrt{11}$. We know that $\omega_{crossing}=0$ is a point on the real axis that we already know is not part of the root locus, so we throw this solution out to find $\omega_{crossing}=\sqrt{11}$. Then, substituting this back into the real part of our characteristic equation tells us:

$$6(1-11)+10K_{crit}=0$$

Which gives us $K_{crit}=6$. Now we know the maximum value of K that will keep our system stable! That's very, very powerful. This is is fairly easy to check using the root locus functionality in Octave, as shown below, where we will plot our crossover point on the root locus plot that octave generates by finding the roots of our characteristic equation at the critical gain we calculated.

In [2]:
s = tf('s');

%set up the open loop TF
GH = 10/((s+1)*(s+2)*(s+3))
%plot the root locus, set hold on
rlocus(GH,.01,0,6)
hold on 

%now calculate our eigenvalues at our calculated critical gain so we can see if we were right!
Kcrit = 6;%this is what we calculated by hand
%compute closed loop TF
Gcl = minreal(Kcrit*GH/(1+Kcrit*GH));
%pull out the denominator
[num,den] = tfdata(Gcl,'v');
%find the roots of the characteristic equation
myroots = roots(den);

%plot those roots on our root locus plot
plot(real(myroots),imag(myroots),'c.','MarkerSize',30)%make them huge so we can see them!
Transfer function 'GH' from input 'u1' to output ...

                10          
 y1:  ----------------------
      s^3 + 6 s^2 + 11 s + 6

Continuous-time model.
                                                                                                                           
                                                            Root Locus of GH                                               
                                                                                                                           
                  |----------------------------------------------------------------------------------------------------|   
                  |    +              +              +              +               +          +----------------**&---+|   
                3 |-+**************************************************************************|###?###asymptot&&&   +||   
                  |    *              *              *              *               *          |%%%?%%%locus*&&&      ||   
                  |    *              *              *              *               *          +---B---open loop poles+|   
                  |    *              *              *              *               *              *  **&&&       *    |   
                2 |-+*********************************************************************************&&&************+-|   
                  |    *              *              *              *               *           ***&&&&           *    |   
                  |    *              *              *              *               *         ** &&&              *    |   
                1 |-+***************************************************************************&&*******************+-|   
                  |    *              *              *              *               *   ***   &&   *              *    |   
                  |    *              *              *              *               * **     &&    *              *    |   
                0 |####%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%B###############B@@@@@@@@&&&&&&B*****************+-|   
                  |    *              *              *              *               *   $$$  @     *              *    |   
                  |    *              *              *              *               *      $$@@    *              *    |   
                  |    *              *              *              *               *        $@@   *              *    |   
               -1 |-+***************************************************************************@@*******************+-|   
                  |    *              *              *              *               *            @@@              *    |   
                  |    *              *              *              *               *              @@@@           *    |   
               -2 |-+*********************************************************************************@@@************+-|   
                  |    *              *              *              *               *              *    @@@$      *    |   
                  |    *              *              *              *               *              *      @@@@    *    |   
                  |    *              *              *              *               *              *         @@@$ *    |   
               -3 |-+******************************************************************************************@@@$**+-|   
                  |    +              +              +              +               +              +              @$   |   
                  |----------------------------------------------------------------------------------------------------|   
                      -6             -5             -4             -3              -2             -1              0        
                                                    Real Axis     gain = [0, 5.98998]                                      
                                                                                                                           
                                                                                                                           
                                                            Root Locus of GH                                               
                                                                                                                           
                  |----------------------------------------------------------------------------------------------------|   
                  |    +              +              +              +               +          +----------------**&---+|   
                3 |-+**************************************************************************|###?###asymptot&&&   +||   
                  |    *              *              *              *               *          |%%%?%%%locus*&&&      ||   
                  |    *              *              *              *               *          +---B---open loop poles+|   
                  |    *              *              *              *               *              *  **&&&       *    |   
                2 |-+*********************************************************************************&&&************+-|   
                  |    *              *              *              *               *           ***&&&&           *    |   
                  |    *              *              *              *               *         ** &&&              *    |   
                1 |-+***************************************************************************&&*******************+-|   
                  |    *              *              *              *               *   ***   &&   *              *    |   
                  |    *              *              *              *               * **     &&    *              *    |   
                0 |####%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%B###############B@@@@@@@@&&&&&&B*****************+-|   
                  |    *              *              *              *               *   $$$  @     *              *    |   
                  |    *              *              *              *               *      $$@@    *              *    |   
                  |    *              *              *              *               *        $@@   *              *    |   
               -1 |-+***************************************************************************@@*******************+-|   
                  |    *              *              *              *               *            @@@              *    |   
                  |    *              *              *              *               *              @@@@           *    |   
               -2 |-+*********************************************************************************@@@************+-|   
                  |    *              *              *              *               *              *    @@@$      *    |   
                  |    *              *              *              *               *              *      @@@@    *    |   
                  |    *              *              *              *               *              *         @@@$ *    |   
               -3 |-+******************************************************************************************@@@$**+-|   
                  |    +              +              +              +               +              +              @$   |   
                  |----------------------------------------------------------------------------------------------------|   
                      -6             -5             -4             -3              -2             -1              0        
                                                    Real Axis     gain = [0, 5.98998]                                      
                                                                                                                           
                                                                                                                           
                                                            Root Locus of GH                                               
                                                                                                                           
                  |----------------------------------------------------------------------------------------------------|   
                  |    +              +              +              +               +          +----------------**G---+|   
                3 |-+##########################################################################|###?###asymptot&&&   +||   
                  |    #              #              #              #               #          |%%%?%%%locus*&&&      ||   
                  |    #              #              #              #               #          +---B---open loop poles+|   
                  |    #              #              #              #               #              #  **&&&       #    |   
                2 |-+##############################################################################***&&&############+-|   
                  |    #              #              #              #               #           ***&&&&           #    |   
                  |    #              #              #              #               #         ** &&&              #    |   
                1 |-+######################################################################***##&&###################+-|   
                  |    #              #              #              #               #   ***   &&   #              #    |   
                  |    #              #              #              #               # **     &&    #              #    |   
                0 |####G%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%B###############B@@@@@@@@&&&&&&B#################+-|   
                  |    #              #              #              #               #   $$$  @     #              #    |   
                  |    #              #              #              #               #      $$@@    #              #    |   
                  |    #              #              #              #               #        $@@   #              #    |   
               -1 |-+###########################################################################@@###################+-|   
                  |    #              #              #              #               #            @@@              #    |   
                  |    #              #              #              #               #              @@@@           #    |   
               -2 |-+#################################################################################@@@############+-|   
                  |    #              #              #              #               #              #    @@@$      #    |   
                  |    #              #              #              #               #              #      @@@@    #    |   
                  |    #              #              #              #               #              #         @@@$ #    |   
               -3 |-+##########################################################################################@@@$##+-|   
                  |    +              +              +              +               +              +              G$   |   
                  |----------------------------------------------------------------------------------------------------|   
                      -6             -5             -4             -3              -2             -1              0        
                                                    Real Axis     gain = [0, 5.98998]                                      
                                                                                                                           

As you can see, we were spot on! The system does indeed cross over into the unstable region of the s-plane right when $K=6$. It is worth noting that you can also do this an even easier way using MATLAB by using the "data cursor." You cannot do this in Jupyter, but if you open MATLAB and plot a root locus, you can click on the "data cursor" button to get information about a root locus. An example of this for the system we're discussing is shown below, which also confirms our suspicions about the crossing point and the critical gain.

image.png

hint: to get the most precision out of your data cursor in MATLAB, right click, select "selection style," and select "mouse position."

Disciplined Process: Steps 1-5 of sketching the root locus

  1. Find the Closed loop characteristic equation for your system: $$1+KG(s)H(s)=0$$
  2. Write the Closed loop characteristic equation as $$\frac{-1}{K}=G(s)H(s)$$
  3. Plot the poles and zeros of $G(s)H(s)$ on the s-plane. Identify any segments of the R.L. on the real axis: the root locus lies on a portion of the root locus if and only if an odd number of "open loop" poles and zeros (poles and zeros of $G(s)H(s)$ are to the right of that portion of the real axis.
  4. Identify the angle(s) of any asymptotes and the point on the real axis where the asymptotes intersect: $$\sigma_a = \frac{\sum poles -\sum zeros}{n-m}$$ $$\theta_a = \frac{2k+1}{n-m}\pi$$
  5. If you suspect that the root locus crosses into the right half of the s-plane (based on the asymptote angles), calculate the crossing frequency (where the system crosses into unstable territory) and critical gain (gain that makes this happen) using the closed loop characteristic equation. Plug in the point $s=s_{crossing}=j\omega_{crossing}$ into the open loop transfer function $G(s)H(s)$ to find the value of $K=K_{critical}$ that will result in an unstable system.

Finally, use the asymptotes to sketch each branch (one per pole of $G(s)H(s)$) of your system's root locus, noting that each pole of the closed loop system will begin at one of the poles of $G(s)H(s)$ and terminate at either a zero of $G(s)H(s)$ or at infinity. Approximate any break-in or break-out points using the real axis rule (step 3).

Exercises for steps 1-5 of root locus sketching: Due Monday, October 25 by MIDNIGHT.

Sketch the root locus for the following "open loop transfer functions" $G(s)H(s)$ using steps 1 through 5 of the sketching rules. Find the crossing point and critical gain for each system if applicable. Include all hand calculations and your hand-sketch. You may check your work using Octave in the provided code cells.

Exercise 1

$$G(s)H(s) = \frac{s+20}{(s^2+20s+250)(s+1)(s+2)}$$

YOUR ANSWER HERE

In [3]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!

Exercise 2

$$G(s)H(s) = \frac{s+10}{(s^2+20s+250)}$$

YOUR ANSWER HERE

In [4]:
% YOUR CODE HERE
error('No Answer Given!')
error: No Answer Given!
In [ ]: