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

Dijlah University

College
DUC
Computer
Techniques
Engineering
Department

‫ حسن عباس حسين‬.‫م‬.‫ م‬: ‫اعداد‬

‫ دمحم عبد هللا عبد السادة‬.‫ د‬: ‫استاذ المادة‬


Control Lab.

List of contents

Experiment
Experiment page
No.
1 The Transfer Function 2
Open-Loop & Closed-Loop Control System
2 5
3 Block Reduction 7
4 The Routh-Hurwitz Stability Criterion 11
Root Locus
5 17
Design by Means of Root Locus Plots.
6 21
Frequency – Domain Plots
7 23
Design of Lead and Lag Compensation by using
8 Bode Diagram 25

Specification of Step Response for Control System


9 28

Transient Response and Steady State Error Analysis


10 30

The Effect of Nonlinear Element on the Response of


11 33
the Control System
12 Simulation of PID Controller using Simulink 36
13 Modeling DC Motor Position 41

2
Control Lab.

Experiment no.1: The Transfer Function

Object:

How to deal with a transfer function and using its coefficients (num , den) in a
matlab program.

Theory:

The transfer function is a convenient representation of a linear time invariant


dynamical system. Mathematically the transfer function is a function of
complex variables. For finite dimensional systems the transfer function is
simply a rational function of a complex variable. The transfer function can be
obtained by inspection or by simple algebraic manipulations of the differential
equations that describe the systems. Transfer functions can describe systems of
very high order, even infinite dimensional systems governed by partial
differential equations. The transfer function of a system can be determined from
experiments on a system.
An input-output description of a system is essentially a table of all possible
input-output pairs. TRANSFER FUNCTIONS input pair only, for example the
impulse response or the step response. In this section we will consider another
interesting pairs of signals.

Procedure:
18( s  20)
A) a transfer function such as G ( s)  the numerator of it is
( s  15)(s  25)
=18(S+20),so we enter in it in a matlab program as num=18*[1 20] , where
(1) is a coefficient of the S and 20 is a coefficient of S^0 thus the
arrangement of coefficient is as follow:

3
Control Lab.

[~~~~ ------ ~~~~]


the coefficient
of the lowest

the degrees between the


highest degree and lowest degree

the coefficient of the highest degree of S

for example if we have the num=S^3 + 2S^2 +5


so we enter it in a matlab program in the form num=[1 2 0 5] and so on , the
same thing is done with denominator so , den=conv[1 15],[1 25] , where conv
mean multiply the two brackets with each other.

Example :

If G(S)= 18(S+20)
(S+15)(S+25)(S+0.4)

the program will be as follows:

num=18*[1 20];
d1=[1 15];
d2=[1 25];
d3=[1 0.4];
d12=conv(d1,d2);
den=conv ( d12,d3);
sys=tf(num,den)

B)if we want to find a T.F. of a 2nd order control system by knowing its natural
frequency Wn & damping ratio ζ by a matlab program this could be known as
follows:

4
Control Lab.

Program:

wn=2; damping=0.707;
[num , den]=ord2(wn , damping);
Sys=tf(num , den)

cases

s ( s  5)
1  G ( s) 
( s  2 s  6)(s  0.1)
2

18s 2
2  G(s) 
( s 2  3)(s  2)
01s  6
3  G ( s) 
( s  0.1)(0.2 s  3)

4  n  3; damping  0.51
5  n  2.5; damping  0.45

Discussion
1) Write aprogram in matlab
15s (0.1s  2s  5)
2
1  G(s) 
(0.3s 2  1)(s  6)
s 2 ( s  0.1)
2  G(s)  2
( s  3s  5)(0.1s  1)

2) What are you learning from exp.

3) Calculate the type and order for all cases.

5
Control Lab.

EXPERIMENT NO.2: Open-loop & Closed-loop control system

Object:
Using Matlab Program to implement the o/l & c/l control system

Theory:

The control system is an arrangement of physical components connected or


related in such a manner as to command, direct, or regulate itself or another
system. The open-loop control systems Those systems are which the output has
no effect on the control action; it is neither measured nor fed back for
comparison with the input.

Closed-loop control systems are feedback control systems are often reformed as
closed-loop control systems. In such systems, the actuating error signal which is
the difference between the input signals and the feedback signals is fed to the
controllers so as to reduce the error and bring the output of the system to the
desired value.

input + plant output


_

measurement

