Vous êtes sur la page 1sur 68

% 436-433 Tutorial A2

% Franklin Problem 7.19


% Plant
A = [0 1;-6 -5]; B = [0; 1]; C = [1 0]; D = 0;
G = ss(A, B, C, D);
% Desired CLPs
dcp = [-1+j; -1-j];
% Control law gains
K = place(A, B, dcp)
K =
-4
-3
% Closed-loop system
Ga = augstate(G);
%
feedin = 1;
%
feedout = [2:3];
%
Gcl = feedback(Ga, K,
Gcl = Gcl(1, 1);
%
zpk(Gcl)

append states to plant output


single plant input
feed back states
feedin, feedout);
suppress augmented outputs

Zero/pole/gain:
1
-------------(s^2 + 2s + 2)
% Step response
ltiview(Gcl)
Step Response
0.7

System: Gcl
Peak amplitude: 0.522
Overshoot (%): 4.32
At time: 3.15

0.6

0.5

Amplitude

0.4

0.3

0.2

0.1

Time (sec)

% 436-433 Tutorial A2
% Franklin Problem 7.20
% Plant
A = [0 1;0 -10]; B = [0; 1]; C = [1 0]; D = 0;
G = ss(A, B, C, D);
% Desired CLPs
zeta = 0.41; zwn = 41; wn = zwn/zeta;
dcp = roots([1 2*zwn wn^2])
dcp =
-41.0000 +91.2086i
-41.0000 -91.2086i
% Control law gains
K = place(A, B, dcp)
K =
1.0e+004 *
1.0000
0.0072
% Closed-loop system
Gcl = ss(A-B*K, B, C, D);
zpk(Gcl)
Zero/pole/gain:
1
------------------(s^2 + 82s + 1e004)
% Step response
ltiview(Gcl)

Step Response

-4

1.4

x 10

1.2

System: Gcl
Peak amplitude: 0.000124
Overshoot (%): 24.3
At time: 0.035

System: Gcl
Settling Time: 0.0841

Amplitude

0.8

0.6

0.4

0.2

0.05

0.1

Time (sec)

0.15

% 436-433 Tutorial A2
% Franklin Problem 7.25
syms m l k a g real
A = [0 1 0 0
-k*a^2/m/l^2-g/l 0 k*a^2/m/l^2 0
0 0 0 1
k*a^2/m/l^2 0 -k*a^2/m/l^2-g/l 0];
B = [0; -1/m/l; 0; 1/m/l];
Co = [B A*B A^2*B A^3*B]
Co =
[0, -1/m/l, 0, -(-k*a^2/m/l^2-g/l)/m/l+k*a^2/m^2/l^3]
[-1/m/l, 0, -(-k*a^2/m/l^2-g/l)/m/l+k*a^2/m^2/l^3, 0]
[0, 1/m/l, 0, -k*a^2/m^2/l^3+(-k*a^2/m/l^2-g/l)/m/l]
[1/m/l, 0, -k*a^2/m^2/l^3+(-k*a^2/m/l^2-g/l)/m/l, 0]
determinant = det(Co)
determinant =
0
if determinant==0, disp('Uncontrollable!'), end
Uncontrollable!

% Symmetry suggests a "rigid body" pendulum mode, in which Theta_1 =


Theta_2
% and a vibrational mode in which Theta_2 = -Theta_1.
% Hence transform EoM into new state variables:
% z_1 = Theta_1 + Theta_2, % z_2 = z_1dot,
% z_3 = Theta_1 Theta_2, z_4 = z_3dot
% Similarity transformation: {z} = [iT] * {x}
iT = [1 0 1 0;0 1 0 1;1 0 -1 0;0 1 0 -1];
T = inv(iT)
T =
0.5000
0
0.5000
0

0
0.5000
0
0.5000

0.5000
0
-0.5000
0

0
0.5000
0
-0.5000

A1 = T\A*T
A1 =
[
0]
[
0]
[
1]
[
0]

0,

1,

0,

-g/l,

0,

0,

0,

0,

0,

0,

0, -(g*m*l+2*k*a^2)/m/l^2,

B1 = T\B
B1 =
[
0]
[
0]
[
0]
[ -2/m/l]
% If forces not symmetrical, e.g., u1 = 0:
B(2) = 0
B =
[
0]
[
0]
[
0]
[ 1/m/l]
%Then
B1 = T\B
B1 =
[
0]
[ 1/m/l]
[
0]
[ -1/m/l]
% Now both modes are controllable from u2

% 436-433 Tutorial A3
% Franklin Problem 7.26
A = [.174 0 0 0 0
.157 .645 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0];
B = [-.207; -.005; 0; 0; 0];
C = [1 0 0 0 0]; D = 0;
Co = ctrb(A, B);
detC = det(Co)
detC =
-2.2829e-007
% Jordan modal form
[V, J]=jordan(A)
V =
0
0
0
0
1.3989

0
0
0
1.3989
10.2086

0
0
1.3989
10.2086
62.0326

1.0000
-0.3333
-1.9157
-11.0098
-63.2748

0
0.3333
0.5168
0.8012
1.2422

0
0
0
0
0

1.0000
0
0
0
0

0
1.0000
0
0
0

0
0
0
0.1740
0

0
0
0
0
0.6450

J =

Bm = V\B
Bm =
0.0000
-0.0318
-0.2015
-0.2070
-0.2220
Cm = C*V
Cm =
0

% Hence, not observable. Check rank of observability matrix:


Ob = obsv(A, C);
detO = det(Ob)
detO =
0

% 436-433 Tutorial A3
% Question 7.28
% Plant, with state vector = [Q Qdot x xdot]'
syms b K1 K2 K3 K4 real
syms s
A = [0 1 0 0
1 0 0 0
0 0 0 1
-b 0 0 0];
B = [0; 1; 0; -1];
K = [K1 K2 K3 K4];
% (a)
% Desired CLPs
dcp = [-1; -1; -1+j; -1-j];
% Desired char. poly
ac = poly(dcp)
ac =
1

% Closed-loop char. poly


ak = simplify(det(s*eye(4) - A + B*K));
ak = collect(ak, s)
ak =
s^4+(K2-K4)*s^3+(K1-1-K3)*s^2+(K4-b*K4)*s-b*K3+K3
% Solve for K with b = 0.5
A = subs(A, b, 1/2);
K1 = acker(A, B, dcp)
K1 =
12

16

12

% (b)
% Symmetric root locus
% Define output as cart displacement x = x3
C = [0 0 1 0]; D = 0;
G = ss(A, B, C, D);
disp('Plant transfer function')
zpk(G)
figure(1)
plot(real(dcp), imag(dcp), 'rs', 'MarkerFaceColor', 'r')
hold on
[rho, clp] = srl(G)

Symmetric root locus


4

0.66

0.5

0.34

0.18

0.78
3
0.87
2
0.94
1

Imag Axis

0.985
0

3.5

2.5

1.5

0.5

0.985
-1
0.94
-2
0.87
-3
0.78
0.66

-4
-4

0.5
-3

0.34
-2

0.18
-1

Real Axis

Select a point in the graphics window


selected_point =
-1.4936 + 1.3136i
rho =
15.9019
clp =
-1.4926 + 1.3145i
-1.4926 - 1.3145i
-0.7085 + 0.0450i
-0.7085 - 0.0450i
hold off
K2 = place(A, B, clp)
K2 =
13.6778

18.6227

3.9877

14.2205

% (c)
% Closed-loop systems
Gcl1 = ss(A-B*K1, B, C, D);
Gcl2 = ss(A-B*K2, B, C, D);
figure(2), initial(Gcl1, Gcl2, [10 0 0 0]')
legend('part (a)', 'part(b)', 0)

Response to Initial Conditions

20

part (a)
part(b)

15

Amplitude

10

-5

Time (sec)

% (d)
% Servo system
Nxu = [A B;C D]\[0; 0; 0; 0; 1];
Nx = Nxu(1:4), Nu = Nxu(5)
% Note that ref state only required for x3 = x
Nx =
0
0
1
0
Nu =
0
% Form closed-loop system
Ga = augstate(G);
% augment output with states
Gc1 = feedback(Ga, K1([1 2 4]), 1, [2 3 5]); % feedback states for which Nx = 0
Gc1 = Gc1(1,1);
% retain only output x3 = x
Gcl1 = feedback(Gc1*K1(3), 1);
Gc2 = feedback(Ga, K2([1 2 4]), 1, [2 3 5]);
Gc2 = Gc2(1,1);
Gcl2 = feedback(Gc2*K2(3), 1);
% Step response
figure(3), step(Gcl1, Gcl2)
legend('part (a)', 'part(b)', 0)

Step Response

1.2

0.8

Amplitude

0.6

0.4

0.2

-0.2
part (a)
part(b)
-0.4

-0.6

Time (sec)

% 436-433 Tutorial A3
% Question 7.42
syms w L1 L2 L3 L4 real
syms s
% State equations
A = [ 0 1 0 0
3*w^2 0 0 2*w
0 0 0 1
0 -2*w 0 0];
B = [0; 0; 0; 1];
C = [0 0 1 0];
D = 0;
% (a) Observability
Ob = [C; C*A; C*A^2; C*A^3]
Ob =
[
0,
[
0,
[
0,
[ -6*w^3,

0,
0,
-2*w,
0,

% observability matrix

1,
0]
0,
1]
0,
0]
0, -4*w^2]

detOb = det(Ob)
detOb =
-12*w^4
if detOb == 0
disp('Not fully state observable from y')
else
disp('Fully state observable from y')
end
Fully state observable from y
% (b) Observer design
dep = [-2*w; -3*w; -3*w+j*3*w; -3*w-j*3*w];
ae = 1;
for k = 1:4, ae = ae*(s - dep(k)); end
ae = collect(simple(ae), s)
ae =
s^4+11*s^3*w+54*s^2*w^2+126*s*w^3+108*w^4
L = [L1; L2; L3; L4];
aL = det(s*eye(4) - A + L*C);
aL = collect(simple(aL), s)
aL =
s^4+s^3*L3+(w^2+L4)*s^2+(w^2*L3-2*w*L2)*s-6*w^3*L1-3*w^2*L4

% Use Ackermann: L = ae(A)*inv(Ob)*[0;0;0;1]


% Find coefficients of 's' in ae(s)
aes = subs(ae, w, 1)
% remove w as a symbolic variable
aes =
s^4+11*s^3+54*s^2+126*s+108
ae_coeff = sym2poly(aes)

% numeric coefficients

ae_coeff =
1
11

108

54

126

ae_coeff = ae_coeff .* [1 w w^2 w^3 w^4]


ae_coeff =
[
1,

11*w,

54*w^2, 126*w^3, 108*w^4]

aeA = polyvalm(ae_coeff, A)
aeA =
[ 267*w^4, 115*w^3,
[ 345*w^5,
55*w^4,
[ -66*w^4, -106*w^3,
[ -318*w^5, -230*w^4,

0, 106*w^3]
0, 230*w^4]
108*w^4,
82*w^3]
0, -104*w^4]

L = aeA*inv(Ob)*[0; 0; 0; 1]
L =
[
-89/2*w]
[ -115/2*w^2]
[
11*w]
[
53*w^2]

% restore w as symbolic variable

% 436-433 Tutorial A3
% Question 7.43
% (a) State-space equations
w = 5; num = 1; den = [1 0 w^2];
Gtf = tf(num, den)
[A, B, C, D] = tf2ss(num, den) % gives controller canonical form
C = [1 0]
% but get theta-dot as observed output
Transfer function:
1
-------s^2 + 25
A =
0
1

-25
0

B =
1
0
C =
0

D =
0
C =
1

% (b) Estimator design


dep = 10*[-1+j; -1-j];
L = place(A', C', dep)'
L =
20.0000
-7.0000
% (c) Transfer function from Y to Qhat
G = ss(A, B, C, D);
% plant
Gest = estim(G, L, 1, 1); % estimator
set(Gest, 'OutputName', {'Yhat','DQ^', 'Q^'}, 'InputName', {'U', 'Y'})
GQhat_Y = zpk(Gest(3,2)) % (recall that estim gives Yhat as 1st output)
Zero/pole/gain from input "Y" to output "Q^":
-7 (s-2.857)
----------------(s^2 + 20s + 200)
I/O groups:
Group name
Measurement
StateEstimate

% (d) Control law


dcp = 4*[-1+j; -1-j];
K = place(A, B, dcp)
K =
8.0000
7.0000

I/O
I
O

Channel(s)
1
1

% 436-433 Tutorial A3
% Question 7.42
A
B
C
D

=
=
=
=

[0 1; 4 0];
[0; 4];
[1 0];
0;

dcp = 2*[-1+j; -1-j];


K = place(A, B, dcp)
K =
3.0000

1.0000

dep = 10*[-1+j; -1-j];


L = place(A', C', dep)'
L =
20.0000
204.0000
G = ss(A, B, C, D);
Greg = reg(G, K, L, 1, [], 1);
zpk(Greg)

Zero/pole/gain:
-264 (s+2.621)
----------------(s^2 + 24s + 292)
I/O groups:
Group name
Measurement
Controls

Gol = -Greg*G;
zpk(Gol)

I/O
I
O

Channel(s)
1
1

% because Greg includes u = -Kx

Zero/pole/gain:
1056 (s+2.621)
----------------------------(s+2) (s-2) (s^2 + 24s + 292)
I/O groups:
Group name
Controls

I/O
O

Channel(s)
1

[Gm,Pm,Wcg,Wcp] = margin(Gol)
Gm =
0.4220
Pm =
36.1147
Wcg =
0
Wcp =
3.3903
margin(Gol)

Bode Diagram
Gm = -7.4945 dB (at 0 rad/sec), Pm = 36.115 deg (at 3.3903 rad/sec)
20
10

Magnitude (dB)

0
-10
-20
-30
-40
-50

Phase (deg)

-60
-135

-180

-225

-270
-1
10

10

10

Frequency (rad/sec)

10

% 436-433 Tutorial A3
% Question 7.48
A
B
C
D

=
=
=
=

[0 1; 0 -1];
[0; 10];
[1 0];
0;

zeta = .5; wn = 3; dcp = roots([1 2*zeta*wn wn^2])


K = place(A, B, dcp)
dcp =
-1.5000 + 2.5981i
-1.5000 - 2.5981i
K =
0.9000
0.2000
zeta = .5; wn = 15; dep = roots([1 2*zeta*wn wn^2])
L = place(A', C', dep)'
dep =
-7.5000 +12.9904i
-7.5000 -12.9904i
L =
14.0000
211.0000
G = ss(A, B, C, D);
Greg = reg(G, K, L, 1, [], 1);
zpk(Greg)

Zero/pole/gain:
-54.8 (s+3.695)
----------------(s^2 + 17s + 262)
I/O groups:
Group name
Measurement
Controls

I/O
I
O

Channel(s)
1
1

Gol = -Greg*G; % because Greg includes u = -Kx


zpk(Gol)
rlocus(Gol)
axis([-30 10 -20 20])
hold on, plot(real([dcp;dep]), imag([dcp;dep]), 'rv', 'MarkerFaceColor', 'r')

Zero/pole/gain:
548 (s+3.695)
------------------------s (s+1) (s^2 + 17s + 262)
I/O groups:

Group name
Controls

I/O
O

Channel(s)
1

Root Locus

20
0.76

0.64

0.5

0.34

0.16

0.86
15

10

Imag Axis

0.94

0.985

25

-5

-10

20

15

10

0.985

0.94

-15
0.86
0.76
-20
-30

-25

0.64
-20

-15

0.5
-10

Real Axis

0.34

0.16
-5

10

% 436-433 Tutorial A3
% Question 7.54
%
A
B
C
G

Plant equations
= [0 1; 1 0];
= [1; 0]; Bw = B;
= [0 1]; D = 0;
= ss(A, [B Bw], C, D);

% plant inputs [u; w]

% Augment state with error integral Dxi = y - r = -e


Aa = [A [0;0]; C 0]
Ba = [B; 0]
dcp = [-1; -1+j; -1-j];
K = place(Aa, Ba, dcp)
Aa =
0
1
0

1
0
1

0
0
0

Ba =
1
0
0
K =
3.0000
Ko = K(1:2);
Ki = K(3);

5.0000

2.0000

% Plant state gains


% Integral state gain

% Construct closed-loop system


Ga = augstate(G);
% outputs [y; x1; x2]
G1 = feedback(Ga, Ko, [1], [2 3]);
% feedin to u, feedout from x1,x2
G1 = G1(1,:);
% output y only
G2 = append( tf(Ki, [1 0]), 1 );
Gcl = feedback( G1*G2, 1, [1], [1]);
set(Gcl, 'InputName', {'r', 'w'}, 'OutputName', 'y')
zpk(Gcl)

Zero/pole/gain from input "r" to output "y":


2
-------------------(s+1) (s^2 + 2s + 2)
Zero/pole/gain from input "w" to output "y":
s
-------------------(s+1) (s^2 + 2s + 2)

step(Gcl)

Step Response
From: r

From: w

0.9

0.8

0.7

To: y

Amplitude

0.6

0.5

0.4

0.3

0.2

0.1

6 0

Time (sec)

436-433 Mechanical Systems


Unit 1: Control Systems
Problem Sheet 3: State-Space Design
The following problems from Franklin, Powell & Emami-Naeini, 4th edn are recommended.
Control law design: 7.18, 7.19, 7.20, 7.22
Controllability: 7.25, 7.26
Symmetric root locus: 7.28
Observability: 7.31, 7.32
Estimator design: 7.42, 7.43, 7.44
Regulator design: 7.45, 7.48
Integral control: 7.54

The following additional problems are from previous exam papers:


Question 2 (2001)
A state-space model for a particular linear system is
3 2
1
x =
x+ u

0 1
1
y = [ 1 ] x
a) Determine, if it exists, a state feedback gain matrix K such that the closed-loop poles are
located at s = 5 and 6.
[5 marks]
b) Determine, if it exists, a state feedback gain matrix K such that the closed-loop natural
motions have the form 1e 2t cos(0.5t + 2 )
[3 marks]
c) Find the range of values of the parameter for which the system is completely state
observable.
[4 marks]
d) Choose a convenient value of that makes the system completely observable, and design an
estimator whose errors decay like e5t.
[5 marks]
e) Draw a detailed simulation diagram of your estimator (with inputs u and y, and outputs
x1 and x 2 ).
[3 marks]

