CISE 302 Linear Control Systems Lab Manual
CISE 302 Linear Control Systems Lab Manual
CISE 302
Linear Control Systems
Laboratory Manual
Systems Engineering Department
Semester 083
2 LabExperiment1:UsingMATLABforControlSystems
Table of Contents
LabExperiment1:UsingMATLABforControlSystems................................................................................4
PartI:IntroductiontoMATLAB.................................................................................................................4
PartII:PolynomialsinMATLAB...............................................................................................................15
PartIII:Scripts,Functions&FlowControlinMATLAB............................................................................20
LaboratoryExperiment2:MathematicalModelingofPhysicalSystems...................................................27
MassSpringSystemModel.................................................................................................................27
SpeedCruiseControlexample:...........................................................................................................29
MassSpringSystemExample:............................................................................................................30
Exercises..................................................................................................................................................32
LaboratoryExperiment3:LinearTimeinvariantSystemsandRepresentation.........................................33
MassSpringSystemModel.................................................................................................................33
TransferFunction:...............................................................................................................................34
LinearTimeInvariantSystemsinMATLAB:........................................................................................34
ExamplesofCreatingLTIModels........................................................................................................34
SimulationofLinearsystemstodifferentinputs....................................................................................36
Exercises.....................................................................................................Error!Bookmarknotdefined.
LabExperiment4:BlockDiagramReduction..............................................................................................40
LabExperiment5:PerformanceofFirstorderandsecondordersystems................................................47
LabExperiment6:DCMotorCharacteristics..............................................................................................52
ModelofthearmaturecontrolledDCmotor:........................................................................................53
ModelSimulationusingSimulink:...........................................................................................................54
ParameterIdentification:........................................................................................................................60
LabExperiment7:ValidationofDCMotorCharacteristics........................................................................64
Modelvalidation:....................................................................................................................................64
Nonlinearcharacteristics........................................................................................................................67
LabExperiment8:EffectofFeedbackondisturbance&ControlSystemDesign......................................70
LabExperiment9:EffectofFeedbackondisturbance&ControlSystemDesignofTankLevelSystem....73
LabExperiment10:IntroductiontoPIDcontroller....................................................................................75
LabExperiment11:OpenLoopandClosedLooppositioncontrolofDCMotor........................................83
LabExperiment12:PIDControllerDesignforTwoTankSystem...............................................................89
3 LabExperiment1:UsingMATLABforControlSystems
PartI:DesignofProportionalControlinthePIDController................................................................91
PartII:DesignofIntegralPartinthePIDController............................................................................94
LabExperiment13:SimpleSpeedControlofDCMotor.............................................................................96
4 LabExperiment1:UsingMATLABforControlSystems
CISE 302
Linear Control Systems
Lab Experiment 1: Using MATLAB for Control Systems
Objectives: This lab provides an introduction to MATLAB in the first part. The lab also
provides tutorial of polynomials, script writing and programming aspect of MATLAB from
control systems view point.
List of Equipment/Software
Following equipment/software is required:
- MATLAB
Category Soft-Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- MATLAB scripts and their results should be reported properly.
Part I: Introduction to MATLAB
Objective: The objective of this exercise will be to introduce you to the concept of
mathematical programming using the software called MATLAB. We shall study how to define
variables, matrices etc, see how we can plot results and write simple MATLAB codes.
MATLAB TUTORIAL
Reference: Engineering Problem Solving Using MATLAB, by Professor Gary Ford, University of California, Davis.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
5 LabExperiment1:UsingMATLABforControlSystems
Topics
Introduction
MATLAB Environment
Getting Help
Variables
Vectors, Matrices, and Linear Algebra
Plotting
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Introduction
What is MATLAB ?
MATLAB is a computer program that combines computation and
visualization power that makes it particularly useful tool for
engineers.
MATLAB is an executive program, and a script can be made with a
list of MATLAB commands like other programming language.
MATLAB St ands for MATrix LABorat ory.
The syst em was designed t o make mat rix comput at ion part icularly easy.
The MATLAB environment allows t he user t o:
manage variables
import and export dat a
perform calculat ions
generat e plot s
develop and manage files for use wit h MATLAB.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
MATLAB
Environment
To start MATLAB:
START PROGRAMS
MATLAB 6.5 MATLAB
6.5
Or shortcut creation/activation
on the desktop
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
6 LabExperiment1:UsingMATLABforControlSystems
Display Windows
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Display Windows (cont)
Graphic (Figure) Window
Displays plots and graphs
Created in response to graphics
commands.
M-file editor/debugger window
Create and edit scripts of commands called
M-files.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Getting Help
type one of following commands in the command
window:
help lists all the help topic
help topic provides help for the specified topic
help command provides help for the specified command
help help provides information on use of the help command
helpwin opens a separate help window for navigation
lookfor keyword Search all M-files for keyword
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
7 LabExperiment1:UsingMATLABforControlSystems
Variables
Variable names:
Must start with a letter
May contain only letters, digits, and the underscore _
Matlab is case sensitive, i.e. one & OnE are different variables.
Matlab only recognizes the first 31 characters in a variable name.
Assignment statement:
Variable = number;
Variable = expression;
Example:
>> tutorial = 1234;
>> tutorial = 1234
tutorial =
1234
NOTE: when a semi-colon
; is placed at t he end of
each command, t he result
is not displayed.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Variables (cont)
Special variables:
ans : default variable name for the result
pi: t = 3.1415926
eps: e = 2.2204e-016, smallest amount by which 2 numbers can differ.
Inf or inf : , infinity
NaN or nan: not-a-number
Commands involving variables:
who: lists the names of defined variables
whos: lists the names and sizes of defined variables
clear: clears all varialbes, reset the default values of special
variables.
clear name: clears the variable name
clc: clears the command window
clf: clears the current figure and the graph window.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Vectors, Matrices and Linear Algebra
Vectors
Matrices
Array Operations
Solutions to Systems of Linear
Equations.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
8 LabExperiment1:UsingMATLABforControlSystems
Vectors
A row vector in MATLAB can be created by an explicit list, starting with a left bracket,
entering the values separated by spaces (or commas) and closing the vector with a right
bracket.
A column vector can be created the same way, and the rows are separated by semicolons.
Example:
>> x = [ 0 0.25*pi 0.5*pi 0.75*pi pi ]
x =
0 0.7854 1.5708 2.3562 3.1416
>> y = [ 0; 0.25*pi; 0.5*pi; 0.75*pi; pi ]
y =
0
0.7854
1.5708
2.3562
3.1416
x is a row vect or.
y is a column vect or.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Vectors (cont)
Vector Addressing A vector element is addressed in MATLAB with an integer
index enclosed in parentheses.
Example:
>> x(3)
ans =
1.5708
1
st
t o 3
rd
element s of vect or x
The colon notation may be used to address a block of elements.
(start : increment : end)
start is the starting index, increment is the amount to add to each successive index, and end
is the ending index. A shortened format (start : end) may be used if increment is 1.
Example:
>> x(1:3)
ans =
0 0.7854 1.5708
NOTE: MATLAB index st art s at 1.
3
rd
element of vect or x
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Vectors (cont)
Some useful commands:
x = start:end creat e row vect or x st art ing wit h st art , count ing by
one, ending at end
x = start:increment:end
creat e row vect or x st art ing wit h st art , count ing by
increment , ending at or before end
linspace(start,end,number) creat e row vect or x st art ing wit h st art , ending at
end, having number element s
length(x) ret urns t he lengt h of vect or x
y = x t ranspose of vect or x
dot (x, y) ret urns t he scalar dot product of t he vect or x and y.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
9 LabExperiment1:UsingMATLABforControlSystems
Matrices
A is an m x n matrix.
A Matrix array is two-dimensional, having both multiple rows and multiple columns,
similar to vector arrays:
it begins with [, and end with ]
spaces or commas are used to separate elements in a row
semicolon or enter is used to separate rows.
Example:
>> f = [ 1 2 3; 4 5 6]
f =
1 2 3
4 5 6
>> h = [ 2 4 6
1 3 5]
h =
2 4 6
1 3 5
t he main diagonal
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Matrices (cont)
Magic Funct ion
For example you can generat e a mat rix by ent ering
> > m= magic(4)
I t generat es a mat rix whose element s are such t hat t he sum of all element s in
it s rows, columns and diagonal element s are same
Sum Funct ion
You can verify t he above magic square by ent ering
> > sum(m)
For rows t ake t he t ranspose and t hen t ake t he sum
> > sum(m)
Diag
You can get t he diagonal element s of a mat rix by ent ering
> > d= diag(m)
> > sum(d)
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Matrices (cont)
Matrix Addressing:
-- matrixname(row, column)
-- colon may be used in place of a row or column reference to select
the entire row or column.
recall:
f =
1 2 3
4 5 6
h =
2 4 6
1 3 5
Example:
>> f(2,3)
ans =
6
>> h(:,1)
ans =
2
1
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
10 LabExperiment1:UsingMATLABforControlSystems
Matrices (cont)
Some useful commands:
zeros(n)
zeros(m,n)
ones(n)
ones(m,n)
rand(n)
rand(m,n)
size (A)
length(A)
ret urns a n x n mat rix of zeros
ret urns a m x n mat rix of zeros
ret urns a n x n mat rix of ones
ret urns a m x n mat rix of ones
ret urns a n x n mat rix of random number
ret urns a m x n mat rix of random number
for a m x n mat rix A, ret urns t he row vect or [ m,n]
cont aining t he number of rows and columns in
mat rix.
ret urns t he larger of t he number of rows or
columns in A.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Matrices (cont)
Transpose B = A
I dent it y Mat rix eye(n) ret urns an n x n ident ity mat rix
eye(m,n) ret urns an m x n mat rix wit h ones on t he main
diagonal and zeros elsewhere.
Addit ion and subt ract ion C = A + B
C = A B
Scalar Mult iplicat ion B = oA, where o is a scalar.
Mat rix Mult iplicat ion C = A* B
Mat rix I nverse B = inv(A), A must be a square matrix in t his case.
rank (A) ret urns t he rank of t he mat rix A.
Mat rix Powers B = A.^ 2 squares each element in t he mat rix
C = A * A comput es A* A, and A must be a square mat rix.
Det erminant det (A), and A must be a square mat rix.
more commands
A, B, C are mat rices, and m, n, o are scalars.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Array Operations
Scalar-Array Mathematics
For addition, subtraction, multiplication, and division of an array by a
scalar simply apply the operations to all elements of the array.
Example:
>> f = [ 1 2; 3 4]
f =
1 2
3 4
>> g = 2*f 1
g =
1 3
5 7
Each element in t he array f is
mult iplied by 2, t hen subt ract ed
by 1.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
11 LabExperiment1:UsingMATLABforControlSystems
=
1 1 1
2 3 1
1 2 3
A
(
(
(
=
3
2
1
x
x
x
x
(
(
(
=
1
5
10
b
Let :
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Solutions to Systems of Linear Equations
(cont)
Solution by Matrix Inverse:
Ax = b
A
-1
Ax = A
-1
b
x = A
-1
b
MATLAB:
>> A = [ 3 2 -1; -1 3 2; 1 -1 -1];
>> b = [ 10; 5; -1];
>> x = inv(A)*b
x =
-2.0000
5.0000
-6.0000
Answer:
x
1
= -2, x
2
= 5, x
3
= -6
Solution by Matrix Division:
The solution to the equation
Ax = b
can be computed using left division.
Answer:
x
1
= -2, x
2
= 5, x
3
= -6
NOTE:
left division: A\b b A right division: x/y x y
MATLAB:
>> A = [ 3 2 -1; -1 3 2; 1 -1 -1];
>> b = [ 10; 5; -1];
>> x = A\b
x =
-2.0000
5.0000
-6.0000
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
12 LabExperiment1:UsingMATLABforControlSystems
Plotting
For more information on 2-D plotting, type help graph2d
Plotting a point:
>> plot ( variablename, symbol)
t he f unct i on pl ot ( ) creat es a
graphi cs wi ndow, cal l ed a Fi gure
wi ndow, and named by def aul t
Fi gure No. 1
Example : Complex number
> > z = 1 + 0.5j ;
> > plot (z, .)
commands for axes:
command descr i pt i on
axis ([ xmin xmax ymin ymax] ) Define minimum and maximum values of t he axes
axis square Produce a square plot
axis equal equal scaling factors for both axes
axis normal turn off axis square, equal
axis (auto) ret urn the axis to defaults
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Plot t ing (cont )
Plot t ing Curves:
pl ot ( x,y) generat es a linear plot of t he values of x (horizont al axis) and y
(vert ical axis).
semi l ogx ( x,y) generat e a plot of t he values of x and y using a logarit hmic
scale for x and a linear scale for y
semi l ogy ( x,y) generat e a plot of t he values of x and y using a linear scale
for x and a logarit hmic scale for y.
l ogl og( x,y) generat e a plot of t he values of x and y using logarit hmic scales
for bot h x and y
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
Plot t ing (cont )
Mult iple Curves:
pl ot ( x, y, w, z) mult iple curves can be plot t ed on t he same graph by using
mult iple argument s in a plot command. The variables x, y, w, and z are
vect ors. Two curves will be plot t ed: y vs. x, and z vs. w.
l egend ( st r i ng1, st r i ng2,) used t o dist inguish bet ween plot s on t he
same graph
Mult iple Figures:
f i gur e ( n) used in creat ion of mult iple plot windows. place t his command
before t he plot () command, and t he corresponding figure will be labeled as
Figure n
cl ose closes t he figure n window.
cl ose al l closes all t he figure windows.
Subplot s:
subpl ot ( m, n, p) m by n grid of windows, wit h p specifying t he
current plot as t he p
t h
window
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
13 LabExperiment1:UsingMATLABforControlSystems
By convention, MATLAB stores roots in column vectors. The function poly returns to the
polynomial coefficients:
>>p2 = poly(r)
p2 =
1 8.8818e-16 -2 -5
poly and roots are inverse functions,
Characteristic Polynomials
The poly function also computes the coefficients of the characteristic polynomial of a matrix:
>>A = [1.2 3 -0.9; 5 1.75 6; 9 0 1];
>>poly(A)
ans =
1.0000 -3.9500 -1.8500 -163.2750
The roots of this polynomial, computed with roots, are the characteristic roots, or eigenvalues, of
the matrix A. (Use eig to compute the eigenvalues of a matrix directly.)
Polynomial Evaluation
The polyval function evaluates a polynomial at a specified value. To evaluate p at s = 5, use
>>polyval(p,5)
ans =
110
It is also possible to evaluate a polynomial in a matrix sense. In this case the equation p(x) =
x
3
- 2x - S becomes p(X) = X
3
- 2X -SI, where X is a square matrix and I is the identity
matrix.
For example, create a square matrix X and evaluate the polynomial p at X:
>>X = [2 4 5; -1 0 3; 7 1 5];
>>Y = polyvalm(p,X)
Y =
377 179 439
111 81 136
490 253 639
Convolution and Deconvolution
17 LabExperiment1:UsingMATLABforControlSystems
q =
-2 -8 -2
d =
4 16 40 48 36
q/d is the result of the operation.
Partial Fraction Expansion
residue finds the partial fraction expansion of the ratio of two polynomials. This is particularly
useful for applications that represent systems in transfer function form. For polynomials b and a,
b(s)
o(s)
=
r
1
s - p
1
+
r
2
s - p
2
+ +
r
n
s - p
n
+ k
s
if there are no multiple roots, where r is a column vector of residues, p is a column vector of pole
locations, and k is a row vector of direct terms.
Consider the transfer function
>>b = [-4 8];
>>a = [1 6 8];
>>[r,p,k] = residue(b,a)
r =
-12
8
p =
-4
-2
k =
[]
Given three input arguments (r, p, and k), residue converts back to polynomial form:
>>[b2,a2] = residue(r,p,k)
b2 =
-4 8
a2 =
1 6 8
19 LabExperiment1:UsingMATLABforControlSystems
Exercise 1:
Consider the two polynomials p(s) = s
2
+ 2s + 1 and q(s) = s +1. Using MATLAB
compute
a. p(s) - q(s)
b. Roots of p(s) and q(s)
c. p(-1) and q(6)
Exercise 2:
Use MATLAB command to find the partial fraction of the following
a.
B(s)
A(s)
=
2s
3
+5s
2
+3s+6
s
3
+6s
2
+11s+6
b.
B(s)
A(s)
=
s
2
+2s+3
(s+1)
3
20 LabExperiment1:UsingMATLABforControlSystems
Functions:
Functions are M-files that can accept input arguments and return output arguments. The names
of the M-file and of the function should be the same. Functions operate on variables within their
own workspace, separate from the workspace you access at the MATLAB command prompt. An
example is provided below:
M-File Element Description
Function definition line
(functions only)
Defines the function name, and the number and order of input and
output arguments.
H1 line A one line summary description of the program, displayed when
you request help on an entire directory, or when you use lookfor.
Help text A more detailed description of the program, displayed together
with the H1 line when you request help on a specific function
Function or script body Program code that performs the actual computations and assigns
values to any output arguments.
Comments Text in the body of the program that explains the internal workings
of the program.
The first line of a function M-file starts with the keyword function. It gives the function name
and order of arguments. In this case, there is one input arguments and one output argument. The
next several lines, up to the first blank or executable line, are comment lines that provide the help
text. These lines are printed when you type help fact. The first line of the help text is the H1
line, which MATLAB displays when you use the lookfor command or request help on a
directory. The rest of the file is the executable MATLAB code defining the function.
The variable n & f introduced in the body of the function as well as the variables on the first line
are all local to the function; they are separate from any variables in the MATLAB workspace.
This example illustrates one aspect of MATLAB functions that is not ordinarily found in other
programming languagesa variable number of arguments. Many M-files work this way. If no
output argument is supplied, the result is stored in ans. If the second input argument is not
supplied, the function computes a default value.
function f = fact(n) Function uefinition line
% Compute a factorial value. B1 line
% FACT(N) returns the factorial of N, Belp text
% usually denoted by N!
% Put simply, FACT(N) is PROD(1:N). Comment
f = prod(1:n); Function bouy
22 LabExperiment1:UsingMATLABforControlSystems
Flow Control:
Conditional Control if, else, switch
This section covers those MATLAB functions that provide conditional program control. if, else,
and elseif. The if statement evaluates a logical expression and executes a group of statements
when the expression is true. The optional elseif and else keywords provide for the execution of
alternate groups of statements. An end keyword, which matches the if, terminates the last group
of statements.
The groups of statements are delineated by the four keywordsno braces or brackets are
involved as given below.
if <condition>
<statements>;
elseif <condition>
<statements>;
else
<statements>;
end
It is important to understand how relational operators and if statements work with matrices.
When you want to check for equality between two variables, you might use
if A == B, ...
This is valid MATLAB code, and does what you expect when A and B are scalars. But when A
and B are matrices, A == B does not test if they are equal, it tests where they are equal; the result
is another matrix of 0's and 1's showing element-by-element equality. (In fact, if A and B are not
the same size, then A == B is an error.)
The proper way to check for equality between two variables is to use the isequal function:
if isequal(A, B), ...
isequal returns a scalar logical value of 1 (representing true) or 0 (false), instead of a matrix, as
the expression to be evaluated by the if function.
>>A = magic(4);
>>B = A;
>>B(1,1) = 0;
>>A == B
ans =
0 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
23 LabExperiment1:UsingMATLABforControlSystems
Unlike the C language switch statement, MATLAB switch does not fall through. If the first case
statement is true, the other case statements do not execute. So, break statements are not required.
For, while, break and continue:
This section covers those MATLAB functions that provide control over program loops.
for:
The for loop, is used to repeat a group of statements for a fixed, predetermined number of
times. A matching end delineates the statements. The syntax is as follows:
for <index> = <starting number>:<step or increment>:<ending number>
<statements>;
end
The semicolon terminating the inner statement suppresses repeated printing, and the r after the
loop displays the final result.
It is a good idea to indent the loops for readability, especially when they are nested:
while:
The while loop, repeats a group of statements indefinite number of times under control of a
logical condition. So a while loop executes atleast once before it checks the condition to stop the
execution of statements. A matching end delineates the statements. The syntax of the while
loop is as follows:
while <condition>
<statements>;
end
Here is a complete program, illustrating while, if, else, and end, that uses interval bisection to
find a zero of a polynomial:
for n = 1:4
r(n) = n*n; % square of a number
end
r
for i = 1:m
for j = 1:n
H(i,j) = 1/(i+j);
end
end
25 LabExperiment1:UsingMATLABforControlSystems
The result is a root of the polynomial x
3
- 2x - 5, namely x = 2.0945. The cautions involving
matrix comparisons that are discussed in the section on the if statement also apply to the while
statement.
break:
The break statement lets you exit early from a for loop or while loop. In nested loops, break
exits from the innermost loop only. Above is an improvement on the example from the previous
section. Why is this use of break a good idea?
continue:
The continue statement passes control to the next iteration of the for loop or while loop in which
it appears, skipping any remaining statements in the body of the loop. The same holds true for
continue statements in nested loops. That is, execution continues at the beginning of the loop in
which the continue statement was encountered.
a = 0; fa = -Inf;
b = 3; fb = Inf;
while b-a > eps*b
x = (a+b)/2;
fx = x^3-2*x-5;
if sign(fx) == sign(fa)
a = x; fa = fx;
else
b = x; fb = fx;
end
end
x
a = 0; fa = -Inf;
b = 3; fb = Inf;
while b-a > eps*b
x = (a+b)/2;
fx = x^3-2*x-5;
if fx == 0
break
elseif sign(fx) == sign(fa)
a = x; fa = fx;
else
b = x; fb = fx;
end
end
26 LabExperiment1:UsingMATLABforControlSystems
Exersice 1: MATLAB M-file Script
Use MATLAB to generate the first 100 terms in the sequence a(n) define recursively by
a(n + 1) = p - a(n) - (1 - a(n))
with p=2.9 and a(1) = 0.5.
Exersice 2: MATLAB M-file Function
Consider the following equation
y(t) =
y()
1 -
e
-m
n
t
stn(m
n
1 -
2
- t + 0)
a) Write a MATLAB M-file function to obtain numerical values of y(t). Your function must
take y(0), ,
n
, t and as function inputs and y(t) as output argument.
b) Obtain the plot for y(t) for 0<t<10 with an increment of 0.1, by considering the following
two cases
Case 1: y(0)=0.15 m,
n
= 2 rad/sec, = 3/(22) and = 0;
Case 2: y(0)=0.15 m,
n
= 2 rad/sec, = 1/(22) and = 0;
Exersice 3: MATLAB Flow Control
Use for or while loop to convert degrees Fahrenheit (T
f
) to degrees Celsius using the
following equation T
=
9
5
- T
c
+ 32. Use any starting temperature, increment and ending
temperature (example: starting temperature=0, increment=10, ending temperature = 200).
Please submit the exercises (m-files and results) in the next lab.
27 LaboratoryExperiment2:MathematicalModelingofPhysicalSystems
CISE 302
Linear Control Systems
Laboratory Experiment 2: Mathematical Modeling of Physical Systems
Objectives: The objective of this exercise is to grasp the important role mathematical models
of physical systems in the design and analysis of control systems. We will learn how MATLAB
helps in solving such models.
List of Equipment/Software
Following equipment/software is required:
- MATLAB
Category Soft-Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- MATLAB scripts and their results for all the assignments and exercises should be
properly reported.
Mass-Spring System Model
Consider the following Mass-Spring system shown in the figure. Where F
s
(x) is the spring force,
F
f
(x ) is the friction coefficient, x(t) is the displacement and F
a
(t) is the applied force:
Where
o =
J:(t)
Jt
=
J
2
x(t)
Jt
2
is tbc occclcrotion,
F
s
(x)
M
F
f
( :)
F
a
(t)
x(t)
M
F
a
(t)
F
f
( :)
F
s
(x)
28 LaboratoryExperiment2:MathematicalModelingofPhysicalSystems
: =
dx(t)
dt
is tbc spccJ,
and
x(t) is tbc Jisploccmcnt.
According to the laws of physics
Ho + F
]
(:) +F
s
(x) = F
u
(t) (1)
In the case where:
F
]
(:) = B: = B
dx(t)
dt
F
s
(x) = Kx(t)
The differential equation for the above Mass-Spring system can then be written as follows
H
d
2
x(t)
dt
2
+ B
dx(t)
dt
+Kx(t) = F
u
(t) (2)
B is called the friction coefficient and K is called the spring constant.
The linear differential equation of second order (2) describes the relationship between the
displacement and the applied force. The differential equation can then be used to study the time
behavior of x(t) under various changes of the applied force. In reality, the spring force and/or the
friction force can have a more complicated expression or could be represented by a graph or data
table. For instance, a nonlinear spring can be designed (see figure 4.2) such that
F
s
(x) = Kx
(t) = F
u
(t) (3)
Equation (3) represents another possible model that describes the dynamic behavior of the mass-
damper system under external force. Model (2) is said to be a linear model whereas (3) is said to
29 LaboratoryExperiment2:MathematicalModelingofPhysicalSystems
% dv/dt=Fa/M-B/M v
dvdt=Fa/M-B/M*v;
2_ in MATLAB write
>> v0= 0; %(initial speed)
>> options = odeset('RelTol',1e-4,'AbsTol',[1e-5],'Stats','on');
>>[t,v]=ode45('cruise_speed', [0 125],v0);
>> plot(t,v);
>>title('cruise speed time response to a constant traction force Fa(t) ')
>>grid
There are many other MATLAB ODE solvers such as ode23, ode45, ode113, ode15s, etc The
function dsolve will result in a symbolic solution. Do doc dsolve to know more. In MATLAB
write
>>dsolve(Dv=Fa/M-B/M*v, v(0)=0)
Note that using MATLAB ODE solvers are able to solve linear or nonlinear ODEs. We will see
in part II of this experiment another approach to solve a linear ODE differently. Higher order
systems can also be solved similarly.
Mass-Spring System Example:
Assume the spring force F
s
(x) = Kx
(t) = F
u
(t)
The second order differential equation has to be decomposed in a set of first order differential
equations as follows
Variables New variable Differential equation
x(t) X
1
JX
1
Jt
= X
2
dx(t)/dt X
2
JX
2
Jt
= -
B
H
X
2
-
K
H
X
1
(t) +
F
u
(t)
H
In vector form, let X = _
X
1
X
2
_ ;
dX
dt
= _
dX
1
dt
dX
2
dt
_ then the system can be written as
JX
Jt
= _
X
2
-
B
H
X
2
-
K
H
X
1
(t) +
F
u
(t)
H
_
31 LaboratoryExperiment2:MathematicalModelingofPhysicalSystems
Massdis
placementy(t)
Mass
M
Spring
Constantk
Forcing
Functionf(t)
k
Friction
Constantb
Exercises 1
Consider the mechanical system depicted in the
figure. The input is given by (t), and the output is
given by y(t). Determine the transfer function from
(t) to y(t) and using MATLAB, write a m-file
and plot the system response to a unit step input.
Let m = 1u, k = 1 and b = u.S. Show that the
peak amplitude of the output is about 1.8.
Exercises2
Consider the differential equation y + 4y + 4y = u where y(u) = y (u) = u and u(t)
is a unit step. Determine the solution analytically and verify by co-plotting the analytical
solution and the step response obtained with step function.
Exercise3:
Find a dynamic system represented by a differential equation(s) in a journal article.
Write a two-pages paper that describes the systems, illustrate the solution using
MATLAB and determine by simulation which coefficient in the dynamic equation that
has most impact on the dynamic behavior of the system.
33 LaboratoryExperiment3:LinearTimeinvariantSystemsandRepresentation
CISE 302
Linear Control Systems
Laboratory Experiment 3: Linear Time-invariant Systems and
Representation
Objectives:This experiment has following two objectives:
1. Continued with the learning of Mathematical Modeling from previous experiment, we
now start focusing the linear systems. We will learn commands in MATLAB that would
be used to represent such systems in terms of transfer function or pole-zero-gain
representations.
2. We will also learn how to make preliminary analysis of such systems using plots of poles
and zeros locations as well as time response due to impulse, step and arbitrary inputs.
List of Equipment/Software
Following equipment/software is required:
- MATLAB
Category Soft-Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- MATLAB scripts and their results should be reported properly.
Mass-Spring System Model
The spring force is assumed to be either linear or can be approximated by a linear function
F
s
(x)= Kx, B is the friction coefficient, x(t) is the displacement and F
a
(t) is the applied force:
34 LaboratoryExperiment3:LinearTimeinvariantSystemsandRepresentation
The differential equation for the above Mass-Spring system can be derived as follows
H
J
2
x(t)
Jt
2
+ B
Jx(t)
Jt
+ Kx(t) = F
u
(t)
Transfer Function:
Applying the Laplace transformation while assuming the initial conditions are zeros, we get
(Hs
2
+ Bs + K) - X(s) = F
u
(s)
Then the transfer function representation of the system is given by
IF =
0utput
Input
=
F
u
(s)
X(s)
=
1
(Hs
2
+ Bs + K)
Linear Time-Invariant Systems in MATLAB:
Control System Toolbox in MATLAB offers extensive tools to manipulate and analyze linear
time-invariant (LTI) models. It supports both continuous- and discrete-time systems. Systems
can be single-input/single-output (SISO) or multiple-input/multiple-output (MIMO). You can
specify LTI models as:
Transfer functions (TF), for example,
P(s) =
s + 2
s
2
+ s + 1u
Note: All LTI models are represented as a ratio of polynomial functions
Examples of Creating LTI Models
Building LTI models with Control System Toolbox is straightforward. The following sections
show simple examples. Note that all LTI models, i.e. TF, ZPK and SS are also MATLAB
objects.
Example of Creating Transfer Function Models
You can create transfer function (TF) models by specifying numerator and denominator
coefficients. For example,
F
s
(x)
M
F
f
( :)
F
a
(t)
x(t)
M
F
a
(t)
F
f
( :)
F
s
(x)
35 LaboratoryExperiment3:LinearTimeinvariantSystemsandRepresentation
>>num = [1 0];
>>den = [1 2 1];
>>sys = tf(num,den)
Transfer function:
s
-------------
s^2 + 2 s + 1
A useful trick is to create the Laplace variable, s. That way, you can specify polynomials using s
as the polynomial variable.
>>s=tf('s');
>>sys= s/(s^2 + 2*s + 1)
Transfer function:
s
-------------
s^2 + 2 s + 1
This is identical to the previous transfer function.
Example of Creating Zero-Pole-Gain Models
To create zero-pole-gain (ZPK) models, you must specify each of the three components in vector
format. For example,
>>sys = zpk([0],[-1 -1],[1])
Zero/pole/gain:
s
-------
(s+1)^2
produces the same transfer function built in the TF example, but the representation is now ZPK.
This example shows a more complicated ZPK model.
>>sys=zpk([1 0], [-1 -3 -.28],[.776])
Zero/pole/gain:
0.776 s (s-1)
--------------------
(s+1) (s+3) (s+0.28)
Plotting poles and zeros of a system:
36 LaboratoryExperiment3:LinearTimeinvariantSystemsandRepresentation
pzmap
Compute pole-zero map of LTI models
pzmap(sys)
pzmap(sys1,sys2,...,sysN)
[p,z] = pzmap(sys)
Description:
pzmap(sys) plots the pole-zero map of the
continuous- or discrete-time LTI model sys. For
SISO systems, pzmap plots the transfer function
poles and zeros. The poles are plotted as x's and the
zeros are plotted as o's.
pzmap(sys1,sys2,...,sysN) plots the pole-zero map
of several LTI models on a single figure. The LTI
models can have different numbers of inputs and
outputs. When invoked with left-hand arguments,
[p,z] = pzmap(sys) returns the system poles and
zeros in the column vectors p and z. No plot is
drawn on the screen. You can use the functions
sgrid or zgrid to plot lines of constant damping
ratio and natural frequency in the s- or z- plane.
Example
Plot the poles and zeros of the continuous-time system.
E(s) =
2s
2
+ Ss + 1
s
2
+ 2s + S
>>H = tf([2 5 1],[1 2 3]); sgrid
>>pzmap(H)
Simulation of Linear systems to different
inputs
impulse, step and lsim
You can simulate the LTI systems to inputs like
impulse, step and other standard inputs and see the
plot of the response in the figure window.
MATLAB command impulse calculates the unit
impulse response of the system, step calculates
the unit step response of the system and lsim
simulates the (time) response of continuous or
discrete linear systems to arbitrary inputs. When
37 LaboratoryExperiment3:LinearTimeinvariantSystemsandRepresentation
invoked without left-hand arguments, all three commands plots the response on the screen. For
example:
To obtain an impulse response
>> H = tf([2 5 1],[1 2 3]);
>>impulse(H)
To obtain a step response type
>>step(H)
Time-interval specification:
To contain the response of the system you can also
specify the time interval to simulate the system to.
For example,
>> t = 0:0.01:10;
>> impulse(H,t)
Or
>> step(H,t)
Simulation to Arbitrary Inputs:
To simulates the (time) response of continuous or
discrete linear systems to arbitrary inputs use
lsim. When invoked without left-hand arguments,
lsim plots the response on the screen.
lsim(sys,u,t) produces a plot of the time response of the LTI model sys to the input time history
t,u. The vector t specifies the time samples for the simulation and consists of regularly
spaced time samples.
T = 0:dt:Tfinal
The matrix u must have as many rows as time
samples (length(t)) and as many columns as system
inputs. Each row u(I, specifies the input value(s)
at the time sample t(i).
Simulate and plot the response of the system
E(s) =
2s
2
+ Ss + 1
s
2
+ 2s + S
to a square wave with period of four seconds.
First generate the square wave with gensig. Sample every 0.1 second during 10 seconds:
38 LaboratoryExperiment3:LinearTimeinvariantSystemsandRepresentation
>>[u,t] = gensig(square,4,10,0.1);
Then simulate with lsim.
>> H = tf([2 5 1],[1 2 3])
Transfer function:
2 s^2 + 5 s + 1
s^2 + 2 s + 3
>> lsim(H,u,t)
39 LaboratoryExperiment3:LinearTimeinvariantSystemsandRepresentation
Exercise1:
Consider the transfer function
0(s) =
6s
2
+ 1
s
3
+Ss
2
+ Ss + 7
Using MATLAB plot the pole zero map of the above system
Exercise2:
a. Obtain the unit impulse response for the following system
B(s)
A(s)
=
1
s
2
+ u.2s + 1
b. Obtain the unit step response for the following system
B(s)
A(s)
=
s
s
2
+ u.2s + 1
c. Explain why the results in a. and b. are same?
Exercise3:
A system has a transfer function
X(s)
R(s)
=
(1S z )(s + z)
s
2
+ Ss + 1S
Plot the response of the system when R(s) is a unit impulse and unit step for the
parameter z=3, 6 and 12.
40 LabExperiment4:BlockDiagramReduction
CISE 302
Linear Control Systems
Lab Experiment 4: Block Diagram Reduction
Objective: The objective of this exercise will be to learn commands in MATLAB that would
be used to reduce linear systems block diagram using series, parallel and feedback configuration.
List of Equipment/Software
Following equipment/software is required:
- MATLAB
Category Soft-Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- MATLAB scripts and their results for examples, exercises and Dorf (text book) related
material of this lab should be reported properly.
Series configuration: If the two blocks are connected as shown below then the blocks are said
to be in series. It would like multiplying two transfer functions. The MATLAB command for the
such configuration is series.
The series command is implemented as shown below:
Example 1: Given the transfer functions of individual blocks generate the system transfer
function of the block combinations.
41 LabExperiment4:BlockDiagramReduction
The result is as shown below:
Parallel configuration: If the two blocks are connected as shown below then the blocks are
said to be in parallel. It would like adding two transfer functions.
The MATLAB command for implementing a parallel configuration is parallel as shown below:
Example 2: For the previous systems defined, modify the MATLAB commands to obtain the
overall transfer function when the two blocks are in parallel.
Feedback configuration: If the blocks are connected as shown below then the blocks are said
to be in feedback. Notice that in the feedback there is no transfer function H(s) defined. When
not specified, H(s) is unity. Such a system is said to be a unity feedback system.
The MATLAB command for implementing a feedback system is feedback as shown below:
42 LabExperiment4:BlockDiagramReduction
When H(s) is non-unity or specified, such a system is said to be a non-unity feedback system as
shown below:
A non-unity feedback system is implemented in MATLAB using the same feedback command
as shown:
Example 3: Given a unity feedback system as shown in the figure, obtain the overall transfer
function using MATLAB:
The result is as shown below:
43 LabExperiment4:BlockDiagramReduction
Example 4: Given a non-unity feedback system as shown in the figure, obtain the overall transfer
function using MATLAB:
The result is as shown below:
Poles and Zeros of System: To obtain the poles and zeros of the system use the MATLAB
command pole and zero respectively as shown in example 5. You can also use MATLAB
command pzmap to obtain the same.
Example 5: Given a system transfer function plot the location of the system zeros and poles
using the MATLAB pole-zero map command.
For example:
44 LabExperiment4:BlockDiagramReduction
Exercise1: For the following multi-loop feedback system, get closed loop transfer function and
the corresponding pole-zero map of the system.
Given
) 10 (
1
1
+
=
s
G ;
) 1 (
1
2
+
=
s
G ;
) 4 4 (
1
2
2
3
+ +
+
=
s s
s
G ;
) 6 (
1
4
+
+
=
s
s
G ;
) 2 (
1
1
+
+
=
s
s
H ; 2
2
= H ;
1
3
= H
45 LabExperiment4:BlockDiagramReduction
Controller
s + 2
s + S
Plant
+
R(s) Y(s)
46 LabExperiment4:BlockDiagramReduction
+
R(s)
Y(s)
B(s)
k(s + a)
s + b
Controller
1
}s
2
Spacecraft
+
(s)
ActualAltitude
d
(s)
DesiredAltitude
47 LabExperiment5:PerformanceofFirstorderandsecondordersystems
CISE 302
Linear Control Systems
Lab Experiment 5: Performance of First order and second order systems
Objective: The objective of this exercise will be to study the performance characteristics of
first and second order systems using MATLAB.
List of Equipment/Software
Following equipment/software is required:
- MATLAB
Category Soft-Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- MATLAB scripts and their results for Exercise 1 & 2 should be reported properly.
Overview First Order Systems:
An electrical RC-circuit is the simplest example of a first order system. It comprises of a resistor
and capacitor connected in series to a voltage supply as shown below on Figure 1.
Figure 1: RC Circuit
If the capacitor is initially uncharged at zero voltage when the circuit is switched on, it starts to
charge due to the current i' through the resistor until the voltage across it reaches the supply
voltage. As soon as this happens, the current stops flowing or decays to zero, and the circuit
becomes like an open circuit. However, if the supply voltage is removed, and the circuit is
closed, the capacitor will discharge the energy it stored again through the resistor. The time it
takes the capacitor to charge depends on the time constant of the system, which is defined as the
R
C
E(t)
V
c
(t)
48 LabExperiment5:PerformanceofFirstorderandsecondordersystems
time taken by the voltage across the capacitor to rise to approximately 63% of the supply
voltage. For a given RC-circuit, this time constant is = RC. Hence its magnitude depends on
the values of the circuit components.
The RC circuit will always behave in this way, no matter what the values of the components.
That is, the voltage across the capacitor will never increase indefinitely. In this respect we will
say that the system is passive and because of this property it is stable.
For the RC-circuit as shown in Fig. 1, the equation governing its behavior is given by
dv
c
(t)
dt
+
1
RC
v
c
(t) =
1
RC
E where v
c
(u) = v
0
(1)
where v
c
(t) is the voltage across the capacitor, R is the resistance and C is the capacitance. The
constant = RC is the time constant of the system and is defined as the time required by the
system output i.e. v
c
(t) to rise to 63% of its final value (which is E). Hence the above equation
(1) can be expressed in terms of the time constant as:
dv
c
(t)
dt
+ v
c
(t) = E where v
c
(u) = v
0
(1)
Obtaining the transfer function of the above differential equation, we get
v
c
(s)
L(s)
=
1
:s+1
(2)
where is time constant of the system and the system is known as the first order system. The
performance measures of a first order system are its time constant and its steady state.
Exercise1:
a) Given the values of R and C, obtain the unit step response of the first order system.
a. R=2K and C=0.01F
b. R=2.5K and C=0.003F
b) Verify in each case that the calculated time constant ( = RC) and the one measured from
the figure as 63% of the final value are same.
c) Obtain the steady state value of the system.
Overview Second Order Systems:
Consider the following Mass-Spring system shown in the Figure 2. Where K is the spring
constant, B is the friction coefficient, x(t) is the displacement and F(t) is the applied force:
49 LabExperiment5:PerformanceofFirstorderandsecondordersystems
Figure 2. Mass-Spring system
The differential equation for the above Mass-Spring system can be derived as follows
H
J
2
x(t)
Jt
2
+ B
ox(t)
ot
+ Kx(t) = F(t)
Applying the Laplace transformation we get
(Hs
2
+Bs +K) - X(s) = F(s)
provided that, all the initial conditions are zeros. Then the transfer function representation of the
system is given by
IF =
0utput
Input
=
F(s)
X(s)
=
1
(Hs
2
+ Bs + K)
The above system is known as a second order system.
The generalized notation for a second order system described above can be written as
2
2 2
( ) ( )
2
n
n n
Y s R s
s s
e
,e e
=
+ +
With the step input applied to the system, we obtain
2
2 2
( )
( 2 )
n
n n
Y s
s s s
e
,e e
=
+ +
for which the transient output, as obtained from the Laplace transform table (Table 2.3,
Textbook), is
2 1
2
1
( ) 1 sin( 1 cos ( ))
1
n
t
n
y t e t
,e
e , ,
,
= +
K
M
B
F(t)
x(t)
50 LabExperiment5:PerformanceofFirstorderandsecondordersystems
where 0 < < 1. The transient response of the system changes for different values of damping
ratio, . Standard performance measures for a second order feedback system are defined in terms
of step response of a system. Where, the response of the second order system is shown below.
The performance measures could be described as follows:
Rise Time: The time for a system to respond to a step input and attains a response equal to a
percentage of the magnitude of the input. The 0-100% rise time, T
r
, measures the time to 100%
of the magnitude of the input. Alternatively, T
r1
, measures the time from 10% to 90% of the
response to the step input.
Peak Time: The time for a system to respond to a step input and rise to peak response.
Overshoot: The amount by which the system output response proceeds beyond the desired
response. It is calculated as
P.O.= 100%
t
p
M f
f
u
u
where M
Pt
is the peak value of the time response, and fv is the final value of the response.
Settling Time: The time required for the systems output to settle within a certain percentage of
the input amplitude (which is usually taken as 2%). Then, settling time, T
s
, is calculated as
4
s
n
T
,e
=
Exercise2: Effect of damping ratio on performance measures. For a single-loop second order
feedback system given below
51 LabExperiment5:PerformanceofFirstorderandsecondordersystems
Find the step response of the system for values of n = 1 and = 0.1, 0.4, 0.7, 1.0 and 2.0. Plot
all the results in the same figure window and fill the following table.
Rise time Peak Time % Overshoot Settling time Steady state value
0.1
0.4
0.7
1.0
2.0
2
( )
( 2 )
n
n
G s
s s
e
,e
=
+
R(s)
E(s)
Y(s)
+
52 LabExperiment6:DCMotorCharacteristics
CISE 302
Linear Control Systems
Lab Experiment 6: DC Motor Characteristics
Objective: The objective of the experiment is to show how a permanent magnet D.C. motor
may be controlled by varying the magnitude and direction of its armature current and recognize
the torque/speed characteristic of the D.C. Motor
List of Equipment/Software
Following equipment/software is required:
- MATLAB
- LabVIEW
- DC Servo System (feedback equipment)
a. OU150A Op Amp Unit
b. AU150B Attenuator Unit
c. PA150C Pre-Amplifier Unit
d. SA150D Servo Amplifier
e. PS150E Power Supply
f. DCM150F DC Motor
g. IP150H Input Potentiometer
h. OP150K Output Potentiometer
i. GT150X Reduction Gear Tacho
j. DC Voltmeter
Category Software-Hardware Experiment
Note: This lab exercise may take two weeks.
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- Clearly show the model development and the Simulink model.
- Show the parameter identification graphs and calculations properly.
- Connection diagram of the hardware experimental part.
- Report the results in the table and graphical way with summarized learning outcomes.
53 LabExperiment6:DCMotorCharacteristics
Introduction:
This experiment will illustrate the characteristics of the D.C. motor used in the Modular Servo
and show how it can be controlled by the Servo Amplifier.
The motor is a permanent magnet type and has a single armature winding. Current flow through
the armature is controlled by power amplifiers as in figure so that rotation in both directions is
possible by using one, or both of the inputs. In most of the later assignments the necessary input
signals are provided by a specialized Pre-Amplifier Unit PA150C, which connected to Inputs 1
and 2 on SA150D
Figure: Armature Control
Figure: DC motor armature-controlled rotational actuator
As the motor accelerates the armature generates an increasing 'back-emf' V
a
tending to oppose
the driving voltage V
in
. The armature current is thus roughly proportional to (V
in
- V
a
). If the
speed drops (due to loading) V
a
reduces, the current increases and thus so does the motor torque.
This tends to oppose the speed drop. This mode of control is called 'armature-control' and gives a
speed proportional to V
in
as in figure.
Model of the armature-controlled DC motor:
The model of the armature-controlled DC motor has been developed in many text books in
particular (Dorf and Bishop, 2008).
Assignment: Read (Dorf and Bishop, 2008) page 62-65
54 LabExperiment6:DCMotorCharacteristics
}} }
= = u
u
u
dt
d
dt
d
2
2
i
dt
di
=
}
- Insert an Integrator block (from the Linear block library) and draw lines to and from its
input and output terminals.
- Label the input line "d2/dt2(theta)" and the output line "d/dt(theta)" as shown below. To
add such a label, double click in the empty space just above the line.
- Insert another Integrator block attached to the output of the previous one and draw a line
from its output terminal.
- Label the output line "theta".
- Insert a third Integrator block above the first one and draw lines to and from its input and
output terminals.
- Label the input line "d/dt(i)" and the output line "i".
Next, we will start to model both Newton's law and Kirchoff's law. These laws applied to the
motor system give the following equations:
[
d
2
0
dt
2
= I - b
d0
dt
=>
d
2
0
dt
2
=
1
]
[ K
t
i - b
d0
dt
I
d
dt
= -Ri + I - c =>
d
dt
=
1
L
( -Ri + I - K
c
d0
dt
)
56 LabExperiment6:DCMotorCharacteristics
The angular acceleration is equal to 1/J multiplied by the sum of two terms (one pos., one neg.).
Similarly, the derivative of current is equal to 1/L multiplied by the sum of three terms (one pos.,
two neg.).
- Insert two Gain blocks, (from the Linear block library) one attached to each of the
leftmost integrators.
- Edit the gain block corresponding to angular acceleration by double-clicking it and
changing its value to "1/J".
- Change the label of this Gain block to "inertia" by clicking on the word "Gain"
underneath the block.
- Similarly, edit the other Gain's value to "1/L" and it's label to Inductance.
- Insert two Sum blocks (from the Linear block library), one attached by a line to each of
the Gain blocks.
- Edit the signs of the Sum block corresponding to rotation to "+-" since one term is
positive and one is negative.
- Edit the signs of the other Sum block to "-+-" to represent the signs of the terms in
Kirchoff's equation.
Now, we will add in the torques which are represented in Newton's equation. First, we will add
in the damping torque.
- Insert a gain block below the inertia block, select it by single-clicking on it, and select
Flip from the Format menu (or type Ctrl-F) to flip it left-to-right.
- Set the gain value to "b" and rename this block to "damping".
- Tap a line (hold Ctrl while drawing) off the first rotational integrator's output (d/dt(theta))
and connect it to the input of the damping gain block.
- Draw a line from the damping gain output to the negative input of the rotational Sum
block.
57 LabExperiment6:DCMotorCharacteristics
The third voltage term in the Kirchoff equation is the control input, V. We will apply a step
input.
- Insert a Step block (from the Sources block library) and connect it with a line to the
positive input of the current Sum block.
- To view the output speed, insert a Scope (from the Sinks block library) connected to the
output of the second rotational integrator (theta).
- To provide a appropriate unit step input at t=0, double-click the Step block and set the
Step Time to "0".
59 LabExperiment6:DCMotorCharacteristics
Step input:
- Use step input from 0 volts to 2 volts and observe the response.
- Save the response to workspace variable to further compare with the
experimental DC motor (DCM 150F).
- Now Step the input voltage from 2 volts to 4 volts. Save the response to
further compare with experimental motor.
- This is the simulation section for the Exercise 2 Step input.
Sine wave input:
- Remove the Step Input and connect a Function Generator from the Simulink-
Library to the input of the motor model in Simulink.
- Select Sinusoidal function in the function generator.
- Fix the amplitude of the sine wave to 2.
- Take several responses by varying the frequency of the sinusoidal wave
keeping the amplitude fixed.
- Save the input and output of the DC motor model to further compare with
experimental motor response.
- This is the simulation section for the Exercise 2 Sine input
Parameter Identification:
Purpose: Modeling in Simulink requires system parameters of DC motor. If the parameters of
the DC motor system are unknown, students should use this section to determine the system
parameters of the DC motor system. The motor is attached to a tachometer, flywheel, and a load
61 LabExperiment6:DCMotorCharacteristics
(magnetic load disk). Data should be acquired for the unloaded spin up of the motor, as well as
the response of the system upon the application of a load. The data from the experimental setup
can be collected using USB DAQ from National Instruments and LABVIEW software.
Derivations
To measure the constants km and R, we can use equations following equations,
e
m m
k e =
R
e e
i
m a
a
=
Divide by
a
e ,
Hint: The last equation resembles with the well known c mx y + = equation of a line.
Since we have measured values for
a
e ,
a
i , and e , we can plot
a
a
i
e
versus
a
i
e
to determine the
slope and intercept, which reveals the constant values of
m
k and R .
To derive B ,
f
t , and
w
k we use the equation
f a i m
B J i k t e e t + + = =
-
For steady state 0 =
-
e , so we have
f m
B t e t + =
e
a
m
a
a
e R
k
R e
i
=
1
R e
i
e R
k
a
a
a
m
1
= + e
R e
i
e R
i R k
a
a
a
a m
1
= +
+ e
R
i R k
e R
a m
a
=
+ e
a m a
i R k e + = e
R k
i i
e
m
a a
a
+ =
e
62 LabExperiment6:DCMotorCharacteristics
2.
a
a
i
e
(volts/ampere = ohms) versus
a
i
e
(rad/(sec*Amp)): To determine constants
m
k and . R
3.
m
T (N*m) versus e (rad/s): To determine B and
f
T .
Table of values:
T f m
k T k R B k
e
64 LabExperiment7:ValidationofDCMotorCharacteristics
CISE 302
Linear Control Systems
Lab Experiment 7: Validation of DC Motor Characteristics
Objective: The objective of the experiment is to validate the learning outcomes of the last
experiment (Exp. 6) for the characteristic of the D.C. Motor.
List of Equipment/Software
Following equipment/software is required:
- LabVIEW
- DC Servo System (feedback equipment)
a. OU150A Op Amp Unit
b. AU150B Attenuator Unit
c. PA150C Pre-Amplifier Unit
d. SA150D Servo Amplifier
e. PS150E Power Supply
f. DCM150F DC Motor
g. IP150H Input Potentiometer
h. OP150K Output Potentiometer
i. GT150X Reduction Gear Tacho
j. DC Voltmeter
Category Software-Hardware Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- Show the parameter identification graphs and calculations properly.
- Connection diagram of the hardware experimental part.
- Report the results in the table and graphical way with summarized learning outcomes.
Model validation:
Preliminary Procedure:
- Attach the AU150B, SA150D and PS150E, to the baseplate by means of the magnetic
bases.
- Fit the eddy-current brake disc to the motor shaft.
65 LabExperiment7:ValidationofDCMotorCharacteristics
- Now attach the DCM150F to the baseplate by means of the magnetic fixings and fix the
plug into the SA150D.
- Attach the GT150X to the baseplate by means of the magnetic fixings and position it, so
that it is connected to the motor shaft by means of the flexible coupling.
- Attach the LU150L to the baseplate by means of the magnetic fixings and position it so
that when the cursor is on position 10 the eddy-current disc lies midway in the gap with
its edge flush with the back of the magnet.
- Fix the plug from the SA150D into the PS150E
- Connect the Power Supply to the mains supply line, DO NOT switch on yet.
Procedure:
- Connect the equipment as shown in the figure.
- The system provides a tacho-generator coupled to the motor. For use in later
assignments, it will be necessary to calibrate this generator by finding the factor Kg,
which are the volts generated per thousand rev/min of motor shaft.
- Use the switch on the top of the GT150X to display the tacho volts or speed as required.
Figure: Connections for DC Motor
Exercise 1:
1. Set the magnetic brake to the unloaded position and turn the potentiometer till there is a
reading of 1V on the voltmeter.
2. Repeat this reading with a 2V output. Then repeat for 3V, 4V and 5V.
Now record the speed. Tabulate your results in a copy of the table given below.
66 LabExperiment7:ValidationofDCMotorCharacteristics
Tacho-generator
Volts
Speed
r/min
3. Plot a graph of your results, as in figure below, of Speed against Tacho-generator volts.
Figure: Speed vs Tacho-generator volts
The calibration factor Kg = Vg/N-r/min. It should be about 2.OV to 3.OV per 1000 r/min.
Exercise 2: Compare model and real system
- Step the input voltage from 0V to 2 V and compare the output with MATLAB
response.
- While the system is stable and the input is at 2 V, Step the input voltage from 2V to
4V. Record the input and output and compare the output with the same experiment in
MATLAB.
- Connect a frequency generator to the input voltage and fix the input to 2*sin(wt)
where w = 2n. Record the output and compare it to MATLAB response.
67 LabExperiment7:ValidationofDCMotorCharacteristics
Nonlinear characteristics
The difference between the MATLAB model and the real system can be explained by the
presence of a nonlinear dynamic that was ignored during modeling. Indeed, Due to brush
friction, a certain minimum input signal is needed to start the motor rotating. Above figure shows
how the speed varies with load torque. The first experiment will be to obtain the characteristics
of the motor.
Figure: Armature control characteristics
Exercise 3: determination of the nonlinear DC motor characteristics
- Reduce the input voltage till the motor is just turning then measure with your voltmeter
the voltages between OV and potentiometer slider and the tacho-generator output. Then
tabulate as in fig 3.3.6. Increase the input voltage in one-volt steps, take readings of the
input voltage and tachogenerator voltage up to approximately 2000 r/min which is the
maximum speed of the motor.
- Plot the input voltages against speed, your results should be similar to the figure which
shows plot of speed vs voltage.
V
in
Volts
V
g
Volts
Speed
rpm
- Calculate the slope (input volts per thousand r/min).
68 LabExperiment7:ValidationofDCMotorCharacteristics
- Plot the two sets of results, as in figure of Speed against Torque (brake position) for the
two input voltage values.
- Below figure shows the approximate brake position/g.cm characteristics of the motor at
1000 r/min. For other speeds, the torque will be proportional to the speed.
Figure: Approximate brake characteristics at 1000 r/min
With armature control the negative feedback of the back emf will oppose the input signal and so
tend to maintain a steady motor current; this results in a more constant speed over the torque
range. As a result the torque/speed curve becomes more similar to that produced by a shunt
wound motor. The armature-controlled shunt-wound motor is extensively used in control
systems.
70 LabExperiment8:EffectofFeedbackondisturbance&ControlSystemDesign
CISE 302
Linear Control Systems
Lab Experiment 8: Effect of Feedback on disturbance & Control System
Design
Objective: The objective of this exercise will be to study the effect of feedback on the
response of the system to step input and step disturbance taking the practical example of English
Channel boring machine and design a control system taking in account performance
measurement.
List of Equipment/Software
Following equipment/software is required:
- MATLAB
Category Soft - Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- The Simulink model.
- MATLAB scripts and results for Exercise 1 & 2.
Overview:
The construction of the tunnel under the English Channel from France to the Great Britain began
in December 1987. The first connection of the boring tunnels from each country was achieved in
November 1990. The tunnel is 23.5 miles long and bored 200 feet below sea level. Costing $14
billion, it was completed in 1992 making it possible for a train to travel from London to Paris in
three hours.
The machine operated from both ends of the channel, bored towards the middle. To link up
accurately in the middle of the channel, a laser guidance system kept the machines precisely
aligned. A model of the boring machine control is shown in the figure, where Y(s) is the actual
angle of direction of travel of the boring machine and R(s) is the desired angle. The effect of load
on the machine is represented by the disturbance, T
d
(s).
71 LabExperiment8:EffectofFeedbackondisturbance&ControlSystemDesign
Figure: A block diagram model of a boring machine control system
Exercise 1:
a) Get the transfer function from R(s) to Y(s)
b) Get the transfer function from D(s) to Y(s)
c) Generate the system response; for K= 10, 20, 50, 100; due to a unit step input - r(t)
d) Generate the system response; for K= 10, 20, 50, 100; due to a unit step disturbance - d(t)
e) For each case find the percentage overshoot(%O.S.), rise time, settling time, steady state
of y(t)
f) Compare the results of the two cases
g) Investigate the effect of changing the controller gain on the influence of the disturbance
on the system output
M-files for two cases of K=20 and K=100 are shown below
Due to unit step r(s)
% Response to a Unit Step Input R(s)=1/s
for K=20 and K=100
%
numg=[1];deng=[1 1
0];sysg=tf(numg,deng);
K1=100;K2=20;
num1=[11 K1];num2=[11 K2];den=[0 1];
sys1=tf(num1,den);sys2=tf(num2,den);
%
sysa=series(sys1,sysg);sysb=series(sys2,sys
d);
sysc=feedback(sysa,[1]);sysd=feedback(sys
b,[1]);
%
t=[0:0.01:2.0];
[y1,t]=step(sysc,t);[y2,t]=step(sysd,t);
subplot(211);plot(t,y1);title(Step Response
for K=100);
xlabel(Time (seconds));ylabel(y(t));grid
on;
subplot(212);plot(t,y2);title(Step Response
for K=20);
xlabel(Time (seconds));ylabel(y(t));grid
on;
Due to unit disturbance T
d
(s)
% Response to a Disturbance Input D(s)=1/s
for K=20 and K=100
%
numg=[1];deng=[1 1
0];sysg=tf(numg,deng);
K1=100;K2=20;
num1=[11 K1];num2=[11 K2];den=[0 1];
sys1=tf(num1,den);sys2=tf(num2,den);
%
sysa=feedback(sysg,sys1);sysa=minreal(sys
a);
sysb=feedback(sysg,sys2);sysb=minreal(sys
b);
%
t=[0:0.01:2.5];
[y1,t]=step(sysa,t);[y2,t]=step(sysb,t);
subplot(211);plot(t,y1);title(Disturbance
Response for K=100);
xlabel(Time (seconds));ylabel(y(t));grid
on;
K + 11s
Gc(s)
Controller
1
s(s + 1)
G(s)
Plant
+
R(s)
Desired
Angle
Y(s)
Angle +
+
T
d
(s)
72 LabExperiment8:EffectofFeedbackondisturbance&ControlSystemDesign
subplot(212);plot(t,y2);title(Disturbance
Response for K=20);
label(Time (seconds));ylabel(y(t));grid
on;
Exercise 2: Design of a Second order feedback system based on performances.
For the motor system given below, we need to design feedback such that the overshoot is limited
and there is less oscillatory nature in the response based on the specifications provided in the
table. Assume no disturbance (D(s)=0).
Table: Specifications for the Transient
Response
Performance Measure
Desired Value
Percent overshoot Less than 8%
Settling time Less than
400ms
Use MATLAB, to find the system performance for different values of K
a
and find which value of
the gain K
a
satisfies the design condition specified. Use the following table.
K
a
20 30 50 60 80
Percent
Overshoot
Settling
time
K
a
5
1
s(s +2u)
R(s)
+
+
Y(s)
Amplifier
Motor
Constant
Load
D(s)
73 LabExperiment9:EffectofFeedbackondisturbance&ControlSystemDesignofTankLevelSystem
CISE 302
Linear Control Systems
Lab Experiment 9: Effect of Feedback on disturbance & Control System
Design of Tank Level System
Objective: The objective of this exercise will be to study the effect of feedback on the
response of the system to step input and step disturbance on the Two Tank System.
List of Equipment/Software
Following equipment/software is required:
- MATLAB
- LabVIEW
- NI USB 6009 Data Acquisition Card
- Two Tank System (CE 105)
Category Software Hardware Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- LabVIEW programming files (Block diagram and Front Panel)
- Graphical representation of data collected for several cases of disturbance (leakage via
valve at bottom). (Instructors should provide the data collection VI file)
- Controller performance and parameters for each case of disturbance.
Overview:
A model of the tank system and the controller is shown in the figure, where Y(s) is the actual
level of the tank and R(s) is the desired level. The effect of disturbance to the tank system is
represented by the disturbance, T
d
(s). The T
d
(s) is the leakage that can be generated from the
hand valve at the bottom of the tank system.
Gc(s)
Controller
G(s)
Plant
+
R(s)
Desired
Level
Y(s)
Height
(Levelof
tank)
+
+
LeakageT
d
(s)
74 LabExperiment9:EffectofFeedbackondisturbance&ControlSystemDesignofTankLevelSystem
Figure: A block diagram model of a two tank level control system
NOTE: Instructors should manage to complete the hardware/software setup for the students to
take reading and implement the controller.
Exercise:
a) Launch the data collection LabVIEW file and make the proper connections to the Two
Tank System. This experiment uses only one tank of the system.
b) The disturbance to the tank is the hand-valve in the bottom of the first tank.
c) Collect the data for the FIVE cases of leakage valve (valve at bottom).
d) From the theory and understanding from last experiment (Exp 7), identify and prepare the
transfer function and respective controllers for the specifications discussed during last
experiment.
e) Generate the system response; for K= 10, 20, 50, 100; due to the five cases of leakage
disturbance - d(t)
f) For each case find the percentage overshoot(%O.S.), rise time, settling time, steady state
of y(t)
g) Compare the results of all the cases
h) Investigate the effect of changing the controller gain on the influence of the disturbance
on the system output
75 LabExperiment10:IntroductiontoPIDcontroller
CISE 302
Linear Control Systems
Lab Experiment 10: Introduction to PID controller
Objective: Study the three term (PID) controller and its effects on the feedback loop response.
Investigate the characteristics of the each of proportional (P), the integral (I), and the derivative
(D) controls, and how to use them to obtain a desired response.
List of Equipment/Software
Following equipment/software is required:
- MATLAB
- LabVIEW
Category Soft - Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- LabVIEW programming files (Block diagram and Front Panel)
- Controller design and parameters for each of the given exercises.
Introduction: Consider the following unity feedback system:
Plant: A system to be controlled.
Controller: Provides excitation for the plant; Designed to control the overall system behavior.
The three-term controller: The transfer function of the PID controller looks like the following:
K
P
+
K
I
s
+K
s =
K
s
2
+K
P
s + K
I
s
Controller Plant
R e
u Y +
76 LabExperiment10:IntroductiontoPIDcontroller
KP = Proportional gain
KI = Integral gain
KD = Derivative gain
First, let's take a look at how the PID controller works in a closed-loop system using the
schematic shown above. The variable (e) represents the tracking error, the difference between the
desired input value (R) and the actual output (Y). This error signal (e) will be sent to the PID
controller, and the controller computes both the derivative and the integral of this error signal.
The signal (u) just past the controller is now equal to the proportional gain (KP) times the
magnitude of the error plus the integral gain (KI) times the integral of the error plus the
derivative gain (KD) times the derivative of the error.
u = K
P
c(t) + K
I
_c(t)Jt + K
Jc(t)
Jt
This signal (u) will be sent to the plant, and the new output (Y) will be obtained. This new output
(Y) will be sent back to the sensor again to find the new error signal (e). The controller takes this
new error signal and computes its derivatives and its internal again. The process goes on and on.
Example Problem:
Suppose we have a simple mass, spring, and damper problem.
The modeling equation of this system is
Hx + bx + kx = F
Taking the Laplace transform of the modeling equation (1), we get
Hs
2
X(s) + bsX(s) + kX(s) = F(s)
The transfer function between the displacement X(s) and the input F(s) then becomes
77 LabExperiment10:IntroductiontoPIDcontroller
X(s)
F(s)
=
1
Hs
2
+ bs +k
Let
- M = 1kg
- b = 10 N.s/m
- k = 20 N/m
- F(s) = 1
Plug these values into the above transfer function
X(s)
F(s)
=
1
s
2
+ 1us + 2u
The goal of this problem is to show you how each of K
p
, K
i
and K
d
contributes to obtain
- Fast rise time
- Minimum overshoot
- No steady-state error
Open-loop step response: Let's first view the open-loop step response.
num=1;
den=[1 10 20];
plant=tf(num,den);
step(plant)
MATLAB command window should give you the plot shown below.
78 LabExperiment10:IntroductiontoPIDcontroller
The DC gain of the plant transfer function is 1/20, so 0.05 is the final value of the output to a unit
step input. This corresponds to the steady-state error of 0.95, quite large indeed. Furthermore, the
rise time is about one second, and the settling time is about 1.5 seconds. Let's design a controller
that will reduce the rise time, reduce the settling time, and eliminates the steady-state error.
Proportional control:
The closed-loop transfer function of the above system with a proportional controller is:
X(s)
F(s)
=
K
P
s
2
+ 1us +(2u + K
P
)
Let the proportional gain (K
P
) equal 300:
Kp=300;
contr=Kp;
sys_cl=feedback(contr*plant,1);
t=0:0.01:2;
step(sys_cl,t)
MATLAB command window should give you the following plot.
PController
K
P
1
s
2
+1us + 2u
Plant
R e
u Y +
79 LabExperiment10:IntroductiontoPIDcontroller
Note: The MATLAB function called feedback was used to obtain a closed-loop transfer function
directly from the open-loop transfer function (instead of computing closed-loop transfer function
by hand). The above plot shows that the proportional controller reduced both the rise time and
the steady-state error, increased the overshoot, and decreased the settling time by small amount.
Proportional-Derivative control:
The closed-loop transfer function of the given system with a PD controller is:
X(s)
F(s)
=
K
s + K
P
s
2
+ (1u + K
)s + (2u + K
P
)
Let K
P
equal 300 as before and let K
D
equal 10.
Kp=300;
Kd=10;
contr=tf([Kd Kp],1);
sys_cl=feedback(contr*plant,1);
t=0:0.01:2;
step(sys_cl,t)
MATLAB command window should give you the following plot.
PDController
K
P
+K
D
s
1
s
2
+1us + 2u
Plant
R e
u Y +
80 LabExperiment10:IntroductiontoPIDcontroller
This plot shows that the derivative controller reduced both the overshoot and the settling time,
and had a small effect on the rise time and the steady-state error.
Proportional-Integral control:
Before going into a PID control, let's take a look at a PI control. For the given system, the
closed-loop transfer function with a PI control is:
X(s)
F(s)
=
K
P
s +K
I
s
3
+ 1us
2
+ (2u + K
P
)s +K
I
Let's reduce the K
P
to 30, and let K
I
equal 70.
Kp=30;
Ki=70;
contr=tf([Kp Ki],[1 0]);
sys_cl=feedback(contr*plant,1);
t=0:0.01:2;
step(sys_cl,t)
MATLAB command window gives the following plot.
PIController
K
P
+K
I
/s
1
s
2
+1us + 2u
Plant
R e
u Y +
81 LabExperiment10:IntroductiontoPIDcontroller
We have reduced the proportional gain (Kp) because the integral controller also reduces the rise
time and increases the overshoot as the proportional controller does (double effect). The above
response shows that the integral controller eliminated the steady-state error.
Proportional-Integral-Derivative control:
Now, let's take a look at a PID controller. The closed-loop transfer function of the given system
with a PID controller is:
X(s)
F(s)
=
K
s
2
+K
P
s + K
I
s
3
+ (1u + K
)s
2
+ (2u +K
P
)s + K
I
After several trial and error runs, the gains Kp=350, Ki=300, and Kd=50 provided the desired
response. To confirm, enter the following commands to an m-file and run it in the command
window. You should get the following step response.
Kp=350;
Ki=300;
Kd=50;
contr=tf([Kd Kp Ki],[1 0]);
sys_cl=feedback(contr*plant,1);
t=0:0.01:2;
step(sys_cl,t)
PIDController
K
P
+K
I
/s+K
D
s
1
s
2
+1us + 2u
Plant
R e
u Y +
82 LabExperiment10:IntroductiontoPIDcontroller
Now, we have obtained a closed-loop system with no overshoot, fast rise time, and no steady-
state error.
The characteristics of P, I, and D controllers:
The proportional controller (K
P
) will have the effect of reducing the rise time and will reduce,
but never eliminate, the steady state error. An integral controller (K
I
) will have the effect of
eliminating the steady state error, but it may make the transient response worse. A derivative
control (K
D
) will have the effect of increasing the stability of the system, reducing the overshoot
and improving the transient response.
Effect of each controller K
P
, K
I
and K
D
on the closed-loop system are summarized below
CL Response Rise Time Overshoot Settling Time S-S Error
K
P
Decrease Increase Small Change Decrease
K
I
Decrease Increase Increases Eliminate
K
D
Small Change Decreases Decreases Small Change
Note that these corrections may not be accurate, because K
P
, K
I
, and K
D
are dependent of each
other. In fact, changing one of these variables can change the effect of the other two. For this
reason the table should only be used as a reference when you are determining the values for K
P
,
K
I
, and K
D
.
Exersice:
Consider a process given below to be controlled by a PID controller,
) 5 . 48 (
400
) (
+
=
s s
s G
p
a) Obtain the unit step response of Gp(s).
b) Try PI controllers with (Kp=2, 10, 100), and Ki=Kp/10. Investigate the unit step
response in each case, compare the results and comment.
c) Let Kp=100, Ki=10, and add a derivative term with (Kd=0.1, 0.9, 2). Investigate the unit
step response in each case, compare the results and comment.
Based on your results in parts b) and c) above what do you conclude as a suitable PID controller
for this process and give your justification.
83 LabExperiment11:OpenLoopandClosedLooppositioncontrolofDCMotor
CISE 302
Linear Control Systems
Lab Experiment 11: Open Loop and Closed Loop position control of DC
Motor
Objective: To familiarize the servo motor system and experience the open and closed loop
control of servo system to be used in an automatic position control system.
List of Equipment/Software
Following equipment/software is required:
- LabVIEW
- DC Servo System (feedback equipment)
a. OU150A Op Amp Unit
b. AU150B Attenuator Unit
c. PA150C Pre-Amplifier Unit
d. SA150D Servo Amplifier
e. PS150E Power Supply
f. DCM150F DC Motor
g. IP150H Input Potentiometer
h. OP150K Output Potentiometer
i. GT150X Reduction Gear Tacho
j. DC Voltmeter
Category Software-Hardware Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- Connection diagram of the hardware experimental part.
- Report the procedure and troubleshooting during the experiment.
- Show results for the open loop and closed loop position control via graphs and tables.
- Report the LabVIEW program components i.e., Front Panel and Block Diagram.
Procedure (Open loop position control):
84 LabExperiment11:OpenLoopandClosedLooppositioncontrolofDCMotor
1. Attach the AU150B, SA150D and DCM150F to the baseplate by means of the magnetic
fixings.
2. Fix the plugs from the servo amplifier into the power supply.
3. Fix the plug from the motor unit into the servo amplifier.
4. Attach the GT150X to the baseplate by means of the magnetic fixing and position it so
that it is connected to the motor shaft by means of the flexible coupling.
5. Set up for open loop as shown in Fig. 1.
6. Use a push-on coupling to link a low-speed shaft of the GT150X to the output
potentiometer shaft.
7. Starting with AU150B the potentiometer knob at the fully counter-clockwise position
gradually turn it till the motor just rotates and record:
8. Scale position at which the motor just rotates: ..........................(1)
9. Direction in which the output rotary potentiometer moves: ........................ (2)
10. Return the output rotary potentiometer cursor to zero by turning the GT150X high-speed
shaft.
11. Decide on a position in the direction (2), you wish the potentiometer shaft to turn to and
then turn the AU150B potentiometer knob to position (1). As the cursor nears the
required angle, reduce this input signal so that the cursor comes to rest nearly at the
required point.
The open loop system will have you as a feedback. Such a system could be shown as in the
figure.
85 LabExperiment11:OpenLoopandClosedLooppositioncontrolofDCMotor
Figure 1: Open loop System (with you as feedback)
86 LabExperiment11:OpenLoopandClosedLooppositioncontrolofDCMotor
Figure 2: Closed Loop Position control of DC Motor.
88 LabExperiment11:OpenLoopandClosedLooppositioncontrolofDCMotor
Double-click the icon which says motor ( ) on the desktop to start the program to
capture the signal. And click the run button which is the first button on the toolbox below the
file menu. The program should be as shown below.
Identify from the setup the equipment which should be place in the following block diagram
Plantequipment
SA150D,__________,
_________________,
__________,OP150K
___
IP150H
Y(s)
+
Controller
equipment
______
PA150C
89 LabExperiment12:PIDControllerDesignforTwoTankSystem
CISE 302
Linear Control Systems
Lab Experiment 12: PID Controller Design for Two Tank System
Objective: To familiarize the Two Tank System and experience the PID controller design to
control the level of the tank system.
List of Equipment/Software
Following equipment/software is required:
- LabVIEW
- NI USB 6009 Data Acquisition Card
- Two Tank System
Category Software-Hardware Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- Show the PID block diagram and the controller parameters with the process graphs.
- Report the LabVIEW program components i.e., Front Panel and Block Diagram.
The USB DAQ
90 LabExperiment12:PIDControllerDesignforTwoTankSystem
94 LabExperiment12:PIDControllerDesignforTwoTankSystem
2. The 2
nd
frame to receive the sensor signal from the Tank, scale it properly and display it
on the front panel in a graph as well as tank format- using DAQ Assistant, Waveform
Chart, Tank and other numeric icons.
3. The last frame to manually terminate the execution of the program through a stop button
on the front panel and make sure the motor is turned off at the end- using DAQ
Assistant, Case Structure and Numeric Constant.
4. (The entire Flat Sequence must be included in the while loop and the Stop button
terminal must be connected to the stop button of the while loop)
5. Calculate the Error by subtracting (Functions >> Programming>> Numeric >>
Subtract) the sensor value or level from the desired set point. The set point can be
given in the form of a Numeric Constant in the Block diagram or through Vertical pointer
slides, Numeric controls, etc. on the Front panel. This can be done in the 2
nd
or 3
rd
frame.
6.
On the front panel, add 2 Control Knobs from the Numeric palette. This will be used to
control the Proportional gain K
p
and the Integral Gain K
I.
7. In the 3
rd
frame of the Block diagram sequence, check if the error is less than zero. If it is,
then send the tank 0.If not go to the next step. The comparison can be made using the
Case Structure and the Lesser Or Equal? function.
8. Multiply the error with the gain by connecting the error and gain terminal to a
multiplication block. Also, integrate the error by sending it to the Integral block
(Functions >> Mathematics>> Integ & diff >>Time Domain Math- select Integral
in this block) and then multiply the integrated error with the Integral gain as was done
with the Proportional gain. Next, add the 2 products together (use compound arithmetic
or 2 add functions). Send the sum to the Tank through the DAQ Assistant.
9. In the same frame check the above product (input to controller) and if it is greater than 1
send one to the Tank system- using DAQ. If it is lesser than 0 send the tank 0. If it is
between 0 and 1, send the control input as it is. The comparison can be done using
Greater Or Equal? and Lesser Or Equal? functions along with a Case Structure
having another Case Structure inside (as in the On-Off Control). Here the control input is
connected to the Case Selector.
10. In the 2-Tank system open the exit valve a little to see the proper effect of the PI Control.
The valve can be opened to the number 2 position or another one depending on the speed
of the motor.
11. After all the wiring is complete switch to Front Panel and press the RUN button to
execute the VI.
96 LabExperiment13:SimpleSpeedControlofDCMotor
CISE 302
Linear Control Systems
Lab Experiment 13: Simple Speed Control of DC Motor
Objective: Observe how the Simple Speed control system is constructed and appreciate the
importance of Tacho-generator in closed-loop speed control system.
List of Equipment/Software
Following equipment/software is required:
- LabVIEW
- DC Servo System (feedback equipment)
a. OU150A Op Amp Unit
b. AU150B Attenuator Unit
c. PA150C Pre-Amplifier Unit
d. SA150D Servo Amplifier
e. PS150E Power Supply
f. DCM150F DC Motor
g. IP150H Input Potentiometer
h. OP150K Output Potentiometer
i. GT150X Reduction Gear Tacho
j. DC Voltmeter
Category Software-Hardware Experiment
Deliverables
A complete lab report including the following:
- Summarized learning outcomes.
- Connection diagram of the hardware experimental part.
- Report the procedure and troubleshooting during the experiment.
- Show results for the open loop and closed loop speed control via graphs and tables.
Introduction:
In the last experiments we saw how simple position control could be constructed. In today's
assignment we shall see how simple speed control of motor could be done. In the experiment
involving the DC Motor Characteristics we saw how the signal inputs into SA150D could vary
the speed of the motor. This means that without any load you can set the motor to run at
specified speed determining the value of the input signal. What kind of speed control was it?
97 LabExperiment13:SimpleSpeedControlofDCMotor
Now if we look at the torque/speed characteristics in the experiment, we can say that if load is
placed on the motor the speed of the motor will change to some extent. With open-loop system
the results show that there can be a reasonable speed control when operating without or with a
fixed load but the system would be very unsuitable where the load was varying.
With closed load, we will show improvement in speed control with respect to varying load. That
is, the actual speed will be compared to the required speed. This produces an error signal to
actuate the servo amplifier output so that the motor maintains a more constant speed.
Exercise 1: Simple feedback speed-control without load.
In this exercise we will simply feedback a signal proportional to the speed, using the Tacho-
generator. We then compare it with a reference signal of opposite polarity, so that the sum will
produce an input signal into the servo amplifier of the required value. As comparator, we will use
an operational amplifier.
On the OA150A set the 'feedback selector' to 100K resistor
98 LabExperiment13:SimpleSpeedControlofDCMotor
Before connecting the Tacho-generator to an input of the OA150A, increase the 'reference'
voltage so that the motor revolves and on your voltmeter determine which the Tachos positive
output is. The correct side can then be connected to OA150A input and the other side to 0V.
Reset the reference voltage to zero and then gradually increase it so that you can take readings
over the motor speed range of upto approximately 2000 r/min for the reference, tacho-generator
and error voltages.
99 LabExperiment13:SimpleSpeedControlofDCMotor
For a gain control we can use the circuit given above, which has a gain of -1/.
10
1
LabExperiment13:SimpleSpeedControlofDCMotor
On the OA150A set the 'feedback selector' switch to 'external feedback'. On the LU150L swing
the magnets clear. Initially set the gain to unity, that is to position 10 of the upper potentiometer
and adjust the reference volts till the motor runs at 1000 r/min. Then take readings of the
reference voltage, V
in
, Error voltage, V
e
and the Tacho-generator voltage, using the voltmeter,
over the range of brake positions 0 10 and then tabulate your results in the following table. Be
careful that you do not exceed the 2A limiting current. Repeat the readings for a gain of 5,
which is to set the gain potentiometer to position 1. Re-adjust the reference potentiometer to give
no-load motor speed of 1000 r/min.
For gain of 1 For gain of 5
Brake
Position
Reference
(V
in
)
volts
Tacho-
generator
volts
Error
(V
e
)
volts
Speed
r/min
Brake
Position
Reference
(V
in
)
volts
Tacho-
generator
volts
Error
(V
e
)
volts
Speed
r/min
10
2
LabExperiment13:SimpleSpeedControlofDCMotor
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10
Plot your results in the form of graphs of error voltage against brake setting and speed for gain
values of 1 and 5.
Exercise 3: Reversible speed control
In the last part of the experiment we will assemble a simple reversible speed control system.
From your reading you have seen that a high gain decreases the minimum reference signal
needed for the motor to respond so this exercise we will use high gain.
The inputs into the SA150D can drive the motor in opposite directions but both inputs require
positive voltages. As the output of the OA 150A varies from positive to negative it is necessary
to use the PA150C pre-amplifier unit that is so designed that a negative input gives a positive
voltage on output and a negative input gives a positive voltage on the other output with a gain of
about 25.
10
3
LabExperiment13:SimpleSpeedControlofDCMotor
Replace the OA150A with PA150C. Setup as shown in the above figure, adjusting the reference
to zero output before coupling to the pre-amplifier. Set the pre-amplifier to 'ac compensation',
this will reduce the effect of ripple on the tacho-generator signal, which causes instability.
Set the potentiometer on AU150B to 5.
With no load on the motor, now find that you can invert the sign of the reference signal so that
you can reverse the direction of the motor rotation, by slowly turning the reference potentiometer
knob to either side of the center position 5. Record the reference voltage that just causes the
motor to rotate.
Minimum signal needed for motor response
Forward Reverse
10
4
LabExperiment13:SimpleSpeedControlofDCMotor
Set the speed of rotation in one direction to 1000 r/min and then take readings over the brake
position 0-10, and record them in the following table. To measure the error voltages place the
voltmeter across both the PA150C outputs.
Then reverse direction and repeat the readings.
Practical Aspects:
So important has the tacho-generator been considered in the speed control, that it has very often
been made an integral part of the motor.
Examples of speed control can be seen in every branch of industry and transport. They have
become particularly important in continuous processes such as in the control of sheet-metal
thickness in hot rolling mills, in generators and most industrial motors. In guidance systems,
automatic pilots, lifts and overhead hoists both reverse speed and positional control may be used.
Forward
Brake
Position
Tacho-
generator
volts
Reference
Voltage
(V
in
)
Error
Voltage
(V
e
)
Speed
r/min
1
2
3
4
5
6
7
8
9
10
Reverse
Brake
Position
Tacho-
generator
volts
Reference
Voltage
(V
in
)
Error
Voltage
(V
e
)
Speed
r/min
1
2
3
4
5
6
7
8
9
10