Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
536 views40 pages

Design of Compensators For Discrete Models With MATLAB

Uploaded by

Ghulam Abbas
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
536 views40 pages

Design of Compensators For Discrete Models With MATLAB

Uploaded by

Ghulam Abbas
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Design of Compensators for Discrete Models using

MATLAB

Davood Shaghaghi
Design of Compensators for

Discrete Models with

MATLAB
Using

CONTROL TOOLBOX

By

Davood Shaghaghi
In the name of Allah

This article is about the design of compensator in Matlab by using of Rltool and Control Toolbox.

I hope that this article will be useful for you and help you in your design.

Here four examples are provided from familiar book, DISCRETE CONTROL SYSTEMS – K. OGATA.

These examples can be found at the end of 4th chapter.

Best regards.

Davood Shaghaghi
Email: [email protected]
Student of Electrical Engineering
Department of Electrical Engineering
Hamadan University of Technology (HUT)
July 2009

Copying is permitted with source citation!


Design of Compensators Using MATLAB
[email protected]

Solution:

Determination of the Z transform of the system:

1
Design of Compensators Using MATLAB

Please waiting until Rltool GUI is loaded …


[email protected]

Rltool is loaded. In the ‘Control and Estimation Tool Manager’ window you can see and change the
architecture of the system , mathematical equation of compensator (after designing),graphical
tuning (related to type of your design– Root Locus or Bode diagram-you can draw any plots needed
for design),analysis plot ( can plot impulse response, step response ,bode diagram ,nyquist diagram
and so on in form of open loop, close loop and etc.) and finally you can tune PID and other forms of
controller automatically.

2
Design of Compensators Using MATLAB

In other window (SISO Design for Design Task) you can see Root Locus plot or Bode plot or any
plots that you choose in managing window. You can add single zero, single pole and conjugate
zeroes or poles for compensator by use of specified section:
[email protected]

single zero conjugate zero

Cleaning zero
single pole conjugate pole or pole

First, we must consider the problem conditions. Problem conditions – in this problem - are damping
ratio (zeta) and close-loop dominant pole.

Damping ratio value equals to 0.5, we must calculate close-loop dominant pole first:

  .5  over shoot  % 16.3


s 
 8  s  10
d d
d 
 z  2  36 
s 
2 d  z  .5629  j .4090
| z | exp( . )  .6958
2  
1  s

3
Design of Compensators Using MATLAB

Setting conditions of the problem:

1) Damping ratio setting:


[email protected]

2 1
Choose damping ratio from menu

3 2
Press OK to accept Setting value

Setting damping ratio to value 0.5

4
Design of Compensators Using MATLAB

2) close-loop dominant pole setting:

1
3
[email protected]

Choose Region Constraint from this menu

2
Type close-loop dominant pole

3
Press Close after
Editing or OK to
accept

Setting close-loop dominant pole to value z  .5629  j.4090

You see the results in below window:

Locus of Damping ratio


(is equal to .5)

Secant location

Locus of close-loop
dominant pole (is equal to
z  .5629  j .4090 )

5
Design of Compensators Using MATLAB

In above window, black lines show the conditions of problem. If Root Locus passes from secant-
location of black lines (desirable conditions), your compensator satisfies conditions!
[email protected]

The problem has another condition and it is presence of integrator in the controller.

We set this condition by adding a pole in z=1 or select ‘Integrator’ from below menu in ‘Control and

Estimation Tool Manager’ window:

6
Design of Compensators Using MATLAB
[email protected]

2
You can change the location of pole
from this section.

The result is the change in Root Locus diagram:

7
Design of Compensators Using MATLAB

From ‘Control and Estimation Tool Manager’ window >> analysis plot, you can see closed-loop
step response of the system:
[email protected]

You see step response in below window:

8
Design of Compensators Using MATLAB

But the system is sorely unstable! Here we use a zero for achieving desirable conditions. Therefore
you should change the location of zero until Root Locus passes the crossover:

? How we can change the location of zero or pole?


[email protected]

In below window we explain this work:

First select the pole or zero that


you want to move it.

Then you can move it on


the real axis horizontally
by dragging.

Note:
When you move the pole or zero, be careful don't move the value of the gain of compensator!

You see the step response of system after adding one integrator and one zero:

9
Design of Compensators Using MATLAB

The value of over shoot is equal to zero .We should change the gain of compensator to achieve the
desirable overshoot (16.3).

Similar to moving pole or zero, you can drag the gain (red quadrangular on the root locus) and
move it to satisfy the overshoot.
[email protected]

Compensator is designed!

And you see the step response of system after compensation:

10
Design of Compensators Using MATLAB

For damping ratio equals to .5, overshoot value is equal to 16.3 that are satisfying.
Also the compensated system has good rise time to step input and this is desirable!

Determination of the static velocity error constant Kv:


[email protected]

To achieve this goal we must export the compensator transfer function(C) and maybe plant transfer
function (G) from Rltool to work space:

For exporting plant transfer function, repeat above steps, from step 4 and this time select plant G.
Now the plant transfer function and compensator are imported to work space and we can continue
the calculation:

11
Design of Compensators Using MATLAB
[email protected]

Solution:

We solve this problem analytically first and then test our solution with Rltool.

12
Design of Compensators Using MATLAB

The system is type zero and so velocity error tends to be infinity! Therefore we add an integrator to
the system before compensator design (indeed we design two compensators: C1=1/s and C2=….).
[email protected]

As you see, velocity error is Kv=2.5. To compensate it, we multiply it by 2 until Kv be equal to 5:

13
Design of Compensators Using MATLAB

Static velocity error constant is compensated. Now we can design the controller. The Bode diagram
of uncompensated system is as below:
[email protected]

Bode Diagram
Gm = -5.62 dB (at 1.32 rad/sec) , Pm = -18 deg (at 1.8 rad/sec)
100

50
Magnitude (dB)

-50

-100

-150
270
Phase (deg)

180

90

0
-2 -1 0 1 2 3 4
10 10 10 10 10 10 10
Frequency (rad/sec)

Phase margin and gain margin is equal to -18 deg and -5.62 dB respectively. System is sorely
unstable .By using a phase-lag compensator; we will change PM to 60 deg and GM to 12 dB.

We understand that Phase lag transfer function is equal to:

1
s
Gd ( s) 
1 T  Ts  1
 s 1  Ts  1
T

14
Design of Compensators Using MATLAB

We should calculate the phase that leads to desirable phase margin:

  60  7  180  113   113  360  247


[email protected]

According to Bode diagram, 247 phase deg occurs in 0.259 rad/sec frequency.

Bode Diagram
Gm = -5.62 dB (at 1.32 rad/sec) , Pm = -18 deg (at 1.8 rad/sec)
100

System: Gw
50 Frequency (rad/sec): 0.259
Magnitude (dB): 25.4
Magnitude (dB)

-50

-100

-150
270

System: Gw
Frequency (rad/sec): 0.259
Phase (deg): 247
180
Phase (deg)

90

0
-2 -1 0 1 2 3 4
10 10 10 10 10 10 10
Frequency (rad/sec)

Magnitude of frequency response function in this frequency is equal to 25.5 dB, then:

1 1 1
 *   *.259  .0259
T 10 10

20log   25.4    18.62

And the compensator transfer function is equal to:

Ts  1 38.6 s  1
Gd ( s)   Gd ( s) 
 Ts  1 718.91 s  1

15
Design of Compensators Using MATLAB

Compensator is designed! For testing the results, we plot the compensated Bode diagram:
[email protected]

You see the Bode diagram in the next page…

16
Design of Compensators Using MATLAB

Bode Diagram
Gm = 19.5 dB (at 1.3 rad/sec) , Pm = 62 deg (at 0.259 rad/sec)
200

100
[email protected]

Magnitude (dB)
0

-100

-200
270
Phase (deg)

180

90

0
-4 -2 0 2 4
10 10 10 10 10
Frequency (rad/sec)

The desirable condition has been obtained .Finally we should convert Continuous controller to
digital form.

Converting Continuous controller to digital form:

This coefficient is because of the Kv


compensation.

17
Design of Compensators Using MATLAB
[email protected]

Solution:

We should calculate the bilinear transfer function for discrete system:

Note:
We can ignore from value 3.804e-013
And consider that the system is type one
And a

18
Design of Compensators Using MATLAB

We Type transfer function again and ignore from mentioned value:

We should first compensate static velocity error constant. This parameter for uncompensated
system is equal to 1 but the desirable value is 10. Then:
[email protected]