tut_a3.doc

Page 1 of 4

Question A1 (2000)

(a)

Describe several approaches to the selection of closed-loop poles for pole-placement


designs of full-state-feedback controllers and estimators, and discuss some important
issues involved in selecting poles for placement.
[4 marks]

(b)

A plant to be controlled has the transfer function


Y ( s)
10
=
G( s) =
U ( s ) s ( s + 2)( s + 8)
A state-space realisation of this transfer function is
10
x (t ) = 16
0
y = [1 0
(i)
(ii)

1 0
0

0 1 x(t ) + 0 u (t )
10
0 0

0] x(t )

Draw a simulation diagram of this realisation. In what canonical form is this


realisation?
[2 marks]
It has been decided to design a state feedback regulator, with the control and fullorder estimator poles placed according to a 3rd-order ITAE prototype. The
desired characteristic polynomials for the controller and estimator are,
respectively,

c ( s ) = s 3 + 3.5s 2 + 8.6s + 8
e ( s ) = s 3 + 10.5s 2 + 77.4 s + 216
Given that the controllability matrix for the realisation is
0 0 10
C = 0 10 0

10 0 0

and that the matrix polynomial c(A) is


464 57.6 6.5
c ( A) = 921.6 112 7.4
0
0
8
determine the required state feedback gain matrix K and the estimator gain
matrix L.
[6 marks]
(iii)

