0% found this document useful (0 votes)
14 views28 pages

CS - Manual-Nazia

The document is a lab manual for the Control Systems course at Yenepoya Institute of Technology, detailing the department's vision, mission, and educational objectives. It includes a comprehensive syllabus for the Control Systems Laboratory, outlining various experiments and MATLAB commands to familiarize students with control system analysis and design. The manual aims to equip students with practical skills and knowledge in Electronics and Communication Engineering through hands-on experience and ethical education.

Uploaded by

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

CS - Manual-Nazia

The document is a lab manual for the Control Systems course at Yenepoya Institute of Technology, detailing the department's vision, mission, and educational objectives. It includes a comprehensive syllabus for the Control Systems Laboratory, outlining various experiments and MATLAB commands to familiarize students with control system analysis and design. The manual aims to equip students with practical skills and knowledge in Electronics and Communication Engineering through hands-on experience and ethical education.

Uploaded by

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

YENEPOYA INSTITUTE OF TECHNOLOGY

[Sponsored by Islamic Academy of Education (Regd)]


NH-13, Thodar, Moodbidri-574225, Mangalore, D.K.

DEPARTMENT OF ELECTRONICS AND


COMMUNICATION ENGINEERING

CONTROL SYSTEMS
Lab Manual

Subject Code: BEC403


Vision of the Department:

To inspire innovations so as to carve a niche in the field of Electronics and


Communication Engineering by inculcate a spirit of creative thinking and train the
students in present technologies to meet industrial as well as social needs.

Mission of the Department:

▪ To continuously keep abreast with current trends and technology that support the
students to excel in the area of Electronics and Communication Engineering.

▪ Provide ethical and value based education by promoting activities addressing the
social and industrial needs.

▪ Equip students with a steady foundation in Electronics and Communication


technology concepts to enable them for continuing education.

Program Educational Objectives (PEOs):

⮚ Graduates will be able to excel in professional career or higher education by


acquiring required up to date knowledge in area of Electronics and Communication
Engineering.

⮚ Graduates will be able to analyze real life problems, design appropriate systems to
provide solutions that are technically sound, economically feasible and socially
acceptable.

⮚ Graduates will be able to exhibit professionalism, ethical attitude, communication


skills and team work and adapt to current trends by engaging in lifelong learning.

Program Specific Outcomes (PSO’s):

● Graduates will be able to Analyze and design analog & digital circuits using
fundamentals of electronics engineering and build systems which will be useful for
the society.

● Graduates will be able to implement functional blocks of hardware and software for
signal processing and communication applications along with automation systems
to process different signals.
BEC403 Control Systems Lab

VTU Syllabus

CONTROL SYSTEMS LABORATORY

Course Code: BEC403 CIE Marks: 50


Semester: IV SEE Marks: 50
Teaching Hours per Week: 02 Credits: 04

TABLE OF CONTENTS

EXPERIMENT PAGE
EXPERIMENT NAME
NO. NO.

FAMILIARIZATION WITH MATLAB 03

1 Implement Block diagram reduction technique to obtain transfer 07


function a control system
2 Implement Signal Flow graph to obtain transfer function a control 08
system
3 Simulation of poles and zeros of a transfer function. 09

4 Determination of time response specification of a second order 10


Under damped System, for different damping factors.
5 Determination of frequency response of a second order System 12

6 Determination of frequency response of a lead lag compensator 13

7 Analyze the stability of the given system using Routh stability 15


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

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

10 Analyze the stability of the given system using Nyquist plot. 17

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

12 Implementation of P,PI, PD,PID Controllers 19

Demonstration Experiments

1 Using Suitable simulation package study of speed control of DC 20


motor using i) Armature control ii) Field control
2 Implementation of Compensators using Simulink 22

Dept. of ECE, YIT Page 2


BEC403 Control Systems Lab

FAMILIARIZATION WITH MATLAB

Aim: To familiarize with MATLAB software, general functions and signal processing
toolbox functions.

The name MATLAB stands for MATrix LABoratory produced by Math works
Inc., USA. It is a matrix-based powerful software package for scientific and
engineering computation and visualization. Complex numerical problems can be
solved in a fraction of the time that required with other high level languages. It
provides an interactive environment with hundreds of built -in –functions for
technical computation, graphics and animation. In addition to built-in-functions,
user can create his own functions.
MATLAB offers several optional toolboxes, such as signal processing,
control systems, neural networks etc. It is command driven software and has
online help facility.
MATLAB has three basic windows normally; command window, graphics
window and edit window.
Command window is characterized by the prompt ‘>>’.
All commands and the ready to run program filename can be typed here. Graphic
window gives the display of the figures as the result of the program. Edit window
is to create program files with an extension.m

Some important commands in MATLAB and its Function

