Lead Compensator design with Root Locus


The steps to design the Lead Compensator are with root locus are:

  1. From given specifications determine $\zeta$ the damping ratio and the natural frequency $\omega_n$.
  2. Find the dominant pole
    $S_d=-\zeta \omega_n +j \omega_n\sqrt(1-\zeta^2)$. If damping ratio alone is given then draw the root locus and draw line from origin at an angle $cos^{-1}\zeta$ to intersect the root locus, the point of intersection is the dominant pole.
  3. Measure angle contributed by each pole and zero of uncompensated system to the dominant pole as marked in the diagram, the angles are measured in the counter clockwise direction from the positive real axis direction.
  4. The angle needed to be provided byt the compensator is
    $\phi=sum of angles contributed by poles of uncompensated system - sum of angles contributed by zeroes of uncompensated systems -180$ This angle if greater than 60 then two compensators each providing half the required angle is made.
  5. as In the figure above draw PC bisection angle APO and draw line PB and PD such that they make angle $\phi/2$ with respect to PC B is the required pole $1/\beta T$and D is the required zero.
  6. a lead compensator has the form
    $\frac{(s+\frac{1}{T})}{(s+\frac{1}{\alpha T})}$
  7. Determine open Loop gain K at Sd,by taking equation

    \begin{displaymath}K=\frac{Product of vector lenghts from Sd to open loop poles}{Product of vector lenghts from Sd to open loop zeroes}\end{displaymath}

     

  8. form the complete transfer function with the lead compensator added in series to the original system
  9. plot the new Bode plot and determine phase margin and observe that it is the required phase margin


Now to do this In Matlab let us take a question. I will be solving the question number 1.7 in Advanced Control Systems By Nagoor Kani. In th text book the question has been solved without using matlab you can go through it to understand the steps better.

The question is
$G(s) = \frac{K}{s(s+4)(s+7)}$ the Peak over shot is 12.63% natural frequency of oscillation is 8 rad/sec and velocity error constant should be greater than or equal to 2.5.

Solution:

Calculate the damping ration from the peak over shoot given the equation had been discussed in the previous post.

The code below shows the matlab commands to obtain the design.


clear all
close all
n=input('Enter the Coefficients of Numerator')
d=input('Enter the Coefficients of Denominator') %enter as array [1 11 28 0]
'G(s)'
G1=tf(n,d)
G2=tf(conv([1 0],n),d); % this is for evaluating the Kv we multiply numerator with s.
M=input('Enter peak overshoot: ')
z=sqrt(log(M)^2 /(pi^2 + log(M)^2)) % calulate damping ratio
wn=input('Enter wn: ')
Kv=input('Enter velocity constant: ')
Sd=complex((-z*wn),(wn*sqrt(1-z^2))) % forming the dominant pole
rlocus(G1)  % plotting uncompensated root locus
hold on
plot(Sd,'*') % mark the dominant pole
axis([-20 20 -20 20])
'Press any key to proceeed'
pause
close all
pzmap(G1)  % make pole zero plot.
hold on
plot(Sd,'*')  % mark the dominant pole
plot(conj(Sd),'*')
axis([-20 20 -20 20])
Po=roots(d)
pang=zeros(1,size(Po,1));

% Finding the angle contributions of poles
for i=1:size(Po,1)
pang(i)=abs(atand((abs(imag(Sd))-abs(imag(Po(i,1))))/(abs(real(Sd))-abs(real(Po(i,1))))));
if(real(Po(i,1))>real(Sd))
pang(i)=180-pang(i);
end
end
Zo=roots(n);
zang=zeros(1,size(Zo,1));

% Finding the angle contributions of zeroes
for i=1:size(Zo,1)
zang(i)=abs(atand((abs(imag(Sd))-abs(imag(Zo(i,1))))/(abs(real(Sd))-abs(real(Zo(i,1))))));
if(real(Zo(i,1))>real(Sd))
zang(i)=180-zang(i);
end
end

thetap=sum(pang);
thetaz=sum(zang);
‘Required Phase Lead’
phm=thetap-thetaz-180
phmh=phm;
t=1;

% LOGIC TO CHECK IF PHASE LEAD IS GREATER THAN 60 in some cases it can be 4 times greater than 60 then we have to repeatedly divide it till less than 60
while phmh>60
phmh=phm/(2*t)
t=t+1;
end
t=2*(t-1);
ph1=180-atand(abs(imag(Sd))/abs(real(Sd)));
ph1=ph1/2;
c=(real(Sd))-((imag(Sd))/tand(ph1));
ph=ph1-(phmh);
pol=(real(Sd))-((imag(Sd))/tand(ph))
ph=(ph+phmh);
zer=(real(Sd))-((imag(Sd))/tand(ph))
‘Press any key to proceeed’
pause
‘The lead Compensator’
Gc=tf([1 -zer],[1,-pol])
hold off
‘Open Loop Transfer Function K=1′
if phmh==phm
Go=Gc*G1;
sG=Gc*G2; % For evaluating error constant
else
Go=(Gc^t)*G1
sG=(Gc^t)*G2 % For evaluating error constant
end
sG=minreal(sG); % For evaluating error constant
rlocus(Go)
hold on
plot(Sd,’*’)
axis([-20 20 -20 20])
[K a]=rlocfind(Go)

‘The Velocity Error Constant is’
Kvn=dcgain(K*sG); % For evaluating error constant
if Kvn>=Kv
‘Condition is satisfied’
Kvn
else
‘Improve design’
Kvn
end
‘The Complete transfer open loop function’
Go=Go*K
close all
rlocus(Go)
hold on
plot(Sd,’*’)

Root Locus Of uncompensated system the dominant Pole is not on Root Locus

 

Root Locus Of compensated system the dominant Pole is on Root Locus

Advertisements

About vineethkartha

Hi, I am Vineeth Kartha, I hold a Masters degree in Embedded Systems from BITS Pilani, Goa Campus. I currently work as a Software Developer. I am A free software promoter and electronics hobbyist. In my free time I do a little bit of birding and Wildlife photography. I love travelling, reading and blogging.

Posted on May 25, 2012, in Technical and tagged , , , , , , , . Bookmark the permalink. 5 Comments.

  1. very good program……..could you please send me the m.file for this programe, since the second part of program not working …..!!!!?

  2. Ziad.Qatanani@dadgroup.com,,,,,,,,,,,,,,,,,,,,,, other question, did you have matlab program to plot and calculate the departure angle of poles in root locus, also can identify (mark in the plote) the root locuse segments as per odd rule.
    …thanks in advance.

  3. I tried to use this code for discret time(z plane) but its not working properly. Can help me?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: