Control System CPE325 Lab Manual BCE
Control System CPE325 Lab Manual BCE
Laboratory Manual
Control System
BS Computer Engineering
Student Name: Registration No.:___________________
ii
Preface
We feel pleasure in presenting the laboratory manual of Control System course for under-
graduate level. The objective of this manual is to support the theory syllabus of the Control
System course through experiments. This Lab Manual is for CPE-325 Control System course
offered in program BS Computer Engineering. The labs constitute 25% of the total marks for
this course. You are not allowed to wander in the lab or consult other groups when performing
experiments. Similarly, the lab reports must contain original efforts. CUI has a zero tolerance
anti-plagiarism policy.
In this manual, experiments are included related to study the response of the system in terms of
step response, pole zero location, stability, transient and steady state error in
MATLAB/SIMULINK using transfer function or state space model. Experiments for the
controller design are also included through which they can achieve design requirements.
A full effort has been made in the designing of this manual to cover the major topic of the
course. The faculty members Dr. Bilal Khan, Dr. Uzair Khan, Engr. Narayan Longani, Engr.
Umar Farid & Engr. Naveed Shahzad, the lab staff including Engr. Muhammad Asad Javaid
Khan (lab engineer) was involved in the developments, validation of experiments and
documentation of this manual. The OBE based review was carried out by Dr. Bilal Khan, Dr.
Uzair Khan, and Engr. Narayan Longani.
We would appreciate for identification of errors for further improvement of quality of the lab
manual.
Dr. Bilal Khan, Dr. Uzair Khan & Engr. Narayan Longani
Department of Electrical & Computer Engineering
COMSATS University Islamabad, Abbottabad Campus
Fall 2021
iii
Safety Regulations for Control System Lab
iv
Experiment 01
Introduction to MATLAB with Control System Aspect
Objective:
After completing this lab student will get familiar with basics of MATLAB, like basics
of coding, how to plot response of system and properly label it. How transfer function
is representing in MATLAB. How to deal with plot function and SIMULINK.
Introduction:
MATLAB, an abbreviation of Matrix Laboratory, is an interactive program for
numerical computation and data visualization; it is used extensively by control
engineers for analysis and design. There are many different toolboxes available which
extend the basic functions of MATLAB into different application areas; in these
tutorials, we will make extensive use of the Control Systems Toolbox. MATLAB is
supported on Unix, Macintosh, and Windows environments.
MATLAB, its Toolboxes and SIMULINK have become, over several years, the
industry standard software package for control system design. The purpose of this LAB
is to introduce the students to some of the more useful aspects of MATLAB, and to
illustrate how the software may be used to solve problem in control system design.
Plot
It is also easy to create plots in MATLAB. Suppose you wanted to plot a sine and cosine
wave as a function of time. First make a time vector (the semicolon after each statement
tells MATLAB we don't want to see all the values) and then compute the sine and
cosine value at each time.
t = 0:0.25:10;
y = sin(t);
W=cos(t)
plot(t,y,'.ko','LineWidth',2,'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',3)
hold on
plot(t,W,'b*','LineWidth',1.5,'MarkerEdgeColor','k','MarkerFaceColor','k','MarkerSize',3);
plot(t,W)
grid on
xlabel('Time','fontweight','bold','fontsize',9)
ylabel('Amplitude','fontweight','bold','fontsize',9)
title('Sine and Cosine Waves','fontweight','bold','fontsize',10)
legend('Sine wave','Cosine Wave',1)
For using more functions type in command window
>> help plot
>> help (any function)
While using Simulink, results are observed in scope, Scope block of previous version
of MATLAB don’t give you freedom to edit the graph like today, so first you have to
import the data to workspace with help of block “to workspace” and plot the result
using figure. Figure give you ease to edit the graphs
Transfer Function
This part introduces the reader to time domain analysis using MATLAB. It uses
commands from the Control System Toolbox. A list of the commands can be found
using
>> help control
>> help step
1
Following are some examples how to represent transfer function in MATLAB.
Example 1: Consider a first-order transfer function G(s) = 1/(s+1). The impulse
response and step response function can be created by using following commands in
script file.
2
SIMULINK
The Simulink give us easy Model analysis and construction. SIMULINK allows a block
diagram representation of a control system to be constructed and real-time simulation
performed.
3
title('Step Response for system G(s)=1/(s+1)','fontweight','bold','fontsize',10)
legend('Step Response',1)
For data synchronization also export Output as structure from Simulink to MATLAB
workspace.
Task: Following are the two transfer functions. Plot the step and impulse response and label
properly in script as well as in Simulink.
1. (s+1)/(s2+2s+1) 2. 10/(s+1)(s+3)(s+5)
In your report label each graph properly as in examples. Also insert caption with each figure.
Most importantly write your observations after each sub-task.
Important Note:
1. If student will copy the lab report, all the identical copy holders will get zero marks.
2. In all subsequent lab reports same lab report style should be used.
4
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
5
Experiment 02
Mathematical Modeling of Electrical and Mechanical Systems
Using MATLAB/Simulink
Objective:
Every day we deal with different physical systems. Interesting fact is that motion or
working of these systems can be modeled mathematically and their behavior can be
observed using software’s like MATLAB.
This feature helps us in the design of a system. Once the system dynamic mathematical
model is developed, we can transform it into frequency or time domain representation
to further analyze the system performance. In this lab students should be able to
mathematically model and simulate the system using MATLAB / Simulink
environment.
Introduction:
A basic RLC circuit is shown is the Figure.1. The system has a voltage source and
voltage drops across each element in the network as shown.
Its dynamic time domain model on terms of differential equations after following the
KVL is
di(t) 1
L + C ∫ i(t)dt + i(t)R = v(t) (1)
dt
This is the cause of conversation of energy. As the sum of all voltage drops across each
component is equal to the total applied voltage. There is one resistive and two reactive
components in the network. The circuit is a simple series circuit where it has the same
current in the network.
6
Figure 2: RLC circuit modeled in the Simulink environment
Student Task: Use the MATLAB/Simulink environment to model and simulate the
3DOF system shown in Figure 4. Take the step response and discuss the results. Provide
the complete and solid analysis on the system response. Lab report should be presented
under the instructions provided in the earlier lab.
7
Figure 3. 3DOF RLC network for the task
8
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
9
Experiment 03
Frequency Domain Modeling of Electrical and Mechanical
Systems
Objective:
In this lab students will learn how to generate the frequency domain mathematical
model of the system when ODE’s of a system are available. This lab emphasizes on
the use of frequency domain modeling technique to model the system in frequency
domain. System transfer function are used for system model and its response
generation.
Introduction:
In this lab Electrical and mechanical system will be modeled in the frequency domain.
First a simple rectilinear plant will be modeled. The system has three masses m1 , m2
and m3 . These masses are connected to each other and to the rigid body by the help of
springs ( k1 , k2 , k3 , k4 ) and dampers ( c1 , c2 , c3 , c4 ). The applied external force is F(t).
The output can be observed at any point in the network which is undergoing a change.
The time domain equations of motion for the three DOF rectilinear plant are
Where 𝑁𝑖 (𝑠) and 𝐷(𝑠) are the numerator and denominator for the system.
Student should be able to apply the Laplace transform on the equation 1-3 and solve
the equations for the unknown variables 𝑥1 (𝑠), 𝑥2 (𝑠) and 𝑥3 (𝑠) for the given input
10
F(s). Student should use the MATLAB commands to find the system transfer function.
The command ‘tf(numerator, denominator)’ will help to find the system transfer
function.
Electrical System
A three degree of freedom system is shown in Figure 2. The system is identical to the
one provided in the earlier lab. Student has to convert the given set of equation (3-5) in
the frequency domain using Laplace transformation. Student is free to decide the
system output for the given input. Use the MATLAB command to find the system
transfer function.
11
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
12
Experiment 04
Frequency Domain Modeling of Electromechanical System
Objective:
A DC motor is one the basic electro-mechanical system and is used in almost 95% of
the systems for control in one or another form. The DC motor can be used to control
the process speed or in some way position as parameter. The property that it takes
electrical input and produces a mechanical output makes it an electro-mechanical
system.
Introduction:
The DC motor have two set of equations. One represents the electrical network and the
other assumes the mechanical side of the DC motor.
and the mechanical side mathematical equation for the same system is
( )
Tm ( s ) = J m s 2 + Dm s m ( s ) (2)
The final transfer function between motor speed and applied input after substitution of different
available equations becomes (Section 2.8 in textbook)
Kt
m ( s) Ra J m
= (3)
Ea ( s ) Kt Kb
s + 1 J Dm +
m Ra
13
Sr. No System Variables Variable Value
01 Mechanical Inertia J m 01 Kgm2
02 Mechanical Damping Dm 5 N-m-s/rad
03 Electrical Resistance Ra 1 ohm
04 Electrical Inductance La 0.3 H
04 Motor Torque Constant K t 0.01 N.M/Amp
05 Back emf constant K b 0.01 V/rad/sec
Table 1: System variables
Student Task: Find the system transfer function using the MATLAB commands.
Student should perform the analysis by changing the values of system variables.
Student should be able to discuss the system response after changing the variable and
the results should be presented in a detailed way.
14
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
15
Experiment 05
State Space Modeling of Systems Using MATLAB/Simulink
Objective:
This lab will make students familiar with the state space modeling in MATLAB. How to make
state space model of a system and evaluate output in MATLAB. The system can be electrical,
mechanical, and electromechanical systems. The choice is for the instructor to choose among
the systems.
Software:
MATLAB
In this we have two states one is capacitor voltage and other is inductor current. So,
the state space model of the circuit will be
dvc 1
= i (3)
dt C
di 1
= (−Ri + vc (t) + v(t)) (4)
dt L
State vector will be
16
v
x = [ c] (5)
i
Now to write it in explicitly state space form of
ẋ = Ax + Bu
(6)
y = Cx + Du
0 1 0
A=[ ];B = [ ] ; C = [1 0]
−1/L −R/L 1/L
Task 1: Now students must implement this state space model of RLC circuit in
SIMULINK. Use applied voltage 10V, 5V and 3V. L = ¼ H, C = 4/3 F and R = 1Ω.
Mechanical System
A translational mechanical system is given in Figure 4.2
Task 3: For the rotational mechanical system given in Figure 4.3, Find the state space
model of the system. Plot the step response θ2(t) in figure 5 where D1 = D2= J1= J2= K
= 1.
17
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
18
Experiment 06
Transient Analysis of First Order Systems
Objective:
The following lab would help the students to get familiar with first order systems and
also with specifications of the first order systems.
Software:
MATLAB
19
Figure 6.2 Output Response of First Order System
Time constant of first order system is given by
1
τ=a (3)
Rise Time: Time required for system output to reach from 10% of final value (C(t) =
0.1 × Cf (t)) to 90% of final value (C(t) = 0.9 × Cf (t)).
2.2
Tr = (4)
a
Settling Time: It is defined as the time for the response to reach and stay within 2 %
of its final value. (0.98 × Cf (t)~1.02 × Cf (t))
4
Ts = a (If 2% of final value criterion is used) (5)
3
Ts = a (If 5% of final value criterion is used) (6)
Task 1: Find the pole location, rise time and settling time of the following system.
1
a) G(s) = s+1
5
b) G(s) = s+2
Task 2: For the RC circuit given below, find equation for output voltage, pole
location, rise time and settling time when the applied voltage is 𝑉𝑖 (𝑡) = step voltage,
For the circuit R = 50Ω and C = 5mF.
20
Figure 6.3: RC Circuit
Pole Location:
Rise Time (Calculated):
Rise Time (Observed):
Settling Time (Observed):
Settling Time (Calculated):
DC Motor
A motor is an electromechanical component that yields an angular displacement output,
θm , for an input voltage,ea , that is, a mechanical output generated by an electrical input.
The motor’s schematic is shown in Figure 6.4(a) and its transfer function for motor
speed response is shown in Figure 6.4(b).
The DC motor speed transfer function is
ωm (s) Kt /(Ra Jm )
= 1 K K (7)
Ea (s) s+ (Dm+ t b)
Jm Ra
21
Figure 6.4 DC Motor (a) Schematic, (b) Block Diagram
Task 4: In this task students will study changes occur in angular velocity when
location of pole is varied, where location of pole is dependent on different parameters
of the system. Take K=1 and vary α from 1 to 5 and study the variation in response
then take K = 5, vary α from 1 to 5 and study the effect. Use step input and write your
observations.
22
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
23
Experiment 07
Transient Analysis for The Second Order Systems
Objective:
In this lab students will get familiar with second order system, types of responses
associated with changing of poles and location, transient response characteristics.
Software:
MATLAB
24
Figure 1: Response of Second System on Changing Poles Location
25
order system, now characteristic associated with transient response of underdamped
second order systems are,
3
Ts = ζω (If 5% of final value criterion is used)
n
Task 2: A closed loop system is in Figure 3. Find and Draw output for each case of
step input and following cases.
26
Figure 2: Closed Loop system for Task 2
S. No Value of K
a)
b)
c)
Damping Ratio, ζ: The frequency of oscillations without damping, like output response
of undamped system in last lab.
27
16
G(s) =
s2 + 2ζωn + 16
Study the step response and pole zero map by varying ζ from 0 to 1.2 with an interval
of 0.1, After completing simulation write down the effect of changing of ζ on step
response and pole zero location.
28
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
29
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
30
Experiment 08
System Reduction and Non-Linearity Analysis
We have been working with individual subsystems represented by a block with its input
and output. More complicated systems, however, are represented by the interconnection
of many subsystems. Since the response of a single transfer function can be calculated,
we want to represent multiple subsystems as a single transfer function.
1. Cascade Form: When two or more subsystems are connected in series or cascade
form then equivalent transfer function is equal to product of transfer function of
individual systems. In figure 3(a), three subsystems are attached in series, so the
equivalent transfer function of the system can be found by taking product of transfer
function of individual subsystems as shown in figure 3(b). Total response of both
the cases, 4(a) and 4(b) is same.
C(s)
= G1 (s)G2 (s)G3 (s)
R(s)
Figure 3: (a) Three Subsystems in series, (b) Equivalent transfer function system.
2. Parallel Form: When two or more subsystems are connected in parallel form then
equivalent transfer function is equal to sum of transfer function of individual
systems. In figure 4(a), three subsystems are attached in parallel, so the equivalent
transfer function of the system can be found by taking sum of transfer function of
individual subsystems as shown in figure 4(b). Total response of both the cases,
5(a) and 5(b), is same.
C(s)
= ±G1 (s) ± G2 ± (s)G3 (s)
R(s)
Figure 4: (a) Three Subsystems in parallel, (b) Equivalent transfer function system
31
3. Feedback Form: The third topology is the feedback form, which will be seen
repeatedly in course of control system engineering. The feedback system forms the
basis for our study of control systems engineering. In Chapter 1, we defined open-
loop and closed-loop systems and pointed out the advantage of closed-loop, or
feedback control, systems over open-loop systems.
Let us derive the transfer function that represents the system from its input to its
output. The typical feedback system, described in detail in Chapter 1, is shown in
Figure 6(a); a simplified model is shown in Figure 6(b). As error will be
Task 1: Write a code that finds the equivalent transfer of following system using
MATLAB commands, series, parallel and feedback.
a)
32
b)
Saturation:
To study the effect of saturation, consider a motor and load from the Antenna Control
Case. Study of Chapter 2 and look at the load angular velocity, ωo (s), where
ωo (s) = 0.1sθm (s)
0.2083
ωo (s) = E (s)
𝑠 + 1.71 a
from Eq. If we drive the motor with the help of amplifier, after certain range amplifier
saturates its output, and without saturation block and a step input of 10V, there will
we’ll be difference in output velocity of both systems.
Task 2: Students have to implement the transfer function of motors with step input of
10V and also with an amplifier, which has saturation of ±5V, and write their
observations when they use saturation block and also without saturation block.
33
Write your observations of Task 5:
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
34
Write your observations of Task 6:
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
Backlash:
To study effect of backlash, again consider the motor, load, and gears from Antenna
Control Case Study of Chapter 2. The motor input is a sinusoidal waveform chosen to
allow us to see the effects of backlash. which is chosen to allow us to see vividly the
effects of backlash in the gears driven by the motor. As the motor reverses direction,
the output shaft remains stationary while the motor begins to reverse. When the gears
finally connect, the output shaft itself begins to turn in the reverse direction. The
resulting response is quite different from the linear response without backlash.
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
________________________________________________________________________________
35
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
36
Experiment 09
Stability Analysis for The Systems Under Different Performance
Conditions
Objective:
In this lab students will learn about stability of system; they will be able to determine
the stability of system either by examining pole’s location or output response of the
system.
Software
MATLAB
Stability:
Stability is the most important system specification. If a system is unstable, transient
response and steady-state errors are moot points. An unstable system cannot be
designed for a specific transient response or steady-state error requirement. What, then,
is stability? There are many definitions for stability, depending upon the kind of system
or the point of view. In this section, we limit ourselves to linear, time-invariant systems.
Stability of system on the basis of time response is given below
Stable: A linear, time-invariant system is stable if the natural response approaches zero
as time approaches infinity.
Marginally Stable: Linear, time-invariant system is marginally stable if the natural
response neither decays nor grows but remains constant or oscillates as time approaches
infinity.
Unstable: A linear, time-invariant system is unstable if the natural response grows
without bound as time approaches infinity.
Stable: Stable systems have closed-loop transfer functions with poles only in the left
half-plane.
Marginally Stable: Marginally stable systems have closed-loop transfer functions with
only imaginary axis poles of multiplicity 1 and poles in the left half-plane.
Unstable: Unstable systems have closed-loop transfer functions with at least one pole
in the right half-plane and/or poles of multiplicity greater than 1 on the imaginary axis.
Task 1: Find out that following systems are either Stable/Unstable, with help of step
response and pole’s location.
1
a) G(s) =
𝑠+1
1
b) G(s) = 𝑠−2
37
Write your answers of Task 1:
Task 2: Find out that following systems are Stable/Unstable/Marginally stable, with
help of step response and pole location.
3
a) G(s) = 𝑠2 +2𝑠+3
6
b) G(s) = 𝑠2 −2𝑠−3
Task 3:Now implement the following systems in unit negative feedback form and find
out that closed loop systems are Stable/Unstable/Marginally stable, with help of step
response.
3
a) G(s) = 𝑠3 +3𝑠2 +2𝑠
6
b) G(s) = 𝑠3 +3𝑠2 +2𝑠
7
c) G(s) = 𝑠3 +3𝑠2 +2𝑠
Task 4: For the system given in figure 1, find equivalent transfer function,
38
Figure 1: Closed Loop System
K
G(s) = , H(s) = 1;
s(s + 2)2
Find the value of gain, K, on paper that will make the system stable, marginally stable
and unstable, then
a) Draw the step response of the system for gain of K-1, where K is value
calculated for marginally stable response
b) Draw the step response of the system for gain of K that yields marginally stable
response.
Write your answers and draw step responses for task 4 in a box at the end of this
lab.
Case Value of K
Stable
Marginally Stable
Unstable
Task 5: Implement the transfer function of DC motor from task 3 of lab 6 in unit
negative feedback form. Now study the effect of proportional, integral and derivative
components by adding them one by one in cascade form with forward path with transfer
function of DC motor. Also use the analog PID module of the control system trainer to
get the difference in the real time and simulation performance.
θL (s)
G(s) =
Ea (s)
R(s) C(s)
P/I/D G(s)
+
-
39
Write Proportional Block Effect.
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
__________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
___________________________________________________________________________________________
40
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
41
Experiment 10
To Observe the System Steady State Error and Its Response
Against the Disturbance as z Signal
Objective:
In this lab students will learn about second part of output response that is steady state
and its characteristic steady state error and the effect of disturbance.
Software:
MATLAB
Steady State Error:
Steady-state error is the difference between the input and the output for a prescribed
test input as t → ∞. The steady-state errors studied resulted strictly from the system
configuration. Based on a system configuration and a group of selected test signals,
namely steps, ramps, and parabolas, we can analyze or design for the system’s steady-
state error performance.
Task 1: Answer the following questions
1. What system types will yield zero steady-state error for step inputs?
2. What system types will yield zero steady-state error for ramp inputs?
3. What system types will yield infinite steady-state error for ramp inputs?
4. What system types will yield zero steady-state error for parabolic inputs?
5. What system types will yield infinite steady-state error for parabolic inputs?
6. For the negative feedback system of Figure 1.
K(s + 6)
G(s) = ; H(s) = 1
(s + 4)(s + 7)(s + 9)(s + 12)
Calculate the steady-state error in terms of K for the inputs: 5u(t), 5tu(t), and 5t2u(t).
42
Task 2: Using Simulink, set up the negative feedback system of Q.6. Plot on
one graph the error signal of the system for an input of 5u(t) and K = 10, 50,
and 100. Repeat for inputs of 5tu(t) and 5t2u(t).
Compare steady state error calculated in Q.6. of Task 1 and steady state error
obtained from simulation. Explain the reasons for any discrepancies.
______________________________________________________________________
Task 3: Using Simulink, set up the negative feedback system of Q.7. Plot on one graph
the error signal of the system for an input of 5u(t) and K = 5, 15, and 150. Repeat for
inputs of 5tu(t) and 5t2u(t).
43
Write your answers of Task 3:
________________________________________________________________________
Task 4: Students will study the unit positive feedback system, for the following system
and will write their observations about steady state error for input,
r(t) = u(t) and r(t) = −u(t)
5
a. G(s) = (s+12) ; H(s) = 1
1
b. G(s) = (s+4)(s+7) ; H(s) = 1
Disturbance:
Disturbances are unwanted signals that enter a system and affect the response of the
system. In open loop system their effect is more prominent and effect the performance
of the system, where closed loop system shows robustness towards disturbances and
44
their effect is minimized. The advantage of using feedback is that regardless of these
disturbances, the system can be designed to follow the input with small or zero error.
In case of closed loop system, steady state error is given by
e(∞) = eR (∞) + eD (∞)
Where,
s
eR (∞) = lim R(s)
s→0 1 + G1 (s)G2 (s)
and
sG2 (s)
eD (∞) = − lim D(s)
s→0 1 + G1 (s)G2 (s)
45
b) Find and plot the steady-state error for reference input, r(t) = 3u(t) and d(t) = -2u(t).
c) Find and plot the steady-state error for reference input, r(t) = 3u(t) and d(t) = -5u(t).
Write down the differences you observe in output after applying disturbance signal?
Does close loop system show any robustness to disturbances compare to open loop
system?
Case a) b) c)
eR (∞) Calculated
eD (∞) Calculated
e (∞) Calculated
eR (∞) Observed
eD (∞) Observed
e (∞) Observed
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
______________________________________________________________________
46
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
47
Experiment 11
Root Locus Analysis for Various Systems.
Objective:
The objective of this lab is to make you familiar with root locus. If a closed loop system
has any varying parameter, then the poles of closed loop system vary with respect to
parameter, and it also affects the stability of the system.
Software:
MATLAB
Root Locus:
Root locus is a graphical presentation of the closed-loop poles as a system control
parameter is varied. It is a powerful method of analysis and design for stability and
transient response. Feedback control systems are difficult to comprehend from a
qualitative point of view, and hence they rely heavily upon mathematics. Different
systems are given below you have to study the path of poles followed when gain of
open loop system is varied with the help of root locus.
Task 1: For the system shown in Figure 1
48
Task 2: Implement the DC motor task of lab 6 in unit negative feedback form as shown in Figure
2. Study the variation in closed loop poles when gain, K, of the forward path is varied
θL (s)
G(s) =
Ea (s)
Plot the root locus for closed loop system
R(s) C(s)
K G(s)
+
-
49
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
50
Experiment 12
Design Controller Using Root Locus Technique
Improving Transient Response
One way of improving the transient response is by replacing the existing system with a system
whose root locus intersects the desired point. Unfortunately, this replacement is expensive and
counterproductive. Transient response improved practically by introducing the compensator.
Steps for Controller Design:
1. Evaluate the performance of the uncompensated system to determine how much
improvement in transient response is required.
2. Design the (lead, lag, P, PD, PI or PID) compensator to meet the transient response
specifications. The design includes the zero location, pole location and the loop gain.
3. Simulate the system to be sure all requirements have been met.
4. Redesign if the simulation shows that requirements have not been met.
5. Evaluate the steady sate error performance for the lead-compensated system determines
whether improvement is required.
6. Design the lag compensator to yield the required steady-state error.
7. Simulate the system to be sure all requirements have been met.
8. Redesign if the simulation shows that requirements have not been met.
51
Note from the specification, we required the overshoot, %OS, damping ratio, zeta, can be find
from approximation damping ratio equation,
ζ= - log(%OS/100)/sqrt(pi^2+[log(%OS/100)^2]).
The command sgrid is used to overlay desired percent overshoot line on the close-up root locus.
Y (s) 1
= Where m=1000, b =50, U(s) =10, Y(s) = velocity is the output.
U ( s ) ms + b
Design Specification:
Y ( s) Kp
=
U ( s) ms + (b + K p )
52
Matlab command called sgrid should be used to find an acceptable region of the root-locus plot.
To use the sgrid, both the damping ratio (zeta) and the natural frequency (Wn) need to be
determined first. The following two equations will be used to find the damping ratio and the natural
frequency:
where
Wn=Natural frequency
zeta=Damping ratio
Tr=Rise time
Mp=Maximum overshoot
One of our design criteria is to have a rise time of less than 5 seconds. From the first equation, we
see that the natural frequency must be greater than 0.36. Also using the second equation, we see
that the damping ratio must be greater than 0.6, since the maximum overshoot must be less than
10%.
Now, we are ready to generate a root-locus plot and use the sgrid to find an acceptable region on
the root-locus. Create a new m-file and enter the following commands.
hold off;
m = 1000;
b = 50;
u = 10;
numo=[1];
deno=[m b];
figure
hold;
axis([-0.6 0 -0.6 0.6]);
rlocus (numo,deno)
sgrid(0.6, 0.36)
[Kp, poles]=rlocfind(numo,deno)
figure
hold;
numc=[Kp];
denc=[m (b+Kp)];
t=0:0.1:20;
53
step (u*numc,denc,t)
axis ([0 20 0 10])
In the figure, the two dotted lines in an angle indicate the locations of constant damping ratio
(zeta=0.6); the damping ratio is greater than 0.6 in between these lines and less than 0.6 outside
the lines. The semi-ellipse indicates the locations of constant natural frequency (Wn=0.36); the
natural frequency is greater than 0.36 outside the semi-ellipse, and smaller than 0.36 inside.
If you look at the Matlab command window, you should see a prompt asking you to pick a point
on the root-locus plot. Since you want to pick a point in between dotted lines (zeta>0.6) and outside
the semi-ellipse (Wn>0.36), click on the real axis just outside the semi-ellipse (around -0.4).
You should see the gain value (Kp) and pole locations in the Matlab command window.
With the specified gain Kp (the one you just picked), the rise time and the overshoot criteria have
been met; however, the steady-state error of more than 10% remained.
Lag controller
To reduce the steady-state error, a lag controller will be added to the system. The transfer
function of the lag controller is:
The pole and the zero of a lag controller need to be placed close together. Also, it states that the
steady-state error will be reducing by a factor of Zo/Po. For these reasons, let Zo equals -0.3 and
Po equals -0.03.
hold off;
m = 1000;
54
b = 50;
u = 10;
Zo=0.3;
Po=0.03;
numo=[1 Zo];
deno=[m b+m*Po b*Po];
figure
hold;
axis ([-0.6 0 -0.4 0.4])
rlocus(numo,deno)
sgrid(0.6,0.36)
[Kp, poles]=rlocfind(numo,deno)
figure
t=0:0.1:20;
numc=[Kp Kp*Zo];
denc=[m b+m*Po+Kp b*Po+Kp*Zo];
axis ([0 20 0 12])
step (u*numc,denc,t)
In the Matlab command window, you should see the prompt asking you to select a point on the
root-locus plot. Once again, click on the real axis around -0.4.
As you can see, the steady-state error has been reduced to near zero. Slight overshoot is a result
of the zero added in the lag controller.
Now all the design criteria have been met and no further iterations will be needed.
K ( s + 6)
Example 2: The unity feedback system with G ( s) = is operating with
( s + 2)(s + 3)(s + 5)
dominant pole damping of 0.707. Design a PD controller so that the settling time is reduced by the
factor of 2. Compare the transient and steady state performance of the uncompensated and
compensated systems. Describe any problems with your design.
Solution:
clf
'Uncompensated System'
numg=[1 6];
deng=poly([-2 -3 -5]);
'G(s)'
G=tf(numg,deng);
Gzpk=zpk(G)
rlocus(G,0:1:100)
z=0.707;
55
pos=exp(-pi*z/sqrt(1-z^2))*100;
sgrid(z,0)
title(['Uncompensated Root Locus with ' , num2str(z), ' Damping Ratio Line'])
[K,p]=rlocfind(G); %Allows input by selecting point on graphic
'Closed-loop poles = '
p
i=input('Give pole number that is operating point ');
'Summary of estimated specifications'
operatingpoint=p(i)
gain=K
estimated_settling_time=4/abs(real(p(i)))
estimated_peak_time=pi/abs(imag(p(i)))
estimated_percent_overshoot=pos
estimated_damping_ratio=z
estimated_natural_frequency=sqrt(real(p(i))^2+imag(p(i))^2)
Kp=dcgain(K*G)
'T(s)'
T=feedback(K*G,1)
'Press any key to continue and obtain the step response'
pause
step(T)
title(['Step Response for Uncompensated System with ' , num2str(z),...
' Damping Ratio'])
'Press any key to go to PD compensation'
pause
'Compensated system'
done=1;
while done>0
a=input('Enter a Test PD Compensator, (s+a). a = ')
numc=[1 a];
'Gc(s)'
GGc=tf(conv(numg,numc),deng);
GGczpk=zpk(GGc)
wn=4/[(estimated_settling_time/2)*z];
rlocus(GGc)
sgrid(z,wn)
title(['PD Compensated Root Locus with ' , num2str(z),...
' Damping Ratio Line', 'PD Zero at ', num2str(a), ', and Required Wn'])
done=input('Are you done? (y=0,n=1) ');
end
[K,p]=rlocfind(GGc); %Allows input by selecting point on graphic
'Closed-loop poles = '
p
i=input('Give pole number that is operating point ');
'Summary of estimated specifications'
operatingpoint=p(i)
56
gain=K
estimated_settling_time=4/abs(real(p(i)))
estimated_peak_time=pi/abs(imag(p(i)))
estimated_percent_overshoot=pos
estimated_damping_ratio=z
estimated_natural_frequency=sqrt(real(p(i))^2+imag(p(i))^2)
Kp=dcgain(K*GGc)
'T(s)'
T=feedback(K*GGc,1)
'Press any key to continue and obtain the step response'
pause
step(T)
title(['Step Response for Compensated System with ' , num2str(z),...
' Damping Ratio'])
K ( s + 0.437)
Q1: The feedback system with G ( s ) = and H ( s ) = ( s + 1) .
( s + 3.483s 3 + 3.215s 2 + 0.4979s )
4
Q2: Design compensator using root locus technique similar as in example 1 but output y(t) is
speed instead of velocity.
Design Specification:
57
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
58
Experiment 13
Design the PI Controller and Lag Compensator for Different Systems &
DC Motor
Objective:
The objective of this lab is to make you familiar with PI and Lag controller. Controllers are added
in closed loop systems to achieve desired design criterion. PI and Lag controllers are used for
improving steady state error of system.
Software:
MATLAB
Commands:
rlocus, rlocfind, sgrid.
Improving Steady State Error:
Steady state error can be improved with two methods. The first technique is ideal integral
compensation, which uses a pure integrator to place an open-loop, forward-path pole at the origin,
thus increasing the system type and reducing the error to zero. The second technique does not use
pure integration. This compensation technique places the pole near the origin, and although it does
not drive the steady-state error to zero, it does yield a measurable reduction in steady-state error.
Different systems are given below you have to design PI and Lag controllers with given
specifications.
Task 1: For the system shown in figure 1, design a PI controller with
59
Write your answers of Task 1:
Transfer function of PI controller = _________________________________
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________
Task 2: For the system shown in figure 1 design a lag controller with design criterion of zeta =
0.174. Additional conditional for lag controller is that steady state error must be improved 20
times. What is the total angular contribution of the lag compensator?
K
G(s) =
(s + 1)(s + 2)(s + 10)
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
60
Experiment 14: Design of The PD Controller & Lead Compensator For
Different Systems.
Objective:
The objective of this lab is to make you familiar with PID and Lead-Lag controller. Controllers
are added in system to achieve desired design criterion. PID and Lead-Lag controllers are used for
improving transient’s specification as well as steady state error.
Software:
MATLAB
Commands:
rlocus, rlocfind, sgrid.
Improving Transients Specifications:
Transients’ specifications can be improved with two methods. First method is ideal derivative
compensation. With ideal derivative compensation, a pure differentiator is added to the forward
path of the feedback control system. This type of compensation requires an active network for its
realization. We call an ideal derivative compensator a proportional-plus-derivative (PD) controller.
The second technique does not use pure differentiation. Instead, it approximates differentiation
with a passive network by adding a zero and a more distant pole to the forward-path transfer
function. The zero approximates pure differentiation as described previously. The second
technique uses a passive network called a lead compensator.
Task 1: For the system shown in figure 1
61
Write your answers of Task 1:
Transfer function of PD controller = _________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Task 2: For the system shown in figure 1, Design three lead compensators for the system that will
reduce the settling time by a factor of 2 while maintaining 30% overshoot. Draw step response of
un-compensated and compensated system.
K
G(s) =
s(s + 4)(s + 6)
_______________________________________________________________________________
_______________________________________________________________________________
_______________________________________________________________________________
62
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
63
Experiment 15
Design PID Controller Using Ziegler Nichols Method
Objective:
1) To demonstrate the use of PID controller using MATLAB.
2) Finding the values of PID gains using the Ziegler Nichols Method
Classical PID Control
This lab examines a particular control structure that has become almost universally used in
industrial control. It is based on a particular fixed structure controller family, the so-called PID
controller family. These controllers have proven to be robust and extremely beneficial in the
control of many important applications.
PID stands for: P (Proportional), I (Integral), and D (Derivative)
Tuning of PID Controllers
Because of their widespread use in practice, we present below several methods for tuning PID
controllers. Actually, these methods are quite old and date back to the 1950’s. Nonetheless, they
remain in widespread use today.
We will study.
1. Ziegler-Nichols Oscillation Method
2. Ziegler-Nichols Reaction Curve Method
3. Cohen-Coon Reaction Curve Method
64
4. Adjust the controller parameters according to Table 6.1 (next slide); there is some
controversy regarding the PID parameterization for which the Z-N method was
developed, but the version described here is, to the best knowledge of the authors,
applicable to the parameterization of standard form PID.
Table 1
General System
If we consider a general plant of the form:
K 0 e − s
G0 ( s ) = ; 0 0
0s +1
then one can obtain the PID settings via Ziegler-Nichols tuning for different values of and 0.
The next plot shows the resultant closed loop step responses as a function of the ratio
x= .
0
Figure1: PI Z-N tuned (oscillation method) control loop for different values of the ratio
Numerical Example
Consider a plant with a model given by
65
Find the parameters of a PID controller using the Z-N oscillation method. Obtain a graph of the
response to a unit step input reference and to a unit step input disturbance.
Solution
The closed loop response to a unit step in the reference at t = 0 and a unit step disturbance at t =
10 are shown in the figure 2.
66
Figure 3: PID Z-N settings applied to series structure (thick line) and conventional
structure (thin line)
Observation
In the above example, it has not made much difference, to which form of PID the tuning rules are
applied. However, the reader is warned that this can make a difference in general.
Reaction Curve Based Methods
A linearized quantitative version of a simple plant can be obtained with an open loop experiment,
using the following procedure:
1. With the plant in open loop, take the plant manually to a normal operating point. Say that the
plant output settles at y(t) = y0 for a constant plant input u(t) = u0.
2. At an initial time, t0, apply a step change to the plant input, from u0 to u (this should be in the
range of 10 to 20% of full scale).
3. Record the plant output until it settles to the new operating point. Assume you obtain the curve
shown on the next slide. This curve is known as the process reaction curve. In Figure 4 , m.s.t.
stands for maximum slope tangent.
4. Compute the parameter model as follows
67
Figure 4: Plant step response
68
69
70
71
LAB Tasks:
1
G ( s) =
1 G(s) =
s + 3.6 s + 9
2
s( s + 1)(0.5s + 1)
Q2: PID controller design for unstable system
1
G(s) =
s −9
72
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
73
Experiment 16
Design PID Controller Using SISO tool
Objective – SISO Design toolbox
This lab will make familiar you with SISO tool, which is used for the controller design. This tool
uses root locus and design the controller according to requirements. At the end of this lab
experience, students should be able to successfully design P, I, PD, PI, and PID controllers to meet
closed‐loop performance specifications including transient performance and steady‐error.
SISO Tool:
This Graphical User Interface lets you design single-input/single-output (SISO) compensators by
graphically interacting with the root locus, Bode, and Nichols plots of the open-loop system. To
import the plant data into the SISO Tool, select the Import item from the File menu. By default,
the control system configuration is Root locus, is a powerful method of analysis and design for
stability and transient response. Feedback control systems are difficult to comprehend from a
qualitative point of view, and hence they rely heavily upon mathematics.
Note, in controller design there are multiple possible solutions, some better than others. It
is possible to have multiple designs that satisfy the given performance constraints, but practical
implementation issues and cost could be prohibitive for some designs. As a general rule, it is a
good idea to keep your controller as simple as possible while meeting the prescribed performance
criteria. In this lab we will be investigating several controller structures on individual plants and
comparing the design process and performance.
R(s) C(s)
GC(s) GP(s)
+
-
a. Getting Started:
1. Enter the transfer function for the plant, GP(s), in your workspace (i.e., from the MATLAB
command prompt).
1
GP (s) =
(s + 1)(s + 2)
2. Type ‘sisotool’ at the command prompt.
B. Loading the Transfer Function
1. Click on File →Import.
74
2. A window on the left will show you the transfer functions in your workspace, while the window
on the right will let you choose the control system configuration.
3. We will usually be assigning G(s) to block ‘G’ (the plant). Double‐click the space next to ‘G’
and type your transfer function name and hit Enter. You must hit enter or nothing will happen.
4. Once you hit enter, you should be able to click the OK button at the bottom of the window.
Then the window will close.
5. After you enter the transfer function, the root locus will be displayed. Double check to make
sure that the open‐loop poles and zeros of your plant are in the correct locations.
C. Generating the Step Response
1. Click on Analysis →Response to Step Command.
2. You will probably two curves on your step response plot. To fix this click on Analysis → Other
Loop Responses. Make sure only r to y is checked
3. You can now click on the pink boxes on the root locus (the current closed‐loop poles for the
given gain) and move them along the root locus. Essentially, you are exploring different controller
gain values by doing this. Note how the step response changes as you move the closed‐loop pole
locations.
4. The values of the closed‐loop poles will appear at the bottom of the root locus window as you
click and hold the mouse on the pink boxes representing them. This only gives you the value of
the closed loop pole you are clicking on. If you need the other closed‐loop pole locations, you will
have to click on them on each of the other branches.
D. Entering the Compensator (Controller)
1. Click Compensators →Edit →C. Click on Add Real Zero or Add Real Pole to enter controller zeros
or poles. You will be able to make changes to these values later. After you are done, click OK to exit this
window.
2. Look at the form of C(s) to be sure it is correct. Then look at the root locus window and see how it
changed once the compensator was added.
3. You can again see how the step response changes with the compensator by clicking on the closed‐loop
poles (the pink squares) and dragging them along the root locus.
4. You can also change the location of the poles/zeros of the compensator by clicking on them and dragging
them. Be careful not to inadvertently change the poles and zeros of the plant!
75
F. Printing/Saving the Figures
To save a figure ‘sisotool’ created during your session, click File →Print to Figure. This opens a figure
window and puts the current figure there.
G. Odds and Ends
1. You may want to adjust the axes. To do this, click Edit →Root Locus →Properties, click on Limits,
and set the desired axis limits.
2. You may also want to turn the grid on. Click Edit →Root Locus →Grid.
3. It is convenient to use the zero/pole/gain format for the compensators. To do this, click on Edit→SISO
Tool Preferences →Options and click on zero/pole/gain.
1. Entering the Constraints
Enter the percent overshoot and settling time constraints in ‘sisotool’. Remember that these constraints are
based on a second order system step response and for higher order systems are predicated by the assumption
of second order dominance of the closed‐loop system poles. Therefore, these design constraints are
guidelines, and you may have to refine your design to stay further inside these constraints to meet the
performance specifications.
2. Proportional (P) Control
Determine the root locus for this system with proportional control. (When you enter the plant transfer
function in ‘sisotool’, this is the default root locus plot. At this point the controller is specified as C(s) =
1.
Look at the step response as the gain increases. You should notice a few things:
1. As K increases, the imaginary part of the closed‐loop poles increases, and therefore the percent
overshoot increases.
2. As K increases, the position error decreases.
3. Since the real part of the pole does not change once K is greater than about 0.008, the settling time
remains constant at about 0.8 seconds.
4. There is no value of K for which the system is unstable
Do as well as you can to meet both constraints (you will not be able to do very well) then save the step
response and control effort plots and your controller gain to turn in with the lab worksheet.
3. Integral (I) Control
1. Add a real pole at zero to implement the integral controller. You can do this from the root locus plot, or
the ‘Control and Estimation Tools Manager’ as described earlier. Note that once you place a compensator
pole (or zero) you can click and drag it to a new location. However, for an integral controller the pole is
always at zero, so leave it there for now.
2. You should note that there are two root locus branches that head towards the imaginary axis (toward
instability), which is generally not desirable.
3. Find the value of K that makes the system marginally stable (the critical gain).
4. Try to find a value for K that gives a response with settling time less than or equal to 2 seconds and has
little overshoot. Save the corresponding step response and control effort plots and the controller gain to turn
in with the lab worksheet.
76
5. Is the position error zero? Could you find a K value for which you could meet the 1 second settling time
constraint?
4. Proportional + Derivative (PD) Control
1. Edit your compensator by removing the integrator (the pole at zero) and add a real zero. Note that in this
PD design that you can select where you place this real zero along the real axis. Take a moment to explore
what happens to the root locus, the step response, and the control effort as you move the zero.
2. Now move the zero between ‐1 and ‐4. Find a configuration with a position error less than 0.5.Save the
step response and control effort figure and the controller that produced it.
3. Next move the zero between ‐7 and ‐9. What happens to the root locus? Are we likely to get a faster
response of the closed‐loop system with this design than the previous one? Specify a controller with a zero
in this range that produces a settling time of 0.1 seconds or less. (Don’t forget that K< 10.) Save the step
response and control effort figure and the controller that produced it.
5. Proportional + Integral (PI) Control
1. Edit your compensator by adding a real pole at zero (adding the integral element). Note that in this PI
design that you can select where you place this real zero along the real axis, but that the real pole must
remain at zero.
2. Place the zero between 0 and ‐5. Find a controller that produces a settling time of less than 0.8seconds,
a percent overshoot of less than 2%, and a position error of zero. Save the step response and control effort
figure and the controller that produced it. Are all your poles inside the design region?
3. Now set the real zero to the left of ‐6. This type of configuration is not likely to get a faster response than
with just a P controller. Why?
6. Proportional + Integral + Derivative (PID) Control
1. Let’s start by making a PID controller with complex conjugate zeros. Edit the previous
compensator by deleting the real zero and adding complex conjugate zeros at -7 ±j7 and look at the root
locus plot.
2. Find a gain value of K on this root locus so that the step response has less than 10% percent overshoot
and a settling time less than 0.5 seconds. Save the step response and control effort figure and the controller
that produced it. Are all your poles and zeros within the design region?
Would you call this a second order dominant system?
3. Keeping the real part of the zeros at ‐7, reduce the imaginary part of the zeros as much as possible while
keeping the same basic shape of the root locus. At some point, as you reduce the imaginary part, the root
locus will take a very different shape. Find a value of K on this root locus so that the step response has a
percent overshoot of less than 2%, settling time less than 1second, and a position error of less than 0.01.
(Remember to keep K < 10.) Save the step
response and control effort figure and the controller that produced it.
a) Now let’s make a PID controller with real zeros at ‐7 and ‐8. Determine the root locus for this
system. Find a value of K on this root locus so that percent overshoot is less than 2% and the settling
time is less than 1 second. (Remember to keep K < 10.) Save the step response and control effort
figure and the controller that produced it.
77
Below is the illustrative way to understand the GUI for SISO tool. To import the plant data into the SISO
Tool, select the Import item from the File menu.
SISOTOOL (Your_Plant) specifies the plant model that you are working on to be used in the SISO Tool.
Here Your Plant is any linear model created with TF, ZPK, or SS.
For more help write in command window
>>help sisotool
To work on it write in command window like in Figure 4
78
Figure 5
2. SISO Design for SISO Design Task Window: where we have different analysis tools like bode
plot for open loop and close loop and root locus (Figure 6).
Figure 6
79
Click on File of “SISO Design for SISO Design Task Window” and click on Import like
Figure 7
Figure 8
Click on Browse following window (Figure 9) will be opened and select workspace where your model
will be present, select that model and press import, you can also import your modal from making your
model in M-file. Press Close after Importing.
80
Figure 9
Figure 10
Following Window will open (Figure 11).
81
Figure 11
By changing pole location or by adding poles or zeros you can get your required design.
Now go on “Control and estimator Tool manager Window” where select “Analysis Plot”Tab. Where
modal can analyze with different configurations.
Figure 2
82
Figure13: Closed Loop System
Design a PID controller so that the system can operate with a peak time that is two-thirds that of the
uncompensated system at 20% overshoot and with zero steady-state error for a step input with help of SISO
tool.
K(s + 8)
G(s) =
(s + 3)(s + 6)(s + 10)
83
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
84
Experiment 17
Bode Plot Analysis for Various Systems
Objective:
The objective of this lab is to make you familiar with frequency domain techniques like Bode plot.
Bode plot is frequency domain technique used to determine the stability of the system and response
of the system.
Software:
MATLAB
Command:
bode(sys)
Bode Plot:
Bode plots are representative of the magnitude and phase of G(j*ω) (where the frequency vector
ω contains only positive frequencies). These consist of two graphs.
The first plot is a plot of log modulus i.e., |G(jω)|, (in decibels) versus frequency. The magnitude
of |G(jω)| of any transfer function for any value of ω is plotted on a logarithmic scale in decibels
where dB = 20log10| P(j ω) | . The second plot is the phase shift (in degrees) versus frequency (ω).
Both plots usually have the frequency (ω) in logarithmic scale from 0 to ∞.
Bode plot is frequency domain technique used to determine the stability of the system. From Gain
and Phase plot we determine Gain Margin and Phase Margin. If both, Gain and Phase margins are
positive then system is stable.
Task 1: For the following systems
b) Draw Magnitude and Phase bode plot on Paper.
c) Make Magnitude and Phase bode plot with Matlab.
d) Compare both results
e) Finally draw Magnitude and Phase result in manual.
1
1. G1 (s) = s
1
2. G2 (s) = (s+10)
3. G3 (s) = s
4. G4 (s) = s + 10
85
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
86
Experiment 18
PID Controller Design via Bode Plot
Two relative stability indicators "Gain Margin" and "Phase Margin" are easily obtained from Bode
Plots. As 0 dB corresponds to a magnitude of 1 the gain margin is the number of dB that |G(jω)| is
below 0 dB at the phase frequency when the phase arc(G(jω)= 180o (Phase crossover). The gain
margin is the factor by which the gain can be increased before instability results.
The phase margin in the number of degrees arg(G(iω) is above -180o frequency associated with a
gain |G(jω)| = 1 (0 dB) (Gain crossover). The phase margin is the amount of phase by which G(jω)
exceeds -180 degrees when |K G(jω)|=1.
The following observations can be made on system stability with respect to the properties of
Bode Plot:
1. The gain margin is positive, and the system is stable if the magnitude of G(jω) at the phase
crossover is negative in dB. That is, the gain margin is measured below 0-dB axis. If the
gain margin is measured above 0-dB axis, the gain margin is negative, and the system is
unstable.
2. The phase margin is positive, and system is stable if the phase of G(jω) is greater than -
180o at the gain crossover. That is, the phase margin is measured above -180o axis. If the
phase margin is measured below the -180o axis, the phase margin is negative, and the
system is unstable.
87
Lab Task :PID control design
Consider following open loop system
G(s) =(s + 1)/s2(s + 8)
Lab Task 1: Plot bode and step response of uncompensated system and comment.
Lab Task 2: Design a PID compensator such that the compensated system has a PM of 60o and a
gain crossover frequency of 5 rad/sec and an acceleration error constant Ka = 1. The PID
compensator is of following form
Gc(s) = KP + KDs +KI/s
Gc(jω) = KP + j(KDω-KI/ω)
Gc(jω)= jGc(jω)j(cosө+ j sinө)
For the PID compensator, we can write
KP = |Gc(jω)| cosө
KDω-KI/ω= |Gc(jω)| sinө
We know that at gain crossover frequency, |Gc(jωg)||G(jωg)| = 1. This gives
|Gc(jωg)| =1/|G(jωg)|
Substituting for |Gc(jω)| from previous equation, we get
Kp =cosө /|G(jωg)|
Similarly, we have
KDωg –KI/ωg=sin ө/|G(jωg)|
Now at ωg = 1 rad/s,
G(jωg) = 0:1754 < -142.1250o
For the compensated system to have a phase margin of 60o at ωg = 1 rad/sec, we should have
-180 + Φm = ө + <G(jω) (Φm = PM)
ө = -180o+ 60o + 142.1250o = 22:1250o
Hence,
KP =cos 22.1250/0.1754 = 3:9571
Choose KI = 0, then KD can be computed to be
KD =(sin (22.1250o ))/0.1754) + 1= 3.1471
88
Hence, we have a PD compensator
Gc(s) = 3.9571 + 3.1471s
Plot the bode and step response of compensated system G(s)Gc(s) and comment.
89
Laboratory Assessment
Student Name: ___________________ Registration Number: ____________________
Learning Level
Allocated Obtained
Criteria Poor Good Very Good Excellent
Marks Marks, A
0-40% 41-60% 61 - 89% 90 - 100%
Affective 10%
Obtained
Learning Level
Marks, C
Allocated
Criteria Very
Marks Poor Good Excellent
Good
0-40% 41-60% 90 - 100%
61 - 89%
Cognitive 20%
Learning Level
Allocated Obtained
Criteria
Marks Poor Good Very Good Excellent Marks, P
0-40% 41-60% 61 - 89% 90 - 100%
Psychomotor 70%
90
Experiment 19
Complex Engineering Problem
91
Equations of motion
From the picture above and Newton's law, we can obtain the dynamic equations as the following:
Design requirements
A good bus suspension system should have satisfactory road holding ability, while still providing
comfort when riding over bumps and holes in the road. When the bus is experiencing any road
disturbance (i.e. pot holes, cracks, and uneven pavement),the bus body should not have large
oscillations, and the oscillations should dissipate quickly. Since the distance X1-W is very difficult
to measure, and the deformation of the tire (X2-W) is negligible, we will use the distance X1-X2
instead of X1-W as the output in our problem. Keep in mind that this is an approximation.
The road disturbance (W) in this problem will be simulated by a step input. This step could
represent the bus coming out of a pothole. We want to design a feedback controller so that the
output (X1-X2) has an overshoot less than 5% and a settling time shorter than 5 seconds. For
example, when the bus runs onto a 10-cm step, the bus body will oscillate within a range of +/- 5
mm and return to a smooth ride within 5 seconds.
Deliverables Timeline:
92