You are on page 1of 8

K. J.

Somaiya College of Engineering, Mumbai-77


(Autonomous College Affiliated to University of Mumbai)
Department of Electronics Engineering

Batch No: B1 Roll No: 1512079

Assignment/Tutorial/Experiment No: 4 Grade: AA / AB / BB / BC / CC / CD /DD


Signature of the Staff In-charge with date:

Title: Digital Lag Compensator

Aim: Design of digital Lag compensator using MATLAB


Mode of experiment: MATLAB Simulation

COs to be achieved:
CO3: Design discrete time controllers in time and frequency domain.

Theory:
For a given second order system, design a digital lag compensator to meet following
specifications:
An overshoot of and steady state error= .
Use bilinear transformation.
Plot step response of uncompensated and compensated system. Also obtain bode plot for
both.

Code: Lag Compensator using Root Locus

clc;
close
all; clear
all;
s=tf('s');
K=2;
Gs=K/((s)*(s+1));
Gz=c2d(Gs,0.1,'zoh')
aug=[0.1,1];
gwss = bilin(ss(Gz),-
1,'S_Tust',aug); gw=tf(gwss)
figure (1);
rlocusplot(gw);
grid on
title('Uncompensated System');
[Gm,Pm,Wgm,Wpm]=margin(gw);
Department of Electronics Engineering
DCS /Jan -May
2019
K. J. Somaiya College of Engineering, Mumbai-77
(Autonomous College Affiliated to University of Mumbai)
Department of Electronics Engineering

%lag compensator
z=tf('z',0.1);
lag=(9*((83*z)-81))/((179*z)-177);
figure (2);
rlocusplot(lag);
grid on
title('Lag Compensator');
%final compensated
final= Gz*lag;
figure (3);
rlocusplot(final);
grid on
title('Compensated System');

Output:
K. J. Somaiya College of Engineering, Mumbai-77
(Autonomous College Affiliated to University of Mumbai)
Department of Electronics Engineering

Code: Lag Compensator using Bode Plot

clc;
clear all;
close all;
t=input('Enter sampling time: ');
s=tf('s');
gc=1/((s)*(s+1));
gz=c2d(gc,0.1,'zoh');
aug=[0.1,1];
gwss = bilin(ss(gz),-1,'S_Tust',aug);
gw=tf(gwss);
bode(gw,gwss);
margin(gw)
grid;
title('Bode plot of uncompensated system');
figure
zpk(gz)
z=tf('z',0.1);
cz=9*((83*z-81)/((179*z)-177));
gc1=gz*cz;
aug=[0.1,1];
gwss1=bilin(ss(gc1),-1,'S_Tust',aug);
gw2=tf(gwss1)
bode(gw2);
margin(gw2)
grid;
title('Bode plot of compensated system');
K. J. Somaiya College of Engineering, Mumbai-77
(Autonomous College Affiliated to University of Mumbai)
Department of Electronics Engineering

Output:

Enter sampling time: 1

ans =

0.0048374 (z+0.9672)
--------------------
(z-1) (z-0.9048)

Sample time: 0.1 seconds


Discrete-time zero/pole/gain model.

gw2 =

-0.0001726 s^3 - 0.2037 s^2 + 4.093 s + 1.01


--------------------------------------------
s^3 + 1.112 s^2 + 0.1123 s - 4.869e-13

Continuous-time transfer function.


K. J. Somaiya College of Engineering, Mumbai-77
(Autonomous College Affiliated to University of Mumbai)
Department of Electronics Engineering

Post Lab Questions:

1. What is the difference between a controller and a compensator

Ans: One basic need of control system design is to obtain desired output value, these two
controller and compensator are there to fulfill this purpose. Ultimate aim is same for both, but
the difference is -
 A controller is an element whose role is to maintain a physical quantity in a desired level.
For example we have a Temperature controller, pH controller, speed control, PID controller.
In other words, aim of controller design is to reduce the error between the reference and the
output signal which is fed back to the controller with input (reference) signal.
 A compensator is a modification of system dynamics, to improve characteristics of the open-
loop plant so that it can safely be used with feedback control. For example to improve
stability, uncouple a system, to a 'lead/lag compensator, phase compensator. In case of Lead
and Lag compensator which are often designed to satisfy phase and gain margins, these bode
plot of the system itself changes after the insertion of compensator, bode plot indirectly
represents system dynamics.

2. Design a lag compensator for the above system theoretically.


K. J. Somaiya College of Engineering, Mumbai-77
(Autonomous College Affiliated to University of Mumbai)
Department of Electronics Engineering
K. J. Somaiya College of Engineering, Mumbai-77
(Autonomous College Affiliated to University of Mumbai)
Department of Electronics Engineering
K. J. Somaiya College of Engineering, Mumbai-77
(Autonomous College Affiliated to University of Mumbai)
Department of Electronics Engineering

Conclusion:

Thus we studied about Lag Compensator using MATLAB.

Date: Signature of faculty in-charge

You might also like