Command Function
help List topics on which help is available
help command name Provides help on the topic selected
demo Runs the demo program
who Lists variables currently in the workspace
whos Lists variables currently in the workspace with their size
clear Clears the workspace, all the variables are removed
clear x,y,z Clears only variables x,y,z
quit Quits MATLAB

SL.NO. FUNCTION/COMMAND OPERATION


1 a=[values followed by space] Creating a vector
t = 0:2:20 Creating a vector evenly spaced by 2
2
(Initial Value: step size: Final Value)
3 t =1:10 Displaying value of ‘t’ from 1 to 10
Displaying the value of ‘k’ from 2 to -1 in steps of
4 k =2:-0.5:-1
0.5
5 b=a+2 Add 2 to each of the elements in vector 'a'
6 c=a+b Adding two vectors
Polynomial: It is represented by a Write coefficient in descending order inside the
7 square bracket. Ex. X= [ . . . .]
vector
polyval: Syntax is It finds the value of polynomial at 2
8
z=(polyval([. . . .],2)
Dept. of ECE, YIT Page 3
BEC403 Control Systems Lab

9 roots ([. . . .]) Extracting the roots of a polynomial


10 Polyadd: syntax is z=polyadd(x,y) Adding two polynomials
11 y=polyder(a) Taking derivative of a polynomial
12 X=sqrt(value) finds square root
13 T=poly(value) finds polynomial of a ch.eqn
14 z = conv(x,y) Multiplying two polynomials
15 [xx, R] = deconv(z,y) Dividing two polynomials
Creating Matrix of 3*3 matrix followed by
16 A=[1 2 3;4 5 6;7 8 9]
semicolon after 3 elements
17 B=A’ Taking transpose of matrix A
18 C=A*B Multiplying two matrices
19 D=B*A Checking for A*B=B*A
20 E=A+B Adding two matrices
21 F=A-B Subtracting two matrices
Dividing matrix A by B(A*inverse of B)(right
22 G=A/B
division)
23 H=A./B Element by element division(right division)
Dividing matrix A by B(inverse of A * B) (left
24 I=A\B
division)
25 J=A.\B Element by element division(left division)
26 K=A.*B Element by element multiplication
27 L=A^2 Taking power of a matrix
28 M=A.^2 Element by element taking powers
29 N=inv(A) Taking inverse of a matrix A
30 O=eig(A) Taking eigen values of matrix A
31 N1=det(A) Gives determinant of matrix A
32 N2=rank(A) Gives rank of matrix A
33 P=poly(A) Writing characteristic equation of matrix A
34 Q=roots(P) Finding the roots of ch.eqn ‘J’
35 S=A (2,:) Extracting 2nd row of matrix A
36 A1=A(6) Extracting 6th element of matrix A
37 A2=A(3,2) Extracting 3rd row,2nd column element
38 A3=exp(3) Finding exponential of 3
39 A4=A(:,2) Extracting 2nd column of matrix A
40 A5=[A;B] Concatenating the matrices A and B
41 [r,c] = size(A) Return dimensions of matrix A; r=row;c=column
42 Z=length(A) Return the length of the matrix A
43 Y=trace(A) Return the sum of diagonal elements
44 B1=sum(A) Return the sum of column vector
E=[1 2 3;4 5 6;7 8 9] Flip the matrix from left to right
45 F=[3 2 1;6 5 4;9 8 7]
F=fliplr(E)
E=[1 2 3;4 5 6;7 8 9] Flip the matrix from top to down
46 G=[7 8 9;4 5 6;1 2 3]
G=flipud(E)
47 B2=sum(sum(A)) Return the sum of entire matrix A
c=9:-2:1; Finding the total no. of elements in an array
48 Output: c=[9 7 5 3 1]; d=5
d=numel(c)

Dept. of ECE, YIT Page 4


BEC403 Control Systems Lab

A+B==B+A, (A+B)+C==A+(B+C), Verifying Commutative law, Associative law and


49 Distributive law
A*(B+C)==(A*B)+(A*C)
zeros(M,N), x = zeros(1,3); MxN matrix of zeros
50
i.e x =0 0 0
ones(M,N), x = ones(1,3); MxN matrix of ones
51
i.e x =1 1 1
rand(M,N), x = rand(1,3), MxN matrix of uniformly distributed random
52 numbers on (0,1)
x = 0.9501 0.2311 0.6068
53 R = eye (3, 3) or eye(3) Creating Identity matrix of order 3*3
t=0:0.25:7;y = sin(t);plot(t,y) Plotting sine waveform from 0 to 7 in steps of
54 ‘plot’ for continuous function 0.25
‘stem’ for discrete function
t=0:0.01:20; x=sin(t); y=cos(t); z=t; Creating a 3-D figure
55
plot3(x,y,z)
linspace Creates a vector with some elements linearly
56 Ex: linspace(initial,final,no,of spaced between initial and final numbers
elements)
55 abs(x) Absolute value of ‘x’
56 angle(x) Angle of ‘x’
57 title(‘text’) It adds text at the top of the current axis.
58 xlabel(‘text’) It adds text beside the x-axis on the current axis.
59 ylabel(‘text’) It adds text beside the y-axis on the current axis.
60 freqs(b,a,w) Frequency response plot
n=[10]; prints the num/den in terms of the ratio of
61 d=[1 2 5]; polynomials in s.
𝑛𝑢𝑚⁄ 10
printsys(n,d,’s’); Output: 𝑑𝑒𝑛 = 𝑠2 +2𝑠+5
syms s Finding inverse Laplace Transform from the
f=10/(s^3+10*s^2+33*s+36); Transfer Fucntion
62 Output:
x=ilaplace(f)
x=10*exp(-4*t)-10*exp(-3*t)+10*t*exp(-3*t)
%Transfer Function to Output:
Partial Fraction r=[0.25 0.75 0.5]
63 n=[1 6 9]; p=[-4 -2 -2]
d=[1 8 20 16]; k=[ ]
[r p k]=residue(n,d);
%Conversion from transfer 𝐴=[
−10 −20 1
] ; 𝐵 = [ ] ; 𝐶 = [0 10]; 𝐷 = [0]
function to state space 0 0 0
64 n=[10];
d=[1 10 20];
[A,B,C,D]=tf2ss(n,d);
%Conversion of state space n=[0 0 10]
to Transfer Function d=[1 4 3]
a=[0 1;-3 -4];
65 b=[0; 1];
c=[10 0];
d=[0];
[n,d]=ss2tf(a,b,c,d);
% MATLAB code to solve linear Input:
66 equations A=[3 2 -1;-1 3 2;1 -1 -1];
B=[10;5;-1];
Dept. of ECE, YIT Page 5
BEC403 Control Systems Lab

3𝑥1 + 2𝑥2 – 𝑥3 = 10 x=inv(A)*B;


−𝑥1 + 3𝑥2 + 2𝑥3 = 5 % or x=A\B (Computing by Left division)
𝑥1 – 𝑥2 – 𝑥3 = −1 Output:
x= -2, 5, -6 [i.e x1=-2, x2=5, x3=-6]

67 %3-D plotting example


x=[0:10];
y=[0:10];
z=x’*y;
mesh(x,y,z);
title(‘3-D Graph’);

68 % use of ceil and floor tool Output:


x=9; Ceil-round the value toward +inf
Floor-round the value toward -inf
y=x/2; z1=5;
z1=ceil(y); z2=4
z2=floor(y);

Dept. of ECE, YIT Page 6


BEC403 Control Systems Lab

EXPERIMENT NO. 1

IMPLEMENT BLOCK DIAGRAM REDUCTION TECHNIQUE TO OBTAIN TRANSFER

FUNCTION A CONTROL SYSTEM

Aim: Obtain the Transfer function using Block Diagram Reduction method and
hence obtain its step response.

% MATLAB Code
n1=[50 70];
d1=[1 7];
gc=tf(n1,d1);
n2=[1];
d2=[1 5 4 0];
gp=tf(n2,d2);
g=series(gc,gp);
t=feedback(g,1);
step(t);
disp(t)

Exercise Problem:
Write the MATLAB Code to find the overall transfer function for the Block diagram
shown below

% MATLAB Code to find the Transfer Function


n1=[1];d1=[1 0 0];
g1=tf(n1,d1);
n2=[50];d2=[1 1];
g2=tf(n2,d2);
n3=[1 1];d3=[2 1];
g3=tf(n3,d3);
n4=[2];d4=[1 0];
g4=tf(n4,d4);
g5=2;
g6=feedback(g2,g4);

Dept. of ECE, YIT Page 7


BEC403 Control Systems Lab

g7=parallel(g3,-g5);
g8=series(g1,g6);
g9=series(g8,g7);
tf=feedback(g9,1);
disp(tf)

EXPERIMENT NO.2

IMPLEMENT SIGNAL FLOW GRAPH TO OBTAIN TRANSFER FUNCTION A CONTROL SYSTEM.

Write the MATLAB Code to find the overall transfer function for the SFG shown
below using Mason’s Gain formula

1 1 1 1 1
𝐺1 = ; 𝐺2 = ; 𝐺3 = ; 𝐺4 = 𝑠; 𝐺5 = ; 𝐺6 = ; 𝐻1 = 2; 𝐻2 = 4; 𝐻3 = 6
𝑠 (𝑠 + 1) (𝑠 + 2) (𝑠 + 3) 𝑠

%MATLAB Code to find the transfer


function for the SFG using Mason’s
Gain formula
clc;
clear all;
close all;
syms s
g1=(1/s);g2=(1/(s+1));g3=(1/(s+2));
g4=s;g5=(1/(s+3));g6=(1/s);
h1=2;h2=4;h3=3;
p1=g1*g2*g3*g4*g5;
p2=g1*g2*g5*g6;
l1=g2*h1;
l2=g3*h2;
l3=g4*h3;
l4=g6*h2*h3;
l11=l1*l3;
d=1-(l1+l2+l3+l4)+l11;
d1=1;d2=1;
tf=(p1*d1+p2*d2)/d;
disp(tf);

Exercise Problem:
Write the MATLAB Code

Dept. of ECE, YIT Page 8


BEC403 Control Systems Lab

EXPERIMENT NO.3

SIMULATION OF POLES AND ZEROS OF A TRANSFER FUNCTION

Case(i) : Finding Poles and Zeros from Transfer Function


n=input(‘enter the Numerator Value’);
d=input(‘enter the Denominator Value’);
[z p k]=tf2zp(n,d);%Pole-Zero locations of transfer function
pzmap(p,z) % to plot pole-zero map

Input: Output:
Example 1: z=NIL (Empty Column Vector)
n=[10]; P= -7.236, -2.764
d=[1 10 20]; K=10

Example 2: z= -10
n=[1 10]; P= -7.96, -1.091+j1.65, -1.091-j1.65
d=[1 10 20 30]; K=1

Case(ii) : Finding Poles and Zeros from State Space


a=[0 1;-3 -4];
b=[0; 1];
c=[10 0];
d=[0];
[z,p,k]=ss2zp(a,b,c,d);

Dept. of ECE, YIT Page 9


BEC403 Control Systems Lab

EXPERIMENT NO.4

TIME DOMAIN SPECIFICATIONS & STEP RESPONSES OF VARIOUS SYSTEMS

a) FIRST ORDER SYSTEM


