Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CS Experiment 07

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

AIR UNIVERSITY

DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING

EXPERIMENT NO 7

Lab Title: Block Diagram Reduction


Student Name: Shahzaib shams Reg. No: __210749______________________
Objective: To verify the equivalency of the basic forms, including cascade, parallel, and feedback

LAB ASSESSMENT:

Excellent Good Average Satisfactory Unsatisfactory


Attributes (5) (4) (3) (2) (1)
Ability to Conduct
Experiment
Ability to assimilate the
results
Effective use of lab
equipment and follows
the lab safety rules

Total Marks: __________________________ Obtained Marks: _________________________

LAB REPORT ASSESSMENT:

Excellent Good Average Satisfactory Unsatisfactory


Attributes
(5) (4) (3) (2) (1)

Data presentation

Experimental results

Conclusion

Total Marks: __________________________ Obtained Marks: _________________________

Date: __________________________ Signature: _________________________

EXPERIMENT 07
Block Diagram Reduction
Objectives:
 To verify the equivalency of the basic forms, including cascade, parallel, and feedback forms
on MATLAB.
 To verify the equivalency of the basic moves, including moving blocks past summing
junctions, and moving blocks past pickoff points.
Equipment required:
 PC with MATLAB installed
Background:
A control system may consist of several components. To show the function performed by each
component in control engineering, we commonly use a diagram called the block diagram. A block
diagram in control systems represents the functional relationships between components within a
system. In block diagram, all system variables are linked to each other through functional blocks. It
uses blocks to represent various elements and arrow to indicate the flow of signals or information
between these elements.
In general, the block diagram of a linear time-invariant system consists of four components, namely
signal, block (with transfer function), summing point and pickoff point as shown below:
Following are basic block diagram reduction rules that can be used when a system is not taking the
usual series, parallel or feedback form.
Rule#1: For moving a block to the left past a summing junction
Rule#2: For moving a block to the right past a summing junction

Rule#3: For moving a block to the left past a pickoff point

Rule#4: For moving a block to the right past a pickoff point

MATLAB Commands:
Parallel: M = parallel(M1,M2) connects the input/output models M1 and M2 in parallel.

Series: M = series(M1,M2) connects the input/ouput models M1 and M2 in series.

Feedback: M = feedback(M1,M2) computes a closed-loop model M for the feedback loop. Negative
feedback is assumed, To apply positive feedback, use the syntax M = feedback(M1,M2,+1).

A few other commands that are used along with these commands are mentioned in the example
below for better understanding. This block diagram can be implemented in Simulink by picking the
relevant blocks and cascading as per the given example. However, the script file version is given as
below:
G1(s)=1; G2(s)=1/(s+1); G3(s)=1/(s+2); G4(s)=1/(s+3);
H1(s)=4; H2(s)=8; H3(s)=12;
MATLAB Code: Simulink:
n1=1; d1=1;
n2=1; d2=[1 1];
n3=1; d3=[1 2];
n4=1; d4=[1 3];
n5=4; d5=1;
n6=8; d6=1;
n7=12; d7=1;
nblocks=7;
blkbuild
q = [1 0 0 0 0
2 1 -5 0 0
3 2 -6 0 0 >> [A,B,C,D]=linmod('Lab07Task01');
4 2 -6 3 -7 >> [num,den]=ss2tf(A,B,C,D);
5 3 0 0 0 >> tf(num,den)
6 3 0 0 0
7 4 0 0 0];
input=1;
output=4;

[aa,bb,cc,dd]=connect(
a,b,c,d,q,input,output
)

[num,den]=ss2tf(aa,bb,
cc,dd)
printsys(num,den)

Output: Output:
num/den = ans =
s+3 s+3
-------------------------- --------------------------
s^3 + 26 s^2 + 179 s + 210 s^3 + 26 s^2 + 179 s + 210
Lab Tasks:
1. Using Simulink set up a cascaded system and equivalent transfer function for the following
three blocks. Plot the step response and record parameters for the time response using LTI
viewer. Now do the same task using script file and compare your results.
1 1 𝑠+4
𝐺1 (𝑠) = ; 𝐺2 (𝑠) = ; 𝐺3 (𝑠) = ;
𝑠+1 𝑠+3 𝑠+2

Code/Simulink:
n1=1; d1=[1 1];
n2=1; d2=[1 3];
n3=[1 4]; d3=[1 2];
;
nblocks=3;
blkbuild
q = [1 0 0 0 0
2 1 0 0 0
3 2 0 0 0];
input=1;
output=3;
[aa,bb,cc,dd]=connect(a,b,c,d,q,input,output)
[num,den]=ss2tf(aa,bb,cc,dd)
printsys(num,den)

Simulink
[A,B,C,D]=linmod('shahzaib1');
[num,den]=ss2tf(A,B,C,D);
tf(num,den)
Results:

2. Using Simulink set up a parallel system and equivalent transfer function for the following
three blocks. Plot the step response and record parameters for the time response using LTI
viewer. Now do the same task using script file and compare your results.
1 1 𝑠+2
𝐺1 (𝑠) = ; 𝐺2 (𝑠) = ; 𝐺3 (𝑠) = ;
𝑠+2 𝑠+3 𝑠+5
Code/Simulink
clc;
close all;
clear all;
num=1;
den=[1 2];
g1=tf(num,den)
num2=1;
den2=[1 3];
g2=tf(num2,den2)
num3=[1 2];
den3=[1 5];
g3=tf(num3,den3)

M = parallel(g1,parallel(g2,g3))
Results:
3. Using Simulink set up the system given in the figure and equivalent transfer function. Plot
the step response and record parameters for the time response using LTI viewer. Now do
the same task using script file and compare your results.
1 1
𝐺1 (𝑠) = ; 𝐺2 (𝑠) = ;
𝑠+1 2𝑠 + 1
2𝑠 + (𝑙𝑎𝑠𝑡 𝑑𝑖𝑔𝑖𝑡 𝑜𝑓 𝑟𝑜𝑙𝑙 𝑛𝑜. )
𝐺3 (𝑠) = ;
𝑠+8
𝑠+5 1
𝐺4 (𝑠) = ; 𝐻(𝑠) = ;
2𝑠 + 1 𝑠

Code/Simulink:
[A,B,C,D]=linmod('lab7task3')
[num,den]=ss2tf(A,B,C,D)
v=tf(num,den)
figure
step(v)
Results:
4. Using Simulink set up the system given in the figure and equivalent transfer function. Plot
the step response and record parameters for the time response using LTI viewer. Now do
the same task using script file and compare your results.
1 1 2𝑠 + 3
𝐺1 (𝑠) = ; 𝐺2 (𝑠) = ; 𝐺3 (𝑠) = ;
𝑠+1 2𝑠 + 1 𝑠+8
𝑠+5 1
𝐺4 (𝑠) = ; 𝐻1 (𝑠) = ; 𝐻2 (𝑠) = 1; 𝐻3 (𝑠) = 2;
2𝑠 + 1 𝑠

Code/Simulink:
n1=1; d1=[1 1];
n2=1; d2=[2 1];
n3=[2 3]; d3=[1 8];

n4=1; d4=[1 0];


n5=1; d5=1;
n6=2; d6=1;
nblocks=6;
blkbuild
q = [1 -4 0 0 0 0
2 1 -5 0 0 0
3 1 -5 2 -6 0
4 2 0 0 0 0
5 2 0 0 0 0
6 3 0 0 0 0
];
input=1;
output=4;
[aa,bb,cc,dd]=connect(a,b,c,d,q,input,output)
[num,den]=ss2tf(aa,bb,cc,dd)
printsys(num,den)

Simulink
[A,B,C,D]=linmod('shahzaib4');
[num,den]=ss2tf(A,B,C,D);
tf(num,den)

Results:
For s=1:
1. The value of the first expression is approximately 0.117.
2. The value of the second expression is 0.111.

Conclusion:

In this lab, we have used MATLAB Simulink to make or draw the transfer function
and also learned how to code for different transfer functions in series or parallel
through code which uses simple input and output and also by using. and also verify
the results .

You might also like