None W07A_Control_ComplexPlane_RootLocusFundamentals

Challenge

In the next few weeks, your challenge is to learn to use a new tool that will allow us to design P, PD, PI, and PID controllers for higher (>2nd) order systems. While the "direct method" gives us a methodology to manipulate a system's characteristic equation, it falls apart when the plant transfer function and/or sensor transfer function produce a system that is higher than second order. Consider, for instance, attempting to control the following plant using P, PD, or PI control:

$$\frac{y(s)}{u(s)}=P(s)=\frac{10}{s^3+2s^2+s+10}$$

Would you know how to choose gains to hit a target $\zeta$ and $\omega_n$? If you're not sure, try computing the closed loop transfer function and examining its characteristic equation!

While we would have a hard time with understanding this system's CLTF by inspection, we can use the characteristic equation in the development of a new tool that will allow us to plot how the closed-loop eigenvalues of our system vary when our controller gains change. What are the closed-loop eigenvalues? As it turns out, when we haved designed a controller to particular performance specification, like $\zeta$, we have been implicitly setting a goal for the system's closed loop eigenvalues. The new tool we will need is called the Root Locus, which is fancy for "a plot on the complex plane that shows how changing my control gains change the closed loop eigenvalues."

Before we can talk about the Root Locus, we should develop some understanding of how to interprest a system's eigenvalues graphically by plotting them on the "s-plane."

Graphical interpretation of linear system behavior

The keys to understanding a linear system's behavior are:

  1. The system's eigenvalues, which govern its transient behavior
  2. The system's zeros, which govern its transient response to an input's derivative(s)
  3. The system's steady state gain, which governs its steady-state response to an input

Focusing on transient behavior, we learned from the study of linear differential equations that a system's eigenvalues come in two "flavors:"

  1. A real number $p = -a = \frac{-1}{\tau}$, which contributes a term $Ce^{-at}$ to the system's homogeneous response.
  2. A complex conjugate pair $p = -\zeta\omega_n \pm \omega_d j$, which contributes a sinusoidal term $Ce^{-\zeta \omega_n t}\sin(\omega_dt + \phi)$ to the system's homogeneous response.

By the principle of superposition, all higher-order systems can be broken down into first or second order "pieces," which contribute to the system's overall behavior. This is often accomplished when a system is in transfer function form using a technique like the partial fraction decomposition. The smaller the magnitude of the real part of a pole is, the longer that behavior will take to get to steady state. If a higher-order system has a pole (or complex conjugate pair of poles) that is much slower than the others, we say that this pole (or pair) is dominant.

As the number of poles in a system increases, it becomes more and more difficult to understand the system's behavior. To combat this, it is often convenient to plot all of the system's eigenvalues on the complex plane (usually with an 'x' marker), where an eigenvalue's real part is plotted on the x-axis, and its imaginary component on the y-axis. This allows us to quickly ascertain whether the system is stable, whether and how oscillatory it may be, and if necessary, what a particular eigenvalue's quantitative response will be. This is summarized in the plot below.

Interpretation of eigenvalues in the complex plane

image-3.png

While it is powerful to be able to interpret an existing system's behavior using the S-plane, determining how a system's eigenvalues move on the plane when subjected to different controller designs requires that we become proficient with manipulating complex numbers in addition to interpreting them! Some basics are provided in the next section.

Complex Numbers

In general, the Laplace variable $s$ is a complex number with both real and imaginary components. Up until this point in the course, we have usually only discussed particular values of the number "s" when it is either a pole or a zero of a transfer function. However, there is an entire s-plane out there, and "s" can in theory be anywhere on that plane. We often write a generalized complex number in Cartesian Form as:

\begin{equation} s = \sigma + j\omega \end{equation}

Remember that $j$ is defined as $j=\sqrt{-1}$.

We often draw complex numbers on the so-called "complex plane" as vectors, with a real part and an imaginary part.

While imaginary numbers are often plotted like vectors, they are not quite vectors. Adding them and subtracting them might make one think that all rules of vector manipulation apply, but imaginary numbers multiply and divide "normally," whereas vectors do not (they have dot and cross products defined, which are different than algebraic multiplication and/or division). A selection of important properties of complex numbers are listed below:

  1. To add complex numbers, simply add the real and imaginary components, or use "head to tail" graphical vector addition as shown in the figure above for $s_3=s_1+s_2$.
  2. To subtract complex numbers, simply subtract the real and imaginary parts of one complex number from those of the other, or use "head to head" graphical vector subtraction as shown in the figure above for $s_4=s_1-s_2$.
  3. There is no cross product and no dot product for complex numbers. To multiply complex numbers, simply "FOIL" or distribute imaginary and real components. For example, to compute $s_5 = s_1s_2$, one would compute $s_5 = (-3+2j)(1+3j)=(-3)(1)+(-3)(3j)+(2j)(1)+(2j)(3j)=-3-9j+2j-6=-9+7j$.
  4. It is possible to divide complex numbers, which is another difference between them and 'true' vectors. This is also done algebraically. Often, if the vector is in Cartesian form, it is easiest to multiply the resulting fraction by the denominator's complex conjugate. For example, to compute $s_6 =\frac{s_1}{s_2}$, one might compute: $s_6 = \frac{-3+2j}{1+3j}\frac{1-3j}{1-3j}=\frac{1}{10}(3+11j)$.

