You are on page 1of 8

K. J.

Somaiya College of Engineering, Mumbai-77

Batch No.__A1__ Roll No. _1412022_

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.

Department of Electronics Engineering


K. J. Somaiya College of Engineering, Mumbai-77

CODE:

clc;
clear all;
close all;
s=tf('s')
Gs=1/((s+1)*((0.5*s)+1));
z=tf('z')
GZ=c2d(Gs,0.2,'zoh')
aug=[ 0.1,1];
gwss=bilin(ss(GZ),-1,'S_Tust',aug)
gw=tf(gwss);
bode(gw);
grid on;
title('uncompensated');
figure;
[Gm,Pm,Wgm,Wpm]=margin(gw)

%lag compensator
z=tf('z',0.1);
lag=(9*((83*z)-81))/((179*z)-177);
bode(lag);
grid on;
title('lag');
figure;

%final compensated system


final=(GZ)*(lag);
bode(final);
grid on;
title('final');
figure;
[Gm,Pm,Wgm,Wpm]=margin(final);

Department of Electronics Engineering


K. J. Somaiya College of Engineering, Mumbai-77
OUTPUT:

s= s
Continuous-time transfer function.

z= z
Sample time: unspecified
Discrete-time transfer function.

GZ =

0.03286 z + 0.0269
----------------------
z^2 - 1.489 z + 0.5488

Sample time: 0.2 seconds


Discrete-time transfer function.

a=
x1 x2
x1 6.833 -7.226
x2 13.17 -12.77

b=
u1
x1 3.292
x2 -3.292

c=
x1 x2
y1 0.007843 0.1119

d=
u1
y1 -0.001961

Continuous-time state-space model.

Gm = 16.7732

Pm =-180

Wgm = 12.0255

Wpm = 0
Department of Electronics Engineering
K. J. Somaiya College of Engineering, Mumbai-77

final =

24.55 z^2 - 3.858 z - 19.61


-------------------------------------
179 z^3 - 443.5 z^2 + 361.8 z - 97.14

Sample time: 0.2 seconds


Discrete-time transfer function.

WAVEFORMS:

Department of Electronics Engineering


K. J. Somaiya College of Engineering, Mumbai-77

Department of Electronics Engineering


K. J. Somaiya College of Engineering, Mumbai-77

Post Lab Questions :


 What is the difference between a controller and a compensator

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 -

COMPENSATOR: modification of system dynamics (equations by which system is


described ) is required in order to obtain performance specification, like 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. A compensator is some type of Controller that
is designed to shape the disired magnitude and phase plots of a closed loop controller
by reshaping the open loop transference (G(jw)H(jw)). The term compensation is much
linked to the Bode Design, a classic control controller design technique (e.g. lead, lag,
lead-lag compensation) although it is also found in Root Locus design.

CONTROLLER: 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.
Controller is much more general term which refers to the block (an analogue/digital
processor) that is inserted to produce the desired behavioural closed-loop performance,
be it in the frequency domain, or in the time domain. The term controller is not linked
to any design technique in my opinion. A controller is a tool that forces the output
towards a certain direction in order to reduce the error .eg Proportional ,Integral,
derivative ,on-off,and PID's. on the other hand a compensator unit is employed to help
fix certain system characteristics that are outside of a proper operating range.eg lag
,lead and lag-lead compensators etc . a compensator can affect either the
magnitude,phase or both.

Department of Electronics Engineering


K. J. Somaiya College of Engineering, Mumbai-77
 Design a lag compensator for the above system theoretically.

Department of Electronics Engineering


K. J. Somaiya College of Engineering, Mumbai-77

Department of Electronics Engineering

You might also like