Procedure:
Using Matlab/Simulink to implement the block diagram .

6
Control Lab.

error

Scope 1
o/p

1 1
s+1 s+1
Step Transfer Fcn Scope Step1 Transfer Fcn 2

i/p
Scope 3
1
1
s+1 o/p s+1
Scope 2 Transfer Fcn 1 Transfer Fcn 3

c/l -ve F .B, o/l control


c/l +ve F .B.

Cases
s ( s  5)
1  G (s)  ; H (s)  1
( s  3s  5)
2

10 1
2  G ( s)  ; H (s) 
( s  3)(s  2) s 1
10( s  1)
3  G (s)  2
( s  3s  8)(s  3)

Discussion
1-What the main difference between the o/l &c/l control system .
2-Compare between all cases. And what the best case.

7
Control Lab.

Experiment no.3: Block Reduction

Object:

Using a matlab program to implement a parallel , serial and feedback


connections between block diagrams to represent the desired control systems.

Theory:

The simplest form of the block diagram is the single block, with one input and
one output. The interior of the rectangle representing the block usually contains
a description of or the name of the element, or the symbol for the mathematical
operation to be performed on the input to yield the output. The arrows represent
the direction of information or signal flow. Block diagram is a short hand,
graphical representation of a physical system, illustrating the functional
relationships among its components.

d
x y
dt
The operations of addition and subtraction have a special representation.
The block becomes a small circle, called a summing point, with the appropriate
plus or minus sign associated with the arrows entering the circle.

Procedure:

(1). For parallel connections as in example shown below:

8
Control Lab.

1 / ( s+2)

(s+3)
(s+10)

program :

n1=[1]; d1=[1 2];


sys1=tf(n1,d1);
n2=[1 3];d2=[1 10];
sys2=tf(n2,d2);
sysp=parallel(sys1,sys2)

so T.F.= S^2 +6S +18


S^2 +12 S +20

(2).for unity feedback block diagram as in the example shown below:

R(S
S+1 Y(S)
(S+3)(S+5)

9
Control Lab.

Program:

n=[1 1];
d1=[1 3];
d2=[1 5];
d=conv(d1 ,d2);
sys1=tf(n,d);
sys2=1
sysf=feedback (sys1,sys2 )

so T.F.= S + 1
S^2 +9S+1

(3).when feedback is not unity, as in the example shown below :


Go

S+1 Y(S)
R(S) (S+3)(S+5)

S+6
S+10

Program:

ngo=[1 1];
d1=[1 3];d2=[1 5];
dgo=conv(d1,d2);
sys1=tf(ngo,dgo);
nh=[1 6] ; dh=[1 10];
sys2=tf(nh,dh);

10
Control Lab.

sysf=feedback(sys1,sys2);

so T.F.= S^2 + 11 S +10


S^3+19S^2+102S+156

(4). For serial connection ,as in the example shown below :

R(S)
S+6 S+1
S+10 (S+3)(S+5) Y(S
)
H Go

G(S)

Program :
ngo =[1 1];
d1=[1 3];d2=[1 5];
dgo =conv(d1,d2);
sys1=tf(ngo,dgo);
nh =[1 6];
dh =[1 10];
sys2=tf(nh,dh);
syss=series(sys1,sys2);
sys3=1;
Syst=feedback (syss,sys3);

CLASS WORK

Write a program to find the overall transfer function of the following block
diagram:

11
Control Lab.

Go=1 , G1=1/(S+2) , G2=1/(S+2) ,G3=1/(S+3)


H4=4 ,H5=8 ,H6=12

Discussion
1-What the advantages of block reduction
2-calculate the type & order of the overall T.F.
3-Solve the above block diagram theoretical and compare the solution in
practical & theoretical.

12
Control Lab.

Experiment no4:
The Routh-Hurwitz Stability Criterion

Object:

The Routh-Hurwitz criterion is a necessary and sufficient criterion for the


stability of linear systems.

Theory:

wIzwvInev rytutnIwawwIwooI rtffe etqwvIrfIwatI awuw wtuevwe Isro qrpewoIpxvwIawytI


I .awqnIsowqt-tturIefIwooIwatIurrwvIwutIeqIwatIotfw-watIvwptIvesqIwqnIqrq
fIwatIwsrytIuttxeutptqwvIII.tatvtIuttxeutptqwvIwutIqt tvvwu IsxwIqrwIvxffe etqw
efIwatIuttxeutptqwvIwutII,txwII.ewIevInqrzqIwawwIwatIv vwtpIevIxqvwwsotI,tIqrwIptwwu
ztIvweooIpxvwIeqytvweswwtIwatIv vwtpIfxuwatuIwrIntwtupeqtIwatIvwwseoew IrfIwatII,ptw
zewaII)v(qxuzewtI uewtuerqIvwwwtvIwawwIwatIqxpstuIrfIurrwvIrfIt-tatIRrxwa .v vwtp
utwoIswuwvIevIttxwoIwrIwatIqxpstuIrfI awqstvIeqIvesqIrfIwatIfeuvwI roxpqI Isrveweyt
I .rfIwatIRrxwaIwuuw
I
Procedure:
:gibtAM gtisa ati ibatS mytsyS

1- program to find the poles:

13
Control Lab.

2- program to find the poles:

14
Control Lab.

15
Control Lab.

16
Control Lab.

Discussion

1- Calculate the range of gain for these cases.


k ( s  5)
1)G ( s ) 
( s  3s  10)
2