Program:
Step Response
n=input(‘eneter the value of 1

Numerator’); 0.9

d=input(‘enter the value of


0.8

0.7
Denominator’); 0.6

Amplitude
c=tf(n,d); 0.5

step(c); 0.4

Input: num=[10] 0.3

Den=[1 1] 0.2

0.1

0
0 2 4 6 8 10 12
Time (seconds)

b) SECOND ORDER SYSTEM


Program:
n=input(‘eneter the value of Numerator’);
d=input(‘enter the value of Denominator’);
c=tf(n,d);
step(c);
stepinfo(c)

Input: num=[10]
Den=[1 2 10]

Case (ii) Time Response of under


damped system for various damping
factors

%Time Response of under damped


system for various damping
factors
e1=0.2;
wn=5;
n1=[wn^2];
d1=[1 2*e1*wn wn^2];
c1=tf(n1,d1);
t=0:0.01:5;
subplot(2,2,1);
step(c1,t);
grid;

e2=0.5;

Dept. of ECE, YIT Page 10


BEC403 Control Systems Lab

wn=5;
n2=[wn^2];
d2=[1 2*e2*wn wn^2];
c2=tf(n2,d2);
t=0:0.01:5;
subplot(2,2,2);
step(c2,t);
grid;

e3=0.7;
wn=5;
n3=[wn^2];
d3=[1 2*e3*wn wn^2];
c3=tf(n3,d3);
t=0:0.01:5;
subplot(2,2,3);
step(c3,t);
grid;

