sc4026 exercise session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 exercise...

18
sc4026 Exercise Session 3 (with solutions) Alessandro Abate [email protected] Marco Forgione [email protected] Delft Center for Systems and Control, TU Delft September 27, 2012 – Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026

Upload: phungtuyen

Post on 18-Feb-2019

237 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

sc4026Exercise Session 3 (with solutions)

Alessandro Abate

[email protected]

Marco Forgione

[email protected]

Delft Center for Systems and Control, TU Delft

September 27, 2012

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026

Page 2: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Linearization Example

In the following diagram, we have a ball of mass m swinging

on a mass-less, perfectly rigid rod of length l. The ball is

attached by a spring to a mass-less and friction-less cart, whose

only purpose is to keep the spring horizontal with the ball. There

is a torque input applied at the base of the rod (point A).

!"#$%&"'%(")#!*+%,-.$/!

!"!#$%!&'((')*"+!,*-+.-/0!)%!$-1%!-!2-((!'&!/-33!!!3)*"+*"+!'"!-!/-33"(%330!4%.&%5#(6!.*+*,!.',!

'&!(%"+#$!"7!!8$%!2-((!*3!-##-5$%,!26!-!34.*"+!#'!-!/-33"(%33!-",!&.*5#*'""(%33!5-.#0!)$'3%!'"(6!

49.4'3%!*3!#'!:%%4!#$%!34.*"+!$'.*;'"#-(!)*#$!#$%!2-((7!!8$%.%!*3!-!#'.<9%!*"49#!# !-44(*%,!-#!#$%!

2-3%!'&!#$%!.',!=4'*"#!>?7!

$

!

l!

Km

x! !

l!

Kx

mgx

cT

!

> 0&$$1)23!4"%5&%,/

6%&"%7.$8/!

!@!/-33!'&!2-((!

!@!(%"+#$!'&!4%",9(9/!

!@!+.-1*#-#*'"-(!5'"3#-"

!@!34.*"+!5'"3#-"#!

!@!/'/%"#!"#-9(!

!@!-"+(%!'&!4%",9(9

!@!$'.*;'"#-(!4'3*#*'"!'&!2-((!=;%.'!*3!,*.%5#(6!2

%!@!/'/%"#!'&!*"%.#*-!=+*1%"!#'!2%!!"&?!

!"' #!

(#$) /!=;%.'!*3!1%.#*5-(!,')"?!

A %"%-#$!4*1'#?!

!

'/%"#3!-2'9#!4*1'#!>B!!!!! !*+ , % - .!

+ , #$ / (012" 345 )1 / 2!'12" 567 )1 , % - . , 2!"&1)8 !

C923#*#9#%B!!!! ! ! " 567 )!

*'"B!!

D

!* 2

!0 ,

cTmglKlml "## !!!! sincossin22 !!E<9-#*'"!'&!/'# ! !

#*'"B! !)8 , 9:;<F%&*"%!,*&&%.%"#*-(!%<9- 2#$ / ("& 567 ) 345 ) / !'" 567 )1 , =2)> #$1!

!0 , ?))@A0!3'!0@ , B)@)8 C , B )@=2)> #$1C!!!G%#

Variables and parameters for the model:

• m, mass of ball

• l, length of pendulum

• g, gravitational constant

• K, spring constant

• Tc, moment input

• θ, angle of pendulum

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 1

Page 3: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

• x, horizontal position of ball (zero is directly beneath pivot)

• I, moment of inertia (given to be ml2)

1. Build up a state-space representation of the controlled system

described above;

2. Linearize the model around the operating point (θ, Tc) =

(0, 0).

Solution:Calculate moments about pivot point A:∑

τ = Iα∑τ = Tc − (Kx)(l cos θ)− (mg)(l sin θ)

= Iα = (ml2)θ

Substitute x = l sin θ, and obtain equation of motion:

ml2θ +Kl

2sin θ cos θ +mgl sin θ = Tc

Define differential equation

θ =1

ml2

(Tc −Kl2 sin θ cos θ −mgl sin θ

)Let x =

θ

], hence x =

θ

]=

f(θ, Tc)

].

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 2

Page 4: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Consider operating point θ = 0, control Tc = 0. Linearize

function f(θ, Tc):

f(θ, Tc) ≈ f(0, 0) +∂f

∂θ

∣∣∣∣(0,0)

(θ − 0) +∂f

∂Tc

∣∣∣∣(0,0)

(Tc − 0).

Now,

∂f

∂θ=

1

ml2

(−Kl2(cos θ sin θ − sin

2θ)−mgl cos θ

),

∂f

∂Tc=

1

ml2

We can thus approximate the second non-linear ODE with the

following linear ODE:

θ =

(−g

l−K

m

)θ +

1

ml2Tc

Resorting to the introduced state vector x, we obtain in

conclusion:

x =d

dt

θ

]=

