0% found this document useful (0 votes)
232 views49 pages

CS Lab Manual - Merged

The Control Systems Laboratory Manual for the Electronics & Communication Engineering department outlines the course objectives, teaching strategies, and assessment details for the BEC403 course. It emphasizes the importance of practical skills in control systems, including stability analysis, frequency response, and state variable analysis. The manual also details the course outcomes and expectations for students in both theory and practical components.

Uploaded by

supriyasupi133
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)
232 views49 pages

CS Lab Manual - Merged

The Control Systems Laboratory Manual for the Electronics & Communication Engineering department outlines the course objectives, teaching strategies, and assessment details for the BEC403 course. It emphasizes the importance of practical skills in control systems, including stability analysis, frequency response, and state variable analysis. The manual also details the course outcomes and expectations for students in both theory and practical components.

Uploaded by

supriyasupi133
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/ 49

Department of Electronics & Communication Engineering

Control Systems Laboratory Manual


[BEC403]
4 SEMESTER, EVEN – 2024
th

Prepared by

Dr. Basavanna M Spoorthi Y Sri Yuvaraju T


Assistant Professor Assistant Professor Assistant. Professor
ECE DEPT, GSSSIETW ECE DEPT, GSSSIETW ECE DEPT, GSSSIETW
Vision of the Department:
"To foster professional level competence in all areas of Electronics and Communication
Engineering and to benchmark the Department as a centre for nurturing Women
Engineers in the Country"

Mission of the Department:


M1: To impart value based Technical education and training.

M2: To impart Theoretical Knowledge, Practical Knowledge and Entrepreneurship


Skills.

M3: Fostering culture of innovation and research for development of society.

M4: To sensitize the Students regarding Social, Moral and Professional ethics.

M5: To provide industry standard certifications on skills to enhance students knowledge


make them prepared for placements.

PROGRAM EDUCATIONAL OBJECTIVES

PEO1: To inculcate students to excel in professional career and/or higher education by


acquiring knowledge in the field of Electronics and Communication.

PEO2: To make the students capable of managing their profession based on existing as
well as new emerging technologies in the area of Electronics and Communication
Engineering.

PEO3: To Produce Technically competent graduates with ability to analyze, design,


develop, optimize and implement Electronics and Communication systems.

PEO4: To prepare the students to be able to exhibit professionalism, ethical attitude,


communication skills, team work in their profession and to adapt to current trends
by engaging in life-long learning.
Program Outcomes

Engineering Graduates will be able to:

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of
the information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities
with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant
to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader
in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, and give and
receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage
in independent and life-long learning in the broadest context of technological change.

Program Specific Outcomes

PSO1. Graduates will have the ability to mould the technology in the areas of Analog and Digital
Scenario.

PSO2. Implementation of functional Blocks of hardware software co-design for signal


processing and communication application.
03.10.2022

VISVESVARAYA TECHNOLOGICAL UNIVERSITY, BELAGAVI


B.E: Electronics & Communication Engineering / B.E: Electronics & Telecommunication
Engineering NEP, Outcome Based Education (OBE) and Choice Based Credit System (CBCS)
(Effective from the academic year 2023 – 24)

IV Semester

Control Systems
Course Code BEC403 CIE Marks 50
Teaching Hours/Week (L: T: P) (3:0:2) SEE Marks 50
Total Hours of Pedagogy 40 hours Theory + 12 Lab slots Total Marks 100
Credits 04 Exam Hours 03
Course objectives: This course will enable students to:
1. Understand basics of control systems and design mathematical models using block diagram
reduction, SFG, etc.
2. Understand Time domain and Frequency domain analysis.
3. Analyze the stability of a system from the transfer function
4. Familiarize with the State Space Model of the system.

Teaching-Learning Process (General Instructions)


These are sample Strategies, which teacher can use to accelerate the attainment of the various
course outcomes.
• Lecture method (L) does not mean only traditional lecture method, but different type of
teaching methods may be adopted to develop the outcomes.
• Show Video/animation films to explain the different concepts of Linear Algebra & Signal
Processing.
• Encourage collaborative (Group) Learning in the class.
• Ask at least three HOTS (Higher order Thinking) questions in the class, which promotes
critical thinking.
• Adopt Problem Based Learning (PBL), which fosters students’ Analytical skills, develop
thinking skills such as the ability to evaluate, generalize, and analyze information rather than
simply recall it.
• Topics will be introduced in a multiple representation.
• Show the different ways to solve the same problem and encourage the students to come up
withtheir own creative ways to solve them.
• Discuss how every concept can be applied to the real world - and when that's possible, it
helps improve the students' understanding.
• Adopt Flipped class technique by sharing the materials / Sample Videos prior to the class and
have discussions on the that topic in the succeeding classes.
• Give Programming Assignments.
Module-1
Introduction to Control Systems: Types of Control Systems, Effect of Feedback Systems,
Differential equation of Physical Systems -Mechanical Systems, Electrical Systems, Analogous
Systems. (Textbook 1: Chapter 1.1, 2.2)