Note that MATLAB/Octave can help you compute addition, subtraction, multiplication, and division of complex numbers. MATLAB uses $i$ to denote a complex number rather than $j$ when it displays complex numbers, but it allows you to input $j$ for the complex number if you wish. MATLAB also allows you to extract the real and imaginary components from any complex number. Some examples are shown below.

In [1]:
clear all
%define our complex numbers s1 and s2
s1 = -3+2j
s2 = 1+3j
%addition and subtraction
s3 = s1+s2
s4 = s1-s2
%multiplication and division
s5 = s1*s2
s6 = s1/s2
%extract the real component from a complex number
s5_real = real(s5)
%extract the imaginary component from a complex number
s5_imag = imag(s5)
s1 = -3 + 2i
s2 =  1 + 3i
s3 = -2 + 5i
s4 = -4 - 1i
s5 = -9 - 7i
s6 =  0.30000 + 1.10000i
s5_real = -9
s5_imag = -7

Alternate forms of complex numbers

While it is convenient and familiar to represent complex numbers in Cartesian form as shown above, sometimes it is even more convenient to look at and manipulate complex numbers in either Polar From or Exponential Form.

Polar Form

Every complex number has both a magnitude and a direction, just like a vector. To write a vector in polar form, we write:

$$ s_1 = \sigma_1+j\omega_1 = \left|s_1\right|\angle(s_1)$$

The magnitude of $s_1$ is computed using the Pythagorean Theorem to find the length of the arrow from the origin of the complex plane to the point $s_1$.

$$\left|s_1\right| = \sqrt{\sigma_1^2 + \omega_1^2}$$

The angle of $s_1$ is computed by using the arctangent to find the angle that the line going from the origin of the complex plane to the point $_1$ makes with the real axis. Be careful here-- if your calculator does not have a 4-quadrant "arctan2" function, you will have to use common sense to determine the total angle $s_1$ makes with the real axis. Also note that the angle is not unique, because any addition of $2\pi$ to the complex number's angle would yield the same result.

$$\angle(s_1) = \tan^{-1}\left(\frac{\omega_1}{\sigma_1}\right)$$

Exponential Form

Writing a complex number in exponential form exploits Euler's formula to represent complex numbers in a very convenient, compact form. Euler's formula states:

$$e^{j\omega} = \cos \theta + j\sin \theta$$

Interestingly, this equation gives us both a real and an imaginary component that is derived from "e" raised to an imaginary number. The other thing that you should notice is that this formula represents a unit vector pointing in the direction defined by the angle $\theta$ on the complex plane. This is shown graphically in the figure below:

Writing a complex number in complex exponential form is summarized by the following equation:

$$s_1 = \left|s_1\right|e^{j \angle(s_1)}$$

So the complex number $s_1$'s magnitude, $\left|s_1\right|=\sqrt{\sigma_1^2+\omega_1^2}$ and angle $\angle(s_1)=\tan^{-1}\left(\frac{\omega_1}{\sigma_1}\right)$ are still used. The convenient thing about writing a complex number in complex exponential form is a direct result of the following arithmetic rules for exponents. Recall that:

$$e^{a}e^{b}=e^{a+b}$$$$\frac{e^{a}}{e^{b}}=e^{a-b}$$$$(e^{a})^{c}=e^{ac}$$

This allows us to write the product or quotient of two complex numbers very easily, since we can multiply or divide the (real-valued) magnitudes and then use the above formulas to determine the new unit vector of the result of the multiplication or division.

For example, take the example $s_5 = s_1s_2$ from above. Recall that $s1 = -3+2j$ and $s2 = 1+3j$. First, we find the angle and magnitude of each vector.

$$\left|s_1\right|=\sqrt{(-3)^2+(2)^2}=3.61$$$$\angle(s_1) = \tan^{-1}\left(\frac{2}{-3}\right) =2.55rad$$$$\left|s_2\right|=\sqrt{(1)^2+(3)^2}=3.16$$$$\angle(s_1) = \tan^{-1}\left(\frac{3}{1}\right) =1.24rad$$

Then, we write each number in exponential form:

$$s_1 = 3.61e^{2.55j}$$$$s_2 = 3.16e^{1.24j}$$

Then, we can find the product of the two complex numbers.

$$s_5 = s_1s_2=(3.61)(3.16)e^{(2.55+1.24)j}$$

We can use MATLAB/Octave to assert that this is the same result that we got from multiplying the two vectors in Cartesian form:

In [2]:
s5
s5_exponentialform = 3.60555*3.16228*exp((2.55359+1.24905)*j)
s5 = -9 - 7i
s5_exponentialform = -9.0000 - 7.0000i

You might notice that there's a little bit of error here if you use the rounded numbers I computed in the markdown cell rather than the more precise values I used in the MATLAB cell. This is a cautionary tale about carrying around significant figures vs. dropping them. Use your judgment here. Also, while the example I showed only covers multiplication, division of complex numbers is similarly easy using complex form using the fact that $\frac{e^{a}}{e^{b}}=e^{a-b}$. This is particularly useful when evaluating a transfer function as a complex number when $s$ is some known value $s=s_1$. You have done this in systems when computing the frequency response of a transfer function. The fact $\frac{e^{a}}{e^{b}}=e^{a-b}$ shows us that $\angle\frac{y(s_1)}{u(s_1)} = \angle y(s_1) - \angle u(s_1)$. We will be using this reduction quite often in the next few topics of ME480.