[0 1

−gl −

Km 0

] [θ

θ

]+

[01ml2

]Tc.

2

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 3

Page 5: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Equilibria and Phase Portrait

Determine the equilibrium point and sketch the phase

portraits 1 of the systems given in the following polar coordinates:

ρ = ρ(ρ2 − 1) , θ = −1 (1)

ρ = ρ(ρ2 − 1)(ρ

2 − 4) , θ = −1. (2)

Here ρ is the radius of the point in the plane and θ is the angle

between the radius line and the positive direction of the x axis

(θ is positive in the counter-clockwise direction). In other words:

x = ρ cos(θ) and y = ρ sin(θ).

Solution:

Introducing the polar coordinates x = ρ cos θ and y =

ρ sin θ, we have that ρ2 = x2 + y2. Let us compute the

1The phase portrait can be sketched 1. by hand, or 2. in MATLAB, or 3. via the “ODEsoftware for MATLAB” by Prof. Polking, available at http://math.rice.edu/∼dfield/

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 4

Page 6: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

dynamics for the Euclidean coordinates in the first instance:

x = ρ cos θ − ρ sin θθ

= x(x2

+ y2 − 1) + y,

y = ρ sin θ + ρ cos θθ

= y(x2

+ y2 − 1)− x.

A sketch of the phase portrait, obtained with the software tool

pplane , follows:

Incidentally, this dynamical model is easily prone to be

linearized in a neighborhood of the origin, where it displays

stability (eigenvalues −1 ± j) – however, the conclusion drawn

by linearization does not hold globally.

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 5

Page 7: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

For the second case we obtain similarly

x = ρ cos θ − ρ sin θθ

= x(x2

+ y2 − 1)(x

2+ y

2 − 4) + y,

y = ρ sin θ + ρ cos θθ

= y(x2

+ y2 − 1)(x

2+ y

2 − 4)− x.

A sketch of the second phase portrait, obtained with the software

tool pplane , follows:

2

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 6

Page 8: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Lyapunov Stability Check

Consider the continuous-time system x = 0.8 x and the test

function V (x) = 2 x. Here the state is a scalar. Which one of

the following statements is true?

1. V (x) is a Lyapunov function for this system and therefore

the system is asymptotically stable;

2. V (x) is not a Lyapunov function for this system and therefore

the system is not stable;

3. V (x) is not a Lyapunov function for this system. Furthermore,

given this information, we cannot conclude anything about

the stability of the system.

Solution:The correct statement is number 3. This function is not a

Lyapunov function. This is verifiable by observing that it is not

a positive definite function, and by direct calculations, namely

realizing that

dV

dxx =

dV

dxf(x) = 2 · 0.8 x

is also not negative definite.

We cannot draw conclusions on the stability of the system based

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 7

Page 9: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

on the function V (x). (In passing, the model is unstable, since

its only eigenvalue is a positive real number.)

2

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 8

Page 10: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Lyapunov Stability

Study the stability of the system:

y + y −(y3

3− y)

= 0.

Solution:The equilibrium is at y = y = 0.

Introduce the state variables x1 = y, x2 = y, obtaining the

following two-dimensional model:

d

dt

(x1

x2

)=

x2

−x1 +

(x3

23 − x2

) .

Let us linearize the model around the origin and obtain:

d

dt

(x1

x2

)=

(0 1

−1 x22 − 1

)∣∣∣∣(0,0)

(x1

x2

)

=

(0 1

−1 −1

)(x1

x2

).

The associated eigenvalues are −12 ± j

√3

2 , which allow to infer

the local (asymptotic) stability of the equilibrium point.

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 9

Page 11: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

What about global stability? Let us try with Lyapunov theory.

Let us choose a Lyapunov function V (x1, x2) = 12(x2

1 + x22). It

is clearly positive definite (we discussed this case in class).

Let us now compute its “time derivative” as follows:

dV

dxx = x1x1 + x2x2

= x1x2 − x1x2 +

(x4

2

3− x2

2

)=

=

(x4

2

3− x2

2

).

The negativity condition is verified for x22 < 3. Since the

conditions do not hold globally, we can thus draw again only

a conclusion on the local stability of the equilibrium, with no

real guarantee on the domain of validity of this conclusion. It

is again important to realize that, since the function does not

verify the negativity condition on its derivative along trajectories

globally, the study remains inconclusive about the precise domain

of validity of this Lyapunov function.

A phase portrait of the model follows, and explains the above

findings:

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 10

Page 12: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

2

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 11

Page 13: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Heat Exchanger

EECS 128 Introduction to Control Design Techniques

Problem Set 6

Professor C. TomlinDepartment of Electrical Engineering and Computer Sciences

University of California at Berkeley, Fall 2008Issued 10/30; Due 11/6.

Problem 1: Properties of the matrix exponential. Show, by using a few terms of the infinite seriesexpansion that:(a) eA(t+s) = eAteAs;(b) e(A+B)t = eAteBt i! AB = BA;(c) d

dteAt = AeAt = eAtA.

Problem 2. Matrix review. Let

A =

!

1 32 4

"

B =

#

$

1 4 72 5 83 6 9

%

& C =

#

$

1 22 43 6

%

& D =

!

4 23 1

"

What is A + D? AD? CA? AB?

Problem 3. Compute eAt, where A is given below.

A =

#

$

1 0 00 1 01 1 1

%

&

Problem 4: Heat Exchanger. Consider the simple heat exchanger shown in Figure 1, in which fC and

TH

TC

f

fH

C

TH

TCi

i

,

,

VH

VC

Figure 1: A simple heat exchange.

fH are the flows (assumed constant) of cold and hot water, TH and TC represent the temperatures in thehot and cold compartments, respectively, THi and TCi denote the temperature of the hot and cold inflow,respectively, and VH and VC are the volumes of hot and cold water. The temperature in each compartmentevolves according to:

VC

dTC

dt= fC(TCi ! TC) + !(TH ! TC) (1)

VH

dTH

dt= fH(THi ! TH) ! !(TH ! TC) (2)

1

Consider the heat exchanger in the figure, where fC and fHare the flows (assumed to be constant) of cold and hot water,

TH and TC represent the temperatures in the hot and cold

compartments, respectively, THi and TCi denote the temperature

of the hot and cold inflow, respectively, and VH and VC are

the volumes of hot and cold water. The temperature in each

compartment evolves according to:

VCdTC

dt= fC(TCi − TC) + β(TH − TC)

VHdTH

dt= fH(THi − TH)− β(TH − TC)

Let the inputs to this system be u1 = TCi, u2 = THi,

let the outputs be y1 = TC and y2 = TH, and assume

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 12

Page 14: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

that fC = fH = 0.1(m3/min), β = 0.2(m3/min) and

VH = VC = 1(m3). Assume that both compartments start at

a temperature of 1 degrees.

1. Write state space and output equations for this system.

2. In the absence of any input, determine y1(t) and y2(t).

3. Now, suppose THi = 10 and TCi = −10 degrees. Determine

