Lab Report 8

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

EEE 325 Control Systems

LAB # 08

Names MUHAMMAD SAAD KHAN


AINA QAMAR

Registration Numbers FA19-BEE-141


FA19-BEE-223

Class BEE-5D

Instructor’s Name DR RIZWAN AZAM

Lab Assessment

Post Lab Total


Pre-Lab In-Lab Data
Data Analysis Writing Style
Presentation
Lab # 08:
Steady State Error Analysis and Design

Objective:
• To find steady state errors and static error constants.
• Verify the results using MATLAB.
• Design controller system Gain to obtain specified characteristics.

Introduction:

Steady-state error is defined as the difference between the input and output of a
system in the limit as time goes to infinity (i.e. when the response has reached the steady
state). The steady-state error depends on the type of input (step, ramp, etc) as well as the
system type (0, I, or II).

Note: Steady-state error analysis is only useful for stable systems

Equations to calculate steady-state errors from open-loop transfer functions given


different inputs:

▪ Step Input (R(s) = 1/s):

▪ Ramp Input (R(s) = 1/s^2):


▪ Parabolic Input (R(s) = 1/s^3):

System types and errors:

The system type is defined as the number of pure integrators in a system. Steady state
error relates to system types as:

Input
System Error
Step Ramp Parabolic
Steady State Error
1/(1+Kp) 1/Kv 1/Ka
Formula
Type 0
Static Error Kp =
systems Kv = 0 Ka = 0
Constant constant
Error 1/(1+Kp) infinity infinity
Type 1
Error 0 1/Kv infinity
systems
Type 2
Error 0 0 1/Ka
systems
In-lab:

Task 1:
For the following systems find the static error constants, and then steady state
error for the following inputs:
i. r(t) = u(t), unit step
ii. r(t) = 20*t*u(t)
iii. r(t) = 5*t^2*u(t)

a)

clc
close all
clear all

s=tf('s')

G1 = (500*(s+2)*(s+5))/((s+8)*(s+10)*(s+12)); % part a
T = feedback(G1,1);
t= 0:0.1:10 ;
figure(1)
kp=dcgain(G1)
Estep= 1/(1+kp)
step (T,t,'--') % plotting step
title('step input part a')

ut= heaviside(t);
ramp= 20.*t.*ut ;
figure(2)
kv=dcgain(s.*G1)
Eramp= 1/kv
lsim(T,ramp,t,'--') % plotting ramp
title('ramp input part a')

parabola = 5.*(t.^2).*ut ;
figure(3)
ka=dcgain((s^2).*G1)
Eparabola= 1/ka
lsim(T,parabola,t,'--') % plotting parabola
title('parabola input part a')
b)

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

G2= (500*(s+2)*(s+5)*(s+6))/(s*(s+8)*(s+10)*(s+12)); % part b


T=feedback(G2,1) ;
t= 0:0.1:10 ;
figure(4)
kp=dcgain(G2)
Estep= 1/(1+kp)
step (T,'r') % plotting step
title('step input part b')

ut= heaviside(t) ;
ramp= 20.*t.*ut ;
figure(5)
kv=dcgain(s.*G2)
Eramp= 1/(kv)
lsim(T,ramp,t,'r') % plotting ramp
title('ramp input part b')

parabola = 5.*(t.^2).*ut ;
figure(6)
ka=dcgain((s^2).*G2)
Eparabola= 1/(ka)
lsim(T,parabola,t,'r') % plotting parabola
title('parabola input part b')
c)
s=tf('s')

G3= (500.*(s+2)*(s+5)*(s+6)*(s+7))/(s^2*(s+8)*(s+10)*(s+12));%part c
T=feedback(G3,1);
t= 0:0.1:10 ;
figure(7)
kp=dcgain(G3)
Estep= 1/(1+kp)
step (T,t,'green') % plotting step
title('step input part c')
t= 0:0.1:1 ;
ut= heaviside(t);
ramp= 20.*t.*ut ;
figure(8)
kv=dcgain(s.*G3)
Eramp= 1/kv
lsim(T,ramp,t,'green') % plotting ramp
title('ramp input part c')

parabola = 5.*(t.^2).*ut ;
figure(9)
ka=dcgain((s^2).*G3)
Eparabola= 1/ka
lsim(T,parabola,t,'green') % plotting parabola
title('parabola input part c')
Table of Errors

Comment: In these tasks, block diagram is implemented in MATLAB and difference


