Daily Archives: May 23, 2012

Lag Compensator design with Root Locus


So far we have discussed on an Introduction to Matlab and Lag compensator design with bode plot. In this post we will deal with lag compensator design with time domain specifications and using the root locus technique.

The steps to design the lag Compensator are

  1. Draw the root locus of the given open loop uncompensated system with K=1
  2. From given specifications determine  the damping ratio.
  3. Draw a line from origin making an angle $cos^{-1}\zeta$ with the negative real axis. The point of intersection of that line with root locus gives the dominant pole Sd
  4. 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}

  5. Let Kv velocity constatn for uncompensated system, Kvd=Desired velocity Constant
    $Kv=\limit_{s \to 0}sG(s)$
  6. A=Kvd/Kv and $\beta=1.2*A$

  7. $T=\frac{1}{-0.1 * Second pole of G(s)}$ 1/T is always choosen to be 10%of second pole of uncompensated system.
  8. a lag compensator has the form
    $\frac{(s+\frac{1}{T})}{(s+\frac{1}{\beta T})}$
  9. form the complete transfer function with the lag compensator added in series to th original system
  10. plot the new Root locus and check if given conditions are satisfied. Or else change the location of poles.

We will solve question number 1.3 in Advanced Control Systems By Nagoor Kani. Let us solve this with matlab.

The question is Forward ath transfer function of a unity feedback control system is
$G(s) = \frac{K}{s(s+2)(s+8)}$ . Design a lag compensator so that peak overshoot is less than 16% for step input and steady state error is less than 0.125 for ramp input.

Solution:
The percentage overshoot is given to determine the damping ratio and we can use the relation

$\%Over shoot=e^{\frac{\zeta\pi}{\sqrt(1-\zeta^2)}}$

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

n=1 %taking K=1
d=conv([1 0],conv([1 2],[1 8]))
'G(s)' % Display title G(s)
G=tf(n,d)
rlocus(G) % plot root locus of uncompensated system
M=input('Enter Percentage overshoot')
zeta=sqrt(log(M)^2 /(pi^2 + log(M)^2)) % calulate damping ratio
sgrid(zeta,0) % draw line from origin with angle of cos^(-1) zeta
[K p]=rlocfind(G) % find the gain K at the point of Sd , Sd selected by clicking on the graph
Kvu=input('Enter Uncompensated Vel VConst')
ess=input('Enter aloowe steady state error')
Kvd=1/ess
A=Kvd/Kvu;
Beta=1.2*A;
root=roots(d); finding roots of the denominator
T=1/(-0.1*root(2)) % usinthe second root
Zc=1/T
Pc=1/(Beta*T)
Gc=tf([1 Zc],[1,Pc])
sys=Gc*G*K
rlocus(sys) % plot root locus of compensated system
pause
sys=feedback(sys,1,-1)
step(sys)
hold on
G=feedback(G,1,-1)
step(G)

The Diagrams below show the results obtained Please don’t forget to comment or ask doubts in case of trouble.

Uncompensated system root locus

Root Locus of Compensated System

Step response of Compensated and Uncompensated system

Lag Compensator design with Bode plot


In the previous post  An Introduction to compensator Design with matlab we saw an introduction to compensators. In this post we will deal with lag compensator design with frequency domain specifications.

The steps to design the lag Compensator are

  1. Determine K from the error constatns given
  2. Sketch the bode plot
  3. Determine phase margin if it is not satisfactory design lag compensator
  4. take  as the required phase margin to that add a tolerance of 5 so that new phase margin is
    $\gamma_{n}=\gamma_{d}+5$
  5. Find new gain cross over frequency $\omega_{gcn}$ which is the frequency corresponding to $\gamma_n$ of previous step for that find
    $\phi_{gcn}=\gamma_n - 180$ from the bode plot determine $\omega_{gcn}$corresponding to $\phi_{gcn}$
  6. Determine gain corresponding to $\omega_{gcn}$ from bode plotlet it be A db
  7. a lag compensator has the form
    $\frac{(s+\frac{1}{T})}{(s+\frac{1}{\beta T})}$

  8. $\beta=10^{\frac{A}{20}}$ since
    $A = 20log\beta$

  9. $T= \frac{10}{\omega_{gcn}}$
  10. form the complete transfer function with the lag compensator added in series to th original system
  11. 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 6.2 in 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

