Lab 9

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

NUST School of Electrical Engineering and Computer

Science

Faculty Member: Dr Farid Gul Date: 16/04/2023

Semester: 6th Section: BEE-12B

Department of Electrical Engineering

EE-397: Control Systems

LAB 9: Root Locus based Design

Lab Lab
Log book
Student name Reg. No. completion report Total/15
Marks / 5
Marks / 5 Marks / 5
Muhammad Rehan 333394
Basharat

Muhammad 345660
Hassaan Saeed

Laraib Nadeem 345867

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 1
1. Objectives
• Learn how to plot root locus in MATLAB
• Learn how to use MATLAB to design a simple controller using the root locus

2. Root Locus
Root locus is a plot of the closed loop poles of the system that shown in the figure
below. The closed loop poles vary as the values of the gain K is changed. The root locus
shows the plot of the closed loop poles as the gain K is varied between zero and positive
infinity.

+ K G(s)
-

In the lectures, we have learnt how to sketch a root locus and also how to find exact
points of interest e.g. the imaginary axis crossing, the break away/in points, the centroid
of asymptotes. Plotting a rough sketch of the root locus is considerably simple; however,
finding exact points on the root locus requires some mathematical calculations. In this
handout, we will see that MATLAB can make this task easier.

3. Root Locus in MATLAB


In MATLAB, the root locus can be plotted with the command rlocus().

Consider the open loop system


1
G(s) =
(s + 1)(s + 2)(s + 3)

The root locus of the above system can be plotted in MATLAB using the following code:

G=zpk([],[-1,-2,-3],1)
rlocus(G)

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 2
After executing the instructions, you should get the following plot

Root Locus
5

1
Imaginary Axis

-1

-2

-3

-4

-5
-8 -7 -6 -5 -4 -3 -2 -1 0 1
Real Axis

As you can see, plotting the root locus is very easy in MATLAB.

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 3
Now we would like to find some points exactly e.g. the imaginary axis crossing, the
breakaway point, the centroid of asymptotes. This can be done with the help of the Data
cursor tool, which is shown in the figure below.

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 4
Select the Data Cursor tool and click anywhere on the root locus. It should give the
location of the closed loop pole, the gain K required to have that closed loop pole, and
some other useful information.

The overshoot, damping ratio and natural frequency indicated with the data cursor are
only w.r.t. to that specific pole, i.e., if the system only had that pole (or the pole pair in
case of a complex pole). This overshoot is not for the whole closed loop system.

Root Locus
5

4 System: G
Gain: 5.31
Pole: -1.03 + 1.34i
3
Damping: 0.608
Overshoot (%): 9.02
2 Frequency (rad/sec): 1.69

1
Imaginary Axis

-1

-2

-3

-4

-5
-8 -7 -6 -5 -4 -3 -2 -1 0 1
Real Axis

Once a data cursor is inserted, you can move it around by dragging it. If you cannot
move the data cursor in fine steps, then right click on the data cursor, go to
Interpolation and select Linear. Sometimes you get a different right click menu. In that
case, go to Selection Style and select Mouse Position.

As an exercise move the data cursor, to find.


i. The gain at which you have imaginary axis crossing.
ii. The value of the pole and the gain at the breakaway point

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 5
You can insert a separate data cursor on each branch of the root locus. Insert a data
cursor on all branches of the root locus.
Root Locus
5
System: G
Gain: 14.1
4
Pole: -0.722 + 1.97i
Damping: 0.344
3 Overshoot (%): 31.6
System: G
Frequency (rad/sec): 2.1
Gain: 39.6
2
Pole: -5.51
Damping: 1
1 Overshoot (%): 0
Imaginary Axis

Frequency (rad/sec): 5.51


0

-1
System: G
Gain: 106
-2
Pole: 0.401 - 4.04i
Damping: -0.0989
-3 Overshoot (%): 137
Frequency (rad/sec): 4.06
-4

-5
-8 -7 -6 -5 -4 -3 -2 -1 0 1
Real Axis

Move the data cursor for one of the complex poles so that you have an overshoot of40%.
Find the value of K required to get that closed loop pole.

Move the rest of the data cursors such that they are showing the same value of the gain
K. This will allow us to see the location of all the closed loop poles of the system for aspecific
value of the gain.

For the value of gain that is required for 40% overshoot, can we approximate thesystems
to a second order system with no zeros?

Once you have decided a value for the gain K, you can find the closed loop transferfunction with
the following code.

K=30
Gcl = feedback(series(K,G),1)

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 6
Exercise 1
Consider the open loop system.
s2 + 4s + 4.25
G(s) =
s3 − s2 − s + 15

Plot the root locus for this system in MATLAB. Using the MATLAB root locus:

1. Find the values of the gain K for which the closed loop system will be stable.

For k>=3.4, the system will be stable.

Design a controller gain K such that the closed system is stable, and the dominantpoles have an
overshoot of 80%. Is a second order approximation valid for this value of K. Find the transfer
function of the closed loop system.

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 7
Exercise 2
Consider the first order model of the DC motor speed vs voltage, which you havederived in
your earlier labs. You get a first order model if you neglect the inductance, i.e.,L=0. Using the
root locus, choose a value of K such that your settling time is 1/20 secs.Find the transfer
function of the closed loop system.

CODE:

J = 0.01;
b = 0.1;
K = 0.8;
R = 1;
L = 0;
s = tf('s');
P_motor = K/((J*s+b)*(L*s+R)+K^2)
f_b=feedback(P_motor,1)
rlocus(f_b)
stepinfo(P_motor)

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 8
Exercise 3
Consider the first order model of the DC motor position vs voltage that you have derived in
your earlier labs. Using the root locus, choose a value of K such that your closed loop system is
stable and has a settling time of 1/5 secs. Find the transfer function of the closed loop
system.
CODE:
J = 0.01;
b = 0.1;
K = 2.738;
R = 1;
L = 0.5;
s = tf('s');
motor_position = K/s*((J*s+b)*(L*s+R)+K^2);
sys=feedback(motor_position,1);
stepinfo(sys);
rlocus(motor_position);
sys

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 9
Exercise 4
Using MATLAB, make a rough sketch of the root locus of the following transfer functions.
(s2 − 2s + 5)
G(s) =
(s + 1)(s + 2)(s + 3)
(s + 7)(s2 − 2s + 5)
G(s) =
(s + 1)(s + 2)(s + 3)(s2 − 4s + 13)
(s + 2)
G(s) =
(s + 1)(s2 + 12 + 61)(s2 − 4s + 13)

Check your answers with the help of MATLAB.

1st Function:

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 10
2nd Function:

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 11
3rd Function:

EE-379: Control Systems Lab 9 Page


Prepared by: Dr. Ammar Hasan, Mr. Saqib Nazir and Mr. Tawakal Hasnain 12

You might also like