0% found this document useful (0 votes)
2K views44 pages

Laboratory Manual: PC-BTE506 - Control System Laboratory

This document is a laboratory manual that provides instructions for students taking the Control System Laboratory course. It outlines the course objectives, which are to demonstrate control system principles through experiments and simulations. It describes the lab regulations, such as submitting individual reports and rules to be followed. It also provides a grading guideline for student work and lists references for the course.

Uploaded by

Vedant .Chavan
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)
2K views44 pages

Laboratory Manual: PC-BTE506 - Control System Laboratory

This document is a laboratory manual that provides instructions for students taking the Control System Laboratory course. It outlines the course objectives, which are to demonstrate control system principles through experiments and simulations. It describes the lab regulations, such as submitting individual reports and rules to be followed. It also provides a grading guideline for student work and lists references for the course.

Uploaded by

Vedant .Chavan
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/ 44

LABORATORY MANUAL

PC-BTE506 – Control System Laboratory

Department of Electrical Engineering


SARDAR PATEL COLLEGE OF ENGINEERING
MUNSHI NAGAR ANDHERI (WEST), MUMBAI – 400 058
2020-2021

NAME OF THE STUDENT


Vedant Chavan
BRANCH
Electrical
EXAM SEAT NO.
E2020003
SEMESTER
SEM V
BATCH
D
GENERAL INSTRUCTIONS

1.1 INTRODUCTION
This manual provides the operating instructions in a simplified form and leads
students through a prescribed set of experiments aimed at demonstrating the
basic principles of control systems. It is essential that students read these
preliminary sections in order to understand the purpose of each experiment.
Objectives of the course are:
• To illustrate concepts of control system course by experiment / simulation.
• To familiarize students with transient-response and frequency-response of a
control system, and to investigate various controller configurations.
• To give the students the opportunity to practice engineering report writing
and teamwork.
• To train the students to use engineering tool, MATLAB / SCILAB, to create
and extend its functions as necessary.

1.2 LAB REGULATIONS


• The lab will be performed in a group of 2 students per computer. Each group
must use the same computer for the entire session.
• Every group member must participate while performing the experiments.
• Every student must prepare and submit an individual report to the lab
instructor at the subsequent lab session. Marked reports will be returned at the
subsequent session. The marking guideline is given later in the manual. Late
submissions will be penalized. The deadline for the final report submission will
be provided by the lab instructor.
• Reports should be neat, concise, original and meaningful.
1.3 RULES TO BE OBSERVED IN THE LAB
• Students are expected to treat the lab equipment with due respect.
Disciplinary action will be taken against any student caught misusing the lab
such as making marks on benches or other equipment.
• Students must show seriousness in performing the lab and not be a source of
disturbance to neighboring stations. Cell phones must be switched off and
students are not allowed to exit the lab to hold cell-phone conversations.
• Bags must be put away from the work area. Keep the workspace clean.
• At the end of each session, make sure that all scrap papers, pens, etc. are
removed and that the lab equipment is switched off according to procedures
given.

1.4 MISSED LABS AND MAKEUP PROCEDURE


A student who misses a lab must attend another lab to make up for the
missed experiment.

1.6 LAB TEST


The lab test is a two hour test based on individuals, not for groups, normally
in the week following the last experiment.

1.7 MARKING GUIDELINE


As per the scheme total 25 marks are there for this course. The average of
the all experiments will be reported on a maximum of 15 and the lab test on
a maximum of 10. Lab reports will be graded on a scale of 15 with the
approximate percentage weightings shown:
Table 1.1: Grading guideline

Sr. No Activity Marks


1 Participation: Attendance and Lab Performance 5
2 Organization and Presentation: write-up, Proper Tabulation, 5
Calculations, Simulations, neatly hand drawn graphs
3 Discussion and Summary: Technical discussion of obtained 5
results, error calculations, experimental / theoretical
correlations, Meaningful conclusion

1.8 REFERENCE
i. Modern Control Systems, Norman Nise.
ii. Modern Control Systems, Nagrath Gopal
Course Code: PC-BTE506 (AY 2019-
20)