Plot bode diagram for system (K *Gw). PM is equal to .0761 deg that less than desirable value (50
deg).

You can see the bode diagram in the next page …

19
Design of Compensators Using MATLAB

Bode Diagram
Gm = 0.0733 dB (at 3.18 rad/sec) , Pm = 0.0761 deg (at 3.16 rad/sec)

50
[email protected]
Magnitude (dB)

-50

270

225
Phase (deg)

180

135

90
-2 -1 0 1 2 3 4 5
10 10 10 10 10 10 10 10
Frequency (rad/sec)

Here we use lead compensator to achieve desirable condition:

1  Ts
Gd ( s) 
1  Ts
We calculate the requirement phase:

m  50  0.0761  7  56.92


1 1
sin(m )   sin(56.92)  .838     0.0882
1  1 

We should find the frequency from bode diagram that satisfies below equation:

20 log ( G( jwm ) )  20 log ( 1 )


20
Design of Compensators Using MATLAB

20 log ( G( jwm ) )  20 log ( 1 )  10.546 


from bode diagram
 wm  5.92
0.0882
[email protected]

Bode Diagram
Gm = 0.0733 dB (at 3.18 rad/sec) , Pm = 0.0761 deg (at 3.16 rad/sec)
100

50 System: Gw
Magnitude (dB)

Frequency (rad/sec): 5.92


Magnitude (dB): -10.5
0

-50

-100
270

225
Phase (deg)

180

135

90
-2 -1 0 1 2 3 4 5
10 10 10 10 10 10 10 10
Frequency (rad/sec)

wm  5.92
wm  1   5.92  1  T  0.568
T.  T . 0.0882

T  0.568  T  0.050

1  .568s
Gd ( s) 
1  .050s

21
Design of Compensators Using MATLAB

Compensator is designed! For testing the results, plot the Bode diagram of compensated system:
[email protected]

You see Bode diagram of compensated system in below:


Bode Diagram
Gm = 10.4 dB (at 18.9 rad/sec) , Pm = 45.5 deg (at 5.91 rad/sec)
100

50
Magnitude (dB)

-50

-100
270

225
Phase (deg)

180

135

90
-2 -1 0 1 2 3 4 5
10 10 10 10 10 10 10 10
Frequency (rad/sec)

22
Design of Compensators Using MATLAB

The phase margin after compensation, approach to 45.5. This value is less than desirable phase
margin; therefore we use Rltool to achieve this phase margin:
[email protected]

Please waiting until Rltool is loaded.

Then for see Bode diagram of system, operate below:

Select ‘ Open-Loop
Bode’ for Plot 2

Select this botton to show the diagram

23
Design of Compensators Using MATLAB

You see Rltool window for the system with its compensator in below. Similar to problem B-4-10,
you can move the pole and zero by drag it.
[email protected]

Select the pole or zero and change it’s


location when pressing the left click mouse.

We should move the pole or zero of compensator, to compensate requirement phase (50 - 45.5 =5.5
deg).
In this case we change the location of pole:

We move the pole of compensator


so compensate the requirement
phase.

24
Design of Compensators Using MATLAB

To achieve the transfer function of new compensator, we must export the compensator transfer
function (C) from Rltool to Work space:
[email protected]

Then we test the result so that is the phase margin satisfied or no?

25
Design of Compensators Using MATLAB

Bode Diagram
Gm = 10.6 dB (at 22.9 rad/sec) , Pm = 50 deg (at 6.03 rad/sec)
100

Magnitude (dB) 50
[email protected]

-50
270

225
Phase (deg)

180

135

90
-2 -1 0 1 2 3 4 5
10 10 10 10 10 10 10 10
Frequency (rad/sec)

Phase margin is satisfied.

Finally, we should convert the Continuous compensator to digital form:

This coefficient is because of Kv


compensation.

26
Design of Compensators Using MATLAB

The number of samples per cycle of damped sinusoidal oscillation:

First using the magnitude condition, we find the closed loop dominant poles:
[email protected]

magnitude condition  1  k * f ( z )  0

0.358 z 2  0.05198 z  0.2951


f ( z )  Gp( z )   1 
z 3  1.773z 2  0.6037 z  0.1694

27
Design of Compensators Using MATLAB

Using the magnitude condition, we find that the closed loop poles are located at z=0.3164 + 0.2462i.

