21
8/18/2019 Bode Compensador Phaselag1web http://slidepdf.com/reader/full/bode-compensador-phaselag1web 1/21 Heikki Koivo 24 2. DESIGN OF CONTROLLERS USING BODE DIAGRAM The basic idea in using controllers is to shape and mold the Bode diagram of the open-loop system in such a way that the given specifications are met. When Bode diagrams are used in design, the specifications have to be transformed into phase and gain margins and usually the steady-state error is also given (here also so-called error coefficients are used). In this presen- tation we concentrate on Bode diagram design exclusively. Other approaches that could be used are Nyquist diagrams, Nichols diagrams and root locus. Essentially the same principle applies: the given representations are shaped so that the given requirements are met. Lately also robustness issues are taken into account in a more careful manner. The most common controllers or compensators are phase-lag, phase-lead and phase-lag- lead  controllers. These have characteristics of more ideal proportional integral (PI), pro-  portional derivative (PD), and proportional integral derivative (PID)  controllers, respec- tively. Although we concentrate on each controller type separately, it is also possible to use, e.g., two phase-lead compensators in series in order to add more phase margin. In practice, so-called tachometer feedback is also quite common. Its design is very similar to phase-lead design. A somewhat different point of view is state-space design, where methods are developed in time domain and using differential equations. Here one could summarize the basic design idea to be pole placement . This means that the closed-loop system poles are placed in such a way that the requirements are met. Closed-loop poles correspond to the eigenvalues of the closed loop system matrix. This is explored more in other textbooks. There are sometimes differing opinions of various techniques of control system design. The strong point of the classical design is that first of the transfer function representation is often easy to obtain by modern spectral analyzers, which sweep through the fr equency range and determine the transfer function automatically. Another significant advantage is that you can see graphically the representation of the whole system. This is not the case with state-space form, where you basically only deal with eigenvalues, poles and zeros, i.e., with numbers. Utilization of computer-aided design makes the classical design approaches extremely power- ful, although many textbooks have been written in the era when this was not he case. There- fore teaching of these methods in basics courses is easily confusing, without clear objective and exercises are tedious, mostly hand and pencil calculations. In reality the design is carried out with computers, with efficient tools to meet engineering specifications. In engineering the final goal is almost always the design of systems, synthesis, which requires skill and experi- ence. Analysis is part of it, since it is better to be sure beforehand that Tsernobyl does not happen. In both cases efficient tools are used. The rest of these notes show how to use such tools in design of control systems.

Bode Compensador Phaselag1web

  • Upload
    j2ca74

  • View
    221

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 1/21

Heikki Koivo 24

2.  DESIGN OF CONTROLLERS USING BODE DIAGRAM 

The basic idea in using controllers is to shape and mold the Bode diagram of the open-loop 

system in such a way that the given specifications are met. When Bode diagrams are used in

design, the specifications have to be transformed into phase and gain margins and usually the

steady-state error is also given (here also so-called error coefficients are used). In this presen-tation we concentrate on Bode diagram design exclusively. Other approaches that could be

used are Nyquist diagrams, Nichols diagrams and root locus. Essentially the same principle

applies: the given representations are shaped so that the given requirements are met. Lately

also robustness issues are taken into account in a more careful manner.

The most common controllers or compensators are phase-lag, phase-lead and phase-lag-

lead  controllers. These have characteristics of more ideal proportional integral (PI), pro-

 portional derivative (PD), and proportional integral derivative (PID) controllers, respec-

tively. Although we concentrate on each controller type separately, it is also possible to use,

e.g., two phase-lead compensators in series in order to add more phase margin. In practice,

so-called tachometer feedback is also quite common. Its design is very similar to phase-leaddesign.

A somewhat different point of view is state-space design, where methods are developed in

time domain and using differential equations. Here one could summarize the basic design idea

to be pole placement . This means that the closed-loop system poles are placed in such a way