Teaching- Chalk and Talk, YouTube videos


LearningProcess RBT Level: L1, L2, L3
03.10.2022

Module-2
Block diagrams and signal flow graphs: Transfer functions, Block diagram algebra and Signal
Flow graphs. (Textbook 1: Chapter 2.4, 2.5, 2.6)
Teaching- Chalk and Talk, YouTube videos, Any software tool to implement block diagram
LearningProcess reduction techniques and Signal Flow graphs
RBT Level: L1, L2, L3
Module-3
Time Response of feedback control systems: Standard test signals, Unit step response of First
and Second order Systems. Time response specifications, Time response specifications of second
order systems, steady state errors and error constants. Introduction to PI, PD and PID Controllers
(excluding design). (Textbook 1: Chapter 5.3, 5.4, 5.5)
Teaching- Chalk and Talk, YouTube videos, Any software tool to show time
LearningProcess response for various transfer functions and PI, PD and PID controllers.
RBT Level: L1, L2, L3
Module-4
Stability analysis: Concepts of stability, Necessary conditions for Stability, Routh stability
criterion, Relative stability analysis: more on the Routh stability criterion.
Introduction to Root-Locus Techniques, The root locus concepts, Construction of root loci.
(Textbook 1: Chapter 6.1, 6.2, 6.4, 6.5, 7.1, 7.2, 7.3)
Teaching- Chalk and Talk, YouTube videos, Any software tool to plot Root locus for
LearningProcess various transfer functions
RBT Level: L1, L2, L3
Module-5
Frequency domain analysis and stability: Correlation between time and frequency response,
Bode Plots, Experimental determination of transfer function. (Textbook 1: Chapter 4: 8.1, 8.2, 8.4)
Mathematical preliminaries, Nyquist Stability criterion, (Stability criteria related to polar plots are
excluded) (Textbook 1: 9.2, 9.3)
State Variable Analysis: Introduction to state variable analysis: Concepts of state, state variable
and state models. State model for Linear continuous –Time systems, solution of state equations.
(Textbook 1: 12.2, 12.3, 12.6)
Teaching- Chalk and Talk, YouTube videos, Any software tool to draw Bode plot
LearningProcess for various transfer functions
RBT Level: L1, L2, L3

PRACTICAL COMPONENT OF IPCC


Using suitable simulation software (P-Spice/ MATLAB / Python / Scilab / OCTAVE / LabVIEW)
demonstrate the operation of the following circuits:
Sl.No Experiments
1 Implement Block diagram reduction technique to obtain transfer function a control system.
2 Implement Signal Flow graph to obtain transfer function a control system.
3 Simulation of poles and zeros of a transfer function.
4 Implement time response specification of a second order Under damped System, for different
damping factors.
5 Implement frequency response of a second order System.
6 Implement frequency response of a lead lag compensator.
7 Analyze the stability of the given system using Routh stability criterion.
8 Analyze the stability of the given system using Root locus.
9 Analyze the stability of the given system using Bode plots.
10 Analyze the stability of the given system using Nyquist plot.
11 Obtain the time response from state model of a system.
12 Implement PI and PD Controllers.
13 Implement a PID Controller and hence realize an Error Detector.
14 Demonstrate the effect of PI, PD and PID controller on the system response.
03.10.2022

Course Outcomes

At the end of the course the student will be able to:


1. Deduce transfer function of a given physical system, from differential equation
representation or Block Diagram representation and SFG representation.
2. Calculate time response specifications and analyse the stability of the system.
3. Draw and analyse the effect of gain on system behaviour using root loci.
4. Perform frequency response Analysis and find the stability of the system.
5. Represent State model of the system and find the time response of the system.

Assessment Details (both CIE and SEE)


The weightage of Continuous Internal Evaluation (CIE) is 50% and for Semester End Exam
(SEE) is 50%. The minimum passing mark for the CIE is 40% of the maximum marks (20
marks). A student shall be deemed to have satisfied the academic requirements and earned the
credits allotted to each subject/ course if the student secures not less than 35% (18 Marks out
of 50) in the semester-end examination (SEE), and a minimum of 40% (40 marks out of 100) in
the sum total of the CIE (Continuous Internal Evaluation) and SEE (Semester End Examination)
taken together

CIE for the theory component of IPCC


Two Tests each of 20 Marks (duration 01 hour)
• First test at the end of 5th week of the semester
• Second test at the end of the 10th week of the semester
Two assignments each of 10 Marks
• First assignment at the end of 4th week of the semester
• Second assignment at the end of 9th week of the semester
Scaled-down marks of two tests and two assignments added will be CIE marks for the theory
component of IPCC for 30 marks.

CIE for the practical component of IPCC


• On completion of every experiment/program in the laboratory, the students shall be
evaluated and marks shall be awarded on the same day. The 15 marks are for
conducting the experiment and preparation of the laboratory record, the other 05
marks shall be for the test conducted at the end of the semester.
• The CIE marks awarded in the case of the Practical component shall be based on the
continuous evaluation of the laboratory report. Each experiment report can be
evaluated for 10 marks. Marks of all experiments’ write-ups are added and scaled down
to 15 marks.
• The laboratory test (duration 03 hours) at the end of the 15th week of the semester
/after completion of all the experiments (whichever is early) shall be conducted for
50 marks and scaled down to 05 marks.
• Scaled-down marks of write-up evaluations and tests added will be CIE marks for the
laboratory component of IPCC for 20 marks.
03.10.2022

SEE for IPCC


Theory SEE will be conducted by University as per the scheduled timetable, with common
question papers for the course (duration 03 hours)
• The question paper will have ten questions. Each question is set for 20 marks.
• There will be 2 questions from each module. Each of the two questions under a
module (with a maximum of 3 sub-questions), should have a mix of topics under that
module.
• The students have to answer 5 full questions, selecting one full question from each
module.

The theory portion of the IPCC shall be for both CIE and SEE, whereas the practical
portion will have a CIE component only. Questions mentioned in the SEE paper shall
include questions from the practical component.
• The minimum marks to be secured in CIE to appear for SEE shall be the 12 (40% of
maximum marks-30) in the theory component and 08 (40% of maximum marks -20) in
the practical component. The laboratory component of the IPCC shall be for CIE only.
However, in SEE, the questions from the laboratory component shall be included. The
maximum of 04/05 questions to be set from the practical component of IPCC, the total
marks of all questions should not be more than the 20 marks.

SEE will be conducted for 100 marks and students shall secure 35% of the maximum marks to
qualify inthe SEE. Marks secured out of 100 shall be reduced proportionally to 50.
Suggested Learning Resources:
Text Books
1. Control Systems Engineering, I J Nagrath, M. Gopal, New age international Publishers, Fifth
edition.

Web links and Video Lectures (e-Resources):


• https://nptel.ac.in/courses/108106098

Activity Based Learning (Suggested Activities in Class)/ Practical Based learning


Programming Assignments / Mini Projects can be given to improve programming skills
Department of Electronics and Communication Engineering
Year of Study: 2024-25

SEMESTER & YEAR: 4th EVEN 2025 FACULTY NAME: Dr. Basavanna M, Smt. Spoorthi Y and
Mr. Yuvaraju T

COURSE NAME/CODE: Control Systems (BEC403)/C218

Course Outcomes
Students will be able to deduce transfer function of a given physical system,
C 218.1 from differential equation representation or Block Diagram representation and
SFG representation.
Students will be able to calculate time response specifications and analyze the
C 218.2
stability of the system.
Students will be able to draw and analyze the effect of gain on system behavior
C 218.3
using root loci.
Students will be able to perform frequency response Analysis and find the
C 218.4
stability of the system.
Students will be able to represent state model of the system and find the time
C 218.5
response of the system.
IMPORTANT INSTRUCTIONS TO THE STUDENTS

1. You should come prepared for the experiments to be done in the lab.

2. Data sheet should be complete with theoretical calculations and the program.

3. Lab record should be complete with theory, theoretical calculations, program, and
observations.

4. You should try to analyze and understand the solved problems and then solve the
unsolved problems of the experiment in the lab.

5. Results of all the problems solved in the lab should be properly noted down in the
data sheet and the output must be plotted on the graph sheet in the lab.

6. You have to get your results verified and observation copies checked by the
instructor before leaving the lab for the day.

7. You should maintain a folder of all the programs you do in the lab in the computer
you use by your name/roll no.

8. Maintain the timings and the discipline of the lab.

9. You will be evaluated in every lab you attend, based on your performance,
observation copy and behavior in the lab.
DO’S AND DON’T’S OF THE LABORATORY
DO’S:
1. Laboratory regulations and procedures for conduction of experiments are to be
followed strictly.

2. Follow the instruction given by faculty members

3. Ensure the main supply is off before making any connection.

4. Make all connections tight.

5. Get the connection checked by the staff before switching on the supply.

6. Keep away from rotating parts motors.

7. During Conduction should be away from the equipments

8. Use all apparatus carefully & replace the same in proper place.

9. For any alteration and change of connection get the approval by the staff.

10. Switch off the supply and remove all the connection made to the Machine / System
after completion of the experiment.

11. Put all the connecting wires in bins.

DONT’S:
1. Do not spread unwanted connecting wires on the table.

2. Do not change connection while supply is on.

3. Do not leave the experiment table unattended while the experimental set up supply
is on.
LIST OF EXPERIMENTS
Control Systems Laboratory
Sl. Page No
Name of Experiment
No
Implement Block diagram reduction technique to obtain transfer 1-3
1
function a control system.
Implement Signal Flow graph to obtain transfer function a control 4-6
2
system.
3 Simulation of poles and zeros of a transfer function. 7-9
Implement time response specification of a second order Under 10-13
4
damped System, for different damping factors.
5 Implement frequency response of a second order System. 14-16
6 Implement frequency response of a lead lag compensator. 17-19
Analyze the stability of the given system using Routh stability 20-23
7
criterion.
8 Analyze the stability of the given system using Root locus. 24-26
9 Analyze the stability of the given system using Bode plots. 27-29
10 Analyze the stability of the given system using Nyquist plot. 30-32
11 Obtain the time response from state model of a system. 33-36
12 Implementation of PI, PD Controllers. 37-41
13 Implement a PID Controller and hence realize an Error Detector. 42-45
Demonstrate the effect of PI, PD and PID controller on the system 46-50
14
response.
Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 1

IMPLEMENT BLOCK DIAGRAM REDUCTION TECHNIQUE


TO OBTAIN TRANSFER FUNCTION A CONTROL SYSTEM

Aim: To implement the block diagram reduction technique in order to obtain the transfer
function of a control system using Matlab.

Software Required: Matlab.

Theory: A block diagram is a graphical representation of a control system, illustrating the flow
of signals and the relationships between system components. Block diagram reduction involves
simplifying a complex system into a single transfer function, which represents the relationship
between the input and output.

Program:
% Define transfer function G1(s)
numerator_G1 = [1];
denominator_G1 = [1, 2];
G1 = tf(numerator_G1, denominator_G1);
% Define transfer function G2(s)
numerator_G2 = [1];

Dept of ECE, GSSSIETW MYSURU Page 1


Control Systems Lab (IPCC) BEC403

denominator_G2 = [1, 1];


G2 = tf(numerator_G2, denominator_G2);
% Define transfer function G3(s)
numerator_G3 = [1];
denominator_G3 = [1, 3];
G3 = tf(numerator_G3, denominator_G3);
% Define transfer function H1(s)
numerator_H1 = [1];
denominator_H1 = [1, 1];
H1 = tf(numerator_H1, denominator_H1);
% Define transfer function H2(s)
numerator_H2 = [1];
denominator_H2 = [1, 4];
H2 = tf(numerator_H2, denominator_H2);
% Perform block diagram reduction
sys = feedback(series(G1, G2), H1, -1);
sys = feedback(sys, G3, -1);
sys = series(sys, H2);
% Display the transfer function
disp('Transfer Function of the System after Block Diagram
Reduction:');
disp(sys);

Result:
Transfer Function of the System after Block Diagram Reduction:
tf with properties:
Numerator: {[0 0 0 1 4 3]}
Denominator: {[1 11 45 87 86 40]}

Viva Questions:

1. What is a block diagram in control systems?

2. How do you combine blocks in series?

3. How do you combine blocks in parallel?

4. What is the formula for the equivalent transfer function of a feedback loop?

5. Why is block diagram reduction important in control systems?

Dept of ECE, GSSSIETW MYSURU Page 2


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 2
IMPLEMENT SIGNAL FLOW GRAPH TO OBTAIN TRANSFER
FUNCTION A CONTROL SYSTEM.
Aim: To implement a signal flow graph (SFG) in order to obtain the transfer
function of a control system using MATLab

Dept of ECE, GSSSIETW MYSURU Page 3


Control Systems Lab (IPCC) BEC403

Program:
% Define the Signal Flow Graph (SFG) represented as an adjacency
matrix
sfg = [
1, 2, 1; % Node 1 to Node 2 with gain 1
2, 3, 1; % Node 2 to Node 3 with gain 1
3, 4, 1; % Node 3 to Node 4 with gain 1
4, 2, -1; % Node 4 to Node 2 with gain -1 (negative feedback)
];
% Create the transfer function from the SFG
[numerator, denominator] = sfg2tf(sfg);
% Display the transfer function
sys_tf = tf(numerator, denominator);
disp('Transfer Function of the System:');
disp(sys_tf);

Result:

Transfer Function of the System:


Numerator: {[ 1 3]}
Denominator: {[1 1 5 8 4]}

Dept of ECE, GSSSIETW MYSURU Page 4


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 3

SIMULATION OF POLES AND ZEROS OF A TRANSFER


FUNCTION.

Aim: To simulate and analyze the poles and zeros of a given transfer
function using MATLab.

Dept of ECE, GSSSIETW MYSURU Page 5


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 4

IMPLEMENT TIME RESPONSE SPECIFICATION OF A SECOND ORDER


UNDER DAMPED SYSTEM, FOR DIFFERENT DAMPING FACTORS.

Program:
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;
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*e3*wn wn^2];
c4=tf(n4,d4);
t=0:0.01:5;
subplot(2,2,4);
step(c4,t);
grid;
figure(2)

Dept of ECE, GSSSIETW MYSURU Page 6


Control Systems Lab (IPCC) BEC403

step(c1,c2,c3,c4,'r--');
title('comparision of all the under damped responses');
legend({'e1=0.2','e2=0.5','e3=0.7','e4=0.9'});
legend('boxoff');
grid;

Dept of ECE, GSSSIETW MYSURU Page 7


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 5

IMPLEMENT FREQUENCY RESPONSE OF A SECOND ORDER SYSTEM.


Program:

% Define the parameters of the second-order system


zeta = 0.1; % damping ratio
omega_n = 10; % natural frequency
% Define the range of frequencies (logarithmically spaced)
omega = logspace(-1, 2, 100);
% Calculate the frequency response of the second-order system
H = (omega_n^2) ./ (omega.^2 - 2*zeta*omega_n*1i*omega +
omega_n^2);
% Calculate the magnitude and phase response
magnitude = abs(H);
phase = angle(H);
% Plot the magnitude response
subplot(2,1,1);
loglog(omega, magnitude);
xlabel('Frequency (rad/s)');
ylabel('Magnitude');
title('Frequency Response - Magnitude');
grid on;
% Plot the phase response
subplot(2,1,2);
semilogx(omega, rad2deg(phase));
xlabel('Frequency (rad/s)');
ylabel('Phase (degrees)');
title('Frequency Response - Phase');
grid on;

Dept of ECE, GSSSIETW MYSURU Page 8


Control Systems Lab (IPCC) BEC403

Dept of ECE, GSSSIETW MYSURU Page 9


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 6

IMPLEMENT FREQUENCY RESPONSE OF A LEAD LAG


COMPENSATOR.

a) Frequency response of a lag compensator.


Program:
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);
step(c);
bode(c);
xlabel('Time');
ylabel('Magnitude');
title('Frequency responce of lag Compensator');

Result:
enter the value of time constant 5
enter the value of the constant 2

b) Frequency response of a Lead compensator.


Program:
Dept of ECE, GSSSIETW MYSURU Page 10
Control Systems Lab (IPCC) BEC403

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);
step(c);
bode(c);
xlabel('Time');
ylabel('Magnitude');
title('Frequency responce of Lead Compensator');

Result:
enter the value of time constant 5
enter the value of the constant 0.2

c) Frequency response of a Lead Lag compensator.

Program:
T1=input('enter the value of time constant T1:');
T2=input('enter the value of time constant T2:');
b=input('enter the value of the constant b:');
a=input('enter the value of the constant a:');
n1=[1 1/T1];
n2=[1 1/T2];

Dept of ECE, GSSSIETW MYSURU Page 11


Control Systems Lab (IPCC) BEC403

num=conv(n1,n2);
d1=[1 1/(b*T)];
d2=[1 1/(a*T)];
den=conv(d1,d2);
c=tf(num,den);
step(c);
bode(c);
xlabel('Time');
ylabel('Magnitude');
title('Frequency responce of Lead Lag Compensator');

Result:
enter the value of time constant T1:5
enter the value of time constant T2:5
enter the value of the constant b:2
enter the value of the constant a:0.5

Dept of ECE, GSSSIETW MYSURU Page 12


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 7

ANALYSE THE STABILITY OF THE GIVEN SYSTEM USING


ROUTH STABILITY CRITERION.

Program:
%%%Routh Hurwitz Automatically
clear
clc
close all
%%%%%%INPUT COEFFICIENTS OF CHARACTERISTIC POLYNOMIAL HERE%%%%%
%coeff = [1,-6,-7,-52];
%coeff = [1,2,1];
%coeff = [1,6,11,7,200];
%coeff = [1,10,31,1030]
syms K % - hey if you have the symbolic toolbox try this
%coeff = [1,18,77,K];
%or this
%coeff = [1,9,(K-10),2]
coeff=[1,9,8,K]
%%%%Create the First Row of the Routh Table
routh_table = [];
first_row = [];
for idx = 1:2:length(coeff)
first_row = [first_row,coeff(idx)];
end
while length(first_row) <= 2
first_row = [first_row,0];
end
disp('First Row')
routh_table = [routh_table;first_row]
%%%%Create the second row of the Routh Table
second_row = [];
for idx = 2:2:length(coeff)
second_row = [second_row,coeff(idx)];
end
while length(second_row) < length(first_row)
second_row = [second_row,0];
end
disp('Second Row')
routh_table = [routh_table;second_row]

Dept of ECE, GSSSIETW MYSURU Page 13


Control Systems Lab (IPCC) BEC403

routh_table_width = length(first_row);
%%%Now create the next rows
required_rows_to_compute = length(coeff)-2;
%%%Check and see if this is first order or smaller
if required_rows_to_compute < 0

disp('Trivial Solution')
return
end
for loop_row = 1:required_rows_to_compute
row = [];
%disp(['Computing Row ',num2str(loop_row+2)])
disp('Divide All Determinants by this var = ')
divisor = routh_table(loop_row+1,1)
%%THe left part of the determinant for a given row is constant
%Thanks Sumit Godara for pointing that out
%disp('Left Half Determinat')
left_half_det = routh_table(loop_row:loop_row+1,1);
for col = 1:routh_table_width
%disp(['Computing Column ',num2str(col)])
if col == routh_table_width
right_half_det = [0;0];
else
right_half_det = routh_table(loop_row:loop_row+1,col+1);
end
disp('Determinant to be computed')
both_det = [left_half_det,right_half_det]
value = -det(both_det)/divisor;
row = [row,value];
end
disp('Next Row of Routh Table')
routh_table = [routh_table;row]
end
%%%Check for stability
%%%Grab the first column
routh_table
first_column = routh_table(:,1)
s = sign(first_column(1));
unstable = 0;
for idx = 2:length(first_column)
value = first_column(idx);
if s ~= sign(value)
disp('Unstable ')

Dept of ECE, GSSSIETW MYSURU Page 14


Control Systems Lab (IPCC) BEC403

unstable = 1;
break
end
end
if ~unstable
disp('System is Stable')
end

Result:
Unstable

Dept of ECE, GSSSIETW MYSURU Page 15


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 8

ANALYSE THE STABILITY OF THE GIVEN SYSTEM USING


ROOT LOCUS.
Program:
num=input('enter the value of Numerator');
den=input('enter the value of Denominator');
sys=tf(num,den);
rlocus(sys);
[K,poles]=rlocfind(sys);

Result 1:
enter the value of Numerator1
enter the value of Denominator [1 8 36 8 0]

Dept of ECE, GSSSIETW MYSURU Page 16


Control Systems Lab (IPCC) BEC403

Result 2:
enter the value of Numerator1
enter the value of Denominator [1 2 3 8 2]

Result 3:
enter the value of Numerator1
enter the value of Denominator [1 2 8 12 20 16 16]

Dept of ECE, GSSSIETW MYSURU Page 17


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 9

ANALYSE THE STABILITY OF THE GIVEN SYSTEM USING


BODE PLOTS.

Program:
num=input('enter the value of Numerator');
den=input('enter the value of Denominator');
sys=tf(num,den);
bode(sys);
[gm, pm, wpc, wgc]=margin(sys);
margin(sys);
if(wpc>wgc)
disp('system is stable')
else
disp('system is unstable')
end

Result 1:
enter the value of Numerator1
enter the value of Denominator [1 8 36 80 0]
system is stable

Dept of ECE, GSSSIETW MYSURU Page 18


Control Systems Lab (IPCC) BEC403

Result 2:
enter the value of Numerator1
enter the value of Denominator [1 2 3 8]
system is unstable

Dept of ECE, GSSSIETW MYSURU Page 19


Control Systems Lab (IPCC) BEC403

Dept of ECE, GSSSIETW MYSURU Page 20


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 10

ANALYSE THE STABILITY OF THE GIVEN SYSTEM USING


NYQUIST PLOT.

Program:
num=input('enter the value of Numerator');
den=input('enter the value of Denominator');
sys=tf(num,den);
nyquist(sys);

Result 1:
enter the value of Numerator1
enter the value of Denominator [1 64 320 20 1]
system is stable

Dept of ECE, GSSSIETW MYSURU Page 21


Control Systems Lab (IPCC) BEC403

Result 2:
enter the value of Numerator1
enter the value of Denominator [1 2 8 12 20 16 16]
system is unstable

Dept of ECE, GSSSIETW MYSURU Page 22


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 11

OBTAIN THE TIME RESPONSE FROM STATE MODEL OF A SYSTEM.


Program:
% Define the state-space model
A = [0 1; -2 -3];
B = [0; 1];
C = [1 0];
D = 0;
% Define time vector
t = 0:0.01:5;
% Define input vector (optional)
u = ones(size(t)); % For example, a step input
% Initial condition (optional)
x0 = [0; 0]; % Initial state
% Obtain the time response using lsim
[y, t, x] = lsim(ss(A, B, C, D), u, t, x0);
% Plot the response
plot(t, y);
xlabel('Time');
ylabel('Output');
title('Time Response from State-Space Model');
grid on;