between input and output is observed to predict the type of system. (a) represents type 0 system
whereas, (b) represents type 1 system (c) represents type 2 system. Since input and output are
perfectly lying over each other.
Lab Task 2:

For the following systems (i) and (ii), do the following tasks:

a) Find the value of k for which system yields e(t=infinity)=10%, verify using MATLAB.
Is the system stable at that gain?
b) From the MATLAB estimate the value of k for which the system yields minimum
e(t=infinity) (system should stay stable)?

i.

s=tf('s')

K=672; % value of k from calculations

G= (K.*(s+5))/(s*(s+6)*(s+7)*(s+8)); % Given transfer function


T=feedback(G,1);
t= 0:0.1:100;
figure()
kp=dcgain(G)
Estep= 1/(1+kp)
step (T,t) % plotting step
axis([0 10 0 2])

ut= heaviside(t);
ramp= 20.*t.*ut
figure()
kv=dcgain(s.*G)
Eramp= 1/kv
lsim(T,ramp,t) % plotting ramp

parabola= 20.*(t.^2).*ut ;
figure()
ka=dcgain((s^2).*G)
Eparabola= 1/ka
lsim(T,parabola,t,'r') % plotting parabola
title('parabola input part c')
Comments: Increasing the ’k’ increases the overshoot and by decreasing the value of ‘k’
increases the steady state time and decreases the overshoot.

ii.

s=tf('s')

K = 189; % value of k from calculations

G = (K.*(s+12))/((s+14)*(s+18)); % Given transfer function


T=feedback(G,1);
t= 0:0.1:100;
figure()
kp=dcgain(G)
Estep= 1/(1+kp)
step (T,t); % plotting step

ut= heaviside(t);
ramp= 20.*t.*ut;
figure()
kv=dcgain(s.*G)
Eramp= 1/kv
lsim(T,ramp,t); % plotting ramp

parabola= 5.*(t.^2).*ut;
figure()
ka=dcgain((s^2).*G)
Eparabola= 1/ka
lsim(T,parabola,t,'green') % plotting parabola
title('parabola input part c')
Comments: Value of ‘k’ should be bigger than 189. As we increase the value of ‘k’, the
overshoot decreases.
Comments: In these tasks, same objective of predicting the system type is followed. (i)
represents the type 1 system whereas, (ii) represents no type.
Post Lab Tasks

Lab Task 3:

• Normal Input

num = [1];
denum = [1 1 0];
sys = tf(num,denum);
t = 0:0.1:10;
u = heaviside(t);
k = 70;
f = feedback(k*sys, 1, -1)
step(f,'r')
• Reference Input

k = 70;
num = k*[1];
denum = [1 1 0];
sys = tf(num,denum);
t = 0:0.1:10;
u = heaviside(t);
f = feedback(1, sys, -1)
step(f)

• Disturbance Input
k = 70;
num = [1];
denum = [1 1 0];
sys = tf(num,denum);
t = 0:0.1:10;
u = heaviside(t);
f = feedback(-sys, k, 1)
step(f)
• Reference + Disturbance Input

k = 70;
num1 = k*[1];
denum1 = [1 1 0];
sys1 = tf(num1,denum1);
t = 0:0.1:10;
u = heaviside(t);
f1 = feedback(1, sys1, -1)

num2 = [1];
denum2 = [1 1 0];
sys2 = tf(num2,denum2);
f2 = feedback(-sys2, k, 1)
lsim(f1,f2,u,t);

Comments: In this task, we are given with Simulink figure and we have to show response of
reference input, Disturbance input and as well as reference + disturbance input. And we figures
and matlab code shows their responses.
Performance Viva
Total/15
(10 Marks) (5 Marks )
Performa /6
nce
Results /3

Critical /1
Analysis
Comments

Critical Analysis / Conclusion

In this lab, we learnt to find the system type manually and by observing the
graph. If the system is giving finite error on application of step at input,
then it is a type 0 system. If a system is giving finite error for ramp input,
then it is type 1 system and type 1 system will show zero error for step
input. If a system is giving finite error for parabolic input, then it is a type 2
system and a type 2 system will show zero error for step and ramp input.

In short, current type system will show zero error for all the lower types’
systems w.r.t that type. Error is, basically, the difference between input
and output. Furthermore, to improve error, relation between an unknown
variable and its effect on error was observed as well.

At last we have performed post lab in which we have learned another type
of response. We have found reference input, Disturbance input as well as
their sum.

You might also like