We determine this point on the root-locus diagram:


[email protected]

28
Design of Compensators Using MATLAB
[email protected]

Closed loop dominant poles

z=0.3164 + 0.2462i

 ?

.2462
  tan 1 ( )  37.88 o z=0.3164 - 0.2462i

.3164

29
Design of Compensators Using MATLAB

The green line connecting the closed loop pole in the upper half of the z plane and the origin has an
[email protected]
angle 37.88 o .Hence, the number of samples per cycle of damped sinusoidal oscillation is:

360o
 9.5
37.88o

30
Design of Compensators Using MATLAB
[email protected]

Solution:

First we should calculate the bilinear-transfer function for discrete system:

Note: we can ignore from value 3.804e-013

And assume the system is type one.

31
Design of Compensators Using MATLAB

We Type transfer function again and ignore from mentioned value:

We should first compensate static velocity error constant. This parameter for uncompensated
system is equal to 1 but the desirable value is 10. Then:
[email protected]

Then plot bode diagram for system (K *Gw). PM is equal to 5.56 deg that less than desirable value
(50 deg).
Bode Diagram
Gm = 1.69 dB (at 11.2 rad/sec) , Pm = 5.56 deg (at 9.88 rad/sec)
80

60
Magnitude (dB)

40

20

-20

-40
315

270
Phase (deg)

225

180

135

90
-2 -1 0 1 2 3 4
10 10 10 10 10 10 10
Frequency (rad/sec)

32
Design of Compensators Using MATLAB

Here we use lag compensator to achieve desirable conditions:

1  Ts
Gd ( s) 
1   Ts
[email protected]

We should calculate the requirement phase:

  50  7 180  123   123  360  237

Bode Diagram
Gm = 1.69 dB (at 11.2 rad/sec) , Pm = 5.56 deg (at 9.88 rad/sec)
80

60
System: Gw
Magnitude (dB)

40 Frequency (rad/sec): 3.2


Magnitude (dB): 14.2
20

-20

-40
315

270
Phase (deg)

225
System: Gw
180 Frequency (rad/sec): 3.2
Phase (deg): 237
135

90
-2 -1 0 1 2 3 4
10 10 10 10 10 10 10
Frequency (rad/sec)

Design calculations:

1 1 1
 *   *3.2  .32
T 10 10

20log   14.2    5.12

3.125s  1
Gd ( s) 
16 s  1

33
Design of Compensators Using MATLAB

You can see Bode diagram of compensated system in below:


[email protected]

Bode Diagram
Gm = 15.5 dB (at 10.8 rad/sec) , Pm = 52.3 deg (at 3.21 rad/sec)
100
Magnitude (dB)

50

-50
270

225
Phase (deg)

180

135

90
-3 -2 -1 0 1 2 3 4
10 10 10 10 10 10 10 10
Frequency (rad/sec)

The desirable conditions have been obtained. Finally we should convert Continuous controller to
digital form.

34
Design of Compensators Using MATLAB

Converting Continuous controller to digital form:


[email protected]

This coefficient is because of Kv


compensation.

The number of samples per cycle of damped sinusoidal oscillation:

35
Design of Compensators Using MATLAB

Similar to previous problem, we should use the magnitude condition and find the close loop poles:

magnitude condition  1  k * f ( z )  0
[email protected]

0.08287 z 3  0.09008 z 2  0.05612 z  0.06357


f ( z )  Gp ( z )   1 
z 4  3.505 z 3  4.555 z 2  2.596 z  0.5454

Here we find the close loop poles:

The close loop poles are located at z=0.7494 + 0.3155i.

36
Design of Compensators Using MATLAB

We determine these points on the root-locus diagram. the line connecting the closed loop pole in
the upper half of the z plane and the origin has an angle 37.88 o .Hence, the number of samples per
cycle of damped sinusoidal oscillation is: 360o/22.83o =15.76.
[email protected]

.3155
  tan 1 ( )  22.83 o
.7494

360o
  15.76
22.83o
Root Locus
2

1.5

1
System: Gp
Gain: 0.992
Pole: 0.748 + 0.31i
Damping: 0.474
0.5 Overshoot (%): 18.4
Frequency (rad/sec): 4.46
Imaginary Axis

 ?
0

-0.5

-1

-1.5

-2
-3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Real Axis

37

You might also like