Course:-Control System Laboratory

Course Objectives:
1. Time response, frequency response and state variable analysis
2. Introduction to controllers and compensators
3. Introduction to optimum and nonlinear control
4. Identify the applications of control system.

Course Outcomes:
Students will demonstrate the ability to Simulate and analyze
1. First, second and higher order systems
2. Bode plot, Nyquist plot, solution of state equations, non-linear system
3. Compensator controller and observer designs
4. Develop managerial skills

Course Contents:

Module Details Hours


Simulation assignments to study, analyze or design
1 First, Second and Higher order systems’ performance 02
in frequency domain
2 Study of second order system with different damping 02
ratio and natural frequency of oscillations
3-4 Bode plot, Nyquist plot analysis 04
5-7 Analysis of different compensators 04
7-8 Study of state space model 04
8-10 Analysis of different controllers 04
11 Non linear system analysis 04

Each student will write a technical report on application or further research based
on various concepts of control system theory. The student has to present the same.
Basics of Simulating Control Systems with Simulink and MATLAB

Simulink Basics
Simulink is a graphical tool that allows to simulate systems.

Placing Components
To place a component, drag it from the component library browser to the model
space. To make a connection, hold down CTRL and click on the arrows on each
block that you wish to connect. To connect multiple lines to a single block, hold
down CTRL and click on the line already attached to the block and then make the
second connection.

Components
For most of the systems in-built blocks are available in Simulink’s component
library. In particular, the components we should be familiar with are:
• Continuous library
Integrator – integrates a signal
State-Space – used to add a system block in state-space form
Transfer Fcn – used to add a system block in transfer function form
• Math Operations library
Gain – a constant gain
Sum – used to add two or more signals
Trigonometric Function – used to place trigonometric elements
• Signal Routing library
Mux – used to multiplex signals together in order to plot them on one graph
• Sinks library
Scope – used for viewing system output
To workspace – used to transfer a signal data to MATLAB workspace.
• Sources library
ramp – generates a ramp signal
Sine Wave – generates a sinusoid
Step – generates a unit step signal

Components in detail:
Gain: To modify a ’Gain’ component, double-click on the component. The ’Gain’
parameter can be either a number or can be an expression.

Sum: The ’Sum’ component is equivalent to a summing junction in a block


diagram. To add more input nodes or change the sign of an input node, double-
click on the ’Sum’ component and modify the text in the ’List of Signs’ parameter.
To add two signals set ’List of Signs’ to ‘++’ and to get difference of two signals,
change the ’List of Signs’ parameter to ‘+−’. To add three signals at summing
input node, change the text to ‘+ ++’.

To Workspace: The ’To Workspace’ component sends data to the MATLAB


workspace where you can plot it or process it as and when required. To set this up,
double-click on the component and change the ’Save format’ parameter to ’Array’.
Also, set the ’Variable name’ parameter to something descriptive, such as ’yout’.
Simulink also automatically exports the time in the MATLAB variable ’tout’. This
allows you to plot the output in MATLAB using the standard ’plot’ command, and
also allows you to edit the plots.

Transfer Fcn: To modify a ’Transfer Fcn’ component, double-click on the block.


The ’Numerator’ and ’Denominator’ parameters are the coefficients of the
polynomials of the numerator and denominator of the transfer function.
The coefficients are in order of decreasing power. For instance, if ’Numerator’ is
set to ’[1 2 3]’, then the numerator of the transfer function is s2 + 2s + 3.
The best way to learn Simulink is by doing.

MATLAB Basics