y1(t) and y2(t).

Solution:Let us introduce the 2-d vectors for state, input, and output:

x =

[TCTH

], u =

[TCiTHi

], y =

[TCTH

].

We straightforwardly obtain:

x =

[−0.3 0.2

0.2 −0.3

]x+

[0.1 0

0 0.1

]u

y =

[1 0

0 1

]x+

[0 0

0 0

].

We know that x0 =

[1

1

]. Consider u(t) ≡ 0, ∀t ≥ 0.

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 13

Page 15: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Diagonalizing matrix A, it can be seen that

eAt

=1

2

[e−0.1t + e−0.5t e−0.1t − e−0.5t

e−0.1t − e−0.5t e−0.1t + e−0.5t

].

Notice that the diagonalization can be performed in MATLAB

with the command eig , obtaining:

A = T−1

ΛT, where

T =1√

2

(1 1

−1 1

),Λ =

(−0.1 0

0 −0.5

).

We obtain:

y(t) = eAtx0 =

[e−0.1t

e−0.1t

].

Now we are going to show how to diagonalize matrix manually and

compute the matrix exponential. First calculate the eigenvalues

of the matrix A, by solving the following equation,

det(λI − A) = 0

The two solutions are λ1 = −0.1 and λ2 = −0.5. Next

calculate the eigenvectors correponding to these eigenvalues, that

is, solve the following linear systems of equations where the

unknowns are the entries of the eigenvector vi = [vix viy]T ,

i=1,2

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 14

Page 16: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Avi = λivi

or

[−0.3 0.2

0.2 −0.3

] [vixviy

]= λi

[vixviy

]

Since there were two systems to be solved, we will have two

solutions v1 and v2. Since these two systems are not determined

we will have certain freedom in choosing a solution. For

example, the eigenvectors are v1 = [1 1]T and v2 = [−1 1]T .

Diagonalization formula is given by,

TAT−1

= Λ.

Matrix Λ is a diagonal matrix with the eigenvalues on the main

diagonal. Columns of T−1 are the eigenvectors of A (we form

T−1 by stacking the eigenvectors vi in the columns of the matrix

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 15

Page 17: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

T−1, next to each other). Next we have,

T−1e

ΛtT = T

−1

(I + Λt+

(Λt)2

2+

(Λt)3

6+ . . .

)T

= (I + T−1

ΛTt+T−1ΛTT−1ATt2

2+ . . .)

= (I + T−1

ΛTt+(T−1ΛTt)2

2+ . . .) = e

T−1ΛTt= e

At

so we conclude

eAt

= T−1e

ΛtT. (3)

Since we know the Λ (diagonal entries are eigenvalues), we also

know eΛt, since

eΛt

=

[eλ1t 0

0 eλ2t

]Notice that the last property is only valid for diagonal matrix.

Since we know T , we also know T−1, thus we can compute eAt

using (3). Now select the input u(t) =

[−1

1

]10, t ≥ 0.

We have:

CeA(t−τ)

Bu(τ) =

[e−0.1(t−τ) 0

0 e−0.5(t−τ)

] [−1

1

].

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 16

Page 18: sc4026 Exercise Session 3 (with solutions)aabate/2012sc4026/2012sc4026_ex3_soln.pdfsc4026 Exercise Session 3 (with solutions) Alessandro Abate a.abate@tudelft.nl Marco Forgione m.forgione@tudelft.nl

A. Abate, M. Forgione

Now integrate the following:∫ t

0

CeA(t−τ)

Bu(τ)dτ = Λ−1(e

Λt − I)[ −1

1

]=

[10e−0.1t − 10

2− 2e−0.5t

].

Pulling it all together, we get:

y(t) = x(t) =

[e−0.1t

e−0.1t

]+

[10e−0.1t − 10

2− 2e−0.5t

]=

[11e−0.1t − 10

2− 2e−0.5t + e−0.1t

]2

– Ac.Yr. 2012/13, 1e Sem. Q1 – Exercise Session 3 – sc4026 17