e4=0.9;
wn=5;
n4=[wn^2];
d4=[1 2*e4*wn wn^2];
c4=tf(n4,d4);
t=0:0.01:5;
subplot(2,2,4);
step(c4,t);
grid;

figure(2)
step(c1,c2,c3,c4);
title('comparision of all the
under damped responses');
legend({'e1=0.2','e2=0.5','e3=
0.7','e4=0.9'});
grid;
Case (iv) Time Response of various
systems
%Types of Responses
%Undampped System
e1=0;
wn=5;
n1=[wn^2];
d1=[1 2*e1*wn wn^2];
c1=tf(n1,d1);
t=0:0.01:5;
subplot(2,2,1);
step(c1,t);
grid;
%Critically dampped System
e2=1;
wn=5;
n2=[wn^2];
d2=[1 2*e2*wn wn^2];
c2=tf(n2,d2);
t=0:0.01:5;

Dept. of ECE, YIT Page 11


BEC403 Control Systems Lab

subplot(2,2,2);
step(c2,t);
grid;
%Under damped system
e3=0.5;
wn=5;
n3=[wn^2];
d3=[1 2*e3*wn wn^2];
c3=tf(n3,d3);
t=0:0.01:5;
subplot(2,2,3);
step(c3,t);
grid;
%Over damped system
e4=1.2;
wn=5;
n4=[wn^2];
d4=[1 2*e4*wn wn^2];
c4=tf(n4,d4);
t=0:0.01:5;
subplot(2,2,4);
step(c4,t);
grid;
figure(2)
step(c1,c2,c3,c4);
title('comparision of all the
system responses');
legend({'undamped','critically
damped','under damped','over
damped'});
grid;

EXPERIMENT NO. 5
FREQUENCY RESPONSE OF SECOND ORDER SYSTEM
Aim: To draw the frequency response of given second order system

Dept. of ECE, YIT Page 12


BEC403 Control Systems Lab

Program:
n=input(‘enter the value of
Numerator’);
d=input(‘enter the value of
Denominator’);
w=0:0.1:2*pi;
freqs (n, d, w);

Input: n=[10]
d=[1 5 25]

EXPERIMENT NO. 6
FREQUENCY RESPONSE OF COMPENSATORS

a) LAG NETWORK
Aim: To draw the response of Lag network
1
(𝑠 + 𝑇)
𝑇(𝑠) = ;𝛽 > 1
1
(𝑠 + )
𝛽𝑇
T=input(‘enter the value of time
constant’);
b=input(‘enter the value of the
constant’);
n=[1 1/T];
d=[1 1/(b*T)];
c=tf(n,d);
bode(c);
grid;
//w=0:0.01:10;
//freqs(n,d,w);
Input: T=5;
b=2;

Dept. of ECE, YIT Page 13


BEC403 Control Systems Lab

b) LEAD NETWORK
Aim: To draw the response of Lead network

1
(𝑠 + 𝑇)
𝑇(𝑠) = ;𝛼 < 1
1
(𝑠 + 𝛼𝑇)
T=input(‘enter the value of time
constant’);
a=input(‘enter the value of the
constant’);
n=[1 1/T];
d=[1 1/(a*T)];
c=tf(n,d);
bode(c);
grid;
//w=0:0.01:10;
//freqs(n,d,w);
Input: T=5;
a=0.5;

c) LAG-LEAD NETWORK
Aim: To draw the response of Lead network

1 1
(𝑠 + 𝑇 ) (𝑠 + 𝑇 )
1 2
𝑇(𝑠) = ; 𝛼 < 1; 𝛽 > 1
1 1
(𝑠 + 𝛼𝑇 ) (𝑠 + )
1 𝛽𝑇2
T1=input(‘enter the value of time constant’);
T2=input(‘enter the value of time constant’);
a=input(‘enter the value of the constant’);
b=input(‘enter the value of the constant’);
n1=[1 1/T1];
n2=[1 1/T2];
n=conv(n1,n2);
d1=[1 1/(a*T1)];
d2=[1 1/(b*T2)];
d=conv(d1,d2);
c=tf(n,d);
bode(c);
margin(c);
grid;

Input: T1=5; T2=6


a=0.5; b=2

Dept. of ECE, YIT Page 14


BEC403 Control Systems Lab

EXPERIMENT NO. 7

ANALYZE THE STABILITY OF THE GIVEN SYSTEM USING ROUTH STABILITY CRITERION

% MATLAB Code to analyze the


stability using Routh Hurwitz
Criteria
a5=1;a4=15;a3=85;a2=225;
a1=274;a0=120;
b0=(a4*a3-a5*a2)/a4;
b1=(a4*a1-a5*a0)/a4;
b2=0;
s3=[b0 b1 b2];
c0=(b0*a2-b1*a4)/b0;
c1=(b0*a0-b2*a4)/b0;
c2=0;
s2=[c0 c1 c2];
d0=(c0*b1-c1*b0)/c0;
d1=0;
s1=[d0 d1];
e0=(d0*c1-c0*d1)/d0;
s0=e0;
if(b0>0 & c0>0 & d0>0 & e0>0)
disp('system is stable');
else
disp('system is
unstable');
end

Exercise: Write the MATLAB Code to analyze the stability of the characteristic
equation given below:
𝐹(𝑠) = 𝑠 5 + 4𝑠 4 + 8𝑠 3 + 2𝑠 2 + 3𝑠 + 1

Dept. of ECE, YIT Page 15


BEC403 Control Systems Lab

EXPERIMENT NO. 8

ANALYZE THE STABILITY OF THE GIVEN SYSTEM USING ROOT LOCUS

Aim: To draw the root loci for a given transfer


function. 15
Root Locus

G(s)=K/s(s+4)(s2+4s+20)
Program: 10

num=input(‘eneter the value of Numerator’);


den=input(‘enter the value of Denominator’);

Imaginary Axis (seconds-1)


5

sys=tf(num,den);
rlocus(sys); 0

[K,poles]=rlocfind(sys);
OUTPUT: -5

Break Away Point: -2,-2±j2.45


-10
Intersection with imaginary axis:±j3.2
Gain(Value of Kmar)=265;Range of K is 0<K<265
-15
-15 -10 -5 0 5 10 15
Real Axis (seconds -1)

EXPERIMENT NO. 9

ANALYZE THE STABILITY OF THE GIVEN SYSTEM USING BODE PLOT

Aim: To draw the Bode plot for a given transfer


Bode Diagram
function. Gm = 4.73 dB (at 4.24 rad/s) , Pm = 76.3 deg (at 1.81 rad/s)
50
G(s)H(s)=48(s+10)/s(s+20)(s2+2.4s+16)
Program: 0
Magnitude (dB)

num=input(‘eneter the value of Numerator’);


-50
den=input(‘enter the value of Denominator’);
sys=tf(num,den); -100

bode(sys);
-150
[gm, pm, wpc, wgc]=margin(sys); -90

margin(sys); -135
Phase (deg)

if(wpc>wgc)
-180
disp(‘system is stable’)
else -225

disp(‘system is unstable’) -270


-1 0 1 2
10 10 10 10
end
Frequency (rad/s)

OUTPUT:
Gain Margin GM=4.73 Db
Gain Cross Over frequency Wgc=1.81 rad/sec
Phase Margin PM=76.3°
Phase Cross Over Frequency Wpc=4.24 rad/sec

Dept. of ECE, YIT Page 16


BEC403 Control Systems Lab

EXPERIMENT NO. 10

ANALYZE THE STABILITY OF THE GIVEN SYSTEM USING NYQUIST PLOT

Aim: To draw the Nyquist plot for a given


Nyquist Diagram
transfer function. 50

G(s)H(s)=48/(s4+64s3+320s2+20s+1) 40
sys

Program: 30

num=input(‘eneter the value of Numerator’); 20

den=input(‘enter the value of Denominator’); 10

Imaginary Axis
sys=tf(num,den); 0

nyquist(sys); -10

[gm, pm, wpc, wgc]=margin(sys); -20

margin(sys); -30

if(wpc>wgc) -40

disp(‘system is stable’) -50


-20 -10 0 10 20 30 40 50
else Real Axis

disp(‘system is unstable’)
end

EXPERIMENT NO. 11

TIME RESPONSE FROM STATE MODEL OF A SYSTEM

Aim: To obtain the time response from state model

Circuit Diagram:

Simulink Model:

𝑑𝑖(𝑡) 1
𝑬𝒒𝒖𝒂𝒕𝒊𝒐𝒏𝒔: 𝐴𝑝𝑝𝑙𝑦 𝐾𝑉𝐿 𝑡𝑜 𝑡ℎ𝑒 𝑙𝑜𝑜𝑝: 𝑅𝑖(𝑡) + 𝐿 + ∫ 𝑖(𝑡)𝑑𝑡 = 𝑉𝑖
𝑑𝑡 𝐶
𝑑𝑖(𝑡) 1
=> = [𝑉𝑖 − 𝑉𝑜 − 𝑅𝑖(𝑡)]
𝑑𝑡 𝐿

Dept. of ECE, YIT Page 17


BEC403 Control Systems Lab

1
𝑂𝑢𝑡𝑝𝑢𝑡 = 𝑉𝑜 = ∫ 𝑖(𝑡)𝑑𝑡
𝐶

Procedure:
(i) Open the simulink library browser
(ii) Click Continuous-Integrator;drag and place in the sheet
(iii) Click Math operations-Gain drag and place in the sheet.
(iv) Click Sources to get step input and click sink to get scope.
(v) Connect all the components to get the above simulink model.
(vi) Save the file,run the model and double click on scope to view the
output waveform.

TIME RESPONSE FROM STATE MODEL

%Time Response from State Model


n=[10];
d=[1 10 20];
c=tf(n,d);%CT transfer function
subplot(3,1,1);
step(c);
grid;
x=zpk(c);%Pole-Zero locations of
transfer function
subplot(3,1,2);
step(x);
grid;
[A,B,C,D]=tf2ss(n,d);%Conversion
from transfer function to state Output:
space 10
𝑐= 2
subplot(3,1,3); 𝑠 + 10𝑠 + 20
step(A,B,C,D);
grid; 10
𝑥=
(𝑠 + 7.236)(𝑠 + 2.764)

Dept. of ECE, YIT Page 18


BEC403 Control Systems Lab

EXPERIMENT NO. 12

STEP RESPONSE OF P, PI, PD, PID CONTROLLERS

Standard form of Transfer function is


𝑲𝒅 𝒔𝟐 + 𝑲𝒑 𝒔 + 𝑲𝒊
𝑻(𝒔) =
𝒔𝟑 + (𝒂𝟏 + 𝑲𝒅 )𝒔𝟐 + (𝒂𝟐 + 𝑲𝒑 )𝒔 + 𝑲𝒊

%Open loop response


n=[1];
d=[1 10 20];
k=tf(n,d);
t=0:0.01:2;
subplot(3,2,1);
step(k,t);
grid;
%Proportional Control
kp=500;
C=pid(kp);
P=tf(n,d);
T1=feedback(C*P,1);
t=0:0.01:2;
subplot(3,2,2);
step(T1,t);
grid;

%PD Controller
kp=500;
kd=10;
C=pid(kp,0,kd);
P=tf(n,d);
T2=feedback(C*P,1);
t=0:0.01:2;
subplot(3,2,3);
step(T2,t);
grid;

%PI Controller
kp=30;
ki=70;
C=pid(kp,ki);
P=tf(n,d);
T3=feedback(C*P,1);
t=0:0.01:2;
subplot(3,2,4);
step(T3,t);
grid;

%PID Controller
kp=500;
ki=400;
kd=50;
C=pid(kp,ki,kd);
P=tf(n,d);

Dept. of ECE, YIT Page 19


BEC403 Control Systems Lab

T4=feedback(C*P,1);
t=0:0.01:2;
subplot(3,2,5);
step(T4,t);
grid;

figure(2)
step(k,T1,T2,T3,T4,'r--
');
title('comparision
of all the responses');
legend({'openloop',
'p_controller',
'pd_controller',
'pi_controller',
'pid_controller'});
legend('boxoff');
grid;

DEMONSTRATION EXPERIMENTS
ADDITIONAL EXPERIMENTS (Not Mandatory to do)

SPEED CONTROL OF DC MOTOR

a) Armature Control Method:

System equations are


𝑑𝑖𝑎 (𝑡)
(𝑖)𝐸𝑙𝑒𝑐𝑡𝑟𝑖𝑐𝑎𝑙 𝐸𝑞𝑢𝑎𝑡𝑖𝑜𝑛: 𝑉𝑎 (𝑡) = 𝑅𝑎 𝑖𝑎 (𝑡) + 𝐿𝑎 + 𝑒𝑏 (𝑡) … … (1)
𝑑𝑡
(𝑖𝑖) 𝑇𝑜𝑟𝑞𝑢𝑒 𝑖𝑠 𝑑𝑖𝑟𝑒𝑐𝑡𝑙𝑦 𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑎𝑙 𝑡𝑜 𝑎𝑟𝑚𝑎𝑡𝑢𝑟𝑒 𝑐𝑢𝑟𝑟𝑒𝑛𝑡, 𝑇 = 𝐾𝑡 𝑖𝑎 (𝑡) … (2)
𝑑2 𝜃 𝑑𝜃
(𝑖𝑖𝑖) 𝑀𝑒𝑐ℎ𝑎𝑛𝑖𝑐𝑎𝑙 𝐸𝑞𝑢𝑎𝑡𝑖𝑜𝑛: 𝑇 = 𝐽 2 + 𝐵 … … (3)
𝑑𝑡 𝑑𝑡
𝑑𝜃
(𝑖𝑣)𝐵𝑎𝑐𝑘 𝑒𝑚𝑓 𝑖𝑠 𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑎𝑙 𝑡𝑜 𝑠𝑝𝑒𝑒𝑑, 𝑒𝑏 (𝑡) = 𝐾𝑏 … … (4)
𝑑𝑡
𝜃(𝑠) 𝐾𝑡
∴ 𝑇𝑟𝑎𝑛𝑠𝑓𝑒𝑟 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 = 𝑇(𝑠) = =
𝑉𝑎 (𝑠) 𝑠[(𝑅𝑎 + 𝑠𝐿𝑎 )(𝐽𝑠 + 𝐵) + 𝐾𝑡 𝐾𝑏 ]

𝐴𝑠𝑠𝑢𝑚𝑒 𝐽 = 0.01; 𝐵 = 0.1; 𝐾 = 0.1; 𝑅𝑎 = 1𝛺; 𝐿𝑎 = 0.5𝐻


Dept. of ECE, YIT Page 20
BEC403 Control Systems Lab

%Transfer Function
J=0.01;B=0.1;K=0.01;
R=1;L=0.5;
n=[K];
d=[0.005 0.06 0.1];
c=tf(n,d)
step(c)
grid;

%Transfer Function
J=0.01;B=0.1;K=0.01;
R=1;L=0.5;
s=tf('s');
P=K/((J*s+B)*(L*s+R)+K^2);
zpk(P);
step(P)
grid;

%State Space
J=0.01;b=0.1;K=0.01;
R=1;L=0.5;
A=[-b/J K/J;-K/L -R/L];
B=[0;1/L];
c=[1 0];
d=[0];
m=ss(A,B,C,D);
step(m);
The above state-space model can also
be generated by converting your existing
transfer function model into state-space
form. This is again accomplished with
the ss command as shown below.

m1=ss(P);

(ii) Simulink Model

Dept. of ECE, YIT Page 21


BEC403 Control Systems Lab

b) Field Control method


System equations are
𝑑𝑖𝑓 (𝑡)
(𝑖)𝐸𝑙𝑒𝑐𝑡𝑟𝑖𝑐𝑎𝑙 𝐸𝑞𝑢𝑎𝑡𝑖𝑜𝑛: 𝑉𝑓 (𝑡) = 𝑅𝑓 𝑖𝑓 (𝑡) + 𝐿𝑓 … … (1)
𝑑𝑡
(𝑖𝑖) 𝑇𝑜𝑟𝑞𝑢𝑒 𝑖𝑠 𝑑𝑖𝑟𝑒𝑐𝑡𝑙𝑦 𝑝𝑟𝑜𝑝𝑜𝑟𝑡𝑖𝑜𝑛𝑎𝑙 𝑡𝑜 𝑎𝑟𝑚𝑎𝑡𝑢𝑟𝑒 𝑐𝑢𝑟𝑟𝑒𝑛𝑡, 𝑇 = 𝐾𝑡 𝑖𝑓 (𝑡) … (2)
𝑑2 𝜃 𝑑𝜃
(𝑖𝑖𝑖) 𝑀𝑒𝑐ℎ𝑎𝑛𝑖𝑐𝑎𝑙 𝐸𝑞𝑢𝑎𝑡𝑖𝑜𝑛: 𝑇 = 𝐽 2 + 𝐵 … … (3)
𝑑𝑡 𝑑𝑡
𝜃(𝑠) 𝐾𝑡
∴ 𝑇𝑟𝑎𝑛𝑠𝑓𝑒𝑟 𝐹𝑢𝑛𝑐𝑡𝑖𝑜𝑛 = 𝑇(𝑠) = =
𝑉𝑓 (𝑠) 𝑠(𝑅𝑓 + 𝑠𝐿𝑓 )(𝐽𝑠 + 𝐵)

Dept. of ECE, YIT Page 22


BEC403 Control Systems Lab

Dept. of ECE, YIT Page 23


BEC403 Control Systems Lab

Open Loop Response:

The open-loop step response can also be generated directly within Simulink, without
extracting any models to the MATLAB workspace. In order to simulate the step response,
the details of the simulation must first be set. This can be accomplished by
selecting Model Configuration Parameters from the Simulation menu. Within the
resulting menu, define the length for which the simulation is to run in the Stop time field.
We will enter "3" since 3 seconds will be long enough for the step response to reach
steady state. Within this window you can also specify various aspects of the numerical
solver, but we will just use the default values for this example.
Next we need to add an input signal and a means for displaying the output of our
simulation. This is done by doing the following:

 Remove the In1 and Out1 blocks.


 Insert a Step block from the Simulink/Sources library and connect it with a line to the
Voltage input of the motor subsystem.
 To view the Speed output, insert a Scope from the Simulink/Sinks library and connect
it to the Speed output of the motor subsystem.
 To provide an appropriate unit step input at t=0, double-click the Step block and set
the Step time to "0".
 The final model should appear as shown in the following figure.

Dept. of ECE, YIT Page 24


BEC403 Control Systems Lab

Linearized Model

 We then need to identify the inputs and outputs of the model we wish to extract.
First right-click on the signal representing the Voltage input in the Simulink model.
 Then choose Linear Analysis Points > Open-loop Input from the resulting menu.
 Similarly, right-click on the signal representing the Speed output and select Linear
Analysis Points > Open-loop Output from the resulting menu.
 The input and output signals should now be identified on your model by arrow
symbols as shown in the figure below.

 In order to perform the extraction, select from the menus at the top of the model
window Analysis > Control Design > Linear Analysis.
 This will cause the Linear Analysis Tool to open. Within the Linear Analysis
Tool window, the Operating Point to be linearized about can remain the
default, Model Initial Condition.
 In order to perform the linearization, next click the Step button identified by a step
response with a small green triangle.
 The result of this linearization is the linsys1 object which will appear in the Linear
Analysis Workspace as shown below.
 Furthermore, the open-loop step response of the linearized system also will be
generated automatically.

Dept. of ECE, YIT Page 25


BEC403 Control Systems Lab

 We will further verify the model extraction by looking at the model itself.
 The linearized model can be exported by simply dragging the object into
the MATLAB Workspace.
 This object can then be used within MATLAB in the same manner as an object
created directly from the MATLAB command line.
 Specifically, entering the command zpk(linsys1) in the MATLAB command window
demonstrates that the resulting model has the following form.
𝜽(𝒔)̇ 𝟐
𝑷(𝒔) = =
𝑽(𝒔) (𝒔 + 𝟗. 𝟗𝟗𝟕)(𝒔 + 𝟐. 𝟎𝟎𝟑)

Closed Loop Response:

(i) Lag Compensator

Dept. of ECE, YIT Page 26


BEC403 Control Systems Lab

(ii) Lead Compensator

(iii) Lag-Lead Compensator

Dept. of ECE, YIT Page 27

You might also like