k ( s  2)
2)G ( s )  2
( s  5s  15)

2- Discuss the stability for each case.

17
Control Lab.

Experiment no5:
ROOT LOCUS

Object:

I Finding and plotting the root locus from the system transfer function.

I
Theory:

A pole-zero plot is simply a plot of the open-loop poles in the complex plane. A
plot of the closed-loop poles can be similarly helpful. Since the closed-loop
poles depend on the controller parameters, we don't get single points; instead,
we get curves showing the pole position as a function of controller gain. Such
plots are called Root Locus Plots.

Quickly sketched root locus plots can be made using a little bit of algebra and
following a few basic rules. It usually isn't necessary to have exact numerical
values. The plots that result provide some very useful qualitative understanding
of the closed loop response.

Root locus plots illustrate how the closed – loop poles of a system change as a
system parameter is varied. These plots are particularly useful for control
system design when the plant can be modeled by a rational transfer function. So
, we will learn how to write a Matlab program to create root locus plots.
I
1.for the control system shown below :
I

18
Control Lab.

Procedure:
For the
( s  2)
G (s) 
( s  6 s  10)
2

K= variable gain.
I
So , the program which used to create root locus plot is :
I

I
Program:

I clf
num = [1 2];
den = [1 6 10];
rlocus( num , den);
or
sys=tf(num,den);
rlocuse(sys)
I
I
Where rlocus , is the command that calculates and plots the root locus of the
system defined by a transfer function.
Now , we can calculate poles and gain K for this control system by adding the
command.
I
[k , poles] = rlocfind (num , den)
I
There are many reasons for customizing a root locus plot. For example , the
following program will find root locus plot , but after running a program we
will see that it is difficult to see the important part of the root locus.

Program:
clf
num=1;
den=conv([1 20] , conv([1 0] , [1 1]));

19
Control Lab.

rlocus(num , den)

So , we customize the graph in order to see more clearly the portion of the root
locus that corresponds to the dominant poles.

Customizing programs :

clf;
num=1;
den=conv([1 20] , conv([1 0] , [1 1]));
rlocus(num , den)
axis([-2 2 -6 6])

So , the axis command , which is used to plot the root locus with the desired
formatting.
num=1 1 1.3];
den=conv([1 0],conv([1 1],conv ([1 1 1.25] , [1 1 4.25])));
rlocus(num , den);
axis([-1 0 0.5 1.5]);

A simple theoretical calculation shows that this root locus should be


symmetrical about the vertical line S=-0.5.
The actual error is quite small and you easily correct it with your eyes , but it is
an aesthetically unpleasant and glaring error , and it is easy to fix.
So , to customize the root locus plot , will run the following program:

clf;
num=[1 1 1.3];
den=conv([1 0] , conv [1 1] , conv ([1 1 1.25] , [1 1 4.25])));
[p , k]=rlocus(num , den);
rlocus(num , den , ‘k’);
axis([-1 0 0.5 1.5]);
[k star , p star]= rlocfind(num , den);
L=(k<k star);
index = sum(L);
K add=[k (index):0.001:k(index + 1)];
K new = [k(1:index)’k add k(index+1:length(k))’];
clf

20
Control Lab.

rlocusnew (num , den , knew)


axis([-1 0 0.5 1.5])