Open loop transfer function   and the phase margin should be atleast 33 and velocity error constant is 30.

Solution:
The velocity error constant is

On solving we get K =9600

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

K=9600
d1=conv([1 4 0],[1 80]) % used to formulate the polynomial
G=tf(K,d1) % generate the transfer function.
margin(G)
pmreq=input('Enter Required Phase Margin') % enter 33 as given in question
pmreq=pmreq+5
phgcm=pmreq-180
wgcm=input('Enter new gain cross over frequency') % from the first bode plot use the mouse pointer and locate wgcm corresponding to phgcm.
[Beta,p]=bode(G,wgcm)
T=10/wgcm
Zc=1/T
Pc=1/(Beta*T)
Gc=tf([1 Zc],[1 Pc])
sys=Gc*G/Beta
margin(sys)

Uncompensated system

Matlab window

Identifying the new frequency

Compensated system

If you have any doubts please do contact me.

 

 An Introduction to compensator Design with matlab

Lag compensator design with root locus

An Introduction to compensator Design with matlab


This will be a series of posts where I will be dealing with Control system Compensator design using matlab. This is intended primarily for Btech Electrical and Electronics students.

I will try to be as brief as possible the underlying concepts have to be studied from standard text books.

If there are any mistakes please point them out.

Basically the compensators have to be designed based on the time domain specifications like rise time, maximum overshoot,damping ratio and settling time. these are the transient state specifications. And in frequency domain the transient state specifications are phase margin, gain margin, resonant peak and bandwidth.

The steady state responses in both cases are the error constants.

We will start with what compensators  are. Compensators are devices added to a  control system so that it meets the given specifications. They introduce poles and zeroes to the system.

The main types of compensators are the lag, lead and lag lead.

Lag Compensator

A compensator that introduces a phase lag to an input signal is called a lag compensator. It improves the steady state performance of the system, but reduces the bandwidth and results in a slower transient response too. It is basically a low pass filter.

Lead Compensator

A compensator that introduces a phase lead to an input signal is called a lead compensator. It increases bandwidth and improves speed ofresponse but there is only a small change in the steady state response. It is basically a high pass  filter.

Please do refer text books for more details on compensators.

Compensators can be designed with time domain specifications and it is done using root locus technique and If frequency domain techniques are used then Bode plot is used( other frequency domain plots can also be used but here we deal with bode Plot).

Commonly used functions in matlab

tf – converts system representation from transfer function to “system” format. This format provides an efficient way to store and manipulate the system model, but does not allow direct access to the system’s numerator and denominator orpoles and zeros. The syntax to convert from transfer function to “system” format is:
sys = tf (num, den);
tfdata – converts system representation from “system” format back to transfer function format. The syntax (for single-input, single-output systems) is:
[num, den] = tf data(sys, v );


series – forms the series combination of 2 blocks to produce the equivalent transfer function. The output of block 1 is the input to block 2. The syntax for the function in transfer function and in “system” formats are:
[num, den] = series(num1, den1, num2, den2);
sys = series(sys1, sys2);

parallel – forms the parallel combination of 2 blocks to produce the equivalenttransfer function. The outputs of block 1 and block 2 are added together. The same input is applied to both block 1 and block 2. The syntax for the function in transfer function and in “system” formats are:
[num, den] = parallel(num1, den1, num2, den2);
sys = parallel(sys1, sys2);