Before you begin the next sections, it would be a good idea to run the MATLAB
Control System Toolbox demo. This is done by typing “demo(’toolbox’,’control’)”
at the MATLAB prompt. Aside from the basic MATLAB plotting commands, you
should become familiar with the following commands:
• tf – This command is used to enter transfer functions. For example, to enter the
s+ 2
transfer function H ( s)= you would type H=tf([1 2],[1 0 5]). The first parameter
s 2 +5
is a row vector of the numerator coefficients. Similarly, the second parameter is a
row vector of the denominator coefficients.
• conv – This command is used to convolve two polynomials. It is particularly
useful for determining the expanded coefficients for factored polynomials. For
example, this command can be used to enter the transfer function
s+2
H (s)=
(s+1)(s−3)
by writing H=tf([1 2],conv([1 1],[1 -3])).
• series or * – This command is used to combine two transfer functions that are in
series. For example, if H(s) and G(s) are in series, they could be combined with the
command “T=G*H” or “T=series(G,H)”.
• feedback – This command is used to combine two transfer functions that are in
feedback. For example, if G(s) is in the forward path and H(s) is in the feedback
path, they could be combined with the command “T=feedback(G,H)”.
• step – This command is used to plot the step response of a system. For example,
“step(T)” would plot the step response of the system T (s). By default it will plot
step response assuming input to be a unit step signal. If you want to get step
response for a step signal of magnitude A then first set the amplitude to A using
command opt = stepDataOptions('StepAmplitude',100); and then execute
step(T,opt);
•stepinfo(sys) computes the step-response characteristics for a dynamic system
model sys. The function returns the characteristics in a structure containing the
fields:
o RiseTime — Time it takes for the response to rise from 10% to 90% of
the steady-state response.
o SettlingTime — Time it takes for the error |y(t) - yfinal| between the
response y(t) and the steady-state response yfinal to fall to within 2%
of yfinal.
o SettlingMin — Minimum value of y(t) once the response has risen.
o SettlingMax — Maximum value of y(t) once the response has risen.
o Overshoot — Percentage overshoot, relative to yfinal).
o Undershoot — Percentage undershoot.
o Peak — Peak absolute value of y(t)
o PeakTime — Time at which the peak value occurs.
 lsim simulates the time response of continuous or discrete linear systems to
arbitrary inputs. When invoked without left-hand arguments, lsim plots the
response on the screen.
 pzmap(sys) creates a pole-zero plot of the continuous or discrete-time dynamic
system model sys
 rlocus – This command is used to plot the root locus of a SISO open-loop
model. The root locus gives the closed-loop pole trajectories as a function of the
feedback gain k (assuming negative feedback). Root loci are used to study the
effects of varying feedback gains on closed-loop pole locations.
 bode – This command is used to plot the frequency response. For example,
“bode(T)” would plot the frequency response of the system T (s).
 nyquist function creates a Nyquist plot of the frequency response of a dynamic
system model. When invoked without left-hand arguments, nyquist produces a
Nyquist plot on the screen. Nyquist plots are used to analyze system properties
including gain margin, phase margin, and stability.
 nichols function creates a Nichols chart of the frequency
response. A Nichols chart displays the magnitude (in dB) plotted against the
phase (in degrees) of the system response. Nichols charts are useful to
analyze open- and closed-loop properties of SISO systems.
INDEX
Sr. Title Date of Page Grade/ Sign with
No performance No. Remark date
1a Simulate the various first order open
loop system and observe the
performance of the systems.
1b Simulate the various second order
open loop system and observe the
performance of the systems.
1c Simulate the various higher order open
loop system and observe the
performance of the systems.
4 Second order system analysis – part I
5 Design the PI, PD and PID controller
for meeting the required specifications
through Root Locus and verify
through domain simulation
6 Analysis of Under-damped systems
7 Effect of zero location
8 Block Diagram Reduction
9 Root Locus
10 Bode Plot
11 Nyquist Plot
12 Introduction to PID Controller
13 State Space
14 Non-Linear System Analysis

This is to certify that Ms./ Mr. Vedant Chavan, Exam Seat No: E2020003 of class
T. Y. BTech Electrical has successfully completed the laboratory work in Control
System Laboratory (PC-BTE506).

Course Instructor HOD Electrical


Exp. 1a: Simulate the various first order open loop system and observe
the performance of the systems.

Objectives:
1) To observe performance of given first order open loop system.
2) To learn use of MATLAB in solving such systems.

List of Equipment/Software: MATLAB

System Details:
C ()C( s)
R(s)

1
1. H 1 ( s ) =
s+5

2
2. H 2 ( s ) =
s−5

5
3. H 3 ( s )=
s+ 3

Procedure:

1) Derive model of the given system in block diagram and transfer function form.
2) Calculate the response of the system for a given input applied to the system.
3) Write a MATLAB program to obtain response of the system. (use functions tf, step, lsim,
stepinfo)
4) Create a Simulink model of the system and obtain the response.

Code:
H1 = tf([1],[1,5]);
figure(1);
subplot(3,1,1);
pzplot(H1);
H2=tf([2],[1,-5]);
subplot(3,1,2);
pzplot(H2);
H3=tf([5],[1,0.3]);
subplot(3,1,3);
pzplot(H3);
figure(2);
subplot(2,1,1);
step(H1);
subplot(2,1,2);
step(H2);
hold on;
step(H3);
X=stepinfo(H1)
Y=stepinfo(H2)
Z=stepinfo(H3)

Plot:
Calculations: Model derivation and response calculation

Observations:

Sr.n Settling
Parameter RiseTime Overshoot PeakTime Peak
o. Time
1
H 1( s) =
1. s+5 0.4394 0 2.1092 0.7824 0.2000

2
H 2 ( s) =
2. s−5 NaN NaN Inf NaN Inf

5
H 3 ( s )=
3. s+ 3 7.3234 0 35.1528 13.0402 16.6662

Conclusions:
First order system is realized. The poles, rising time and overshoot is calculated. For a
system with a pole that is located in the RHS, the system can't be realized and is not
feasible. As evident from step responses, H1 & H3 are converging and H2 is
diverging.
Exp. 1b: Simulate the various second order open loop system and
observe the performance of the systems.

Objectives:
1. To observe performance of given second order open loop system.
2. To learn use of MATLAB in solving such systems.

List of Equipment/Software: MATLAB

System Details:

1. H1( s) = 1/(s 2+2s+1)


2. H2( s) = 4/(s 2+2s+4)
3. H3( s) = 9/(s 2+9)
Procedure:

1. Derive model of the given system in block diagram and transfer function form.
2. Calculate the response of the system for a given input applied to the system.
3. Write a MATLAB program to obtain response of the system. (use functions tf, step, lsim,
stepinfo)
4. Create a Simulink model of the system and obtain the response.

Code:
num1= [1];

den1= [1,2,1];

H1=tf(num1,den1);

figure(1);

subplot(3,1,1);

pzplot(H1);

num2=[4];

den2=[1,2,4];

H2=tf(num2,den2);

subplot(3,1,2);

pzplot(H2);
num3=[9];

den3=[1,0,9];

H3=tf(num3,den3);

subplot(3,1,3);

pzplot(H3);

figure(2);

subplot(3,1,1);

step(H1);

subplot(3,1,2);

step(H2);

subplot(3,1,3);

step(H3);

X=stepinfo(H1)

Y=stepinfo(H2)

Z=stepinfo(H3)

Plot:
Calculations: Model derivation and response calculation.

Observations:

Sr.n Settling
Parameter RiseTime Overshoot PeakTime Peak
o. Time
1 H 1 ( s ) =¿1/(s +2s+1)
2
3.3579 0 9.7900 5.8339 0.9994
H 2 ( s ) =¿4/(s +2s+4)
2
2 0.8195 0 1.7960 4.0379 1.1629
H 3 ( s )=¿9/(s 2+9)
3 NaN NaN Inf NaN Inf
Conclusions:
a) The second order systems are classified as:
1) Overdamped
2) Underdamped
3) Undamped

b) Roots of equation of each system:


1) Overdamped: Real & Unequal
2) Underdamped Complex Conjugate
3) Undamped: Roots Imaginary Conjugate
Exp. 1c: Simulate the various higher order open loop system and
observe the performance of the systems.

Objectives:
1. To observe performance of given higher order open loop system.
2. To learn use of MATLAB in solving such systems.

List of Equipment/Software: MATLAB

System Details:
1. H1( s) = 6/(s 3+6 s2+11s+6)
2. H2( s) = 5/(s 4+24 s 3+225 s 2+900s+2500)
3. H3( s) = (s+3)/(s 5+14.5 s 4+81 s 3+187 s 2+300s+112.5)
Procedure:

1. Derive model of the given system in block diagram and transfer function form.
2. Calculate the response of the system for a given input applied to the system.
3. Write a MATLAB program to obtain response of the system. (use functions tf, step, lsim,
stepinfo)
4. Create a Simulink model of the system and obtain the response.

Code:
num1=[6];

den1=[1,6,11,6];

H1=tf(num1,den1);

figure(1);

subplot(3,1,1);
pzplot(H1);

num2=[5];

den2=[1,24,225,900,2500];

H2=tf(num2,den2);

subplot(3,1,2);

pzplot(H2);

num3=[1,3];

den3=[1,14.5,81,187,300,112.5];

H3=tf(num3,den3);

subplot(3,1,2);

pzplot(H3);

figure(2);

subplot(3,1,1);

step(H1);

subplot(3,1,2);

step(H2);

subplot(3,1,3);

step(H3);

X=stepinfo(H1)

Y=stepinfo(H2)

Z=stepinfo(H3)
Plot:

Calculations: Model derivation and response calculation.

Observations:

Sr. Rise Peak Settling


Parameter Overshoot Peak
no. Time Time Time
3 2
1 H 1 ( s ) =6/(s + 6 s + 11 s+6) 2.7428 0 8.2586 5.0039 0.9992
H 2 ( s ) =¿5/(s 4+24 s 3+225
2 s2+900s+2500) 0.3951 0 0.9671 2.0272 0.0024

3 H 3 ( s )=¿(s+3)/(s 5+14.5 s 4+81 4.1065 0 14.6444 8.0594 0.0266


s3+187 s 2+300s+112.5)

Conclusions: Higher order system is realized. The poles, rising time and overshoot is
calculated.

Exp. 2: Simulate the simple open loop and closed loop transfer functions
and observe the effect of feedback on system performances and comment on
the difference.

Objectives:
To Sketch the open loop and closed loop transfer functions and observe the effect of
feedback.

List of Equipment/Software: MATLAB

System Details:
G(s) = 1/s3+5s2+8s
H(s) = 1/s
Code:
clc

G =tf([0 1],[1 5 8])

subplot(4,1,1)

step(G)

subplot(4,1,2)

impulse(G)

H = tf([0 1],[1 0])

T = feedback(G,H)
subplot(4,1,3)

step(T)

subplot(4,1,4)

impulse(G)

Plot:

Observation: The accuracy of open loop transfer function is less as compared to closed loop
transfer function, but open loop transfer function is more stable as compared to a closed loop
system.
Exp. 3: Simulate typical second order system for various combinations
of damping ration and natural frequency of oscillations. Note down the
various observations verify hem with hand calculations

Objectives:
To study the effect of damping ratio and natural frequency on the performance of
second order system.

List of Equipment/Software: MATLAB


2
ωn
System Details: G ( s )= 2 2
s + 2ξ ω n+ ωn

Code:
clc
G1 =tf([0 4],[1 2 4])
damp(G1)
G2 =tf([0 4],[1 0.5 4])
damp(G2)
G3 =tf([0 16],[1 -2 16])
damp(G3)
G4 =tf([0 64],[1 0.5 64])
damp(G4)
subplot(4,1,1)
step(G1)
subplot(4,1,2)
step(G2)
subplot(4,1,3)
step(G3)
subplot(4,1,4)
step(G4)

W = stepinfo(G1)
X = stepinfo(G2)
Y = stepinfo(G3)
Z = stepinfo(G4)
Plot:

Observation:
ξ ωn Peak time (s) Rise time (s) % overshoot Settling time (s)

2 2 1.7960 0.8195 16.2929 4.0379


0.5 2 1.5708 0.5754 64.2931 14.6533
-2 4 Inf NaN NaN NaN
0.5 5 0.3927 0.1334 90.6446 15.3692
Exp. 4: Simulate to plot the root locus of different transfer functions
representing various systems and note down the observations from the root
locus. Verify them by plotting them in time scale.