that the requirements are met. Closed-loop poles correspond to the eigenvalues of the closed

loop system matrix. This is explored more in other textbooks.

There are sometimes differing opinions of various techniques of control system design. The

strong point of the classical design is that first of the transfer function representation is often

easy to obtain by modern spectral analyzers, which sweep through the frequency range anddetermine the transfer function automatically. Another significant advantage is that you can see

graphically the representation of the whole system. This is not the case with state-space form,

where you basically only deal with eigenvalues, poles and zeros, i.e., with numbers.

Utilization of computer-aided design makes the classical design approaches extremely power-

ful, although many textbooks have been written in the era when this was not he case. There-

fore teaching of these methods in basics courses is easily confusing, without clear objective

and exercises are tedious, mostly hand and pencil calculations. In reality the design is carried

out with computers, with efficient tools to meet engineering specifications. In engineering the

final goal is almost always the design of systems, synthesis, which requires skill and experi-

ence. Analysis is part of it, since it is better to be sure beforehand that Tsernobyl does not

happen. In both cases efficient tools are used. The rest of these notes show how to use such

tools in design of control systems.

Page 2: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 2/21

Heikki Koivo 25

 

2.2. Dominant polesIn the subsequent section we will study how a number of basic design specifications can be

connected to Bode diagram specifications. This is a crucial step in design. It can also deter-

mine the design approach.Basic assumption in design is that even if the original open-loop system is of high order, the

closed-loop system behaves like a second-order system:

Y s

 R sG s

 s s

n

n n

( )

( )( )= =

+ +ω

ω ς ω

2

2 22  (2- 1) 

If the system is of high order, then the complex conjugate pair of poles, which is closest to the

imaginary axis is called dominant poles. In order this to hold the other poles have to be far

from the dominant poles or there must be a zero to approximately cancel out the effect of the

 pole. An example of this is given in Figure 2.1.

x

 jIm

Re

x

xo

x

x

Dominant poles

 

Fig.2.1. Dominant poles. Note that if a pole is close to the dominant poles then a zerohas to cancel its effect. 

The design of a servocontrol system is based on this, but the performance has to be checked

 by simulation, since we are not quite sure how well the assumption will hold. Let us next collect certain facts about second order systems.

Page 3: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 3/21

Heikki Koivo 26

 

2.2. Dominant poles - Percent Overshoot (PO) vs. ζ , PM vs. ζ  

Consider a unit step response of a second order system. It is possible to calculate exactly

maximum percent overshoot as a function of damping ratio ζ. First determine the actual re-

sponse y(t). Then calculate where the first peak of the response occurs. Subtract one from

 y(t) in order to get maximum overshoot. Then express it in percentage. After some calcula-

tions the following expression is obtained for the magnitude of the first overshoot M  p:

 M e p = +   − −( )1

1 2ζπ ζ   (2- 2)

and therefore percent overshoot PO

 PO e=   − −100

1 2ςπ ς/ (%) . (2- 3)

Consider a typical example  (ω n = 2 and ζ = 0.2) 

Y s R s  s s

( )( ) .

=+ +

4

0 4 42

  (2- 4) 

Use the following MATLAB commands to compute the step response (Fig.2.2):

» num=[4];den=[1 0.4 4]; gopen=tf(num,den) % transfer function tf- form  

Transfer function: 4/s^2 + 0.4 s + 4

» step(gopen) % % step response cal cul ation  

Time (sec.)

   A  m  p   l   i   t  u   d  e

Step Response

0 5 10 15 20 25 3 0

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

 

Fig.2.2. Typical unit step response of a second order system. Here ω n = 2 and ζ = 0.2.

From the figure percent overshoot PO≈ 72%.

PO≈72%

Page 4: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 4/21

Heikki Koivo 27

 

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10

10

20

30

40

50

60

70

80

90

100

Damping ratio tseta

   %   O  v  e  r  s   h  o  o   t

 

Fig.2.3.  Percent overshoot (PO) as a function of damping ratio ζ. 

Another useful relationship in design is between phase margin (PM) and the damping coeffi-

cient

ζ.

Phase margin vs. ζ 

 PM =   −+ −

tan ( [( )

½]½

)1

21

44

1 22

ζζ ζ

  (2- 5)

Fig.2.4. Phase margin as a function of ζ. 

Added phase margin vs. percent overshoot is plotted using the above relationships.

Page 5: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 5/21

Heikki Koivo 28

 

Fig.2.5. Added phase margin phimax as a function of percent overshoot (PO). 

Exercise: Complete the graphs

BANDWIDTH: The bandwidth  (BW) of the system is defined to be the frequency at which

the overall gain has dropped 3 dB from the level that it was at lower frequencies.

For second order systems it is possible to compute the following expression:

 BW nω

ς ς ς22 2 21 2 2 4 1

 

  

    = − + − −( ) ( )   (2- 6 ) 

Similarly for first order systems, it is easy show that

ωτ

cc

=1

  (2- 7)

EXERCISE: One common design specification is settling time t s. This is defined to be

the time when the unit step response finally settles to a tolerance of ± 1% (or ± 5%).Calculate the exact expression of settling time for a second order system in terms ζ and

ωn.

(Answer: Settling time t s ≥ 4/ζωn. For higher order systems the predominant time con-

stant is used for the same purpose as ζωn). 

Page 6: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 6/21

Heikki Koivo 29

 

3. DESIGN OF PHASE-LAG COMPENSATOR

The basic idea in compensators, as the name says, is to compensate or modify the original

transfer function in the way that the specifications of the closed loop system are met. Phase-

lag compensator, which corresponds to PI controller, is appropriate, when speed is not an is-

sue, because it will slow the original response.

Transfer function of phase-lag compensators is given by

W sa s

 sa Lag ( ) =

  ++

1

1

11

τ

τ , < 1 (3- 1)

Gain at high frequencies

W a Lag dB

dB( ) ( )∞ = 1 . (3- 2)

Upper cut-off frequency

ωτ

ua

=1

1

  (3- 3) 

The name of the phase-lag controller follows from the property that phase of the output

of W lag 

(s) is lagging behind the phase of the input signal. As can be seen from Figure

3.1 the gain decreases at higher frequencies. The gain at higher frequencies is a1. Since

a1 < 1, this means that W a Lag dB

dB( ) ( )∞ = 1  is negative, which is clear from Figure

3.1.

Frequency (rad/sec)

   P   h  a  s  e   (   d  e  g   )  ;   M  a  g  n   i   t  u   d  e   (   d   B   )

Bode Diagrams

-20

-15

-10

-5

0

 

10-1

100

101

102

-50

-40

-30

-20

-10

 

Fig.3.1. Bode diagram of a typical phase-lag circuit: W s s

 s Lag ( )

.=  +

+1 01

1  . Observe

the behavior at break frequencies 1 rad/s and 10 rad/s. 

Page 7: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 7/21

Heikki Koivo 30

Phase-lag compensator is like a PI controller at high frequencies. Let us draw a PI

controller, which roughly corresponds to the phase lag circuit in Figure 3.1.  

W  PI   s  s( ) (

.)= +1

1

01  (3- 4)

or in MATLAB form» num=[0.1 1];den=[1 0]; g=tf(num,den); bode(g)

The result is displayed in Figure 3.2.

Frequency (rad/sec)

   P   h  a  s  e   (   d  e  g   )  ;   M  a  g  n   i   t  u   d  e   (   d   B   )

Bode Diagrams

-20

-10

0

10

20

 

10-1

100

101

102

-80

-60

-40

-20

 

Fig.3.2. Bode diagram of PI controller  W  PI   s  s( ) (

.)= +1 1

01. For ω > 4 rad/s the PI

controller behaves like the phase-lag compensator of Fig. 3.1.  