Now, with a more developed understanding of how to manipulate complex numbers, we are finally ready for a new tool that will allow us to design controllers for systems that have an order greater than two.

Controller Design: Root Locus Method

Up until this point in the course, we have been working with the following "canonical form" of a feedback control system:

To choose controller gains for our controller $C(s)$, we have been directly manipulating the control system's closed loop characteristic equation after finding it using the system's closed loop transfer function:

$$\frac{y(s)}{r(s)} = G_{cl}(s)=\frac{CP}{1+CPH}$$

Again, when we haved designed a controller to particular performance specification, like $\zeta$, we are implicitly setting a goal for the system's closed loop eigenvalues. Because manipulating third and higher order polynomials is difficult, it is hard to determine the closed loop eigenvalues that will yield the desired closed-loop behavior. So we will turn to the new Root Locus Plot tool. This tool will be able to reveal how to choose our controller's structure (P, PI, PD, or PID) and set its gains to achieve a desired system eigenvalue.

The Root Locus Plot is a graphical description of how a system's closed loop eigenvalues move around the s-plane when one controller parameter (e.g. $k_p$,$k_i$,etc) varies from $0\rightarrow\infty$. This might seem restrictive, because it won't immediately allow us to choose all gains in a PID controller, but we have to crawl before we can walk! Once we learn rules for quickly sketching root locus plots, we'll be able to use them to determine:

  1. What eigenvalues are and are not possible with a particular controller, particular plant P(s), and sensor transfer function H(s).
  2. How to set controller gains to achieve eigenvalues that are possible with our controller
  3. A measure of "how stable" our control system is for a given controller design.

To see where we'll be going, consider the following root locus plot for a 6th order system under proportional control with several zeros, plotted courtesy of Octave/MATLAB. Note that Octave prints a goofy-looking ASCII version of the root locus along with the 'nice' plot. Disregard this first plot.

In [3]:
clear all
s = tf('s');

P = (s^2+s+10)/((s+1)*(s+15)*(s^2+.5*s+4)*(s^2+10*s+30));

rlocus(P);
                                                                                                                           
                                                              Root Locus of P                                              
                                                                                                                           
                   |---------------------------------------------------------------------------------------------------|   
                   |    &&##        +           +           +           +           +          +---------------****---+|   
                   |    &&&&&###    &           &           &           &           &          |###?###asympto****    ||   
                15 |-+&&&&&&&&&&&###&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&|@@@?@@@loc****       +||   
                   |    &       &&&&####        &           &           &           &          |   B***open loop poles||   
                   |    &           &&&&####    &           &           &           &          ****F***zeros----------+|   
                10 |-+&&&&&&&&&&&&&&&&&&&&&&####&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&********&&&&&&&&&&&&&&&&&&+-|   
                   |    &           &      &&&  ####        &           &           &  **** **** &           &         |   
                   |    &           &         &&&   ####    &           &          ****  ****    &           &         |   
                 5 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&####&&&&&&&&&&&&&&&&&&&****&&&****&&&&&&&&&&&&&&&&&&&&&&&&&&&+-|   
                   |    &           &           &  &&&      ####        &  ****$$$$$& *          &           &         |   
                   |    &           &           &    &&     &   ####   *B$*  $$$   FB**          &           &         |   
                 0 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&B@@@@@@&&&&&&&&&&&&&&&&&&$$$$$&&&&B&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+-|   
                   |    &           &           &      @    $$$$        &#####%     &            &           &         |   
                   |    &           &           &    @@  $$$&           B#   ###%% FB==          &           &         |   
                   |    &           &           &  @@@$$$   &           &      #####%%=          &           &         |   
                -5 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&@@@$&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&====&&&&&&&&&&&&&&&&&&&&&&&&&&&+-|   
                   |    &           &         @@@           &           &           &    ====    &           &         |   
                   |    &           &     $@@@  &           &           &           &       ====%&           &         |   
               -10 |-+&&&&&&&&&&&&&&&&$@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&====%%&&&&&&&&&&&&&&&&+-|   
                   |    &         $$@@@@        &           &           &           &            & ====%%    &         |   
                   |    &      $@@@@&           &           &           &           &            &    =====% &         |   
               -15 |-+&&&&&$@@@@@&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&====%%&&&&&+-|   
                   |   $$@@@@       &           &           &           &           &            &           &====%%   |   
                   |  $ @@          +           +           +           +           +            +           +   == %  |   
                   |---------------------------------------------------------------------------------------------------|   
                       -25         -20         -15         -10         -5           0            5          10             
                                                     Real Axis     gain = [0, 450446]                                      
                                                                                                                           

This plot represents how the closed-loop eigenvalues of a system comprised of $P$ regulated by a proportional controller move around the s-plane. The blue lines represent possible closed-loop eigenvalues. Note that there are a number of branches (paths) that move around the s-plane with a particular, symmetric pattern. If we can learn these patterns, we can sketch these plots manually and get some valuable insight about the consequences of plant, sensor, and controller structure on what behavior our system can achieve under closed-loop control.

You can see the how to call the rlocus command by using help:

In [4]:
help rlocus
'rlocus' is a function from the file /home/brownaa/octave/control-3.3.1/rlocus.m

 -- Function File: rlocus (SYS)
 -- Function File: [RLDATA, K] = rlocus (SYS, INCREMENT, MIN_K, MAX_K)
     Display root locus plot of the specified SISO system.

     *Inputs*
     SYS
          LTI model.  Must be a single-input and single-output (SISO)
          system.
     INCREMENT
          The increment used in computing gain values.
     MIN_K
          Minimum value of K.
     MAX_K
          Maximum value of K.

     *Outputs*
     RLDATA
          Data points plotted: in column 1 real values, in column 2 the
          imaginary values.
     K
          Gains for real axis break points.

     *Block Diagram*
           u    +         +---+      +------+             y
          ------>(+)----->| k |----->| SISO |-------+------->
                  ^ -     +---+      +------+       |
                  |                                 |
                  +---------------------------------+

Additional help for built-in functions and operators is
available in the online version of the manual.  Use the command
'doc <topic>' to search the manual index.

Help and information about Octave is also available on the WWW
at http://www.octave.org and via the help@octave.org
mailing list.

Preparing your system for root locus analysis

To begin, we will assume that we can factor one parameter out of our controller transfer function $C(s)$. After factoring this one, real "gain factor" out of $C(s)$, we will denote the "static" part of our controller transfer function $C^\star(s)$. This is shown in the figure below:

image.png

Let's do a couple of examples to illustrate how this might work.

Example 1: P Control Root Locus Preparation

If our controller transfer function is a proportional controller with $C(s)=K_p$, the situation is very easy. To make the system match the diagram above, we only need to set $C^\star(s)=1$, and set $K=K_p$. Then, we can use the root locus plot to vary $K$ and see how the system eigenvalues move.

Example 2: PD Control Root Locus Preparation

If our controller transfer function is $C(s)=K_{sum}(K_p+K_ds)$, or a PD controller with a "summing gain," we could factor $K_d$ out of $C(s)$ as follows:

$$C(s) = K_{sum}\left(K_p + K_ds\right)=K_{sum}K_d\left(s+\frac{K_p}{K_d}\right)$$

What this does is it explicitly calls out the zero that the PD controller adds to the "forward path" of the control system at $s=-\frac{K_p}{K_d}$. Let's call that zero "$z$" and rewrite the controller transfer function again:

$$C(s)= K_{sum}K_d\left(s+z\right)$$

Now, let's wrap $K_{sum}K_d$ into one "gain factor" which we'll call $K$, so that the system matches what we drew above.

$$C(s) = KC^\star(s)= K\left(s+z\right)$$

Now, with the root locus analysis tools we'll learn in the next few pages, we can look at how the system's closed-loop eigenvalues change as we vary the "root locus gain" $K$. Functionally, we could change $K$ by changing the value of either $K_d$ or $K_{sum}$, but changing $K_d$ would also change the location of the zero $z$. Therefore, we generally will vary $K$ by changing $K_{sum}$ for a PD controller. Let's do the same example with a PI controller before moving on.

Example 3: PI Control Root Locus Preparation

Consider a PI controller with a summing gain:

$$C(s) = K_{sum}\left(K_p+\frac{K_i}{s}\right)=K_{sum}\frac{K_ps+K_i}{s}$$

We can factor K_p out of this controller as follows:

$$C(s) = K_{sum}K_p\frac{s+\frac{K_i}{K_p}}{s}=K\frac{s+z}{s} = KC^\star(s)$$

Note that this time, the controller adds both a zero and a new pole to the forward path transfer function of the control system. By setting the ratio of $K_i$ and $K_p$, we can specify the location of the forward path transfer function's zero at $s=-z=-\frac{K_i}{K_p}$. With our P, PD, and PI control structures prepared for root locus analysis, we can re-draw our canonical control system as follows:

In this figure, $G(s)=C^\star(s)P(s)$, and the transfer function of the closed loop system from $r$ to $y$ is given by:

$$\frac{y(s)}{r(s)}=G_{cl}(s) = \frac{KG}{1+KGH}$$

.

This is the form we will use for almost all of our root locus analyses in this course. Many times, if we are just talking about proportional control of a system, $C^\star(s)=1$, and $G(s)=P(s)$, but this is not always the case, as we just saw. Often, we will use a PD, PI, or PID controller that adds poles and/or zeros to the forward path, and we will roll the "fixed" $C^\star(s)$ into the plant transfer function to get $G(s)=C^\star(s)P(s)$. This will allow us to study how our single varying parameter in the controller, $K$, will change the closed loop system eigenvalues.

Determining the Closed Loop Characteristic Equation

In the closed loop transfer function shown above,

$$\frac{y(s)}{r(s)}=G_{cl}(s) = \frac{KG}{1+KGH}$$

,

The characteristic equation for the closed loop system is found by looking at the denominator of $G_{cl}(s)$. In other words, the characteristic equation is given by:

$$1+KGH=0$$

.

Instead of "clearing fractions" in this characteristic equation, the way we did when we were manipulating it directly to achieve particular eigenvalues, we will leave the transfer function $GH$ as a fraction of polynomials. In some texts, like Schaum's outline, the authors explicitly say $G(s)H(s) = \frac{N(s)}{D(s)}$ to denote that it is a (proper or strictly proper) fraction of the two polynomials $N(s)$ and $D(s)$. We won't worry too much about that. What we will do, however, is rearrange the characteristic equation using some simple algebra to obtain:

$$-\frac{1}{K}=G(s)H(s)$$

.