Result :

Dept of ECE, GSSSIETW MYSURU Page 23


Control Systems Lab (IPCC) BEC403

Dept of ECE, GSSSIETW MYSURU Page 24


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 12

IMPLEMENT PI AND PD CONTROLLERS.

Program: PI CONTROLLERS
% Define system parameters
setpoint = 10; % Setpoint
Kp = 1; % Proportional gain
Ki = 0.1; % Integral gain
dt = 0.1; % Time step
t_end = 20; % Simulation end time
initial_value = 0; % Initial value of the system
% Initialize variables
time = 0:dt:t_end;
error = zeros(size(time));
output = zeros(size(time));
integral = 0;
% Simulate system with PI control
for i = 1:length(time)
% Calculate error
error(i) = setpoint - output(i);
% Calculate proportional term
P = Kp * error(i);
% Calculate integral term
integral = integral + error(i) * dt;
I = Ki * integral;
% Calculate control signal
control_signal = P + I;
% Update system output (for simplicity, assume a first-order system)
output(i+1) = output(i) + dt * (control_signal - output(i));
end
% Plot results
figure;
subplot(1,1,1);
plot(time, output(1:end-1), 'b', 'LineWidth', 1.5);
hold on;
plot(time, setpoint*ones(size(time)), 'r--', 'LineWidth', 1.5);
xlabel('Time');
ylabel('Output');
legend('Output', 'Setpoint');
title('System Response with PI Control');

Dept of ECE, GSSSIETW MYSURU Page 25


Control Systems Lab (IPCC) BEC403

Result:

Program:

PD CONTROLLERS
% Define system parameters
setpoint = 10; % Setpoint
Kp = 1; % Proportional gain
Kd = 0.1; % Derivative gain
dt = 0.1; % Time step
t_end = 20; % Simulation end time
initial_value = 0; % Initial value of the system
% Initialize variables
time = 0:dt:t_end;
error = zeros(size(time));
output = zeros(size(time));
prev_error = 0;
% Simulate system with PD control
for i = 1:length(time)
% Calculate error
error(i) = setpoint - output(i);
% Calculate proportional term

Dept of ECE, GSSSIETW MYSURU Page 26


Control Systems Lab (IPCC) BEC403

P = Kp * error(i);
% Calculate derivative term
D = Kd * (error(i) - prev_error) / dt;
% Calculate control signal
control_signal = P + D;
% Update system output (for simplicity, assume a first-order system)
output(i+1) = output(i) + dt * (control_signal - output(i));
% Update previous error
prev_error = error(i);
end
% Plot results
figure;
subplot(1,1,1);
plot(time, output(1:end-1), 'b', 'LineWidth', 1.5);
hold on;
plot(time, setpoint*ones(size(time)), 'r--', 'LineWidth', 1.5);
xlabel('Time');
ylabel('Output');
legend('Output', 'Setpoint');
title('System Response with PD Control');

Dept of ECE, GSSSIETW MYSURU Page 27


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 13

IMPLEMENT A PID CONTROLLER AND HENCE REALIZE AN


ERROR DETECTOR

Program:
% Define system parameters
setpoint = 10; % Setpoint
Kp = 1; % Proportional gain
Ki = 0.1; % Integral gain
Kd = 0.01; % Derivative gain
dt = 0.1; % Time step
t_end = 20; % Simulation end time
initial_value = 0; % Initial value of the system
% Initialize variables
time = 0:dt:t_end;
error = zeros(size(time));
output = zeros(size(time));
integral = 0;
derivative = 0;
prev_error = 0;
% Simulate system with PID control
for i = 1:length(time)
% Calculate error
error(i) = setpoint - output(i);
% Calculate proportional term
P = Kp * error(i);
% Calculate integral term
integral = integral + error(i) * dt;
I = Ki * integral;
% Calculate derivative term
derivative = (error(i) - prev_error) / dt;
D = Kd * derivative;
% Calculate control signal
control_signal = P + I + D;
% Update system output (for simplicity, assume a first-order
system)
output(i+1) = output(i) + dt * (control_signal - output(i));
% Update previous error
prev_error = error(i);
end

% Plot results
figure;
subplot(2,1,1);
plot(time, output(1:end-1), 'b', 'LineWidth', 1.5);

Dept of ECE, GSSSIETW MYSURU Page 28


Control Systems Lab (IPCC) BEC403