Steps in design of phase-lag compensator  

STEP 1. 

Choose gain K to satisfy steady-state requirements.

STEP 2. 

Draw Bode-diagram of KG(s).

STEP 3. 

Determine the new crossover frequency ωc, i.e., the frequency at which the uncompen-

sated system has phase (-180o+PM’), where PM’ = desired phase margin. Typically

the required phase margin is 45o

-60o

for electro-mechanical systems and 25o

-30o

for processes.

Page 8: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 8/21

Heikki Koivo 31

STEP 4. 

Determine how much to decrease the gain in dB at the frequency mentioned in step 3

so that it would become the new cross-over frequency ωc. This determines a1.

STEP 5. 

Gain must be decreased at high frequencies without disturbing it at lower frequencies.This is guaranteed by choosing the upper cut-off frequency ωu to be one decade below 

ωc.

STEP 6. 

Check by simulating the unit step response.

STEP 7. 

If requirements are met, stop. Otherwise go back to STEP 1.

EXAMPLE Open-loop transfer function of a unity feedback system of Fig.3.3 is given by

G s s s

( )( . )

=+1

1 0 2.  (3- 5)

 

Fig.3.3. The block diagram of the overall system. Here WLAG(s) represents the phase-lag

controller or compensator and G(s) the open-loop system transfer function. The system has

unity feedback, H(s) = 1.

Specifications for the system are:

• Accuracy for a unit ramp input < 2%, i.e. steady-state error < 0.02.

• Maximum percent overshoot = PO < 20%.

Design a phase-lag compensator that satisfies the requirements.

HINT: Use MATLAB Help command to familiarize yourself with the following commands,

which are useful in design. See APPENDIX for details.

-

+

Controller  System

WLAG(s)R(s)R(s) Y(s)Y(s)

G s s s

( )( . )

=+1

1 02

Page 9: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 9/21

Heikki Koivo 32

 

FEEDBACK   Feedback connection of two systems.

ROOTS   Find polynomial roots.

SOLUTION:

STEP 1. Compute the steady-state for unit ramp input e

ss

e sE s sG s

 R s ss s s

= =+→ →

lim ( ) lim (( )

) ( )0 0

1

1  (3- 6)

ess lims 0

[s(1

1K 

s(1 0.2s)

)]1

s2

0.02

=→ +

+

=

<

 K   (3- 7) 

This implies that

K > 1/0.02 = 50, choose K = 50. (3- 8)

Gain is now sufficient. The controller is at this point a P (proportional) controller.

STEP 2. 

From Fig.2.5 percent overshoot PO <20% corresponds to > 48° phase margin, PM. This

holds for second order systems and therefore we will make the dominant pole assumption.

Draw the Bode diagram of the transfer function KG(s) = 50 /s(1 + 0.2s).

REMARK. The numerator now includes gain 50.

We will use MATLAB for plotting. Recall that MATLAB requires num/den form so that

 NUMERATOR: »num=[250];

DENOMINATOR: »den=[1 5 0];

» g=tf(num,den) %Transfer f unction g  

Transfer function:

250

---------

s^2 + 5 s

 Next draw the Bode diagram with bode(g).

Page 10: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 10/21

Heikki Koivo 33

  Frequency (rad/sec)

   P   h  a  s  e   (   d  e  g   )  ;   M  a

  g  n   i   t  u   d  e   (   d   B   )

Bode Diagrams

-20

0

20

40

 

10-1

100

101

102

-160

-140

-120

-100

 

Fig.3.4.The open-loop transfer function KG(s). Note that the original open-loop transfer

function has been multiplied by K = 50, which is a P controller. The steady-state requirement

is now satisfied. Plotting is done with bode command. 

Phase margin can be read from Figure 3.2. Recall that it is obtained from the Bode diagram

 by first determining the frequency at which the gain curve crosses the 0 dB level. After that

read the phase at the same frequency from the phase curve and subtract it from 1800. 

A better and a more accurate answer can be obtained with MARGIN(g) command, which

draws the whole Bode diagram and also produces directly gain margin Gm, which is not used

in the current design, phase margin Pm and the corresponding frequencies.

Gain margin, Gm =Inf, Phase margin, Pm = 17.96° (phase margin ≈ 18°), at frequency

Wcp = 15.42 1/s

Fig.3.5. MARGIN command margin(g) plots Bode diagram, draws also both the gain and

 phase margin and the corresponding frequencies and computes the exact numbers into the fig-

ure. The open-loop system has been compensated with gain K = 50.

Frequency (rad/sec)

   P   h  a  s  e   (   d  e  g   )  ;   M  a  g  n   i   t  u   d  e   (   d   B   )

Bode Diagrams

-20

0

20

40

Gm = Inf, Pm=17.964 deg. (at 15.421 rad/sec)

100

101

-180

-160

-140

-120

-100

 

Page 11: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 11/21

Heikki Koivo 34

Phase margin Pm = 18° is not enough, at least 48° is needed. Phase margin relates to over-

shoot. It is also easy to check the maximum overshoot by simulation, when the open loop has

gain K=50.

Note that the simulation must be done for closed-loop system.

Compute the closed-loop system transfer function using  feedback  command. Then apply step 

command.

The closed-loop transfer function is obtained by

» T=feedback(g,1)

Transfer function:

250

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

 s^2 + 5 s + 250

The step response is computed by using

» step(T)

For easier reading a grid is drawn together with labels on x- and y-axis. 

» grid

» xlabel('time in secs');ylabel('Output');

» title('Unit step response of closed loop system') 

The maximum overshoot can now be read from Fig.3.4. to be about 60 %.

Time (sec.)

   A  m  p   l   i   t  u   d  e

Step Response

0 0.5 1 1.5 2 2.5

0

0. 2

0. 4

0. 6

0. 8

1

1. 2

1. 4

1. 6

Unit step response of closed loop system

time in secs

   O  u   t  p  u   t

 

Fig.3.6. The unit step response of the closed-loop system, when only pure gain compensator  K = 50 (P controller) is used. The maximum overshoot PO = 60% is quite large, but the

steady-state error for a step (not for a ramp) is zero, since the system includes an integrator.

There is clearly too much overshoot! Additional compensating is needed.

Page 12: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 12/21

Heikki Koivo 35

 

At this point it is also useful to draw the Bode diagram of the closed-loop system  so that it

can be later compared with the compensated one:

 

»bode(T) 

Fig.3.7. Bode diagram of the closed-loop system when the compensator is  K = 50. Band-

width is read from the figure (use ginput(1)) to be about 25 rad/s 

STEP 3. In designing phase-lag compensator, the first thing is to determine the frequency, at which the

 phase margin would be sufficient, if the gain is not changed.

Read from the Bode diagram of Fig.3.2 at what frequency there is enough phase margin. A

handy way to do it is to use crosshair command  ginput(1).

» ginput(1)

ans = 4.1786 18.5074

Fig.3.8. Use of crosshair to determine the new crossover frequency, at which the phase mar-

gin is sufficient.

Bandwidth, about 25 rad/s –

read at – 3dB oint

Page 13: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 13/21

Heikki Koivo 36

Or compute more exactly, which is clumsier but more accurate. 

(Only part of the table is shown)  

» num=[250];den=[1 5 0]; g=tf(num,den) % define KG(s)  

» w=logspace(-1,2);[mag phase w]=bode(g,w); % compute magni tude and phase  

» phi=180.+phase; magdb = 20*log10(mag); %compute phase margin and mag dB  

» [squeeze(magdb) squeeze(phase) squeeze(phi) w]% table of mag in dB, phase,

phase margin , frequency  

Table 2.1. Original magnitude and phase, the new phase margin

(if magnitude is fixed to be 0 dB) and the frequency. 

MagdB phase phi ω 

23.29 -120.51 59.48 2.9471

21.72 -124.16 55.83 3.3932

20.07 -128.00 51.99 3.9069

18.34 -131.97 48.02 4.4984

16.52 -136.01 43.98 5.1795

At 4 rad/s (3.9069 to be exact) the new phase margin is about 520 (51.99640). Let

the new crossover frequency be ωc = 4rad/s.

STEP 4. 

One further piece of information is read from the table. At 4 rad/s the gain is about 20 dB.

This must be taken care by the phase lag compensator. Choose a1 = - 20 dB or a

1 = 0.1.

STEP 5. 

Since the upper cut-off frequency ωu is one decade below the new crossover frequency ωc,

we have ωc = 4 rad/s = 10xωu = 10/ (a1τ) or τ = 20 s.

STEP 6. This is sufficient accuracy during first design iteration. The design is now checked by

simulation.

The transfer function of the open-loop compensated system is obtained either by hand

calculation (the computations are simple enough) or by product of transfer functions

»numw=[0.1 0.05]; denw=[1 0.05]; gw=tf(numw,denw)

Compensator * Open loop transfer function = W(s)KG(s) or

» g1=gw*g

Transfer function:

25 s + 12.5

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

 s^3 + 5.05 s^2 + 0.25 s

Page 14: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 14/21

Heikki Koivo 37

Let us draw the open-loop compensated Bode diagram, so as to see how the original Bode

diagram has changed.

» bode(g1)

Fig.3.9. Bode diagram of the compensated open loop system.

For comparison purposes the Bode diagrams of the uncompensated and compensated

open-loop system are drawn in the same Figure. Use the following MATLAB com-

mands:

% open-loop transfer function to have more data points  

» w=logspace(-3,2);[mag phase w]=bode(g,w);

% Compensated open-loop transfer f unction

» numw=[0.1 0.05]; denw=[1 0.05]; gw=tf(numw,denw) % compensator  

»g1=gw*g % compensated open-loop tr ansfer f unction  

Transfer function:

25 s + 12.5

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

 s^3 + 5.05 s^2 + 0.25 s

»w=logspace(-3,2);[mag1 phase1 w]=bode(g1,w);

% plot in the same f igure – fi rst magni tude in dB» w=logspace(-3,2); [mag phase w]=bode(g,w); [mag1 phase1 w]=bode(g1,w);

»magdb=squeeze(20*log10(mag));

»mag1db=squeeze(20*log10(mag1));

» semilogx(w,squeeze(magdb),'k',w,squeeze(mag1db),'k --'); grid

» xlabel('Frequency (rad/s)'); ylabel('Open and closed loop magnitudes in dB')

Frequency (rad/sec)

   P   h  a  s  e   (   d  e  g   )  ;   M  a  g  n   i   t  u   d  e   (   d   B   )

Bode Diagrams

-50

0

50

 

10 -3 10-2 10 -1 10 0 101 10 2

-160

-140

-120

-100

 

Page 15: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 15/21

Heikki Koivo 38

10-3

10-2

10-1

100

101

102

-60

-40

-20

0

20

40

60

80

100

Frequency (rad/s)

   O  p  e  n  a  n   d  c   l  o  s  e

   d   l  o  o  p  m  a  g  n   i   t  u   d  e  s   i  n   d   B

 

Fig.3.10. Gain of the uncompensated (solid line, -) and compensated (dashed line, --) open-loop

system.  Note how the phase-lag compensator decreases the gain at higher frequencies.

Fig.3.11.Phase of the uncompensated (solid line, -) and compensated (dashed line, --) open-loop system. Note how the phase-lag compensator decreases the phase at middle frequencies. 

% Then phase

 semilogx(w,squeeze(phase),'k',w,squeeze(phase1),'k--'); grid

 xlabel('w (rad/s)');ylabel('phase, uncompensated (-), compensated(--)')

Let us now compute the closed-loop transfer function and then both the Bode diagram and

the unit step response. Again in simple cases you could compute the transfer function by hand,

 but as easily by applying feedback  command

% closed-loop transfer function  

T1=feedback(g1,1)

Transfer function:

25 s + 12.5

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

 s^3 + 5.05 s^2 + 25.25 s + 12.5

ew crossover

frequency ωc 

ωc 

Page 16: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 16/21

Heikki Koivo 39

 

Bode diagram of T  is shown in Figure 3.12.

»[magcl,phasecl]=bode(T1) 

Fig.3.12. Bode diagram of the compensated closed-loop system. The bandwidth BW

≈ 6.8 rad/s is found using crosshair ginput(1), which is less than the 25 rad/s in

Fig.3.7. resulting from gain compensation. This is also seen in the unit step response of

Fig.3.15, where the response is slower now than without compensation.

For comparison the Bode diagrams of the uncompensated and compensated closed-

loop systems are drawn in the same Figure.

Recall how to compute the closed loop-transfer function (uncompensated)

% uncompensated closed-loop system  

»T=feedback(g,1);

» w=logspace(-1,2); [magcl phascl w]=bode(T,w);

» semilogx(w,20*log10(squeeze(magcl)),'k')

% compensated closed- loop system  

» w=logspace(-1,2);[magcl1 phasecl1 w]=bode(T1,w);

% both in the same fi gure  

» semilogx(w,20*log10(squeeze(magcl)),'k',w,20*log10(squeeze(magcl1)),'k --')

» xlabel('w (rad/s)');ylabel('closed-loop magnitude, uncompensated (-), compensated(--)')

» grid

Page 17: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 17/21

Heikki Koivo 40

 

Fig.3.13. Bode diagram of the uncompensated and the compensated closed-loop

magnitude. Note how the bandwidth is decreased, when phase-lag controller is used.

This is also seen in the step response.

Finally, let us compute the step response of the compensated closed-loop with the command

» step(T1); grid  

Fig.3.14. The compensated closed-loop step-response. The overshoot is still slightly above

20%. This is because the assumption of second order dominant poles does not hold as well as

expected.

Page 18: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 18/21

Heikki Koivo 41

The roots of the closed-loop system are obtained from

» [numcl dencl]=tfdata(T1,'v');

» roots(dencl)

ans =

-2.2506 + 4.2089i

-2.2506 - 4.2089i

-0.5487

There are two complex poles, but the third pole clearly has a strong effect on the response.

Checking also the zeros:

» roots(numcl)

ans = -0.5000.

The zero is quite close to the pole  p =   -0.5487  and thus cancels most of the effect,

 but not quite enough.

The uncompensated and compensated unit step responses can be drawn in the same Figure

 by using the following:

» [numcl dencl]=tfdata(T1,'v');

» [numc denc]=tfdata(T,'v'); 

»t=linspace(0,3); y1=step(numc,denc,t); y2=step(numcl,dencl,t);

» plot(t,y1,'g',t,y2,'b--'); grid

» xlabel('time');ylabel('Stepresponses, uncomp (-), comp (- -)');

The result is shown in Fig.3.15.

Fig.3.15. The closed loop unit step responses, pure gain compensation (K = 50) (-),

and compensation with lag compensator (--). The overshoot is not quite satisfactory.

As indicated above this is due to the error in dominant pole assumption.

Page 19: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 19/21

Heikki Koivo 42

The result is not quite good enough, because the overshoot is almost 30% - maybe a larger

requirement for phase margin leading to a sma ller value of a1 and a larger τ. Calculations are

exactly the same as before.

EXERCISE: Conclude the design so that also the overshoot requirement is satisfied.

SUMMARY OF PHASE-LAG DESIGN

STEP 1. 

Choose gain K  to satisfy steady-state requirements.

STEP 2. 

Draw Bode-diagram of KG(s).

STEP 3. 

