Beruflich Dokumente
Kultur Dokumente
80
s(s 2 + 24 s + 48 )
or
to achieve the following specifications for the closed loop step response:
Rise time < 0.5s
Overshoot < 10%
We shall work through the following steps for the design:
A. Calculating the required open loop frequency response.
B. Determining the PID parameters.
C. Plotting the step response of the closed loop.
D. Fine-tuning the design to achieve the specifications
1 2n
=> m = tan
=> m = 1.02 rad
c
Anthony Bright
Page 1
04/ 18/ 02
Anthony Bright
Page 2
04/ 18/ 02
The bode plot shows a crossover frequency of 1.4 rad/s. The crossover frequency must be
raised to 2.60 rad/s to speed up the time response.
First, find the magnitude and phase of the dc motor at the crossover frequency :
>>[magH,phaseH]=bode(H,2.60)
magH =
0.4117
phaseH =
-146.5225
At 2.60 rad/s, the combined phase of the controller and process must give a phase margin
of 1.02 rad (59o )
The phase lead added by the controller at 2.60 rad/s must be -180 + 59 +147 = 26o
( C ( j c ) = 0.44 rad) and the gain added by the controller at 2.60 rad/s must equal the
1
reciprocal of the dc motor gain C ( j c ) =
= 2.43 .
.412
We can now calculate the controller parameters, assuming that T I = 10T D by solving
C ( j c ) =
K 1 + 2c TD2 1 + 2c TI2
c
=> TD = 0.256 s ; => TI = 2.56 s
=> K = 0.780
So the PID controller is given by
2
(0.256 s + 1)( 2.56s + 1) 0.512 s + 2.20s + 0.780
C ( s) = 0.780
=
s
s
Now check the phase margin and crossover frequency of our design with the open loop
bode plot
Anthony Bright
Page 3
04/ 18/ 02
>>margin(C*H)
Anthony Bright
Page 4
04/ 18/ 02
Plot the step response of the closed loop system for 0 < t < 4 s
>>step(Q,4)
The step response meets the rise time requirement (< 0.5 s) but not the overshoot
specification (<10%)
Anthony Bright
Page 5
04/ 18/ 02
Anthony Bright
Page 6
04/ 18/ 02
x1
0
0
0
x1
x2
x3
u1
0
0
20
x2
1
0
-12
x3
0
4
-24
b =
Anthony Bright
Page 7
04/ 18/ 02
c =
y1
x1
1
y1
u1
0
x2
0
x3
0
d =
Continuous-time system.
The command ss created a state space model of the system. We can now look at the
frequency response bode(H), step response step(H), and so forth, just as we did for the
transfer function models in Part I.
With full state feedback, the feedback gain can be evaluated using pole placement or the
LQR method.
B. Pole Placement
First determine the dominant closed loop pole positions.
What values of the dominant poles will give the appropriate time response ( <10%
overshoot, <0.5 s settling time => = 0.6, n = 3.6 rad/s)?
0.1200
The command place matches the eigenvalues of the closed loop system matrix Af = A-BK
with the chosen poles. It also measures the number of digits accuracy in the position of the
closed loop poles.
Next, the reference gain Kr is determined
>>N=inv([A B;C D])*[zeros(length(B),1);1];
>>Nx=N(1:length(B));Nu=N(length(B)+1); Kr= Nu + K*Nx
Kr = 3.6437
The closed loop system can now be defined in state space form
>>Q=ss(A-B*K,B*Kr,C-D*K,D*Kr);
Anthony Bright
Page 8
04/ 18/ 02
This choice weights the motor angle with a factor of ten and the control input with a factor
of 0.1. Solve the linear quadratic regulator with Matlab function lqr
>>[K,S,e]=lqr(A,B,Q,R)
K =
10.0000
2.2273
S =
2.8273
0.3817
0.0500
0.3817
0.0774
0.0111
0.3267
0.0500
0.0111
0.0016
e =
-21.8628
-4.3360 + 4.2180i
-4.3360 - 4.2180i
Anthony Bright
Page 9
04/ 18/ 02
The values of the feedback gain vector K are the optimum values to minimize the
performance index. The matrix S is the solution of the associated Riccati equation and the
e vector contains the closed loop eigenvalues (poles). The closed loop response follows as
before
>>Kr= Nu + K*Nx
>>Q=ss(A-B*K,B*Kr,C-D*K,D*Kr); step(Q)
D. Observer Design
Full state feedback of the servo motor requires simultaneous measurement of motor
angular position, angular velocity and motor current. Typically all of these are not
measured. So we need to include an observer to estimate the state of the system. We will
choose the observer poles to be twice as fast as the system poles:
>>pe=2*e
pe =
-43.7256
-8.6720 + 8.4359i
-8.6720 - 8.4359i
Anthony Bright
Page 10
04/ 18/ 02
L =
1.0e+003 *
0.0371
-0.0329
1.3527
Note that the place function solves A-BK, so we need to invert the A and C matrices to
find the column vector L.
The observer gain L is now incorporated into an augmented state space description of
both the system state and the observer state:
>>Ae=[A -B*K;L*C A-L*C-B*K];Be=[B*Kr;B*Kr];
>>Ce=[C -D*K; 0 0 0 C-D*K];De=[D*Kr;D*Kr];
The upper reponse curve corresponds to the measured output y = ; the lower curve to
the estimated output y = . Overshoot 4%, rise time 0.38s, the observer does an excellent
job!
Anthony Bright
Page 11
04/ 18/ 02
Before you come to the conclusion that the problem is solved and you can take the rest of
the evening off, you should just check the closed loop response of the other two state
variables, the motor speed and the motor current i. For example to find the closed loop
step response of the motor current, we change the output matrix:
>>C=[0 0 1];Ce=[C -D*K2; 0 0 0 C-D*K2];
>>Qi=ss(Ae,Be,Ce,De);step(Qi)
The motor current exceeds 4 amps for a short duration. This current level could burn out
the motor windings. We need to relax some of the design specifications and penalize
large values of current in our weighting matrix Q.
Fine tune the observer-based state space control scheme for rise time < 1.5 s,
overshoot < 10%, motor speed < 1 rad/s and motor current < 2 amps. The M-file
stspace_tune.m given on the next page may be helpful:
Anthony Bright
Page 12
04/ 18/ 02
Anthony Bright
Page 13
04/ 18/ 02
Notice that the addition of the sample time T to the transfer function command tf creates
a discrete time model of the PID controller.
Anthony Bright
Page 14
04/ 18/ 02
Now we convert the continuous process transfer function to the equivalent discrete
transfer function using the c2d (continuous-to-discrete) command applying a zero order
hold to the input:
>>Hs=tf(80,[1 24 48 0]);Hz=c2d(Hs,T,'zoh')
Transfer function:
0.001259 z^2 + 0.003814 z + 0.0006928
------------------------------------z^3 - 2.232 z^2 + 1.533 z - 0.3012
Sampling time: 0.05
Now we find the step response. The output of the system is continuous, but we can find
the sampled output from the discrete closed loop transfer function:
>>Qz=feedback(Cz*Hz,1);step(Qz);
If we compare this response to the results for the continuous control system (Part I), the
rise time is reduced slightly but the overshoot is increased.
Anthony Bright
Page 15
04/ 18/ 02
The continuous state space equations for the system can be converted to discrete form
and state feedback strategies applied to the discrete system.
First find the equivalent discrete state model for the process:
>>A=[0 1 0;0 0 4;0 -12 -24];B=[0 0 20]';C=[1 0 0];D=0;
>>Hc=ss(A,B,C,D);
>>Hd=c2d(Hc,T,'zoh');
>>Ad=Hd.a
>>Bd=Hd.b
Ad =
1.0000
0
0
0.0492
0.9586
-0.3426
0.0034
0.1142
0.2734
Bd =
0.0013
0.0690
0.5710
To apply the optimal control LQR method for the state feedback gain, choose the
weighting parameters of the objective function
>>Q=[10 0 0;0 0 0;0 0 ];R=0.1;
Now solve the discrete linear quadratic regulator with Matlab function dlqr
>>[K,S,e]=dlqr(Ad,Bd,Q,R)
K =
8.4950
2.0222
0.3007
S =
61.7350
7.6247
1.0043
7.6247
1.5544
0.2236
1.0043
0.2236
0.0328
e =
0.7875 + 0.1689i
0.7875 - 0.1689i
0.3350
Anthony Bright
Page 16
04/ 18/ 02
The observer is designed by pole placement. Choose estimator poles to be one half the
value of the system poles (making them about twice as fast in the discrete domain), and
solve for the estimator gain:
>>pe=e/2, L=place(Ad',C',pe)'
pe =
0.3938 + 0.0845i
0.3938 - 0.0845i
0.1675
place: ndigits= 15
L =
1.2769
7.0198
-3.3579
Write the augmented discrete state space equations for both the state variables and the
estimates of the state variables and plot the step response:
>>Ae=[Ad -Bd*K;L*C Ad-L*C-Bd*K];Be=[Bd*Kr;Bd*Kr];Ce=[C -D*K];De=D*Kr
>>Q=ss(Ae,Be,Ce,De,T);step(Q)
Anthony Bright
Page 17
04/ 18/ 02
The response is practically identical to the results from the continuous state space system
and leaves open the same questions about the behavior of the other state variables.
Fine tune the observer-based digital state space control scheme for rise time <
1.5 s, overshoot < 10%, motor speed < 1 rad/s and motor current < 2 amps.
The following M-file may be helpful:
Anthony Bright
Page 18
04/ 18/ 02