hold on;
plot(time, setpoint*ones(size(time)), 'r--', 'LineWidth', 1.5);
xlabel('Time');
ylabel('Output');
legend('Output', 'Setpoint');
title('System Response with PID Control');
subplot(2,1,2);
plot(time, error, 'g', 'LineWidth', 1.5);
xlabel('Time');
ylabel('Error');
title('Error Signal');
% Error detection
acceptable_error = 0.3; % Define acceptable error threshold
if max(abs(error)) <= acceptable_error
disp('System is within acceptable error bounds.');
else
disp('Error detected: System is outside acceptable error bounds.');
end

Result:
Error detected: System is outside acceptable error bounds.

Dept of ECE, GSSSIETW MYSURU Page 29


Control Systems Lab (IPCC) BEC403

EXPERIMENT NO 14

DEMONSTRATE THE EFFECT OF PI, PD AND PID


CONTROLLER ON THE SYSTEM RESPONSE

Program:
n=[1];
d=[1 10 20];
%PD Controller
kp=500;
kd=10;
C=pid(kp,0,kd);
P=tf(n,d);
T1=feedback(C*P,1);
t=0:0.01:2;
subplot(3,1,1);
step(T1,t);
grid;
%PI Controller
kp=30;
ki=70;
C=pid(kp,ki);
P=tf(n,d);
T2=feedback(C*P,1);
t=0:0.01:2;
subplot(3,1,2);
step(T2,t);
grid;
%PID Controller
kp=500;
ki=400;
kd=50;
C=pid(kp,ki,kd);
P=tf(n,d);
T3=feedback(C*P,1);
t=0:0.01:2;
subplot(3,1,3);
step(T3,t);
grid;
figure(2)
step(k,T1,T2,T3,'r--');
title('comparision of all the responses');
legend({'pd_controller','pi_controller','pid_controller'});
legend('boxoff');
grid;

Dept of ECE, GSSSIETW MYSURU Page 30


Control Systems Lab (IPCC) BEC403

Dept of ECE, GSSSIETW MYSURU Page 31


Control Systems Lab (IPCC) BEC403

Dept of ECE, GSSSIETW MYSURU Page 32


Control Systems Lab (IPCC) BEC403

Beyond Syllabus Experiments


EXPERIMENT A

PLOT UNIT STEP RESPONSE OF GIVEN TRANSFER FUNCTION AND FINDS


DELAY TIME, RISE TIME, PEAK TIME AND PEAK OVERSHOOT

Program:
% Plot unit step response of given transfer function and find peak
overshoot, peak time, rise time and delay time using MATLAB.
% Transfer Function = 25/(s^2+6s+25)
clear all
clc
syms s t
n=[25]
d=[1 6 25]
sys = tf(n,d)

Dept of ECE, GSSSIETW MYSURU Page 33


Control Systems Lab (IPCC) BEC403

R=roots(d)
'RiseTimeLimits',[0.00,1.00])

25
d=
1 6 25
Transfer function:
25
--------------
s^2 + 6 s + 25
R=
-3.0000 + 4.0000i
-3.0000 - 4.0000i
S=
RiseTime: 0.5538
SettlingTime: 1.1886
SettlingMin: 0.9910
SettlingMax: 1.0948
Overshoot: 9.4778
Undershoot: 0
Peak: 1.0948
PeakTime: 0.7869

Dept of ECE, GSSSIETW MYSURU Page 34


Control Systems Lab (IPCC) BEC403

EXPERIMENT B

DETERMINE THE TIME RESPONSE OF THE GIVEN SYSTEM


SUBJECTED TO ANY ARBITRARY INPUT.

Program:
close all;
h1=tf([9],[1 6 9])
t=linspace(1,15); %STEP RESPONSE%
subplot(3,2,1);
step(h1); %IMPULSE RESPONSE%
subplot(3,2,2);
impulse(h1);
r=sin(t);
s=2*t;
q=5*(t.^2); %SINE RESPONSE%
subplot(3,2,3);
lsim(h1,r,t); %RAMP RESPONSE%
subplot(3,2,4);
lsim(h1,s,t); %PARABOLIC RESPONSE%
subplot(3,2,5);
lsim(h1,q,t);
Result:
h1 =
9
-------------
s^2 + 6 s + 9

Dept of ECE, GSSSIETW MYSURU Page 35


Control Systems Lab (IPCC) BEC403

Dept of ECE, GSSSIETW MYSURU Page 36


Institution Mission Vision

Vision
"To become a recognized world class Women Educational Institution, by imparting
professional education to the students, creating technical opportunities through
academic excellence and technical achievements, with ethical values"
Mission
• To support value based education with state of art infrastructure.
• To empower women with the additional skill for professional future carrier
• To enrich students with research blends in order to fulfill the International
challenges
• To create multidisciplinary center of excellence
• To achieve Accreditation standards towards intentional education recognition.
• To establish more Post Graduate & Research course.
• To increase Doctorates numbers towards the Research quality of academics.

You might also like