Objectives:
To Sketch the root locus for a given linear system.

List of Equipment/Software: MATLAB

System Details:
GH1(s) = s+2/s2+4s+3

GH2(s) = 1/s3+5s2+8s

GH3(s) = s+2/s(s2+2s+4)

Code:
clc
num1 = [1,2];
dum1 = [1,4,3];
G1 = tf(num1,dum1)
H1 = 1;
subplot(3,1,1)
rlocus(G1*H1)
num2 = [1];
dum2 = [1,5,8];
G2 = tf(num2,dum2)
H2 = 1/s;
subplot(3,1,2)
rlocus(G2*H2)
num3 = [1,2];
dum3 = [1,2,4];
G3 = tf(num3,dum3)
H3 =1/s;
subplot(3,1,3)
rlocus(G3*H3)
Plot:

Observation:

System 1 System 2 System 3

Theoretical Simulation Theoretical Simulation Theoretical Simulation


Number of branches 2 2 3 3 3 3

Break away/ break in - - -2, -1.33 -2, -1.33 - -


point
Intersection with jω axis No No ±2.828 ±2.828 Parallel to Parallel to
intersection intersectio jw axis jw axis
n
Range of K for Stability K>-3/2 K>-3/2 K>0 K>0 K<2 K<2

Exp. 5a: Design the PI controller for meeting the required specifications
through Root Locus and verify through time domain simulation
Objectives:
Study the two term (PI) controller and its effects on the feedback loop response.
Investigate the characteristics of the each of proportional (P) and the integral (I)
controls.

List of Equipment/Software: MATLAB

System Details:

Procedure:
1) Simulate open loop system and observe the response for unit step input.
2) Simulate the closed loop system and observe the response for unit step input.
3) Simulate the closed loop system with proportional controller and observe the response for
unit step input.
4) Simulate the closed loop system with PI controller and observe the response for unit step
input.

Code:

num=1; den=[1,2,3];
p =tf(num,den);
figure(1);
step(p);
kp=30;
ki=5;
figure (2);
C1=pid(kp,ki)
T1=feedback(C1*p,1)
step(T1)
figure(3)
pzplot(T1)

Plot:
Observations & Conclusions:

Step Response (Without control): The steady state error is very large (e=0.95). We
need to reduce this error using PI control. The following observations show responses
with different controllers as compared to that without controller.
PI Control:- Rise time Increases, but settling time Increases. Steady state value
increases to 1.
Exp. 5b: Design the PD controller for meeting the required
specifications through Root Locus and verify through time domain simulation

Objectives:
Study the two term (PD) controller and its effects on the feedback loop response.
Investigate the characteristics of the each of proportional (P) and the derivative (D)
controls.

List of Equipment/Software: MATLAB

System Details:

Procedure:
1) Simulate open loop system and observe the response for unit step input.
2) Simulate the closed loop system and observe the response for unit step input.
3) Simulate the closed loop system with proportional controller and observe the response for
unit step input.
4) Simulate the closed loop system with PD controller and observe the response for unit step
input.

Code:
clear all; clc;
num=1; den=[1,2,3];
p =tf(num,den);
figure(1);
step(p);
kp=30;
kd=300;
figure (2);
C1=pid(kp,0,kd)
T1=feedback(C1*p,1)
step(T1)
figure(3)
pzplot(T1)
Plot:
Observations & Conclusions:

Step Response (Without control): The steady state error is very large (e=0.95). We
need to reduce this error using PI control. The following observations show responses
with different controllers as compared to that without controller.
PD Control
Rise time decreases, settling time Increases. Steady state value becomes 0.6
Exp. 5c: Design the PID controller for meeting the required
specifications through Root Locus and verify through time domain simulation

Objectives:
Study the three term (PID) controller and its effects on the feedback loop response.
Investigate the characteristics of the each of proportional (P), the derivative (D) and
the integral (I) controls.

