Upload
abdul-ghaffar
View
218
Download
0
Embed Size (px)
Citation preview
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
1/40
Design of Compensators for Discrete Models using
MATLAB
Davood Shaghaghi
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
2/40
Design of Compensators for
Discrete Models with
MATLABUsing
CONTROL TOOLBOX
By
Davood Shaghaghi
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
3/40
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!
mailto:[email protected]:[email protected]:[email protected]:[email protected]8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
4/40
davo
od.s
hagh
Solution:
Determination of the Z transform of the system:
Design of Compensators Using MATLAB
1
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
5/40
davo
od.s
hagh
Please waiting until Rltool GUI is loaded
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
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
6/40
2
.5 % 16.3
8 10
2 36
.5629 .40902
| | exp( . ) .69581
s s
d d
d
s
d
s
over shoot
z
z j
z
davo
od.s
hagh
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:
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:
single pole
single zero
conjugate pole
conjugate zero
Cleaning zero
or pole
3
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
7/40
1
2
davo
od.s
hagh
3
Setting conditions of the problem:
1) Damping ratio setting:
Setting damping ratio to value 0.5
Choose damping ratio from menu
Setting valuePress OK to accept
2
1
4
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
8/40
1
2
3
davo
od.s
hagh
2) close-loop dominant pole setting:
You see the results in below window:
Setting close-loop dominant pole to value .5629 .4090z j
3Type close-loop dominant pole
Press Close after
Editing or OK to
accept
Choose Region Constraint from this menu
Locus of Damping ratio
(is equal to .5)
Locus ofclose-loop
dominant pole (is equal to
.5629 .4090z j )
Secant location
5
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
9/40
davo
od.s
hagh
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!
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
1
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
10/40
davo
od.s
hagh
The result is the change in Root Locus diagram:
7
Design of Compensators Using MATLAB
You can change the location of pole
from this section.
2
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
11/40
davo
od.s
hagh
From Control and Estimation Tool Manager window >> analysis plot, you can see closed-loop
step response of the system:
You see step response in below window:
8
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
12/40
davo
od.s
hagh
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?
In below window we explain this work:
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:
First select the pole or zero that
you want to move it.
Then you can move it on
the real axis horizontally
by dragging.
?
9
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
13/40
davo
od.s
hagh
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.
Compensator is designed!
And you see the step response of system after compensation:
10
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
14/40
davo
od.s
hagh
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:
To achieve this goal we must export the compensator transfer function(C) and maybe plant transferfunction (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
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
15/40
davo
od.s
hagh
Solution:
We solve this problem analytically first and then test our solution with Rltool.
12
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
16/40
davo
od.s
hagh
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=.).
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
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
17/40
-150
-100
-50
0
50
100
Magnitude(dB)
10-2
10-1
100
101
102
103
104
0
90
180
270
Phase(deg)
Bode Diagram
Gm = -5.62 dB (at 1.32 rad/sec) , Pm = -18 deg (at 1.8 rad/sec)
Frequency (rad/sec)
11 1
( )1 1
d
sTsTG sTs
sT
davo
od.s
hagh
Static velocity error constant is compensated. Now we can design the controller. The Bode diagram
of uncompensated system is as below:
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:
14
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
18/40
60 7 180 113 113 360 247
Bode Diagram
Gm = -5.62 dB (at 1.32 rad/sec ) , Pm = -18 deg (at 1.8 rad/sec )
Frequency (rad/sec)
10-2
10-1
100
101
102
103
104
0
90
180
270
System: Gw
Frequency (r ad/sec): 0.259
Phase (deg): 247
Phase(deg)
-150
-100
-50
0
50
100
System: Gw
Frequency ( rad/sec): 0.259
Magnitude (dB): 25.4
Magnitude(dB)
1 1 1* *.259 .0259
10 10T
20log 25.4 18.62
1 38.6 1( ) ( )
1 718.91 1d d
Ts sG s G s
Ts s
davo
od.s
hagh
We should calculate the phase that leads to desirable phase margin:
According to Bode diagram, 247 phase deg occurs in 0.259 rad/sec frequency.
Magnitude of frequency response function in this frequency is equal to 25.5 dB, then:
And the compensator transfer function is equal to:
15
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
19/40
davo
od.s
hagh
Compensator is designed! For testing the results, we plot the compensated Bode diagram:
You see the Bode diagram in the next page
16
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
20/40
-200
-100
0
100
200
Magnitude
(dB)
10-4
10-2
100
102
104
0
90
180
270
Phase(deg)
Bode Diagram
Gm = 19.5 dB (at 1.3 rad/sec) , Pm = 62 deg (at 0.259 rad/sec)
Frequency (rad/sec)
davo
od.s
hagh
The desirable condition has been obtained .Finally we should convert Continuous controller to
digital form.
Converting Continuous controller to digital form:
17
This coefficient is because of the Kv
compensation.
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
21/40
davo
od.s
hagh
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
18
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
22/40
davo
od.s
hagh
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:
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
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
23/40
-50
0
50
Magnitude(d
B)
10-2
10-1
100
101
102
103
104
105
90
135
180
225
270
Phase(deg)
Bode Diagram
Gm = 0.0733 dB (at 3.18 rad/sec) , Pm = 0.0761 deg (at 3.16 rad/sec)
Frequency (rad/sec)
1( )
1d
TsG s
Ts
50 0.0761 7 56.92
1 1sin( ) sin(56.92) .838 0.0882
1 1
m
m
120 log ( ( ) ) 20 log ( )mG jw
davo
od.s
hagh
Here we use lead compensator to achieve desirable condition:
We calculate the requirement phase:
We should find the frequency from bode diagram that satisfies below equation:
20
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
24/40
120 log ( ( ) ) 20 log ( ) 10.546 5.920.0882
from bode diagram
m mG jw w
10-2
10-1
100
101
102
103
104
105
90
135
180
225
270
Phase(deg)
Bode Diagram
Gm = 0.0733 dB (at 3.18 rad/sec) , Pm = 0.0761 deg (at 3.16 rad/sec)
Frequency (rad/sec)
-100
-50
0
50
100
System: Gw
Frequency (rad/sec): 5.92
Magnitude (dB): -10.5
Magnitude(dB)
5.921 15.92 0.568. . 0.0882
mw
mw TT T
0.568 0.050T T
1 .568( ) 1 .050
d
sG s s
davo
od.s
hagh
21
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
25/40
-100
-50
0
50
100
Magnitude(dB)
10-2
10-1
100
101
102
103
104
105
90
135
180
225
270
Phase(deg
)
Bode Diagram
Gm = 10.4 dB (at 18.9 rad/sec ) , Pm = 45.5 deg (at 5.91 rad/sec )
Frequency (rad/sec)davo
od.s
hagh
Compensator is designed! For testing the results, plot the Bode diagram of compensated system:
You see Bode diagram of compensated system in below:
22
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
26/40
davo
od.s
hagh
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:
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
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
27/40
davo
od.s
hagh
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.
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:
Select the pole or zero and change its
location when pressing the left click mouse.
We move the pole of compensator
so compensate the requirement
phase.
24
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
28/40
davo
od.s
hagh
To achieve the transfer function of new compensator, we must export the compensator transfer
function (C) from Rltool to Work space:
Then we test the result so that is the phase margin satisfied or no?
25
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
29/40
-50
0
50
100
Magnitud
e(dB)
10-2
10-1
100
101
102
103
104
105
90
135
180
225
270
Phase(deg)
Bode Diagram
Gm = 10.6 dB (at 22.9 rad/sec) , Pm = 50 deg (at 6.03 rad/sec)
Frequency (rad/sec)
davo
od.s
hagh
Phase margin is satisfied.
Finally, we should convert the Continuous compensator to digital form:
26
This coefficient is because of Kv
compensation.
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
30/40
davo
od.s
hagh
2
3 2
1 * (
0.358 0.05198 0.2951
1.77
) 0
( ) ( )3 0.6037 0.1694
1
magnitude condition k f z
f z Gpz
z zz
z
z
The number of samples per cycle of damped sinusoidal oscillation:
First using the magnitude condition, we find the closed loop dominant poles:
27
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
31/40
davo
od.s
hagh
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:
28
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
32/40
?
1 .2462tan ( ) 37.88.3164
o
davo
od.s
hagh
z=0.3164 + 0.2462i
z=0.3164 - 0.2462i
29
Design of Compensators Using MATLAB
Closed loop dominant poles
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
33/40
davo
od.s
hag
haghi@g
mail.com
o
o
3609.5
37.88
The green 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:
30
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
34/40
davo
od.s
hagh
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
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
35/40
-40
-20
0
20
40
60
80
Magnitude(dB)
10-2
10-1
100
101
102
103
104
90
135
180
225
270
315
Phase(deg)
Bode Diagram
Gm = 1.69 dB (at 11.2 rad/sec) , Pm = 5.56 deg (at 9.88 rad/sec)
Frequency (rad/sec)
davo
od.s
hagh
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:
Then plot bode diagram for system (K *Gw). PM is equal to 5.56 deg that less than desirable value
(50 deg).
32
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
36/40
1( )
1d
TsG s
Ts
50 7 180 123 123 360 237
1 1 1* *3.2 .32
10 10T
20log 14.2 5.12
3.125 1( )
16 1d
sG s
s
davo
od.s
hagh
Here we use lag compensator to achieve desirable conditions:
We should calculate the requirement phase:
Design calculations:
Bode Diagram
Gm = 1.69 dB (at 11.2 rad/sec) , Pm = 5.56 deg (at 9.88 rad/sec)
Frequency (rad/sec)
10-2
10-1
100
101
102
103
104
90
135
180
225
270
315
System: Gw
Frequency (rad/sec): 3.2
Phase (deg): 237Pha
se(deg)
-40
-20
0
20
40
60
80
System: Gw
Frequency (rad/sec): 3.2Magnitude (dB): 14.2
Magnitude(d
B)
33
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
37/40
-50
0
50
100
Magnitude(dB)
10-3
10-2
10-1
100
101
102
103
104
90
135
180
225
270
Phase(deg)
Bode Diagram
Gm = 15.5 dB (at 10.8 rad/sec) , Pm = 52.3 deg (at 3.21 rad/sec)
Frequency (rad/sec)
davo
od.s
hagh
You can see Bode diagram of compensated system in below:
The desirable conditions have been obtained. Finally we should convert Continuous controller to
digital form.
34
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
38/40
davo
od.s
hagh
Converting Continuous controller to digital form:
The number of samples per cycle of damped sinusoidal oscillation:
35
This coefficient is because of Kv
compensation.
Design of Compensators Using MATLAB
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
39/40
3 2
4 3 20.08287 0.09008 0.0561
1 *
2 0.063573.505 4.555 2.5
( ) 0
( ) ( )96 0.5454
1
magnitude condition k
z z zz
f z
f z Gp z z z z
davo
od.s
hagh
Similar to previous problem, we should use the magnitude condition and find the close loop poles:
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
8/3/2019 Design of tors for Discrete Models With Matlab Using Control Toolbox by Davood Shaghaghi
40/40
Root Locus
Real Axis
ImaginaryAxis
-3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
System: Gp
Gain: 0.992
Pole: 0.748 + 0.31i
Damping: 0.474
Overshoot (%): 18.4
Frequency (rad/sec): 4.46
?
1
o
o
.3155tan ( ) 22.83.7494
36015.76
22.83
o
davo
od.s
hagh
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.
Design of Compensators Using MATLAB