Cases:
K ( s  1)
1  GH ( s )  ;k  1
s ( s  1)
k ( s 2  6 s  10)
2  GH ( s )  2 ; k  10
( s  2 s  10)
k ( s  2)(s  4)
3  GH ( s ) 
s ( s  13s  10)(s  2)
2

Discussion:
1-Compare between the theoretical and the results of program
2-Discusse the stability for each case

21
Control Lab.

Exp.no.6:
Design by means of root locus plots

Object:

The root locus plot , can be extremely useful design tool , so we use it in
controller design here. Adding a lead compensator to improve the natural
frequency of the closed-loop system.

Theory:

Using root locus techniques, we have seen how the pole positions of a closed
loop can be adjusted by varying a parameter gain. The compensator adds poles
and zeros to the P(s) in the root locus procedure.
Hence we can change the shape of the root locus. If we can capture desirable
performance in terms of positions of closed loop poles then compensator design
problem reduces to:
-changing the shape of the root locus so that these desired closed-loop pole
positions appear on the root locus
- finding the gain that places the closed-loop pole positions at their desired
positions.
If we would like to improve the transient performance of a closed loop.
We can try to place the dominant closed-loop poles in desired positions.
One approach to doing that is lead compensator design , however, that typically
requires the use of an amplifier in the compensator, and hence requires a power
supply. Broadening of bandwidth improves transient performance but exposes
loop to noise ,if we would like to improve the steady-state error performance of
a closed loop without changing the dominant transient features too much
We can consider designing a lag compensator to provide the required gain.

Procedure:
For a system with three real poles one normally puts the zero of compensator
close to the middle pole of the plant .
The compensator pole is placed as far to the left as possible.
Generally , noise and actuator limits prevent one from making this pole larger
than ten times the compensator zero.
We have chosen the lead compensator
C(S) = K ( S+1)
0.1 S+1

22
Control Lab.

notice that lim(s 0) S C(S)G(S) = K.

it is shown as the long line leaving the real axis near S=-2 , this is a great
improvement. choosing a controller gain that produces a damping of 0.707 also
produces a wn = 2.7.

program:

hold on
num=[1 1];
den=conv(conv(conv[1 0] , [1 1] ) , [0.2 1]) , [0.1 1]);
rlocus(num , den)
hold off
we now must add zeros (complex or real) or add poles(complex or real) on the
rootlocus plot , and notice what happen to the rooylocus , will it be stable , or
unstable .

Cases:
20 (1  5s )
1  G(s)  ; Gc 
s (1  0.5s )(1  0.05s ) (1  50s )
20 (1  0.118ss)
2  G( s)  ; Gc 
s (1  0.2s ) (1  0.05s )
30 (1  3.57s )
3  G(s)  ; Gc 
s (1  0.1s )(1  0.2s ) (1  35.7 s )
10 (1  0.374s )
4  G( s)  2 ; Gc 
s (1  0.25s ) (1  0.0074s )

Discussion:
1-Discusses the effect of compensator on stability for each case.
2-Draw the root locus of all cades y using Matlab program and by using rules
(theoretical).
3- Compare between the theoretical solution and the results of program.

23
Control Lab.

Experiment no.7 :

Frequency – domain plots

Object:

Creating a bode , nyquist , & Nichols plot.

Theory:

A Bode plot is a standard format for plotting frequency response of LTI


systems. Becoming familiar with this format is useful because: 1. It is a
standard format, so using that format facilitates communication between
engineers. 2. Many common system behaviors produce simple shapes (e.g.
straight lines) on a Bode plot, so it is easy to either look at a plot and recognize
the system behavior, or to sketch a plot from what you know about the system
behavior. The format is a log frequency scale on the horizontal axis and, on the
vertical axis, phase in degrees and magnitude in decibels. The general plan for
how to sketch a Bode plot by hand is, then, to first gain an understanding of
what individual poles and individual zeros do, and then add the responses
together. It is easiest to understand complex poles and zeros by looking at the
response of a complex conjugate pair, rather than trying to look at the complex
poles or zeros individually.

Procedure:

1. for known transfer function:

program:

24
Control Lab.

clf
num=[0 5.979 53.8122 197.3113 388.6435];
den=[1 13 58 0 260];
bode(num , den)

2.for known zeros &poles of the system:

