Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Automation
John Lygeros
2
Who and what?
Control theory
State equations
Solutions
J. Lygeros
Discrete time systems
State and parameter estimation
Feedback
PID control
R. Smith
MPC Convex optimization
Energy hubs
Mixed Integer Linear Programs
A. Bollinger (EMPA)
Market based
Automation
HVAC control
C. Gaehler (Siemens)
3
Reading material
Lecture notes
Slides, handouts, available on class webpage
Blackboard notes
Recommended book
K.J. strm and R.M. Murray: Feedback Systems: An Introduction for
Scientists and Engineers, Princeton U.P., 2008
h`p://www.cds.caltech.edu/~murray/amwiki/index.php/Main_Page
Other excellent books
G.F. Franklin, J.D. Powell, and A. Emami-Naeini, Feedback control of
dynamical systems, Prentice-Hall, 2006 (also used in Regesysteme I/II)
J. Hespanha, Linear Systems Theory, Princeton U.P., 2009
T. Kailath, Linear systems, Prentice-Hall, 1980
E.A. Lee and P. Varaiya, Structure and interpretation of signals and
systems, Addison-Wesley, 2002
4
Single room house
Heater
u(t) C Thermal
Capacitance
d(t) Disturbance:
xa (t) x(t) Internal gains,
Solar irradiation,
h
Room
Ambient Thermal Temperature
Temperature
conductance
5
Dynamics
d
C x(t) = h xa (t) x(t) + u(t) + d(t)
dt
Given
Dierential equation
Initial temperature
x(0) = x0
Inputs
u(t), d(t), xa (t) for all t 0
Can determine
x(t) for all t 0
i.e. we can determine the future
And if we do not like the future, change it!
6
If only life were so simple!
In reality
1. Multiple rooms, zones, wall layers,
2. Bounded inputs
3. Constraints from user comfort, regulations,
4. Disturbances, uncertainty
5. Unknown parameters
6. Thermostats, heat pumps, device dynamics,
7. Interaction with multi-energy carrier grids
8.
7
Multiple zones
x5 (t)
y1 (t) h21 h25 h23 y2 (t)
x1 (t) x2 (t) x3 (t) x4 (t)
u1 (t) u2 (t) h20 u3 (t)
ui (t) = Radiator
C2 x!2 (t) = h20 (xa (t) x2 (t)) + h21 (x1 (t) x2 (t)) +
h23 (x3 (t) x2 (t)) + h25 (x5 (t) x2 (t)) + u2 (t) + d2 (t)
8
State and input variables
x1 (t) d1 (t)
u (t)
x2 (t) d2 (t)
1
x(t) = x3 (t) !5 u(t) = u2 (t) ! 3 d(t) = d3 (t) !5
x4 (t) d4 (t)
u3 (t)
x5 (t) d5 (t)
h
ij
For i j, H ij = Ci (
if i is "neighbour" of j Generally h ij = h ji )
0 otherwise
H ii = H ij
ji
9
Dynamics
A b
0 0 0 0 0 0 0 C5 1
B D 10
Measurements
Only some temperatures can be measured
Rooms 1 and 3 equipped with thermometers
x (t) 1 0 0 0 0
y(t) =
1
! 2 y(t) = x(t)
x3 (t) 0 0 1 0 0
C
System in prototypical linear form
11
Structure of the dynamics
Matrix A
O diagonal elements non-negative
Diagonal elements negative
Diagonally dominant
hii h ji
ji
Matrices A and B, vector b sparse (many zeros)
12
Parameter identication
Thermal capacities and conductivities usually
Ci hij
not exactly known
Would like to estimate their values from
measurements
Apply known input
u(t), t [0,T ]
Measure resulting temperatures
ym (t), t [0,T ]
Measure disturbances
xa (t), d(t), t [0,T ]
Solve system to obtain
y(t) = Cx(t), t [0,T ]
Change to optimize the match between
Ci , hij y(t)
predicted by the model and measured
ym (t)
u(t), t [0,T ]
Applied input may be important
13
LTI systems in state space form
LTI = linear time invariant
x (t)
! = Ax(t) + Ev(t)
x(t) a
v(t) = u(t)
E = b B D
y(t) = Cx(t) + Fv(t) d(t)
State
space
v1 y1 x1
A nn E ! nm v2 y2 x2
y= x = n
v= "
m p
!
C pn F ! pm vm yp xn
Input vector Output vector State vector
14
LTI systems in state space form
a11 a12 ... a1n
For LTI systems state space equations
n coupled, rst order, linear dierential equations
A = a21 a22 ... a2n
p linear algebraic equations
an1 an2 ... ann
Constant coecients
e ... e1m
x!1 (t) = a11x1 (t) + ...+ a1n xn (t) + e11v1 (t) + ...+ e1mvm (t) 11
E= ! " !
x!2 (t) = a21x1 (t) + ...+ a2n xn (t) + e21v1 (t) + ...+ e2mvm (t) e ... enm
n1
" c ... c1n
11
x!n (t) = an1x1 (t) + ...+ ann xn (t) + en1v1 (t) + ...+ enmvm (t) C=
c ... c
p1 pn
y1 (t) = c11x1 (t) + ...+ c1n xn (t) + f11v1 (t) + ...+ f1mvm (t)
f ... f1m
y2 (t) = c21x1 (t) + ...+ c2n xn (t) + f 21v1 (t) + ...+ f 2mvm (t) 11
F= ! " !
! f ... f pm
p1
y p (t) = c p1x1 (t) + ...+ c pn xn (t) + f p1v1 (t) + ...+ f pmvm (t)
15
System solution
Since system is time invariant, assume we are given
Initial condition
x0 R
n
16
State solution
The system solution is
t
x(t) = e x0 + e At A(t )
Ev( ) d
0
where
2 2 k k
A t A t
e = I + At +
At
+ ...+ + ... R nn
2! k!
State transition
matrix
and the integral is computed element by element
2 2
a t
e = 1+ at + + ... if a
(cf. Taylor series expansion: )
at
2!
17
Output solution
Simply combine state solution
t
x(t) = e x0 + e A(t ) Ev( ) d
At
0
18
State solution structure
The solution consists of two parts:
t
x(t) = e x0 + e
At A(t )
Ev( ) d
0
Zero Zero
Total
transition
= Input + State
transition transition
19
Output solution structure
The solution consists of two parts:
t
y(t) = Ce x0 + C e
At A(t )
Ev( ) d + Fv(t)
0
Zero Zero
Total
Response
= Input + State
Response Response
20
The 2-norm
Definition: The 2-norm is a Fact: For all x, y R n
, a R
function i : R n R that to each
1. x 0 and x = 0 if & only if x = 0
x R n assigns a real number
n 2. ax = a x
x = i
x 2
i=1
3. x + y x + y
2
Exercise: Show that x = x T
x Exercise: Prove 1 and 2.
21
Inverse of a square matrix
Definition: The inverse of a matrix A R nn is a matrix A1 R nn
A1 A = AA1 = I
Definition: A matrix is called Fact: A is invertible if and
singular if it does not have an only if det(A) 0
inverse. Otherwise it is called
non-singular or invertible. Exercise: Show that
d b
1
1 adj(A) Adjoint matrix= matrix a b c a
A = of subdeterminants =
det(A) c d ad bc
transposed
22
Eigenvalues and eigenvectors
Definition: A (nonzero) vector w C n is called an eigenvector of
a matrix A R if there exists a number C such that
nn
C nn
Definition: A is called
diagonalizable if W is invertible A = W W 1
24
Symmetric, positive denite and
positive semi-denite matrices
Definition: A matrix is called Definition: A symmetric matrix
symmetric if A = AT is called positive definite if
25
Transition matrix computation
Change of coordinates using matrix of eigenvectors
Assume matrix diagonalizable
AW = W A = W W 1 Exercise: Prove
by induction that
Matrix of
Therefore
Ak = W kW 1
e-vectors
t 1
e At
= We W
Exercise: Prove this
where
e
1t
... 0
t
e =
0 ... e
n t
26
Example: 2 room building
u(t) Heating/
h21 u(t) ! cooling
input
x1 (t) x2 (t)
xa (t) ! Ambient
temperature
h10 h20
xa (t)
x (t) xa (t)
x(t) =
1
! 2 Temperature
each room
of
x2 (t) u(t)
v(t) = ! 4
d (t) d1 (t)
1
! 2 Internal gain of
d(t) = each room d2 (t)
d2 (t)
27
Example: 2 room building
h12 = h10 = h20 = 1, C1 = C2 = 1
For simplicity take
A b B D
dx(t) 2 1
= x(t) + 1 xa (t) + 1 u(t) + 1 0 d(t)
dt 1 2 1 0 0 1
= 2 1 x(t) + 1 1 1 0 v(t)
1 2 1 0 0 1
E
Eigenvalues of A:
1 = 3, 2 = 1
Eigenvectors of A:
w1 = 1 , w2 = 1
1 1
28
Example: Transition matrix
1 1 Using Matlab:
e At = WetW 1 = 1 1 e3t 0t 1 1
1 1 0 e 2 >> A=[-2 1;1 -2];
>> [W,L]=eig(A)
W =
W e t W 1
0.7071 -0.7071
0.7071 0.7071
1 et + e3t et e3t
e =
At L =
t 3t
2 e e e +e
t 3t
-1 0
0 -3
29
Example: ZIT
No external inputs
xa (t) = u(t) = d1 (t) = d2 (t) = 0
Zero Input Transition starting at
x(0) = x0 ! 2
x(t) = e x0At
1 et + e3t et e3t
= x0
2 e e e + e
t 3t t 3t
0 as t
Therefore ZIT 0 for all initial conditions
30
Example: Constant input
t
A(t )
General transition
x(t) = e x0
+ e At
Ev( ) d
0
For simplicity assume
u(t) = d1 (t) = d2 (t) = 0
xa (t) = xa constant
t t
31
Example: Constant input
=t
x(t) = e x0 + e
At (t )
1 xa
=0 1
=
1 et + e3t et e3t
t 3t
2 e e e +e
t 3t 0 ( )
x + 1 et 1 x
1 a
0 as t xa
as t
xa
32
Example: Constant input
x0 = 10
Say
2
10
xa=0o C 20
xa=20o C
9
18
8
16
7
14
6
12
x1, x2
x1, x2
5
10
4
8
3
6
2
1 4
0 2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
t t
33
Example: Constant input
What value will the state se`le to?
Se`le stop moving derivative w.r.t. time = 0
x(t)
! = Ax(t) + bxa = 0
1 2 1 1 xa 1
x(t) = A bxa = xa =
1 2 1 x
a
How do we know it will se`le to this value and not to
another value, or oscillate, or go o to innity, or ?
Look at distance between trajectory and steady state
34
Example: Constant input
20
A 1bxa
18
16
14
x2
x2
10
8
x(t)
6
2
x0
0
8 10 12 14 16 18 20
x1
x1
! = x(t)
e(t) ! = Ax(t) + bxa = Ae(t) e(t) = e At e(0) 0 as t
35
Notes: Diagonalizable matrices
For diagonalizable matrices, state transition matrix linear
combination of terms of the form
eit
Generally
i = j C, ,
So ZIT linear combination of terms of the form
if i = 0 ( = 0, = 0)
1
e t if i = ( 0, = 0)
t)
sin( and cos( t) if i = j ( = 0, 0)
t t
sin( t) and e cos( t) if i = j ( 0, 0)
e
i = j
Part of ZIT corresponding to
= 0, = 0
Constant if
Converges to 0 if
< 0
Periodic if
= 0, 0
Goes to innity if
> 0
36
Typical ZIT for diagonalizable matrices
Im()
Re()
37
Stability: Zero input transition
Consider the system
x(t) ! = Ax(t) + Ev(t)
Let x(t) be its ZIT
x(t) = e At x0
39
Diagonalizable matrices
Theorem: System with diagonalizable A matrix is:
Stable if and only if Re[i ] 0,i
Asymptotically stable if and only if Re[i ] < 0 i
Unstable if and only if i : Re[ i ] > 0
Proof: By inspection!
i t
Transition matrix linear combination of
e
Re[
for all initial conditions ZIT tends
i ] < 0,i
to zero
ZIT remains bounded and for
Re[i ] 0 i
some initial conditions is periodic (or constant)
for some initial conditions ZIT
i : Re[i ] > 0
tends to innity
40
Non-diagonalizable matrices (examples)
t t t 2 et
1 1 0 e te
A3 = 0 1 1 e =
At
t
2 t
0 0 1 0 e
0 0 et
te
41
Non-diagonalizable matrices (general)
Distinct e-values matrix diagonalizable (Fact 2.18)
1 = 2 = = r = j
Assume some e-value repeated r times,
In general, ZIT linear combination of terms of the form
1,t,t
2 ,,t r-1 if = 0, = 0
t t r-1 t
e
,te ,,t e if 0, = 0
sin( t),cos( t),t sin( t),,t r1
cos( t) if = 0, 0
e
t
sin( t),e t cos( t),,t r1e t cos( t) if 0, 0
Can be shown using generalized eigenvectors and Jordan
canonical form
42
Non-diagonalizable matrices (general)
Note that:
If
< 0,
t k e t , t k e t cos t, t k e t sin t t
0
Hence ZIT tends to zero (for some initial states)
If
> 0,
t k e t , t k e t cos t, t k e t sin t t
Hence ZIT tends to innity (for some initial states)
If
= 0,
1,cos t, sin t
remain bounded
t k , t k cos t, t k sin t t for k 1
ZIT may remain bounded or tend to innity
Cannot tell just by looking at e-values
43
Non-diagonalizable matrices: Stability
Theorem: The system is:
Asymptotically stable if and only if Re[i ] < 0 i
Unstable if i : Re[ i ] > 0
44
Stability with inputs
! = Ax(t) + Ev(t)
x(t)
Consider the system
t
Zero state transition
x(t) = e A(t ) Ev( ) d
0
46
State feedback
Assume all states measured
Select input as a function of state to make the system
do something useful
E.g. Track reference temperatures, minimize costs,
Linear state feedback
u(t) = Kx(t), K R mn
Closed loop system dynamics
dx
(t) = ( A + BK ) x(t)
dt
Can we select K so that (A+BK) has nice eigenvalues?
47
Controllability and controller design
P = B AB A B R
n1 dim( x)dim( x)dim(u)
49
Observability and observer design
Observability matrix, quanties state C
information contained in output
CA
Q= R npn
n1
CA
Theorem: If columns of Q linearly independent, then L can be
chosen such that eigenvalues of (A-LC) have negative real parts
y(t) yk
51
Sampled Data Systems
In embedded computational systems digital
computer has to interact with analog environment.
Measurements of physical quantities processed by
computers
Decisions of computer applied to physical system
Requires transformation of real valued signals of real
time to discrete valued signals of discrete time and
vice-versa
Analog to digital conversion (A/D or ADC)
Digital to analog conversion (D/A or DAC)
52
Sampled Data Systems
Usually value quantization is quite accurate.
Here we ignore value quantization, we concentrate
on time quantization.
Assume:
ADCsample every T
DACzero order hold
53
Sampled Data Systems
uk
COMPUTER
Z.O.H
SYSTEM
! = Ax(t) + Ev(t)
x(t)
y(t) = Cx(t) + Fv(t) u(t)
xa (t), d(t)
54
Sampled Data Linear Systems
How does linear system with sampling and zero
order hold look like from computer?
! = Ax(t) + Ev(t)
x(t) A ! nn
E ! nm
y(t) = Cx(t) + Fv(t) C ! pn
F ! pm
55
Exact discretization
After a couple of steps of calculus
Let xk = x(kT ), vk = v(kT ), yk = y(kT ). Then
yk = Cxk + Fvk C = C, F = F
xk R n and yk R p ,k = 0,1,, N
k1 Exercise: Prove
xk = A x0 + A
k ki1
Evi this by induction
i=0 (take A0 = I)
ZIT ZST
k1
yk = C A x0 + C A
k ki1
Evi + Fvk
i=0
58