This is important because it means that because $K$ is a positive real number, the so-called "open loop transfer function" (this is an unfortunate name, but that's what people call it... see the appendix) has to reduce to a negative real number for any value of $s=\sigma+j\omega$ if it is a solution to the system's closed-loop characteristic equation.

That's it. That's the whole key to learning to draw, interpret, and use root locus plots in control system design. Because $-\frac{1}{K}$ is a negative real number, $G(s)H(s)$ must be a negative real number also when evaluated at a point $s_1$ on the complex plane that is a solution to the characteristic equation.

Finding Eigenvalues on the Root Locus and their Gains

Let's look a little closer at what the realization above tells us. If we were to plot the point $s=-\frac{1}{K}$ on the complex s-plane, we would get something like this:

The angle of this point will always be $\pm180^\circ$, possibly with $360n^\circ$ added without loss of generality. This leads to what we call the "angle criterion" for the root locus plot.

Angle Criterion: Determining Eigenvalues on the Root Locus

A point $s1=\sigma_1+j\omega_1$ is "on the root locus" of a system if the angle of the transfer function $G(s)H(s)$ is $\pm 180^\circ$ when that transfer function is evaluated as a complex number at $s=s1$. The angle criterion can be written formally as:

$$\angle-\frac{1}{K}=\angle G(s)H(s) = \pm 180^\circ$$

The angle criterion is what we'll use to derive all of the rules for sketching root locus plots by hand. It does not tell us how to get to that point by setting the gain factor $K$ to a particular value. It merely tells us that we can get to that point, which means that if the point $s_1$ is a desired eigenvalue for our closed-loop system, we'll be able to know whether it's possible to achieve it, regardless of how complex the transfer function $G(s)H(s)$ is! If you need help figuring out what "the angle of G(s)H(s)" means, please see the other notebook in this folder, which is a review of complex numbers.

The "magnitude criterion" does tell us how to get to a particular point on the root locus. As you might guess, if the closed-loop characteristic equation, which we write as $-\frac{1}{K}=G(s)H(s)$, is satisfied, then we can assert that the magnitude of $-\frac{1}{K}$ must equal the magnitude of the transfer function $G(s)H(s)$.

Magnitude Criterion: Determining Gains for Possible Eigenvalues

If a point on the root locus is given by $s=\sigma+j\omega$, then the following equality holds:

$$\left|-\frac{1}{K}\right|=\left| G(s)H(s)\right|$$

Therefore, we can find the gain factor $K$ that 'gets us to' a particular point $s_1$ on the root locus for our system using $K=\frac{1}{\left|G(s)H(s)\right|}$.

Finding Eigenvalues and Gains on the Root Locus

While we don't know yet how to sketch a root locus plot (except by using MATLAB to draw it exactly), what we can do at this point is directly check whether some point $s$ is "on the root locus" (achievable using our controller).

Example 1

Say that we wish to control a plant $P(s)=\frac{1}{s+1}$ with a perfect sensor $H(s)=1$ and a proportional controller. This affords us the following system in "root locus form:"

$$G(s)=P(s)=\frac{1}{s+1}$$$$K = K_p$$$$H(s)=1$$

If we want to know whether we can use a positive gain factor $K$ to achieve the closed-loop eigenvalue $s_1 = -0.5$, we will use the angle criterion. Specifically, we substitute this value of $s$ into the "open loop transfer function" $G(s)H(s) = \frac{1}{s+1}$.

$$\left.G(s)H(s)\right|_{s=-0.5} = \frac{1}{-0.5+1}$$

Now, we have to ask ourselves whether the angle of the complex number $\left.G(s)H(s)\right|_{s=-0.5}$ has an angle of $\pm 180^\circ$. To do this, let's exploit complex exponential form, in which we know that:

$$\frac{num(s)}{den(s)}=\frac{\left|num(s)\right|}{\left|den(s)\right|}e^{\angle(num(s))-\angle(den(s))}$$

This form essentially tells us that $\angle(G(s)H(s)) = \angle(num(s))-\angle(den(s))$, where $num(s)$ and $den(s)$ are the numerator and the denominator of our transfer function, respectively. So, calculating the angle of $G(s)H(s)=\frac{1}{s+1}$ for our desired pole location $s=-0.5$ yields:

$$\angle \frac{1}{-0.5+1} = \angle(1)-\angle(0.5) = 0-0$$

As you can see, the angle of the transfer function is not $\pm 180^\circ$ for this value of $s$, so it is not on the root locus, and is thus not achievable with this controller with a positive gain factor $K=K_p$.

Example 2

Let's now assume that our same plant and sensor are under the control of a PI controller. We'll use the form of the PI controller we derived earlier, so:

$$P(s) = \frac{1}{s+1}$$$$H(s)=1$$$$C^\star(s) = \frac{s+z}{s}$$$$K = K_pK_{sum}$$

For our system, and therefore $G(s) = C^\star(s)P(s)$ depends on the zero location $s=-\frac{K_i}{K_p}=-z$ that we choose for our system. Let's move the zero far away from the poles in our "open loop transfer function" $G(s)H(s)$ to minimize its effects on the closed-loop response... let's put it at, say, $-z=-100$. Note that this is not always a good choice, but it serves us well for this example. If we do this, we get:

$$G(s)H(s) = \frac{s+100}{s^2+s}$$

OK. Now, let's again see if the point $s=-0.5$ is possible for our new system under PI control. Substituting $s=-0.5$ into $G(s)H(s)$ yields:

$$G(-0.5)H(-0.5) = \frac{-.5+100}{(-0.5)^2-0.5}$$

Now, we find the angle of the transfer function evaluated at $s=-0.5$ as follows:

$$\angle(G(-0.5)H(-0.5)) = \angle(99.5)-\angle(-0.25) = \tan^{-1}\frac{0}{99.5} - \tan^{-1}\frac{0}{-.25} = 0+180^\circ$$

As you can see, because the real part of the denominator is negative, its angle is $180^\circ$, and the transfer function satisfies the angle criterion. To find out what gain factor $K$ will produce a closed-loop eigenvalue at $s=-.5$, we apply the magnitude criterion, which is easy since everything in our transfer function is a real number.

$$K = \frac{1}{\frac{99.5}{.25}} = 0.0025$$

So we've determined what gain factor $K=K_pK_{sum}$ will give us a closed-loop eigenvalue at $s=-0.5$. If we already set the zero location at $s=-z$ using $z=\frac{K_i}{K_p}$, we can then determine all of the control gains if we pick one of them. It's common (but not necessary) to assume that $K_{sum}=1$, which would allow us to find that $K_p=0.0025$ and $K_i=0.25$. To see how this worked out, let's use MATLAB to plot the root locus for our system, find the gains $K_p$ and $K_i$ when $K_{sum}$ is 1, and plot the closed-loop system's step response.

In [5]:
clear all
s = tf('s');

z = 100;%this is our choice of zero location for the PI controller (we don't know HOW to choose this yet... we just picked it)

P = 1/(s+1);
H = 1;
Cstar = (s+100)/(s);
G = Cstar*P;

%plot the root locus
rlocus(G*H)

figure
rlocus(G*H,0.1)
xlim([-5 0])
ylim([-20 20])

%we used the magnitude criteria to find that, for our desired pole:
K = 0.0025;
%we decided that in our controller, C(s) = ksum*(kp + ki/s), we would keep ksum=1, so
Ksum = 1;%our choice (either kp or ksum is our choice)
Kp = K/Ksum;%just algebra here
%now we find Ki based on our chosen zero location z=100
%z = Ki/Kp so
Ki = z*Kp;

%now we can implement our controller, and check out the step response to make sure it makes sense for having an eigenvalue at s=-0.5
C = Ksum*(Kp+Ki/s);
Gcl = minreal(C*P/(1+C*P*H))
figure
step(Gcl)
                                                                                                                           
                                                              Root Locus of                                                
                                                                                                                           
                    |--------------------------------------------------------------------------------------------------|   
                100 |-+&+&&&&&&&&&&+&&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&&&&+&&&&&&&&&&+&&+-----$$$$$$-----------+|   
                    |   &          &           &          &          &           &          &  |##$$$##loc$$$         ||   
                    |   &          &           &          &          &           &          &  | $$B   open loop poles||   
                    |   &          &           &          &          &           &          &  $$--F---zeros--$$------+|   
                    |   &          &           &          &          &           &          &  $       &       $$  &   |   
                    |   &          &           &          &          &           &          & $        &        $$ &   |   
                 50 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$$&&&&&&&&&&&&&&&&&&$&&&+-|   
                    |   &          &           &          &          &           &          &$         &         $$&   |   
                    |   &          &           &          &          &           &          $$         &          $&   |   
                    |   &          &           &          &          &           &          $          &          $&   |   
                    |   &          &           &          &          &           &          $          &          $&   |   
                  0 |****###################################################################$$$$$$$$$$$F**********BB***|   
                    |   &          &           &          &          &           &          #          &          #&   |   
                    |   &          &           &          &          &           &          #          &          #&   |   
                    |   &          &           &          &          &           &          #          &          #&   |   
                    |   &          &           &          &          &           &          ##         &          #&   |   
                    |   &          &           &          &          &           &          &#         &         ##&   |   
                -50 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&##&&&&&&&&&&&&&&&&&&#&&&+-|   
                    |   &          &           &          &          &           &          & #        &        ## &   |   
                    |   &          &           &          &          &           &          &  #       &       ##  &   |   
                    |   &          &           &          &          &           &          &  ##      &      ##   &   |   
                    |   &          &           &          &          &           &          &    ##    &     ##    &   |   
                    |   &          &           &          &          &           &          &     ###  &  ###      &   |   
               -100 |-+&+&&&&&&&&&&+&&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&######&&&&&&&&+&+-|   
                    |--------------------------------------------------------------------------------------------------|   
                      -800       -700        -600       -500       -400        -300       -200       -100          0       
                                                     Real Axis     gain = [0, 909.71]                                      
                                                                                                                           
                                                                                                                           
                                                              Root Locus of                                                
                                                                                                                           
                    |--------------------------------------------------------------------------------------------------|   
                100 |-+&+&&&&&&&&&&+&&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&&&&+&&&&&&&&&&+&&+----$$$$$$$-----------+|   
                    |   &          &           &          &          &           &          &  |##$$$##loc$$$$        ||   
                    |   &          &           &          &          &           &          &  |$$$B   open loop poles||   
                    |   &          &           &          &          &           &          &  $$--F---zeros--$$------+|   
                    |   &          &           &          &          &           &          & $$       &       $$  &   |   
                    |   &          &           &          &          &           &          & $        &        $$ &   |   
                 50 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$$&&&&&&&&&&&&&&&&&&$&&&+-|   
                    |   &          &           &          &          &           &          &$         &         $$&   |   
                    |   &          &           &          &          &           &          $$         &          $&   |   
                    |   &          &           &          &          &           &          $          &          $&   |   
                    |   &          &           &          &          &           &          $          &          $&   |   
                  0 |****###################################################################$$$$$$$$$$$F**********BB***|   
                    |   &          &           &          &          &           &          #          &          #&   |   
                    |   &          &           &          &          &           &          #          &          #&   |   
                    |   &          &           &          &          &           &          #          &          #&   |   
                    |   &          &           &          &          &           &          ##         &          #&   |   
                    |   &          &           &          &          &           &          &#         &         ##&   |   
                -50 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&##&&&&&&&&&&&&&&&&&&#&&&+-|   
                    |   &          &           &          &          &           &          & #        &        ## &   |   
                    |   &          &           &          &          &           &          & ##       &       ##  &   |   
                    |   &          &           &          &          &           &          &  ##      &      ##   &   |   
                    |   &          &           &          &          &           &          &   ###    &     ##    &   |   
                    |   &          &           &          &          &           &          &     ###  &  ####     &   |   
               -100 |-+&+&&&&&&&&&&+&&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&&&+&&&&&&&&&&&+&&&&&&&&&&+&&&&&&&#######&&&&&&&&+&+-|   
                    |--------------------------------------------------------------------------------------------------|   
                      -800       -700        -600       -500       -400        -300       -200       -100          0       
                                                     Real Axis     gain = [0, 909.51]                                      
                                                                                                                           
                                                                                                                           
                                                              Root Locus of                                                
                                                                                                                           
                    |--------------------------------------------------------------------------------------------------|   
                100 |-+&&&&&&&&&&&&&&&&&+&&&&&&&&&&&&&&&&&&&+&&&&&&&&&&&&&&&&&&+&&&&&&&&&&&&&&&+----------------------+|   
                    |                   &                   &                  &               |###?###locus          ||   
                    |                   &                   &                  &               |   B   open loop poles||   
                    |                   &                   &                  &               +---F---zeros----------+|   
                    |                   &                   &                  &                   &                   |   
                    |                   &                   &                  &                   &                   |   
                 50 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+-|   
                    |                   &                   &                  &                   &                   |   
                    |$$$$$$$$$$$$$$$$$$$&                   &                  &                   &                   |   
                    |                   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ &                   &                   |   
                    |                   &                   &                 $$$$$$$$$$$$$$$$$$$$$$$$                 |   
                  0 |******************************************************************************B##$$$$$$$$$$$$$$$$$|   
                    |                   &                   &                  &                   &  ########         |   
                    |                   &                   &                 ########################                 |   
                    |                   ###################################### &                   &                   |   
                    |###################&                   &                  &                   &                   |   
                    |                   &                   &                  &                   &                   |   
                -50 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&+-|   
                    |                   &                   &                  &                   &                   |   
                    |                   &                   &                  &                   &                   |   
                    |                   &                   &                  &                   &                   |   
                    |                   &                   &                  &                   &                   |   
                    |                   &                   &                  &                   &                   |   
               -100 |-+&&&&&&&&&&&&&&&&&+&&&&&&&&&&&&&&&&&&&+&&&&&&&&&&&&&&&&&&+&&&&&&&&&&&&&&&&&&&+&&&&&&&&&&&&&&&&&+-|   
                    |--------------------------------------------------------------------------------------------------|   
                   -5                  -4                  -3                 -2                  -1                   0   
                                                     Real Axis     gain = [0, 909.51]                                      
                                                                                                                           
                                                                                                                           
                                                              Root Locus of                                                
                                                                                                                           
                20 |---------------------------------------------------------------------------------------------------|   
                   |                   +                   +            $$$$$$ +               +----------------------+|   
                   |                   &                   &                  $$$$$$           |###?###locus          ||   
                15 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$$$$$&&&&&&|   B   open loop poles||   
                   |                   &                   &                   &         $$$$  +---F---zeros----------+|   
                   |                   &                   &                   &             $$$$  &                   |   
                10 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$$$&&&&&&&&&&&&&&&&&+-|   
                   |                   &                   &                   &                   &$$$                |   
                   |                   &                   &                   &                   &   $$              |   
                 5 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$$&&&&&&&&&&+-|   
                   |                   &                   &                   &                   &       $           |   
                   |                   &                   &                   &                   &        $          |   
                 0 |*******************************************************************************B#########$$$$$$$$$$|   
                   |                   &                   &                   &                   &         #         |   
                   |                   &                   &                   &                   &        #          |   
                   |                   &                   &                   &                   &       #           |   
                -5 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&##&&&&&&&&&&+-|   
                   |                   &                   &                   &                   &   ##              |   
                   |                   &                   &                   &                   &###                |   
               -10 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&###&&&&&&&&&&&&&&&&&+-|   
                   |                   &                   &                   &             ####  &                   |   
                   |                   &                   &                   &         ####      &                   |   
               -15 |-+&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&#####&&&&&&&&&&&&&&&&&&&&&&&&&&&&+-|   
                   |                   &                   &                  ######               &                   |   
                   |                   +                   +            ###### +                   +                   |   
               -20 |---------------------------------------------------------------------------------------------------|   
                  -5                  -4                  -3                  -2                  -1                   0   
                                                     Real Axis     gain = [0, 909.51]                                      
                                                                                                                           

Transfer function 'Gcl' from input 'u1' to output ...

        0.0025 s + 0.25   
 y1:  --------------------
      s^2 + 1.002 s + 0.25

Continuous-time model.

From the step response, it looks like our system is just about critically damped. To check to see whether we've achieved our desired pole, we can see that the root locus branches do pass through $s=-0.5$ so that pole is achievable as we predicted!

Again, we still don't know HOW to draw the root locus for a system ourselves, but the angle and magnitude criteria alone are extremely powerful for determining whether a particular point is achievable using a particular controller, and finding out HOW to hit that point if it is achievable by changing our "gain factor" $K$.

What is the meaning of this "open loop transfer function" G(s)H(s)?

One of the most common points of confusion for students learning to draw the root locus is this idea that we call $G(s)H(s)$ the "open loop transfer function." It's not a very good name, but it is convention. In reality, the "open loop transfer function" as it's defined in root locus analysis is a very specific transfer function indeed:

What we call the "open loop transfer function" in root locus analysis is a transfer function that transforms the signal after the gain factor $K$ into the signal that is read by the control system, as shown in the figure above. So when we talk about the "open loop zeros" and "open loop poles" as we go through the root locus material in this course, we are specifically talking about the poles and zeros of $G(s)H(s)=C^\star(s)P(s)H(s)$. As you might imagine, if the "fixed" portion of our controller, $C^\star$, includes poles and zeros, then the "open loop poles" and "open loop zeros" are not necessarily just the poles and zeros of the plant and sensor transfer functions.

As long as you remember where the root locus equation $-\frac{1}{K}=GH$ came from (the closed-loop characteristic equation), it should be relatively painless to proceed through the root-locus sketching and design procedures without error.

Exercises Due FRIDAY, October 2 before class

Controller Design: Root Locus Method

Recognizing the discplined process we are using...

image-3.png

these exercises begin AFTER model development (scoping and constuction) has been completed and the system model has been validated. This work begins during Controller Design when you are trying to determine the gains that will provide the desired response.

In these exercises you are trying to determine if the desired eigenvalue (that is to say the value of the poles that give us the desired closed-loop behavior) can be achieved by varying a controller gain $K$ between $0$ and $\infty$.

If the desired eigenvalue(pole) is achievable, then you can calculate the specific control gain(s) that will result in that pole, and compute the system step response.

Exercise 1

$$P(s) = \frac{10}{s+5}$$

Determine whether the following eigenvalues are achievable with proportional control using positive gains by applying the angle and magnitude criteria of the root locus. If the point is achievable, find the gain $K_p$ that will achieve it and plot the system step response under closed loop control assuming $H(s) = 1$:

  1. $s_1 = -0.5$
  2. $s_1 = -11$

YOUR ANSWER HERE

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

Exercise 2

$$P(s) = \frac{10}{(s+5)(s+10)}$$

Determine whether the following eigenvalues are achievable with proportional control using positive gains by applying the angle and magnitude criteria of the root locus. If the point is achievable, find the gain $K_p$ that will achieve it and plot the system step response under closed loop control assuming $H(s) = 1$:

  1. $s_1 = -7.5$
  2. $s_1 = -7.5+j$
  3. $s_1 = -6+j$

YOUR ANSWER HERE

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

Exercise 3

For the plant above, and assuming that the system is under proportional control, plot the closed loop poles of the system as you vary the proportional gain $K_p$ on the s-plane, effectively creating your own "root locus." Plot the eigenvalues that result from proportional gains from 0 to 10 in increments of 0.1 on one plot. Some helpful MATLAB code is provided below to get you started. You will need to add some kind of loop that adds your computed eigenvalues for each proportional gain to a figure.

Example code:

close all
clear all
s = tf('s');

%let's say your closed loop transfer function was the following for a particular gain Kp
Gcl = 1/(s^2+s+10)

%to extract the denominator coefficients as vectors of decreasing power of s, we can do this:
[num,den] = tfdata(Gcl,'v')% the 'v' argument tells it to return these as a vector rather than cell array.

%now, we can use the 'roots' function to find the roots of the characteristic equation
myroots = roots(den)

%to plot the real vs. imaginary components on a graph, we can do the following thing:
figure()
plot(real(myroots),imag(myroots),'kx','MarkerSize',15)
grid on
title('test plot to show how you can make plot eigenvalues on the s plane')
xlabel('real component ')
ylabel('imaginary component')
In [8]:
close all
clear all
s = tf('s');

%let's say your closed loop transfer function was the following for a particular gain Kp
Gcl = 1/(s^2+s+10)

%to extract the denominator coefficients as vectors of decreasing power of s, we can do this:
[num,den] = tfdata(Gcl,'v')% the 'v' argument tells it to return these as a vector rather than cell array.

%now, we can use the 'roots' function to find the roots of the characteristic equation
myroots = roots(den)

%to plot the real vs. imaginary components on a graph, we can do the following thing:
figure()
plot(real(myroots),imag(myroots),'kx','MarkerSize',15)
grid on
title('test plot to show how you can make plot eigenvalues on the s plane')
xlabel('real component ')
ylabel('imaginary component')

% YOUR CODE HERE
error('No Answer Given!')
Transfer function 'Gcl' from input 'u1' to output ...

           1      
 y1:  ------------
      s^2 + s + 10

Continuous-time model.
num =  1
den =

    1    1   10

myroots =

  -0.5000 + 3.1225i
  -0.5000 - 3.1225i

error: No Answer Given!