The effective feedback compensator formed by the estimator-controller


combination is
( s + 0.432)( s + 2.10)
H ( s ) = 190
( s 1.88)( s + 2.94 j8.32)
A root locus drawn for the open-loop transfer function G(s)H(s), with the
compensator gain as a parameter, is shown in figure 1. The poles of the closedloop system when the gain is 190 are indicated with the symbols (control) and
(estimator). Comment on the suitability of the ITAE prototype poles in this
instance, taking account of the issues discussed in part (a) and the resulting
compensator and closed-loop system.
[4 marks]

tut_a3.doc

Page 2 of 4

(iv)

A root locus for an alternative design, in which the desired control and estimator
poles were selected from a symmetric root locus (SRL), is shown in figure 2. The
control and estimator gains for this design are K = [0.259 0.208 0.204] and
L = [7.17 97.3 367]T, respectively.
Compare the important features of the ITAE and SRL designs.

[4 marks]

ITAE design
10

Imag Axis

10
15

10

5
Real Axis

Figure 1
SRL design
8

Imag Axis

8
12

10

4
Real Axis

Figure 2
tut_a3.doc

Page 3 of 4

Question A1 (1999)
Consider a plant with the state-space representation
2 1
1
x =
x
+
0 u
0
1

y = [0 1]x

(a)

Design a full state feedback control law which will place the closed-loop poles at
s = 2, 2.
[7 marks]

(b)

A full state estimator is to be used, with estimator poles placed at s = p0, p0. Show that the
required estimator gain matrix is

p 2 + 4 p 0 + 3
L= 0

2( p 0 + 1)
(c)

[7 marks]

It is desired to investigate the effect of sensor noise on the operation of the closed-loop
regulator system. Let the sensor signal be y + n, where y is the actual plant output. Derive a
T
set of state-space equations (involving the state vector [x x ] ) which describe how the
plant output y and the control signal u respond to the noise input n.
[6 marks]

tut_a3.doc

Page 4 of 4

Vous aimerez peut-être aussi