List of Equipment/Software: MATLAB

System Details:

Procedure:
1) Simulate open loop system and observe the response for unit step input.
2) Simulate the closed loop system and observe the response for unit step input.
3) Simulate the closed loop system with proportional controller and observe the response for
unit step input.
4) Simulate the closed loop system with PID controller and observe the response for unit
step input.

Printout: MATLAB Program, Results (pole-zero plot and time response).

Code:
clear all; clc;
num=1; den=[1,2,3];
p =tf(num,den);
figure(1);
step(p);
kp=30;
kd=300;
figure (2);
C1=pid(kp,0,kd)
T1=feedback(C1*p,1)
step(T1)
figure(3)
pzplot(T1)
Plot:
Observations & Conclusions:

Step Response (Without control): The steady state error is very large (e=0.95). We
need to reduce this error using PI control. The following observations show responses
with different controllers as compared to that without controller.
PID Control: Rise time decreases and settling time Increases. Graph rises to 1, then
decreases and settles at 1 again. % overshoot reduces.
Exp. 6a: Design the Lag for meeting the required specifications through
Root Locus and verify through time domain simulation

Objectives:
To design a lag compensator for a given system using MATLAB software.

List of Equipment/Software: MATLAB

System Details:
K = 1942000
G(s) = K / (s 3+170 s 2+6000s)

Code:
clc
K=1942000; pos=20; numg=[K];
deng=[1 170 6000 0];
'G(s)'
G=tf(numg,deng)
z=(-log(pos/100))/(sqrt(pi^2+log(pos/100)^2));
Pm=atan(2*z/(sqrt(-2*z^2+sqrt(1+4*z^4))))*(180/pi)+10;
w=0.01:0.01:100;
[M,P]=bode(G,w);
Ph=-180+Pm;
for k=1:1:length(P);
if P(k)-Ph <=0;
M=M(k);
wf=w(k);
break
end
end
wh=wf/10;
wl=(wh/M);
numc=[1 wh]; denc=[1 wl];
Kc=wl/wh;
'Lag compensator'
Kc
'Gc(s)'
Gc=tf(Kc*numc,denc)
' Gc(s)G(s)'
GcG=Gc*G
s=tf([1 0],1);
sGcG=s*GcG;
sGcG=minreal(sGcG);
Kv=dcgain(sGcG)
T=feedback(GcG,1);
step(T)
title ('Closed-Loop Step Response for Lag-Compensated System')
pause

Output:
ans =

'G(s)'

G = 1.942e06

----------------------

s^3 + 170 s^2 + 6000 s

Continuous-time transfer function.

ans =

'Lag compensator'

Kc =

0.0691

ans =

'Gc(s)'

Gc =

0.06909 s + 0.141

-----------------

s + 0.141

Continuous-time transfer function.

ans =

' Gc(s)G(s)'
GcG =

1.342e05 s + 2.738e05

------------------------------------

s^4 + 170.1 s^3 + 6024 s^2 + 846.1 s

Continuous-time transfer function.

Kv =

323.6667

Plot:
Verification:

Exp. 6b: Design the Lead for meeting the required specifications through
Root Locus and verify through time domain simulation

Objectives:
To design a lead compensator for a given system using MATLAB software.

List of Equipment/Software: MATLAB

System Details:
G(s) = 100 /s (s+120) (s+50)