Determine the new crossover frequency ωc. , i.e., the frequency at which the uncompensated

system has phase (- 180

o

+PM’), PM’ = desired phase margin .(PM 45

o-60

ofor electro-mechanical, 25

o-30

ofor processes).

STEP 4. 

Decide how much to decrease the gain in dB at the frequency mentioned in step 3 so

that it would become the new cross-over frequency ωc.  This determines a

1. 

STEP 5 

Gain must be decreased at high frequencies without disturbing it at lower frequencies.

This is guaranteed by choosing the upper cut-off frequency to be one decade below 

ωc.

STEP 6 

Check by simulating step response.

STEP 7. 

If requirements are met, stop. Otherwise go back to STEP 1.

REMARK : If the system includes feedback dynamics H(s), because of a sensor, then the

design is carried out by including it in the Bode diagram. So instead of the open-loop G(s), the

design is performed for G(s)H(s). Exactly the same steps are followed. Special care must be

taken e.g. in computing steady-state error.

Page 20: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 20/21

Heikki Koivo 43

APPENDIX

FEEDBACK   Feedback connection of two systems.

SYS = FEEDBACK(SYS1,SYS2) produces the feedback loop

u --->O---->[ SYS1 ]----+---> y

| |+-----[ SYS2 ]<---+

 Negative feedback is assumed and the resulting system SYS maps u to y. To apply posit ive feedback,

use the syntax SYS = FEEDBACK(SYS1,SYS2,+1).

SYS = FEEDBACK(SYS1,SYS2,FEEDIN,FEEDOUT,SIGN) builds the more general feedback system

+--------+

v --------->| | --------> z

| SYS1 |

u --->O---->| |----+---> y

| +--------+ |

| |

+-----[ SYS2 ]<---+

The vector FEEDIN contains indices into the input vector of SYS1and specifies which inputs u are in-

volved in the feedback loop. Similarly, FEEDOUT specifies which outputs y of SYS1 are used for

 feedback. If SIGN=1 then posit ive feedback is used. If SIGN=-1 or SIGN is omitted, then negative

 feedback is used. In all cases, the resulting system SYS has the same i nputs and outputs as SYS1).

See also STAR, PARALLEL, SERIES, and CONNECT.

ROOTS   Find polynomial roots.

 ROOTS(C) computes the roots of the polynomial whose coefficient sare the elements of the vector C. If C

has N+1 components,the polynomial is C(1)*X^N + ... + C(N)*X + C(N+1).

See also POLY.

TFDATA

TFDATA Quick access to transfer function data.

[NUM,DEN] = TFDATA(SYS) returns the numerator(s) and denominator(s) of the transfer function

SYS. NUM and DEN are cell arrays with as many rows as outputs and as many columns as inputs,

and their (I,J) entries specify the transfer function from input J to output I. SYS is first converted to

transfer function if necessary.

[NUM,DEN,TS,TD] = TFDATA(SYS) returns the sample time TS and input delays TD. For con tinuous

 systems, TD is a vector with one entry per input channel. For discrete systems, TD is the empty matrix[].

 For SISO systems, the convenience syntax [NUM,DEN] = TFDATA(SYS,'v') returns the numerator and

denominator as row vectors rather than cell arrays.

Other properties of SYS can be accessed with GET or by direct structure-like referencing (e.g., SYS.Ts)

See also GET, SSDATA, ZPKDATA.

PLOTTING PHASE MARGIN VS. ZETA

zeta=0:0.1:1;

PO=100*exp(-zeta*pi./sqrt(1-zeta.^2));

PM=atan(2*zeta./sqrt(sqrt(4*zeta.^4+1)-2*zeta.^2));

 plot(zeta,PM);

Page 21: Bode Compensador Phaselag1web

8/18/2019 Bode Compensador Phaselag1web

http://slidepdf.com/reader/full/bode-compensador-phaselag1web 21/21

Heikki Koivo 44