program:
clf
z=[-2 -2+5*i -2-5*i];
p=[-1 -5 -7 -1+7*i -1-7*i];
k=(35*50)/(2*29) %k is chosen to give a d.c. gain of 1
[num , den]=zp2tf(z’ , p’ , k);
subplot(211) , nyquist(num , den)
subplot(212) , nichols(num , den)
ngrid
axis([-360 0 -40 30]);

Cases:
1000
1  G ( s) 
s(1  0.1s)(1  0.001s)
20
2  G( s) 
s(1  0.5s )(1  0.05s )
20
3  G(s) 
s(0.2s  1)
30
4  G( s) 
s(1  0.1s)(0.2s  1)
Discussion:
1-Compare between the theoretical and the results of program
2-Discusse the stability for each case.
3-Draw the Bode diagram for all cases by using Matlab program and rules
(Theoretical)

25
Control Lab.

Experiment no.8:

Design of lead and lag compensation by using Bode Diagram

Object:

how to customize frequency – domain plot S to display the important


information. The Bode Diagram , can be extremely useful design tool , so we
use it in controller design here. Adding a lead compensator to improve the
natural frequency of the closed-loop system.

Theory:
As with phase lag and phase lead compensation, the purpose of lag-lead
compensator design in the frequency domain generally is to satisfy
specifications on steady-state accuracy and phase margin. Typically, there is
also a specification (implicitly or explicitly) on gain crossover frequency or
closed-loop bandwidth. A phase margin specification can represent a
requirement on relative stability due to pure time delay in the system, or it can
represent desired transient response characteristics that have been translated
from the time domain into the frequency domain. A specification on bandwidth
or crossover frequency can represent a requirement on speed of response in the
time domain or a frequency-domain requirement on which sinusoidal
frequencies will be passed by the system without significant attenuation. The
overall philosophy in the design procedure presented here is for the lead part of
the compensator to adjust the system’s Bode phase curve to establish the
required phase margin at a specified frequency, without reducing the zero-
frequency magnitude value. The lag part of the compensator is used to drop the
magnitude curve down to 0 db at that specified frequency. The lag compensator
must attenuate the magnitude of the series combination of the lead compensator
Gc_lead (s) and the plant Gp(s) at the chosen frequency. Thus, in the procedure
presented here, the lead compensator is designed first. In order for lag-lead
compensation to work in this context, the following two characteristics are
needed: • the uncompensated phase shift at the chosen gain crossover frequency
must be more negative than the value needed to satisfy the phase margin

26
Control Lab.

specification (otherwise, no lead compensation is needed); • the Bode


magnitude curve (after the lead compensator has been designed) must be above
0 db at the frequency chosen for the gain crossover frequency (otherwise no lag
compensation is needed, just additional gain). The basic lag-lead compensator
has two stages, one each of lag and lead compensation. If the compensator is to
have a single-stage lead compensator, then the amount that the phase curve
needs to be moved up at the gain crossover frequency in order to satisfy the
phase margin specification must be less than 90◦, and is generally restricted to a
maximum value in the range 55◦–65◦. Multiple stages of lead compensation can
be used, following the same procedure as shown below, and are needed when
the amount that the Bode phase curve must be moved up exceeds the available
phase shift for a single stage of compensation.
Matlab makes it extremely easy to create frequency – domain plots using the
command bode.

Procedure:

For the following control system:

G(S)= 40/[(S+0.01)(S+4)(S+1+6i)(S+1-6i)

When we run the following program:

Clf
[num , den] =zp2tf ([ ] ,[-0.01 -4 -1+6*I -1-6*i] , 40);
nyquist(num , den)

there are two warnings that indicate this might not be true , but they require
careful observation.
First , the scale of the plot is rather larger and the nyquist locus does appear to
go slightly to the left of the jw-axis .
Second, we also know that a system with a4-poles and no-zeros should have -
180deg. Of phase shift at a non-zero gain and that its nyquist locus should be
asymptotic to -360deg. As , thus we used the axis command to zoom
in on the region.

Clf
27
Control Lab.

[num , den]=zp2tf([ ],[-0.01 -4 -1+6*I -1-6*i] , 40);


nyquist(num , den)
axis([-0.5 0.5 -0.5 0.5])

this use of the axis command causes the command nyquist to display only the 1
by -1 square range of the plot centered at the origin.
As we can see , this system would be closed – loop unstable with a feedback
gain of more approximately 120.

Cases:
1000 (1  0.016s)
1  G ( s)  ; Gc ( s ) 
s(1  0.1s)(1  0.001s) (1  0.00214s)
20 (1  5s)
2  G ( s)  ; Gc ( s ) 
s(1  0.5s )(1  0.05s) (1  50s)
20 (1  0.0118s)
3  G( s)  ; Gc ( s ) 
s (0.2s  1) (1  0.058s )
30 (1  3.57s )
4  G ( s)  ; Gc ( s ) 
s(1  0.1s)(0.2s  1) (1  35.7 s )

Discussion:
1-Discusses the effect of compensator on stability for each case.
2-Draw the root locus of all cades y using Matlab program and by using rules
(theoretical).
3- Compare between the theoretical solution and the results of program.

28
Control Lab.

Experiment no.9:
Specification of Step Response for Control System

Object:
How to create graphs of the time-domain response of a linear time-invariant
systems.

Theory:
Control systems are often required to satisfy specifications on several aspects of
their step response.
Typical examples are:

1. time to peak = the time for the step response to reach its first (and largest)
peak.
2. percent over shoot =100 (peak value – final value )
final value

3. rise time = time at which step response first reaches (90%)of its final
value minus time at which it first reaches (10%)of its final value.
4. settling time = last time the step response is farther than (+,- 2%) from its
final value.
5. note that the computation of final value is a direct implementation of the
formula

final value = lim(s—0) SG(S) 1 =G(0)


S

Procedure:

Matlab will tell you there are problems with this formula , for example , you
will be warned about %if G(S) has a pole at zero.

Program:

[num , den]=zp2tf([ ] , [-1+3*i -1-3*i ] , 3);


final value = polyval(num ,0)/poly val(den , 0)

[y , x , t]=step(num , den);
[y , k]=max(y);

29
Control Lab.

timetopeak = t(k)
percent over shoot = 100*(y-final value)/final value
%computerise time
n=1;
while y(n)<0.1*final value , n=n+1;end
m=1;
while y(n)<0.9 * final value , m=m+1;end
rise time = t(m)-t(n)
%compute settling time
Ll=length(t);
while (y(L)>0.98*final value)&(y(Ll)<1.02*final value)
L=L-1;
End
Settling time = t(L)
We compute the step response using step command and stores it in the vector
corresponding to y is stored in the vector t. the vector x represent the (matlab
selected) state as a function of time.
However , we are not interested in the state in this example .
2. the command MAX to find the peak value of y and its index these are stored
as y and k.

Cases:

10
1  G (s) 
( s  13)
9
2  G (s)  2
s  2s  9
13
3  G(s)  2
s  7s  9
25
4  G (s)  2
s  7 s  13
( s  1)
4  G (s) 
( s  5)(0.1s  1)

Discussion:
1-For the above cases find the specification of step response (tr,td,tp,Mp%,e.s.s)
2- For the 2nd order transfer function find the ωn and ζ .
3- Compare between the results of program with the theoretical solution.

30
Control Lab.

EXPERIMENT NO.10:

Transient Response and Steady State Error Analysis

Object:
To learn how to used Matlab & Simulink to control system in order to find the
steady state error & transient response .

Theory:
In control system analysis and design it is important to consider the complete
system response and to design controllers such that a satisfactory response is
obtained for all time instants , where stands for the initial time. It is known that
the system response has two components: transient response and steady state
response. The transient response is present in the short period of time
immediately after the system is turned on. If the system is asymptotically stable,
the transient response . However, if the system is unstable, the transient
response will increase very quickly (exponentially) in time, and in the most
cases the system will be practically unusable or even destroyed during the
unstable transient response (as can occur, for example, in some electrical
networks). Even if the system is asymptotically stable, the transient response
should be carefully monitored since some undesired phenomena like high-
frequency oscillations (e.g. in aircraft during landing and takeoff), rapid
changes, and high magnitudes of the output may occur. Assuming that the
system is asymptotically stable, then the system response in the long run is
determined by its steady state component only.

Procedure:

-Model connected

31
Control Lab.

Error signal
sum
Scope

s+1
Step
Sourse G(s) output
sink
math operation tansfer function

s+1

H(s)

countinous

mux

For all cases the inputs are :

3- Parabola 2- Ramp 1- Step

Step

Integrator Step

32
Control Lab.

Prapola

Integrato

Cases:
5
1  G(s)  ; H ( s)  1
( s  2)
10
2  G ( s)  2 ; H (s)  1
s  2 s  10
( s  2) 2
3  G (s)  2 ; H (s) 
s  12s  20 s2
s ( s  5) 1
4  G ( s)  ; H ( s) 
(0.1s  2 s  13)
2
s
1
(0.1s  5) H ( s) 
5  G ( s)  ; s ( s  3)
s ( s 2  3s  6)

Discussion:
1-For the above cases find the steady state error & transient response .
2- Compare between the results of program with the theoretical solution.

33
Control Lab.

Experiment no. 11:The effect of nonlinear


element on the response of the control
system
Object:
1- To learn how to describe the effect of nonlinear element
on the response of the control system .
2- To observe the output response of control system without
nonlinear & with nonlinear control system.

Theory:
An initial question that the reader might reasonably ask is what happens if a
linear controller is applied to a nonlinear plant. We know from experience that
this must be a reasonable strategy in many cases because one knows that all real
plants exhibit some (presumably) mild form of nonlinearity and yet almost all
real-world controllers are based on linear design .We will thus pause to analyze
the effect of using a linear controller (C) on a nonlinear plant (which we think
of as being composed of a linear nominal part G0 together with nonlinear
additive model error Ge).
In the sequel we will need to mix linear and nonlinear descriptions of systems,
simple interpretation can be given by the analysis by simply thinking of an
operator (such as Ge) as some kind of nonlinear function. Of course, Ge will in
general be a dynamical system. A more rigorous statement of what we mean by
an operator Ge is given on the next slide. We define a nonlinear dynamic
operator f as a mapping from one function space to another. Thus, f maps
functions of time into other functions of time. Say, for example, that the time
functions have finite energy; then we say that they belong to the space L2, and
we then say that f maps functions from L2 into L2. We will use the symbol
y (without brackets) to denote an element of a function space; i.e. y as L2 is
of the form {y(t) : IR→IR}. We also use the notation y = f(u) to represent the
.mapping (transformation) from u to y via f.

Procedure:
1- Run Matlab by selecting [start] →Matlab 0202 →Matlab
command window opens.
34
Control Lab.

2- In Matlab command window →Simulink.


3- In untitled window draw the block diagram as shown in figure below.

4-Set the step block step time to zero.

35
Control Lab.

Experiment no. 12:

Simulation of PID controller using simulink.

Object :

Using PID controller to control the performance of a plant , by using MATLAB


SIMULINK.

Theory:

The first step in this experiment of PID control is to use SIMULINK to create
following sys.

36
Control Lab.

there are many ways to determine the appropriate gains for a PID
controller.
C(S)=Kp +Ki /S +KdS

Kp=proportional , Ki/S=integral , KdS=differential.

Actually , the KdS part of the controller is not really implementable.


For this reason given above , we set Kd=0 , this changes the controller into PI
controller.
Or , by multiplying the part (KdS) by (zero-pole)block.
The first step in this experiment of PID control is to use SIMULINK to create
following sys.

Procedure:
Now , to find the rootlocus plot of the PID plant .

Program:

Clear
Num=20*[1 0.11];
Den=conv([1 10] , conv(1 0.1) , conv([1 0] , [1 2])));
Rlocus(num , den)
Sgrid([0.707] , [1])
Axis([-1 0 -1 1])
[Kp , poles]=rlocfind(num , den)
Ki=0.11 * Kp

Instructions :

in matlab there is command called simulink a block with its T.F. , from (' ') ,
for example & mathematical operations from ('math op') , and provide different
function as inputs step , ramp from ('source') , and find the response with
scope from (' sink') ; and there are many fields which enables you to implement
any block diagram you need.

CLASS WORK :

37
Control Lab.

1.implement the following block diagram :

2-find the response by clicking run click on scope

3. set G=1 / 1

4. find the response.

5. discuss the changes between case 2. & 4. and what the effect of integrator
(1/S) is on the response.

The first step in this experiment of PID control is to use SIMULINK to create
following sys.

there are many ways to determine the appropriate gains for a PID
controller.
C(S)=Kp +Ki /S +KdS

Kp=proportional , Ki/S=integral , KdS=differential.

Actually , the KdS part of the controller is not really implementable.


For this reason given above , we set Kd=0 , this changes the controller into PI
controller.
Or , by multiplying the part (KdS) by (zero-pole)block.
Now , to find the rootlocus plot of the PID plant .

Program:

Clear
Num=20*[1 0.11];
Den=conv([1 10] , conv(1 0.1) , conv([1 0] , [1 2])));

38
Control Lab.

Rlocus(num , den)
Sgrid([0.707] , [1])
Axis([-1 0 -1 1])
[Kp , poles]=rlocfind(num , den)
Ki=0.11 * Kp

Dissuasion:
1- Explained the effect of PID Controller on the specifications of transient
response.
2- For the above examples design the PID controller by using theoretical
method.
3- Compare between results.

39
Control Lab.

EXPERIMENT NO.13:

Modeling DC Motor Position


-Physical Setup
-System Equations
-Design Requirements
-Matlab Representation and Open-Loop Response

Physical Setup

A common actuator in control systems is the DC motor. It directly provides


rotary motion and, coupled with wheels or drums and cables, can provide
transitional motion. The electric circuit of the armature and the free body
diagram of the rotor are shown in the following figure:

For this example, we will assume the following values for the physical
parameters. These values were derived by experiment from an actual motor in
Carnegie Mellon's undergraduate controls lab.

 moment of inertia of the rotor (J) = 3.2284E-6 kg.m^2/s^2


* damping ratio of the mechanical system (b) = 3.5077E-6 Nms
* electromotive force constant (K=Ke=Kt) = 0.0274 Nm/Amp
* electric resistance (R) = 4 ohm
* electric inductance (L) = 2.75E-6 H
* input (V): Source Voltage

40
Control Lab.

* output (theta): position of shaft


* The rotor and shaft are assumed to be rigid

System Equations

The motor torque, T, is related to the armature current, i, by a constant factor


Kt. The back emf, e, is related to the rotational velocity by the following
equations:

In SI units (which we will use), Kt (armature constant) is equal to Ke (motor


constant).

From the figure above we can write the following equations based on Newton's
law combined with Kirchhoff's law:

1. Transfer Function
Using Laplace Transforms the above equations can be expressed in terms of s.

41
Control Lab.

By eliminating I(s) we can get the following transfer function, where the
rotating speed is the output and the voltage is an input.

However during this example we will be looking at the position, as being the
output. We can obtain the position by integrating Theta Dot, therefore we just
need to divide the transfer function by s.

Matlab representation and open-loop response

1. Transfer Function
We can put the transfer function into Matlab by defining the numerator and
denominator as vectors:

Create a new m-file and enter the following commands:

J=3.2284E-6;
b=3.5077E-6;
K=0.0274;
R=4;
L=2.75E-6;
num=K;
den=[(J*L) ((J*R)+(L*b)) ((b*R)+K^2) 0];
Now let's see how the original open-loop system performs. Add the following
command onto the end of the m-file and run it in the Matlab command window:
step(num,den,0:0.001:0.2)

42
Control Lab.

You should get the following plot:

From the plot we see that when 1 volt is applied to the system, the motor
position changes by 6 radians, six times greater than our desired position. For a
1 volt step input the motor should spin through 1 radian. Also, the motor doesn't
reach a steady state which does not satisfy our design criteria

43
Control Lab.

PROPOSED CONTROL TRAINING KIT

Introduction
In this chapter, the proposed control training kit is discussed in more
details in order to highlight the capability of this training kit to perform
effective control experiments which represents the main target of this thesis.

Interfacing with PC
The proposed training kit is designed to interface it with standard PC
using USB port which is the easiest way of interfacing with PC. The overall
interfacing diagram in the proposed training kit is mentioned in Figure (3.1).

Basically, the proposed control training kit includes 13 analog input


channels which are tuned manually by potentiometer. these channels are
captured using smart system which collects all 13 channels and then send them
sequentially to the PC using single message.

Finally, a special software unit is designed to perform life accessing of


all AI channels. The information read by smart system and then sends it to the
PC directly.

44
Control Lab.

13 Analog
Input
Channels
PC
Smart
Interfaci USB

ng unit

Figure (1): General Block Diagram of Interfacing Proposed Control Training Kit with PC
using USB port.

Internal Structure
Basically, the proposed control training kit includes is a single electronic
board which is placed in metal had bag. The external view of this board is
mentioned in Figure (2).

As mentioned in Figure (2), the proposed control training kit includes


four parts. Each part is designed to deal with specific characteristic of the
control system by updating the effective parameters of the mathematical model
that simulates the actual control plant.

45
Control Lab.

Figure (2): External View of the proposed Control Training kit.

46

You might also like