feedback – forms the closed-loop system that has block 1 in the forward path and block 2 in the feedback path. The default configuration is for negative feedback. In the syntax example shown below, the −1 for negative feedback is shown explicitly. For positive feedback, a +1 would be used in the function’s input argument list. For unity feedback, num2 = den2 = 1. The syntax for the function in transfer function and in “system” formats are:
[num, den] = f eedback(num1, den1, num2, den2, −1);
sys = f eedback(sys1, sys2, −1);


cloop – forms the closed-loop system when unity feedback is used. This function is obsolete, but is still available in most MATLAB versions. It can only be used when the block in the feedback path is unity, and it can only be used with the system model expressed in transfer function form, not in “system” format. The syntax for the function is:
[num, den] = cloop(num1, den1, −1);

rlocus – computes and plots the root locus for a system, using an internally generated set of gain values. A user-specified vector of gain values can be included as an input argument if desired. Output arguments of closed-loop poles and the corresponding gain values can also be obtained. In this case, no plot is made. If the root locus plot for negative gain values is desired, a minus sign is placed in front of num or sys. The syntax for the function in transfer function and in “system” formats are:
rlocus(num, den);
rlocus(sys);


rlocfind – computes the gain and the corresponding closed-loop pole locations for a specified point on the root locus. A crosshair is made available to select a point on the root locus plot. The gain corresponding to that point is returned, as well as all the closed-loop poles for that gain. The syntax for the function in transfer function and in “system” formats are:
[K, poles] = rlocf ind(num, den);
[K, poles] = rlocf ind(sys);


Instead of graphically selecting a point, one or more desired closed-loop pole locations can be input to the function. The gains and closed-loop poles cor- responding to those specified pole locations are returned. No error message is given if the specified pole locations are not actually on the root locus for the system. The syntax for the function in transfer function and in “system” formats are:
[K, poles] = rlocf ind(num, den, P );
[K, poles] = rlocf ind(sys, P );


bode – computes the magnitude (absolute value) and phase (degrees) of a system evaluated on the jω axis. If no frequency vector is provided as an input argument, MATLAB selects a set of frequency values. If no output arguments are specified, the Bode plots are automatically made. If output arguments are specified, no plots are made. Specifying a frequency vector and output
arguments, the syntax for the function in transfer function and in “system” formats are:
[mag, ph] = bode(num, den, w);
[mag, ph] = bode(sys, w);

margin – computes the following measures of relative stability based on the frequency response of a system: gain margin (Gm), phase margin (Pm), phase crossover frequency (Wcg), gain crossover frequency (Wcp). These measures
provide information about how much perturbation to a system can be tolerated without becoming unstable and are often used as design specifications. If no frequency vector is included as an input argument, the values are computed
analytically from the transfer function. If a frequency vector is included, the values are obtained by searching the magnitude and phase arrays at those frequencies. If no output arguments are specified, Bode plots are made with the gain and phase margins shown on the plots. The syntax for the function in transfer function and in “system” formats are:
[Gm, P m, W cg, W cp] = margin(num, den);
[Gm, P m, W cg, W cp] = margin(sys);
[Gm, P m, W cg, W cp] = margin(mag, ph, w);
nyquist – computes the real and imaginary components of the frequency response of a system (rather than magnitude and phase). A frequency vector is an optional input argument. If no output arguments are specified, a plot of the imaginary part vs. the real part of the frequency response is plotted, and the s = −1 + j0 point is indicated on the plot. If output arguments are specified, the real and imaginary parts are returned, and no plot is made. The syntax for the function in transfer function and in “system” formats are:
[re, im] = nyquist(num, den, w);
[re, im] = nyquist(sys, w);


step – computes the unit step response for a system. A time vector is an optional input argument. The vector of values of the step response is an optional output argument. If no output argument is specified, a plot of the response is made. The syntax for the function in transfer function and in “system” formats are:
c = step(num, den, t);
c = step(sys, t);

If you have learned the basics then please move on to the next Post.

Lag Compensator design with Bode plot

Lag Compensator design with Root Locus

%d bloggers like this: