0% found this document useful (0 votes)
6 views23 pages

CS Manual

The document outlines the Control System Laboratory course (BEC403-IPCC) at VVIET, Mysuru, detailing various experiments related to control systems, including block diagram reduction, signal flow graphs, stability analysis, and controller implementation. It also includes a list of do's and don'ts for students in the laboratory, emphasizing safety, discipline, and proper conduct. Additionally, the document provides sample code snippets for simulations and analyses using software like MATLAB and Scilab.

Uploaded by

Pallavi Jayram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views23 pages

CS Manual

The document outlines the Control System Laboratory course (BEC403-IPCC) at VVIET, Mysuru, detailing various experiments related to control systems, including block diagram reduction, signal flow graphs, stability analysis, and controller implementation. It also includes a list of do's and don'ts for students in the laboratory, emphasizing safety, discipline, and proper conduct. Additionally, the document provides sample code snippets for simulations and analyses using software like MATLAB and Scilab.

Uploaded by

Pallavi Jayram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

ECHNOLOGICAL UNIVERSITY

Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

CONTENTS
Sl. Page
Name of the Experiment
No. No.
i Do’s and Don’t’s 2
Using suitable simulation software (P-Spice/ MATLAB / Python / Scilab / OCTAVE /
LabVIEW) demonstrate the operation of the following circuits:
Sl.N Experiments
o
Implement Block diagram reduction technique to obtain transfer function a control
1 system. 3
Implement Signal Flow graph to obtain transfer function a control system.
2 4
Simulation of poles and zeros of a transfer function.
3 6
Implement time response specification of a second order Under damped System, for
4 different damping factors. 7
Implement frequency response of a second order System.
5 8
6 Implement frequency response of a lead lag compensator. 9
7 Analyze the stability of the given system using Routh stability criterion. 10
Analyze the stability of the given system using Root locus.
8 11
Analyze the stability of the given system using Bode plots.
9 14
Analyze the stability of the given system using Nyquist plot.
10 15

11 Obtain the time response from state model of a system. 18


12 Implement PI and PD Controllers. 21

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

DO’s and DON’Ts

Do’s
 Students should be in proper uniform and dress code with identity cards in the laboratory.
 Students should bring their observation, manual and record compulsorily.
 Students should maintain discipline in the laboratory.
 Students are required to handle all the equipment’s/Computers properly.
 Students are required to follow the safety precautions.
 Enter the lab in time as per the given time table.
 Enter time-in and time-out in log book.
 Comply with the instructions given by faculty and instructor.
 Arrange the chairs/ equipment’s before leaving the lab.
 Take signature in the observation, before leaving the lab.

Don’ts
 Mobile phones are strictly banned.
 Ragging is punishable.
 Do not operate any peripherals or accessories without supervision.
 Avoid stepping on computer cables and electrical wires.
 Do not walk around in the lab unnecessarily.
 Do not go out of the lab without permission.

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

1. Implement Block diagram reduction technique to obtain transfer function a


control system.

clc
clear
g1=syslin('c',%s,%s+1);
g2=syslin('c',%s,1);
h1=1
disp(g1,"first open loop gain");
disp(g2,"second open loop gain");
cascade=g1*g2;
parallel=g1+g2;
feedback=cascade/.h1
feedback1=cascade/.-h1
disp(cascade,"when g1andg2 are in series")
disp(parallel,"when g1andg2 are in parallel")
disp(feedback,"cascade block in negative feedback h1")
disp(feedback1,"cascade block in postive feedback h1")

Output: -----
1+s
first open loop gain
s Cascade Block In Negative Feedback H1
------
1+s 2
Second Open Loop Gain s
s ----------
-- 2
1 1+s+s
When G1and G2 Are In Series
2 Cascade Block In Postive Feedback H1
s
------ 2
1+s s
When G1and G2 Are In Parallel ----------
2 2
2s + s 1+s-s

1. Implement Signal Flow graph to obtain transfer function a control system.

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

Numeric
0 / -18 = 0

Symbolic
[ (1 - ( g7.h4 )) * (g1.g2.g3.g4.g5) ]
_____________________________________________________________________
1 - ( g2.h1 + g2.g3.g4.g5.g6.g7.g8 + g4.h2 + g7.h4 ) + ( g2.h1.g4.h2 +
g2.h1.g7.h4 + g4.h2.g7.h4 ) - ( g4.h2.g7.h4.g2.h1 )

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