Code:
clc
pos=20; Tp=0.2; Kv=50; numg=[100];
deng=poly ([0 -50 -120]);
G=tf(numg,deng);
s=tf([1 0],1);
sG=s*G;
sG=minreal(sG);
K=dcgain(Kv/sG);
'G(s)'
G=zpk(K*G)
z=(-log(pos/100))/(sqrt(pi^2+log(pos/100)^2));
Pm=atan(2*z/(sqrt(-2*z^2+sqrt(1+4*z^4))))*(180/pi);
wn=pi/(Tp*sqrt(1-z^2));
wBW=wn*sqrt((1-2*z^2)+sqrt(4*z^4-4*z^2+2));
w=0.01:0.5:1000;
[M,P]=bode(G,w);
[Gm,Pm,Wcg,Wcp]=margin(G);
Pmreq=atan(2*z/(sqrt(-2*z^2+sqrt(1+4*z^4))))*(180/pi);
Pmreqc=Pmreq+10;
Pc=Pmreqc-Pm;
beta=(1-sin(Pc*pi/180))/(1+sin(Pc*pi/180));
magpc=1/sqrt(beta);
for k=1:1:length(M);
if M(k)-(1/magpc) <=0;
wmax=w(k);
break
end
end
zc=wmax*sqrt(beta);
pc=zc/beta;
Kc=1/beta;
'Gc(s)'
Gc=tf(Kc*[1 zc],[1 pc]);
Gc=zpk(Gc)
'Ge(s)=G(s)Gc(s)'
Ge=G*Gc
sGe=s*Ge;
sGe=minreal(sGe);
Kv=dcgain(sGe)
T=feedback(Ge,1);
step(T)
title('Lead-Compensated Step Response')

Output:
ans =

'G(s)'

G=

3e+05
----------------
s (s+120) (s+50)

Continuous-time zero/pole/gain model.

ans =

'Gc(s)'

Gc =
2.2752 (s+33.15)
----------------
(s+75.43)

Continuous-time zero/pole/gain model.

ans =

'Ge(s)=G(s)Gc(s)'

Ge =

6.8257e05 (s+33.15)
--------------------------
s (s+120) (s+75.43) (s+50)

Continuous-time zero/pole/gain model.

Kv = 50.0000

Plot:
Verification:

Exp. 6c: Design the Lag Lead for meeting the required specifications through Root
Locus and verify through time domain simulation

Objectives:
To design a lead compensator for a given system using MATLAB software.

List of Equipment/Software: MATLAB

Code:
clc
K=1942000; pos=20; numg=[K];
deng=[1 170 6000 0];
'G(s)'
G=tf(numg,deng)
z=(-log(pos/100))/(sqrt(pi^2+log(pos/100)^2));
Pm=atan(2*z/(sqrt(-2*z^2+sqrt(1+4*z^4))))*(180/pi)+10;
Pmreq=atan(2*z/(sqrt(-2*z^2+sqrt(1+4*z^4))))*(180/pi);
Pmreqc=Pmreq+10;
Pc=Pmreqc-Pm;

beta=(1-sin(Pc*pi/180))/(1+sin(Pc*pi/180));
w=0.01:0.01:100;
[M,P]=bode(G,w);
Ph=-180+Pm;
for k=1:1:length(P);
if P(k)-Ph <=0;
M=M(k);
wf=w(k);
break
end
end
wh=wf/10;
wl=(wh/M);
numc=[1 wh]; denc=[1 wl];
Kc=wl/wh;

'Gc1(s)'
Gc1=tf(Kc*numc,denc)

zc=wmax*sqrt(beta);
pc=zc/beta;
Kc=1/beta;
'Gc2(s)'
Gc2=tf(Kc*[1 zc],[1 pc]);
Gc2=zpk(Gc2)
'Ge(s)=G(s)Gc(s)'

Ge=G*Gc1*Gc2
sGe=s*Ge;
sGe=minreal(sGe);
Kv=dcgain(sGe)
T=feedback(Ge,1);
step(T)

Output:
ans =

'G(s)'

G=

1.942e06
----------------------
s^3 + 170 s^2 + 6000 s

Continuous-time transfer function.

ans =

'Gc1(s)'

Gc1 =

0.06909 s + 0.141
-----------------
s + 0.141

Continuous-time transfer function.

ans =

'Gc2(s)'

Gc2 =

(s+50.01)
---------
(s+50.01)

Continuous-time zero/pole/gain model.

ans =

'Ge(s)=G(s)Gc(s)'

Ge =

1.3417e05 (s+2.041) (s+50.01)


------------------------------------
s (s+120) (s+50.01) (s+50) (s+0.141)

Continuous-time zero/pole/gain model.

Kv = 323.6667

Plot:
Verification:

You might also like