4

Comp Lab 1 Hints

Embed Size (px)

DESCRIPTION

Saveti

Citation preview

Uppsala University

Information Te hnology

Dept. of Systems and Control

BPGH November 5, 2012

Control Design (F, IT)

Computer Controlled Systems (STS,

W), 2007

Computer exer ise 1

Introdu tion to multi-variable ontrol: Hints

1 Solution to the preparation exer ises

Ex 2.1

The system is des ribed by

x(t) = Ax(t) + Bu(t); (1)

y(t) = Cx(t) + w(t): (2)

The system is ontrolled by the ontroller

u(t) = �Lx(t) + mr(t): (3)

Observer:

˙x(t) = Ax(t) + Bu(t) + Kfy(t)� Cx(t)g: (4)

Under stati ondition (nothing is hanging) x(t) = 0 and

˙x(t) = 0. We are

interested in the stati gain from r(t) to y(t). Hen e set the other input w(t) = 0.Using these observations and subtra ting (1) from (4) we get

(A�KC)fx(t)� x(t)g = 0: (5)

Sin e A�KC is not a singular matrix in general,

x(t) = x(t): (6)

Note that the above equality may not hold if A�KC is a singular matrix, whi h

would mean that the estimation error may not be zero at steady state (stati

ondition). Using (1),(3) and (6) we get

x(t) = �(A�BL)�1Bmr(t) ) y(t) = �C(A�BL)�1

Bmr(t): (7)

Hen e to get unit stati gain we must have

m = �fC(A�BL)�1Bg

�1: (8)

Ex 2.2

>From (1) and (3) we get

x(t) = Ax(t)�BLx(t) + Bmr(t): (9)

>From (2), (3) and (4) we get

˙x(t) = KCx(t) + (A�BL�KC)x(t) + Bmr(t) + Kw(t): (10)

2

Hen e the required state spa e form is given by

x(t)˙x(t)

=

A �BL

KC A�BL�KC

��

x(t)x(t)

+

Bm

Bm

r(t) +

0K

w(t)

y(t) =�

C 0�

x(t)x(t)

+ w(t): (11)

Ex 2.3

K = (a ker(A',C',p_obs))'

Ex 2.4

F = [A, -B*L; K*C, A-B*L-K*C℄, G =[B; B℄*m,

H = [C zeros(size(C))℄, S = ss(F,G,H,0)

Ex 2.5

Sn = ss(F, [zeros(size(K)); K℄, H, 1)

Ex 2.6 Let C =�

1 : : :

n

and B =�

b1 : : : b

n

>

(Note the di�eren e

in dimensions of B and C). Then

g(t) =

n

X

k=1

k

b

k

epkt: (12)

If p1 is the dominating pole, for t >> 0

g(t) � 1b1ep1t) log [g(t)] = p1t + log( 1b1); (13)

whi h means that the slope of the semilog urve for large t gives the dominating

pole.

3

% ********* Closed loop system *********************

g1 = tf([2 1℄,[1 2 1 0℄) % Open loop system G1

f1 = tf(1,1) % Unity feedba k

h1 = feedba k(g1,f1) % losed loop system

step(h1) % step response

% ********* Stability margins *********************

bode(g1) % bode plot

[M ph w℄ = bode(g1) % frequen y response data

[Gm Pm G P ℄ = margin(M,ph,w) % Gain and phase margin:

% Pm = phase margin

P = phase ross over

% **********************************************

Table 1: Sample ode for system 1.

% ********* Pole pla ement *********************

K = (pla e(A',C',p_o))' % Need to transpose matri es.

L = a ker(A,B,p_s) % No need to transpose matri es.

% ********* Closed loop system *********************

F = [A -B*L; K*C A-B*L-K*C℄ %

m = inv(C*inv(B*L-A)*B) % Set the stati gain = 1

G = [B;B℄*m % State spa e des ription

H = [C zeros(size(C))℄ % of the losed loop system

Gr = ss(F,G,H,0) % You have done it before.

step(Gr) % Step response of Gr

% **********************************************

Table 2: State feedba k and pole pla ement.

2 Di� ulties in ontrol

A brief outline of the Matlab ode for forming the losed loop system for sys-

tem 1 is given in Table 1. You an modify the same set of odes to study the

other systems also. Next ompensators are required to be designed. Follow the

instru tions given in the instru tion sheet. Create the LTI obje t for the om-

pensated system. Study the ompensated losed loop system properties using

bode and Nyquist plots. You may need to as ade two systems. Use

h = series(g1, 1); or h = g1* 1;

for that. Next we study state spa e feedba k ontrol of the systems. To reate

the state spa e des ription of open loop system use

s1 = ss(g1), [A, B, C, D℄ = ssdata(s1);

Next hoose your pole! Let p_s be the ve tor of ontroller poles and p_o be the

ve tor of observer poles. Observer poles has to be faster than the system poles.

The set of odes given in Table 2 may be helpful.

4