3. Simulation of poles and zeros of a transfer function.


clc
s=%s;
n=poly([2 3 1],'s',"coeff");
d=poly([12 7 1],'s',"coeff");
t=syslin('c',n,d);
disp(t,"the transfer function");
plzr(t)

output:
2
2 + 3s + s
------------
2
12 + 7s + s

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

4. Implement time response specification of a second order Under damped System, for
different damping factors.
clc
clear
s=%s
t=0:0.01:5;
n=poly([25],"s",'c');
d=poly([25,4,1],"s",'c');
sys=syslin('c',n/d);
y=csim('step',t,sys);
plot(t,y,'r')
set(gca(),"auto_clear","off")
d1=poly(conv([25 4 1],[2,1]),"s",'c');
sys1=syslin('c',n/d1);
y1=csim('step',t,sys1);
plot(t,y1,'b');
set(gca(),"auto_clear","off")
n1=poly(conv([25],[4 1]),"s",'c');
sys2=syslin('c',n1/d);
y2=csim('step',t,sys2);
plot(t,y2,'g');
set(gca(),"auto_clear","off")
n2=poly(conv([25],[4]),"s",'c');
sys3=syslin('c',n2/d);
y3=csim('step',t,sys3);
plot(t,y3,'y');
output:

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

5. Implement frequency response of a second order System.


// Define system parameters
wn = 2*%pi*10; // Natural frequency
zeta = 0.2; // Damping ratio

// Create the transfer function


s = %s;
tf = syslin('c', 1, s^2 + 2*zeta*wn*s + wn^2);

// Generate frequency response


[f, mag, pha] = repfreq(tf, 0.1, 100);

// Plot the frequency response


figure(1);
subplot(2,1,1);
plot(f, mag, 'r');
xlabel('Frequency (rad/s)');
ylabel('Magnitude');
title('Frequency Response of Second Order System');

subplot(2,1,2);
plot(f, pha, 'b');
xlabel('Frequency (rad/s)');
ylabel('Phase (degrees)');
xgrid();

output:
1
--------------------------
3947.8418 +25.132741s +s^2

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

6. Implement frequency response of a lead lag compensator.

// Define the transfer function of a lead-lag compensator


function [H]=lead_lag_compensator(s, z_lead, p_lead, z_lag, p_lag)
H = (s + z_lead)/(s + p_lead) * (s + z_lag)/(s + p_lag);
endfunction;

// Example usage:
s = poly(0, 's'); // Laplace variable
z_lead = 10; // Zero of the lead compensator
p_lead = 20; // Pole of the lead compensator
z_lag = 0.1; // Zero of the lag compensator
p_lag = 0.2; // Pole of the lag compensator
H = lead_lag_compensator(s, z_lead, p_lead, z_lag, p_lag);

H = [rational] of s

1 +10.1s +s^2
-------------
4 +20.2s +s^2

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

7. Analyze the stability of the given system using Routh stability criterion.

clc
close
s=%s;
p=2*s^4+s^3+3*s^2+5*s+10;
disp(p,"given system function=")
c=coeff(p)
l=length(c)
routh=routh_t(p)
disp(routh,"rouths table=")
x=0;
for i=1:1
if(routh(i,1)<0)
x=x+1;
end
end
if(x>=1)
printf("from rouths table,it is clear that the system is stable.")
else
printf("from rouths table,it is clear that the system is unstable.")
end

output
10 +5s +3s^2 +s^3 +2s^4
"given system function="
2. 3. 10.
1. 5. 0.
-7. 10. 0.
6.4285714 0. 0.
10. 0. 0.
"rouths table="
from rouths table,it is clear that the system is unstable.

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

8. Analyze the stability of the given system using Root locus.

clc
close
s=%s
num=input('enter the numerator=')
den=input('enter the denominator=')
TF=syslin('c',num,den)
disp(TF,"transfer function of system=")
h=syslin('c',num,den)
evans(h,100)

output:
case :1
enter the numerator=s+1
enter the denominator=(s^2*(s+3)*(s+5))
transfer function of system=

1+s
-------------
2 3 4
15s + 8s + s

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

Case:2
enter the numerator=s+1
enter the denominator=s*(s+2)*(s^2+2*s+5)
transfer function of system=
1+s
------------------
2 3 4
10s + 9s + 4s + s

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

Case:3

enter the numerator=1


enter the denominator=(s*(s+2)*(s+5))
transfer function of system=
1
-------------
2 3
10s + 7s + s

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

9. Analyze the stability of the given system using Bode plots.

close
s=poly(0,'s')
h=syslin('c',31.62*(s*0.125+1)/((s)*(s*2+1)*(s*0.044+1)))
clf();
bode(h,0.1,100)
g_margin(h)
show_margins(h)
p_margin(h)
show_margins(h)

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

10. Analyze the stability of the given system using Nyquist plot.
clc
close
s=poly(0,'s')
num=input('enter the numerator=')
den=input('enter the denominator=')
TF=syslin('c',num,den)
disp(TF,"transfer function of system=")
h=syslin('c',num,den)
nyquist(h)

case:1
enter the numerator=1
enter the denominator=(s*(s+1)*(2*s+1))
transfer function of system=

1
------------
2 3
s + 3s + 2s

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

case:2

enter the numerator=(5+s)*(s+40)


enter the denominator=(s^3)*(s+200)*(s+1000)

transfer function of system=


2
200 + 45s + s
--------------------
3 4 5
200000s + 1200s + s

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

Case:3
enter the numerator=(s+1)
enter the denominator=(s^2)*(s+5)*(s+10)
transfer function of system=
1+s
--------------
2 3 4
50s + 15s + s

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

11. Obtain the time response from state model of a system.

clear
clc
A=[0,1,0;0,0,1;-6,-11,-6]
B=[0;0;1]
C=[6,0,0]
D=0
sys=syslin('c',A,B,C,D);
clc
G=ss2tf(sys)
spec(A)
roots([1,6,11,6])
clc
s=%s;
G2=syslin('c',6,s^3+6*s^2+11*s+6)
sys2=tf2ss(G2)
clc
[A,B,C,B]=abcd(sys2)
clc
x0=[1;-2;0]
t=0:0.01:10;
y1=csim('step',t,sys);
y2=csim(0*t,t,sys,x0);
y3=y1+y2;
plot(t,y1,t,y2,t,y3)

Output

ans = [3x1 double]

-1. + 0.i
-2. + 0.i
-3. + 0.i

--> roots([1,6,11,6])

ans = [3x1 double]

-3. + 0.i
-2. + 0.i
-1. + 0.i

G2 = [rational] of s

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

6
-----------------
6 +11s +6s^2 +s^3

sys2 = [state-space]

A (matrix) = [0,1,0;0,0,4;-1.5,-2.75,-6]
B (matrix) = [0;0;2.4494897]
C (matrix) = [0.6123724,0,0]
D (matrix) = 0
X0 (initial state) = [0;0;0]
dt (time domain) = "c"

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

Xcos is a free, open-source graphical editor in Scilab that allows users to model and
simulate dynamical systems. It's used to design models of hybrid systems, which can
be continuous or discrete, and can include both physical and mechanical systems

What Xcos can do

Model systems: Xcos can model mechanical systems, hydraulic circuits, and
control systems
Simulate systems: Xcos can simulate systems defined by symbolic equations,
discrete systems, and continuous systems
View results: Xcos can display simulation results in real time, and the results can
be used for post-processing in Scilab
Create custom blocks: Users can create new blocks and libraries to extend Xcos's
capabilities

How Xcos work

 Users design models using a block diagram editor


 Users can drag and drop blocks from palettes into the model editor
 Users can connect blocks to each other to create a model
 Users can change the parameters and properties of blocks by double-clicking on
them
 Users can compile and simulate models using the Xcos GUI
 Xcos is similar to Simulink, a popular commercial block-based modeling and
simulation tool.

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

12. Implement PI , PD and PID Controllers.

Figure 1 : PI controller with and without feedback

5
Control System LABORATORY- BEC403-IPCC VVIET, MYSURU

Figure 2 : PD controller with and without feedback

Figure 3: PID controller with and without feedback

You might also like