Professional Documents
Culture Documents
Linear Systems
Linear Systems
Linear Systems
LINEAR SYSTEMS
u
( Br Pg Be ily )
-
for →
controlling
a 2b point mass
point mass
,
a
I:)
-
÷H: :
:
• e. renren.am ,
p
/ reformulation
-
general form X
-
- -
A B U
je
'
2e
.
H = P R2 =
p
, ,
:p )
Ie, ice
' '
⇒ Rz u
:]
p
I:) fo
= = =
on sina.ae mm
-
-
::
a-
Ea]
a- -
-
CE ] LF ] -
-
- ~
n
.
-
:÷÷÷÷:÷÷"÷÷÷÷÷÷÷÷:i y
Y c
l
-
se
.fi
where in is the number control
of inputs,
General state space
and Y £ It where he is the number
form of
÷.
for point Px m
a mass pxn
CE IR D t IR
=L : :X:'ll:b
-
-
Tz Lineaoisah on
-
-
in -
U
je a -
µ)
]
u
if = [ I ° + D
w i =
f Ce , u
) Y -
-
h Casa )
- O
" "
C ~
local linear model
se
we want to find a
,
-
operating point
around an .
-
Let's
A Point operating point
Controlling ZD thats . define an
# (Ro ,
Wo ) I = slot
thus
Gr Su
Case ) Uo
✓
2e No t U = t
U
Uy
=
=
,
TT T T
T
deviation
sonfallu
'
•
use Pie small deviation operating
operating
=
.
of u
P= ( Pa
Py ) pry
point point of
'
u
,
hey = of x
by joy]
un -
Ise
= -
, , I
Fy
, =
Uy =
'
similarly is
Py]t
gu
[ Pa
=
y =
.
thus
je =
f ( no + Sir ,
not Gu )
Ise =
f ( Hot Sse ,
Uo t Su )
÷t÷÷÷÷ :
:÷÷f
Taylor series Expansion
on
:*:÷: : ::÷÷÷.÷ .. .
..
t -
-
-
↳g 2¥
in
order
Highest Teem
2nz
H .
O .T "
"
1=17-1
state
-
control
input
"
-
ro
-
- o and there .
is no
, ,
thus
Item
)
II
III.
ai ' .su
item
.
-
o i
-
s.
age
-
- - -
-
-
.
.
.
nxm
I = Ase t B U
yup , zu,
2¥40)
So
8"
)
in Sa
! !
-
I
-
= o
I:#
.
Zu
7 is
¥ .
- -
- a'
⇒
similarly
Y =
hlseofsse ) = h ( no ) t 2k¥ .
Eat Hot
(!! )
2K
assuming hcseol h
gunge
-
-
o
=
Y = 2h17 .
En
22
- do :
÷=f:÷÷÷I: ¥÷f
C
www.onrene-uea.me ."
# i
-
:
be = A fat B Su
i
-
:÷:÷j
LIFT
c=sy:€
je f (se )
÷÷÷÷:÷÷÷
a
Azz )
a
,
HIM
"
- -
hee Y Csa
Y )
:
=
-
:
Zu
rdacotian
Computing
-
.
f- =
fkn , per
- - -
ten
,
Ui
,
ur ,
- --
Um )
t:
"
-
-
.
Unicycle
-
t.f.IE
-
#fed%n nonlinear
¥o÷zIE . .
f- Cse y)
tootling
• ,
# →
je
"
topic = U cos I
the state
lets define I resin a
IT
=
x [ a ETT sie =
[ oi ,
E-
=
, ,
= W
Y = a
)
X ( a)
1¥
se
y a-
• = the '
" ) -
-
= , ,
.no
.
+ acne
E -
-
Csi .si soit
T
. Y = be , y a)
,
Y -
- h Cr ) = E
evaluate non-linear system at
so we can see
C Ko
,
Uo ) = (o, O
)
)
1%17
ft : s.no . + ucoso .
Ex -
-
fcsex.us =
:
the Jacobian n
.
)
÷:
't:÷÷÷÷÷t I:÷÷:÷÷÷÷÷÷,
"
son
I)
out
( Eino Toa Ey
-
so
-
-
* s.no .
=L: )
O
:
at a → o
win :÷o
=L; :b .
:
Hill
"
¥
: .
rag :/
=p÷÷÷÷÷i
:#
÷÷e÷÷ ,
.
=
[ i o
] 3C
with scalar
T let 's start
h ( XD =
( K , Y ,
a) Targa Cto ) -
-
no
a is number
scalar
,
is gruff a
I
2h (X ) She 2h , 2h professor said that the solution is
=L: : :L
= ,
I 0
- - - act -
to )
:÷÷: :* :e
no
..
.
.
FYI
2h, 2h,
.
Tze Ty Klto V
correct
c÷H : : :X:H÷k:L
-
date) Ko
=
* -
alt - to )
= E No
q .
- -
- -
-
in
xi A X B U ie = a se ✓
ne't '
-
Correct
(g ! ! ) (Ff )
what said is
:*'÷
solution
'
from pwraa,
(Tf )
.
=
T-a-higher-otde-y.es
C X je = A se sector ) = No
y
,
A- is a matrix
to )
the control ( ee WIT is given EA
Lt -
u =
,
.
zee ) =
zeo
.
lineariseh
-
on does not
give exponential
sometime
=€!a÷t! !
E. :t÷
" A
all the system eat
capture
or .
e
,
- in
SYSTEMS proven
it be
LTI can
- by programming
-
I;÷E:→
y
Exponential is
e. the derivative of matrix
¥e*=dEi¥ ←
E.ie#ILaEE
How such system behave ?
K
! deft A eat
¥
=
a
=
I = Ase se (to) = Ko k
!
kA÷t fu
t §= ,
A
Ce -
s
) !
how the
system .
,
u
I
E Ak th
-
= o +
ka ¥ !
'
-
o + *
E
'
=
AE.oA÷!
.
-
dzfotoIH.to
we turnt control "
Mal
scale space DT
,
) Buk)
sie = Ase
-
the solution
f- Cest )
t
't 't -
)
Real
f.tda.tk
x e
-4
=
d
fct.es
.
'
= + . -
T
)
etttt
--
ie =
A sect )
.
de
define =
Ect ,
t) Butt ) t AOI Ct ,
t ) Butt)
Lt to )
EA
-
=
OI ( t
,
-2
)
so
thees
k =
Ect ,
-4 .
se CE )
dde7-ttl.AOILE.tojkltd-EG.tl in
Butt) t
I
DOICE to) A ICE to )
)
,
(Itt # Ect
= ,
der Butt)
-
' A ,
to) alto) t , e) BUNDT +
) I I ideating take
ICE t
-
= .
-
state space
,
with control signal this is oust sect )
je B ✓
d÷7=
= Ase t u
A Nlt) t Bu Cf )
is correct
Professor solution C. claim that professor
f!
.
Ect
Ct -4 But ) da
HH a ,
to ) Reto) t ,
correct
Now IN
fcehrhraoy
the Bobek on is
verify that
poof
start with initial condition .
C- = to Ic = Ase + BU
Heo ) -
- IO ( to ,
to
) alto ) t Cto , a) BUCH de y = Cse
E
-
-
I o
YLE) -
-
C Elt ,
to ) Rko ) t
C)Ect -4 ,
BUCH DI
Act -4 ,
{ II compute
UK) DT Don't don't
KLH -
-
IOCE.to ) se Cto ) + CE ,
t ) B worry
we need to
d÷H= ÷ #Ect
to )
behavior which
+ ,
e)BUCH de
studying the system
T the system stability
htt
.
= A ICE ,
to ) neo, t - - -
this difficult -
-
-
:n±÷*f
-
y
-
:÷¥¥a:i:÷ :*
-
: =
, ,
1. stability r
Because A is a matrix we cannot
2 .
9 other obscures
and
Eigenvalues eigenvector
scalar systems -
self ) =
eats co) to :O
A u = Xu
,
behaviour
-
I I t
lets check the
system cnxn pen
"
scalar
setts
teigen
④ a > ° matrix vector
↳ eigenvector ECqypu.gg
value
A "
acts
"
in different directions (eigenvectors )
§#
④ a "
"
MT
4:11 : ) ali)
• -
KCH
④ ^
µoµ,
a -0
- if I I I
or
Three
-
cases
of stability .
1.
etsympfioticaly stable
tf seco )
Feuding Eigenvalues and Eigenvectors
KCH -20 ,
-
Ace
" "
tf all Are
for
" =
in this Kalat at °
of XI )
CA
case
- I = o G)
2 Unstable
.
( do I ) )
to "
infinity crows
deff
up )
I)
.
o
-
la the case
of scalar a > o
,
-
3
Critically stable :
( (3g !) )
R
.
def
-
"
The does to so
system not
go infinity
bat does not either
go
"
to Zero
,
.
.
a. O
C d) ( )
a
-2 -
d -
G -
-
o
'
-
6 -
d t d - 6 = O
d, 4
=
At d 22 0
) de
-
=
-
=-3
(X -
4) ( X t z )
Example
Aag de
(: :)
:
s
-
A.
( A - AI ) it = o
''
'
µ ) l ! ! )) ( Y )
⇒
Eigenvalues
! -
-
-
o
outta - AI ) - o
f; :X: ) att ? )
"
o
-
a
K)
( c d) ( = o
- -
I -
202
}
U
hw#on
0
t
X, 12=-1
=
Infinite
,
-
go, - go, =o
-
I + 42 = o = I
If 4=2 Eigenvectors
2K
/
O
)
2 t
-
II I
-
A 0
-
=
U2 = I
=L? )
( to (
so it is the eigenvector correspond to 'd = O
eigenvalue di -
-
4
.
And also .
,
If we = I
l :)
* = -
i
Ur = - O .
5
to And there
eigenvalue X, so on
= 4
dik
.
Y
.
-
= o
correspond
-
to
are
infinite eigenvector et
a
particular eigenvalue .
de =L de -0 Iz = 1
,
geometrically 9=2 ,
K -
- I
# ,
A- t.tw
-
called
de -
-
l U = i if = 0
A * the
eigenvalue also
stretching factor
-
the ,
,
er = -
I if =L
,
it eigenvector , also called the
stretching
.
is the Direction
-
;
A the line at transformation
-
In
LD
n
.
-7 Av
describe the
.
i How can
eigenvalues
system behaviour ?
I
from state space system dynamic from A p e
p p we have
je AK
/A=pppT#
=
sect) =
eat seco
) -
theorem
µ#
+ T and H
'
= is nxn
the theorem of matrix
Using
'
find eigenvalues
-
suppose that we n
At PDP t
.
di Xr da and L
,
,
. .
. the
corresponding = E
" t '
eigenvectors
-
are
= p e .
P
I !÷ )
.mn#qneu::areaenumoa::ue::(su..÷: "÷÷÷÷
a: n: .:nm.?. . . r
"
" "
remain:
-
. .
.
"
( )
o
-
o
-
P vi v .vn
.
. .
-
.
the
Back to the solution
of
it:÷÷÷÷÷÷:)
state
space dynamic
me. # no ,
)P
"
! ÷
'¥
not
P
"
and desire a matrix n whose e
§! !g÷÷ a)
D= so
for tf Seco) the behaviour
of
characterised
by
-
the system is
the
.
isn't
IAP=PDT
it is clear now ,
?
if 7120 : sect)
- → u
is rotted
-
.
(to %)
add the system
A- = if
we
up
caused each
by
ruesponse
then the system
eigenvalue
the
eigenvalues are ×, se de = -
, dynamic will
look like
,
+
the
eigenvectors Y
( lo ) (9)
are -
-
Vr =
↳
rise
the
skin : :
self ) =
ett zeo
Tammany :
p.to : ) D= ( I :) a -
-
ar
al: :) oil: :)
--
.
-
If and only if
Re (d) so Ad E eight )
(et ele )
,
NCH =
ko
"
red
part of X is
negatif for all
) of system
A
(se
taahix
and sect ) =
Lt ) see Ct )
, ,
then --
burnable
,
"
there exists d which part of
Converge
→ to Zero
-
stable
that
Critically
It is
proved
also by an
example -
of eigenvalues
it can be deduced that the all X which part
zero
for
will add the
eigenvalues up of system matrix A
"
state behaviour
system .
"
and have negative
one
eigenvalue is o the test
Cn
graphical it can be
explained real "
part
,
as follows
K two
purely imaginary eigenvalues and
I✓
the test "
370 have
negatif real part .
deco
and transfer which
computed
as
state space
function
feigCAI-detfA.AE#
5h = AN t U
go at can be concluded that
RW
Y CR t CA) is
actually the
system poles
-
eig
-
=p
'
→ u
a-
Et
•
dynamic p
acceleration
-
the control signal
is the
particle
thus the it defined at
transfer function
-
fffT (
'
=
lets define the star se = P ,
F )
VCs )
thus we have
A- F re
form of
lets the state
the space
ftp./- ( Oo to )f:p ) ( Y )
get eaycace u
+
Bucs )
sxcs ) Axes ) je ←
-
=
t
l
n
position
(SI - A
) Xo ) = BUCS ) assume that we can
only observe Ahe
' the"
xes ) CSI Bucs )
-
A
)
)
=
Cio) ( Pp
-
y =
- YG ) = C X Cs ) t D VCs ) e
( (Oo ! ) ( I 1) 1=0
'
CSI At Bucs ) t Dues )
eight )
= C
⇒
-
"
=
(CGI -
A) B t
D) Vcs )
/
'
µ!
AT
Yui, =
c CSI -
B t D ⇒ o
=
=
C ad2( SI -
A
) B t D
'
d
Esta
-
-
o
part
-
CSI A)
=/ (so ;) ( Oo ! ) )
=
→ numerator dot -
-
DCS) → Denumeratm
! !/
stability of system
=/
Poles described the the .
'
obtained characteristic s
ftp.gaaa.be
by system =
D Cs) = O
+he
tchehaoalcteristic E-
gutian
|detCsI-A)= is
5=0
From the we know
state space and
poles
the are
eight )
CEIL : ill:# to ]
PsgI!I
Y (s) Kp poles : "
(4) =
U (s) ⌧p s + 1
where y(0) = 0.
(7) ẋ =
1
x+
Kp
u
eight)⇒
deff et
-
-
d
) - o
⌧p ⌧p a.
(8) y = x
amour
¥
- - '
1 Kp .
In this case A = ,B= , C = 1 and D = 0
⌧p ⌧p
3.0
2.5
2.0
Response (y)
1.5
1.0
0 2 4 6 8 10 12 14
Time (t)
47 plt . show ()
d2 y dy
(10) ⌧s2 2
+ 2⇣⌧s + y = Kp u(t ✓p )
dt dt
d2 y ⇣ dy 1
(11) 2
= 2 y + Kp u(t ✓p )
dt ⌧s dt ⌧s2
⇣ 1
(12) s2 Y (s) sẏ(0) y(0) = 2 (sY (s) y(0)) Y (s) + Kp e s✓p
U (s)
⌧s ⌧s2
(13) Y (s)(⌧s2 s2 + 2⇣⌧s s + 1) = Kp e s✓p U (s)
Y (s) Kp s✓p
(14) = 2 2
e
U (s) ⌧s s + 2⇣⌧s s + 1
+5-2455-1=02,11
where y(0) = 0 and ẏ(0) = 0
poles i
4 INDRAZNO SIRADJUDDIN, ZAKIYAH AMALIA
'll:c '÷! ti :D
⌧2 ⌧s
2 s3 de
0 -
(18) B = 4 Kp 5 .
⌧2
⇥ s ⇤ ,
(19) C = 1 0
'÷÷ .to
f
(20) D = [0] "
2.1.4. Python. The python code is listed below .
5 + .
6 @author : idr
,
7 """
N
29¥
d
¥,
8 o
t + =
9 import numpy as np
10 from scipy import signal
|Tidt29Esdtl=I
11 import matplotlib . pyplot as plt
12 from scipy . integrate import odeint
13
14 # tau * dy2 / dt2 + 2* zeta * tau * dy / dt + y = Kp * u
15 Kp = 2.0 # gain
16 tau = 1.0 # time constant
17 zeta = 0.25 # damping factor
18 theta = 0.0 # no time delay
19 du = 1.0 # change in u
20
21 # (1) Transfer Function
22 num = [ Kp ]
23 den = [ tau **2 ,2* zeta * tau ,1]
24 sys1 = signal . TransferFunction ( num , den )
25 t1 , y1 = signal . step ( sys1 )
26
27 # (2) State Space
28 A = [[0.0 ,1.0] ,[ -1.0/ tau **2 , -2.0* zeta / tau ]]
29 B = [[0.0] ,[ Kp / tau **2]]
SYSTEM DYNAMICS SIMULATION USING PYTHON WITH INPUT VARIATION 5
30 C = [1.0 ,0.0]
31 D = 0.0
32 sys2 = signal . StateSpace (A ,B ,C , D )
33 t2 , y2 = signal . step ( sys2 )
34
35 # (3) ODE Integrator
36 def model3 (x , t ):
37 y = x [0]
38 dydt = x [1]
39 dy2dt2 = ( -2.0* zeta * tau * dydt - y + Kp * du )/ tau **2
40 return [ dydt , dy2dt2 ]
41
42 t3 = np . linspace (0 ,25 ,100)
43 x3 = odeint ( model3 ,[0 ,0] , t3 )
44 y3 = x3 [: ,0]
45
46 plt . figure (1)
47 plt . plot ( t1 , y1 * du , ’b - - ’ , linewidth =3 , label = r ’ Transfer Fcn ’)
48 plt . plot ( t2 , y2 * du , ’g : ’ , linewidth =2 , label = r ’ State Space ’)
49 plt . plot ( t3 , y3 , ’r - ’ , linewidth =1 , label = r ’ ODE Integrator ’)
50 y_ss = Kp * du
51 plt . plot ([0 , max ( t1 )] ,[ y_ss , y_ss ] , ’k : ’)
52 plt . xlim ([0 , max ( t1 )])
53 plt . xlabel ( r ’ Time ( $t$ ) ’)
54 plt . ylabel ( r ’ Response ( $y$ ) ’)
55 plt . legend ( loc = ’ best ’)
56 plt . savefig ( ’2 nd_order . pdf ’)
57 plt . show ()
Listing 2. Python example
3.0
Transfer Fcn
State Space
2.5 ODE Integrator
2.0
Response (y)
1.5
1.0
0.5
0.0
0 5 10 15 20 25
Time(t)
iii. instill
"
I §
?
U
Y =
C X t n
yall )
( Pp )
o
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
thesis
plots
""" stake space VS ONE-HIT
Created on Mon Apr 13 12:00:30 2020
p a
↳
@author: idr
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal The some results
from scipy.integrate import odeint
yq
u = 1. - a ,
um,
gag
t = np.linspace(0, 25, 100) y
u1 = np.ones_like(t) * u
7ToH:tHN
than
t1,y1,x1 = signal.lsim(sys1, u1, t, [0., 0.]) eni find condition sea sea o
in
2 state
space
off Ax t the
→ =
def model(x, t, u):
aieonuintmame
'
dxdt = x[1]
dx2dt2 = u
return [dxdt, dx2dt2] .
x2 = odeint(model,
-
[0., 0.], t, (u,)) x =
1¥ =/ model
plt.plot(t1, x1[:,0], '-.r')
plt.plot(t, x2[:,0], ':g')
"
eigenvalues =
roots =
poles
print ("Eigen Values \n = ", eigvals)
f, = O
S z
= O
,
plt.show()
-
we or
Escorcia :
control gain
following around se
linearis the system
.
.
- o
closed
the idea is to
pick k so that the -
loop
(
= LE t VE t ee
system hone the desired
eigenvalues poles )
't
( ) d- Cassi
x =
2-
,
E U - T
Before we confirmon the on
,
why the
fzofessor choose
megabit sign
ie -
-
fi ) ( item -
-
+ ye +
en
.
Ha for the controller design
U =
k se
"
: :*
which that
. ,
mean
expecting
If the system converges exponentially
=L:c :/ =L : : )
.
""
an
the
u.
.
a. e.
. ..
::÷s
.
I t:÷÷÷t ,
"
-
t
method
ft the observed output is only t than Pole
placement
that the
the idea select Hehe k so
,
(t )
Y ( c o
) Poles megabit red parts eigenvalues
= are
the
,
C C o
)
computation
=
lets recall the eigenvalues
Cfg ) toemenapmpks
D ofataahix ta
mm!
: o -
(M )
-
det at
att: ill
-
-
-
is
µm' Id ?
the Lte state given
-
space as
a def = Cm a) Lma N
.
- -
- mum
,
m
Fe =
Ase + BU
,
if = Cse
@g_p.u
= Mima -
limiting )d t M - m,
my
P N (m
- , t ma )X t Meng - M-
Ms - O
ie :
(: f) set
(7) u
A .
.
-
-
Cme
-
-ima > ± EEEa.meim.TT
should *eigenvalues from
To stabilise the
system the control signal U it seems that
finding the corresponding matrix
that element
be given . the question is what is u
of
ra is
affiant .
polynomial
are
completely determined
te -
( X A) (X da ) Cd du
) the closed loop diagram
f- (d) -
-
. . .
- -
o
=
II (d di )
f-
o
⇐ nth order Be
IT
= -
-
u
-
£=*B
[
for second order
f- a) = (d - A) Cd -
di ) =o
TU
-
stabilise the -
X, =
-
I to
system then the desired
'
characteristic Equation y
aliases the controller
design
(d) (d c) Cd-i ) I 21 +
1--0 always guarantee
f + +
stability ?
=
=
Not
-
The is no
Back to the
professor
answer
state proven
given space .
je Ase Bu
(Te! ) E-
.
= t k -
-
state control
is B. then whatever u
can not change
feedback
=o
the word
system dynamic
other
fee
(Rea)
in
)
or
U = -
,
ka = - Kae ,
" "
the
system
can
is not rich then
plugin
e
if B
je Ase Bk se
not be controlled .
To see this
,
-
=
the state
in space
this is a new
system matrix
after Rue , A Ree = t Buy
u is
given and called It
where instant
-
④ ) (9) )
'
F- CA ) La *
-
-
Bk =
-
en ) •
an .
.
.
in
o
EM: :)
'
Bo
Ro
th )
controller the would move the state
= suppose the
initial to the desired state seat
state ko
from
-
achieved it
that
and take n time step to
.
how
µ
Kf 's no
(ad
the
( )
= -
eight ) -
-
def E - KI =
def -
⇒
,
Kao R = A Ro f B Uo
,
! a)
-
-
det a o = Bao
.
.
z
-
d Kei se =
A R, t BUI
,
£ - d (Ig -
X) t k
,
= o = A B Uo t BA
,
IT t ked tie , = O
E -
- 2
dog = A Nr t DU,
have
'
so we
cchatadenshc function
= A CAB Uo t Buc ) t Bur
the desired
AZB Uo t AB Uh , t Dur
d'
=
a 2X t I = O
BY !! )
I
and the
system characteristic function hah " m -
-
x. + e. a * -
- o
n a
the
will stabilise the
M e d- mention of input
systems
Examples
If:÷ )
"
:
C
9)
an
Lila
'
① ie
=L ?
-
see
T '
exists
the state number n = 2
the solution if
and
only if
the of it the
controllability
Fanu
taasnix is
rank (T) -
-
n
T =
(B AB )
(T) linearly independent
( I 9) l! ) ) :( ! I )
tank is the bet
of
mum
(
'
=
tows column #ahu in
of
a-
then validate
we must if
The
system dynamics
number state can not
is
equal to the
of .
Therefore
M is called
controllability matrix
.
be controlled .
precious of matrix
( f) (9)
tank
②
a
sie
Oo
= see
have
suppose we
Hi t 2 Rz =
4
k
, t 2K = 5
the date number n =
2
l: HT 't:L Nz
i c: :X :lH : : )
-
A-
n
"
m
"
rank (f) = 2 = n
The rave
of CA) HER the
therefore system dynamics
= , and
that where
means rank
deficiencies , is controllable
the ( )
.
and
.
as no se
,
see that
for
x, t 27 = 4
⇒ ie =
( A - Bk ) K
goes -1 4K , = 5
-
(⇒ (T)
~
←(
=
A
is not the pole placement
to
arbitrary
independent onsd
sinew the second rows is 2 times the first row
eigenvalues is possible if only if
the matrix E is
full tank
.
rank (F) =
n
I
Point to
point us .
Trajectories . Case studies
-
is
meant
controllable
that
system dynamic
by giving
,
which
¥0
robot consists of
U = -
KR Segway Dynamic
the control signal
U can
bring sub system Dynamic
desired
system dynamic
to the
the segway a
unicycle t inverted
pendulum e -
- -
controller can
necessarily that u
" • sign it as a E- aw
I
state
follow to any arbitrary Jez = Tsin a
trajectory .
r
:{ an.ge?u.-oon-
ta-exam.pe of point maps Is
the state ( p B 7 where
se =
, the state se = ( sci ,
se -
T input -
-
T
P is 8 is
Velocity
the T
the and ( )
position
o
z Csi je )
u w
-
-
,
=
, , ,
NP
sext
1-
t-Bag
•
.
. .
Ock ,
the blue line is the desired
suppose the state
,
trajectory is it possible that
Io ) of
u can
,
see =
(¢ ,
* the angular position
the state the R* pendulum normal
more Seo to of the
from
given
desired trajectory ( blue line ) ? to the gravity .
lhtow input
The answer is impossible ,
Itueufegtttmheec
.
)
'
Th
feet
'
can the
point mane in the negative a-
,
er
velocity ?
direction
using positive In = torque toon
trajectory the right wheel .
*
B K : ( see ,
see ,
it
,
a
,
E
,
& ,
d)
N
[#
K
• •
ko a = ( Te , Ip)T
/ Y sa the Dynamic
States
P x
-
-
Coosa ,
asana
,
ii. E. it oi , ,
IT
Segway dynamic diff eq .
Ipa ) 'd
Mw t sin t Ie t
as E- =
Tn
?
'
Sabaean
modeling
to missaoable
horrible diff equation
-
f linearis et at room ( se
,
u ) -
- Co , o )
dad
give
all
parameters value
we have
sie a Aoe t Bu
l:÷÷÷÷÷: t.it
d O
=
Ki
Zz a o
:::÷: i
§ o o
o
o
o
o
o
o
o
72.49
d
O
l O
0
.
I
O
-24 .
-
O
24.15
Check the
controllability Mahin TT of the
system
using python :
rant ( Tl ) =
6 the state number is 7
controllable
which means that thye system is not fully .
not be controlled
system
state can
complete the
so
for a
the base
only it and ate enough for driving then
If
w
,
system dynamic
state
we can reduce the
by removing the
unicycle
c :*.n÷÷÷÷÷÷n⇒
ie a
O O 2.16 o
: :÷ .
using python
state number is 9
rank (F) = 4 and the new
controllable
rank therefore
the system is completely
that is
full
.
.
,
now let's stabilised the robot at desired
ad =
(od ,
cod ,
O
,
0
IT
in
A T
je = se + B u
the
pendulum position is uptight
and the angular velocity
of
E R Kd the
pendulum is zero
= -
£ = je Since Hd = O
E = A
( e
toed ) t Bu
E A A Bu
=
e t Rd t
÷÷÷ it:L
*.
then
E = Ae t Bu
to the desired delate Rd
by setting the controller to drive ,
Eigen values
the
the pick the of error system
If professor
dynamic as
-
and characteristic
what is the desired Eg .
ke
)
U
(d de ) CX Mfd A) H da
- -
fay
- -
-
-
E ( A Bk ) ?
=
-
e
AT =
( A -
Bk ) / control signal
in: : :÷÷n÷÷÷÷÷÷n :
#hand
exercise this by
: : :c
I
:p
.
-
-
Aase - AE -
L Cee - ed
u Y
→
se
y -
ca : = A ( se - ai ) LC ( se - I
)
1-
-
⇒
-
i
-
'
,
-
CA )
i ,
e LC e
L =
i -
.
- -
. . . . .
. -
Since don't
-
what is value
to stabilise the error
dynamic e.
we how w exactly the
to
The observer has mimic the
system dynamic
without
giving
the control
signal a path
ie Ase
pole placement again
=
if = Cae
so the
is
copy of the system dynamic I reactor
IIe feig ( A -
LC )) L O
je A E I state
Eixample
=
=
the
estimate -
if I I
¢ ! 1)
c
the dynamic
=
=
Ie
J output I-sat.LI?e se
-
the estimate
-
-
-
Therefore ,
we need a notion
of
how
good
the state estimate mimic the real system .
Y = ( l - l
) K
theofsetuetdltignx )
to the estimate of
the
system dynamic cpaeofcfor )
a AI c- L Cy -
CI ) e- = CA - LC e
w -
p >
T
.
,
,
matrix
-
predictor cot rector
e:p ite
:
e .
-
-
-
" "
Leuenberger observer
How do we choose L ?
( j! ÷:L )
' ' '
=
e
Choosing the observer Eoin
,
idea observer L
the
of choosing
the
gain -
is stabilise the Iab tuner such that the ~
A
between the actual state se and
difference
the estimated state
eig (E)
at zero
the characteristic
is
equation
Lim e se I 0
of the observer
-
-
=
t →o .
simvlasi dougan odeout
program
E:L le
:
e
" "
⇐ it : :X :L
-
-
"
III. le
r c
I :L
=L :L
-
-
C
observer
Kitt: :X:b If it :D
-
-
a -
eight ) .
-
det
ft - II
) #!/usr/bin/env python3
.it/--detfII.'
# -*- coding: utf-8 -*-
deff fi
"""
-
-
Created on Mon Feb 24 09:13:35 2020
-
@author: idr
"""
import numpy as np
)
'
III.
" from scipy.integrate import odeint
import matplotlib.pyplot as plt
a
-
plt.rcParams['text.usetex'] = True
thus the characteristic the observer import os
equation
of #
os.environ["PATH"] += os.pathsep + '/usr/local/texlive/2018/
-
bin/x86_64-darwin'
( -
l -
Li -
d) C- 2 + L2
-
d
-
) -
↳ (2-14)=0 # function that returns dz/dt
je
-
An
-
z
- n
def model(z,t):
d't
y
=
-
d(
,
, (3 t Li -
La
) + 12+24 the)
= O dxdt = -z[0] + 2*z[1]
d2xdt2 = -2 * z[1] y = Cx
I - -
y = z[0] - z[1]
- - -
)
- -
- - - n
htt CI
gaiD=
n
desired that the AI
'
now we
eigenvalues d, = I t
- -
=
yhat = z[2] - z[3]
thus the desired characteristic equation as dxhatdt = -z[2] + 2*z[3] - (2./3.)*(y - yhat) CI
d2xhatdt2 = -2 * z[3] + (1./3.)*(y-yhat)
Iti ) ti ) to
r
co - dzdt = [dxdt,d2xdt2, dxhatdt , d2xhatdt2]
d't Xtc . = 0 return dzdt
z0 = [2,4,-3, 5.] 24 5
3. t Li Le -3
2
-
=
# time points in
It 24 + L2 =
I t = np.linspace(0,10.)
wrong estimates
# solve ODE
solving those we have
z = odeint(model,z0,t)
↳ = -
Ys
# plot results
plt.figure(0) -
10
plt.plot(t,z[:,0],'b-',label=r'$x$')
113
-
↳ =
plt.plot(t,z[:,2],'r--',label=r'$\hat{x}$')
finally if
we pick Kef -
Y, ↳ IT then plt.ylabel('response')
plt.xlabel('time')
-2
will stabilise the estimate plt.legend(loc='best')
the observer error
plt.savefig('observerx.pdf')
to zero
)
plt.figure(1)
-2
( Yg Cy ca )
•
~
plt.plot(t,z[:,1],'b-',label=r'$\dot{x}$') '
a- at
④
-
plt.plot(t,z[:,3],'r--',label=r'$\dot{\hat{x}}$')
=
plt.ylabel('response')
plt.xlabel('time') →
Where k = ( se , Jez )T Nz =
Ie ,
plt.legend(loc='best')
plt.savefig('observerxdot.pdf')
The will look like
qtqfife plt.show()
^¥L
sea ① and show that
o -
the estimate converge to the
actual state
t
← O
3 x
x̂
2
O
response
K RT
°1 =
°2
°3
0 2 4 6 8 10
time
O
5 ẋ
x̂˙
3
response
1 x' =
E
0 O
0 2 4 6 8 10
time
another words
design
in
does the observer
observable
completely
'
No
the same as the controller design
therefore pole placement for
which does not always work .
an observer to
arbitrary poles /
eigenvalues is possible if ond only
I ⇒ check the Ct the system is completely observable
-
controllability
f
check the
Observability .
⇒
e. n Discreet time form controllability
-
A- see
Nute
=
he can
;E⇒95£Ety
=
so for 6=0 -2 ke n -
I ↳
To C Ko
=
Building Block
Y, C Re C Ako
t.kz?ttaeffe-B4J
-
= -
Ye Ck CARµ= Cairo
-
-
-
"
'
I
÷
I
Hnhokahi ob¥l
"" ~ -
Tai CIA no
¥e
÷H¥÷÷)
4-
-
a 9
✓ pokpCaam
^ tells
diode
observability
This building us
is
observability matrix
It
r
of prove
fall rank
of
u
a o
TROVE in the matrix
form
Ti-AoetBugfghIsffsugea@J.fA ) (f)
-
Bk Bk
Y = CR
is control Labe 0 A -
LC
and observable
y
U Kae sie CA -
BK ) se
Thi is an upper triangular
= -
⇒ =
design
theory
.
but we
adnaly have I thus
the
eigenvalues of triangular
,
u = - KI blodetmatnix are
given by the eigen
Values its blocks
the observer of diagonal
now estimate se
using thus :
£ - Asi t Bu + L Cy -
ca )
- -
eighth ) =
eight -
Bk
) eight - Lc
)
Predictor
.
corrector
involves hone
pole placement
which
by
we
H design that
Re ( eight ))
v
- Ek so
e- =
(A - LC ) e
and
-
the observer (the Ceig CA - LC )) to
design
I
separately .
where e K
Therefore
-
SO
Cig
CH )
now the Joint dynamic between
be ,
-
the whole
system will be
thi is the real dynamic
stable also
by substituting
u = - KI
asymptotically ,
je = Ase - Bak CK - e
)
PROVED
= CA -
Bk ) a
t Bke
Observer dynamic
e- = Ca -
Lc ) e
In complex plane
:{
Final Block
Diagram of state
,
and
physics of the system lpcawf of state feedback
06 Servet can be
,¥÷T
÷
T :::÷:¥ o
list
poles
:÷÷÷÷÷÷÷÷÷
.
i
'
÷ .
..
Eigenfunction
*
then
Red poles are
faster
The should
Blue
poles .
Keys : - observer go
much
faster than
the state feedback
otherwise the obsetaet
,
the observer
Large gains for
-
-
will not be a
problem
Circe the observer only
be
computed in
software
-
Large gains for state the
volts DC motor
for example a 22
U = 12 Volts .
Kampala
E-
observability
-
high (Cea )
Robot actuator r =
¥÷'
"i
fi :c:* ):
-
Differential Eq :
boi )
E
gL( Kei
-
-
( to ) }
°
Young}pendent
=
I = moment
of neo
-
ha b -
-
friction coogea.eu
ka :
torque constant ,
i = motor current
-
Ca, it )T ,
si -
- CE , EY ,
a- I
taste control
reference Tracking problem
for position 4=0
Case
the controller should
{ ÷)
dive the
( : Ig )
u
• se + "
'
= '
actuator to
follow the desired state
U*=(f* f-
)
*
reference where
y = ( i o
) a ,
Ext o
⇒ a*=(f* o
)
-
.
controllability -
meaning
that the
angular
T = (B AB ) velocity a* at the desired
angular
OT should
(( ÷ ) ( : !g ) ( Ig)
position be zero
=
ex =
K - R
:*
fi :n:÷¥=f¥,
'
↳
.
in
-
differentiating wrr t .
time
(F) (
full )
* *
tank = 2 rank
in = je - I a. so
en = sie state
-
y constant
of state is 2
Ese = Ie Esea R -
Z* Characteristic function of the error
↳
dynamic
-
)
" e- *
) µ ÷ ) f! ) @
+
(
i Aat Bu
A Bk
eig eig
=
Kd
- -
-
-
i.
=
Aea Ar* BU
( :c
+ + l
"
8
( ! ÷) f :* )
Aa*= .
o
o
,
y
-
o,
! Tori ))
dot
a=AeatBg
e- -
-
÷
- . .
the error dynamic
)
of C
-
-
÷
= se
det
)
't
=
cleat n
sett .ua -
one -
d
= C en t C , .
Cea Cl )
(9*1
o
=
t
dfyeo.sk ,
xd ) t 0.2 Kc = O
Cee Ext
d (440.2 Kc ) X eke
'
O
y t t t o =
-
-
term
state output in
of error
-
-
I de - -
I
b =L characteristic
3=2 , ka -
- o .
I
,
so desired equation
we are
going
to
design
the controller
(ht s ) ( Xtc ) = o
with observer
an
.
Thus the state
T t 2X t I = 0
U =
-
Kee Kc =
5
En = ( A -
BK ) ee ooo k =
( 5
,
7.5 )
ka ( Kc ka )
le placement for observer
-
P the
The observer design
.
observer
-
characteristic equation of the
we have obtained the state feedback
( ) eigfco )
gains
k >
Car .
so ) eig A - LC -
-
-
( lol
.
84 : ÷) fi! :))
a = -
Keese "
-
remember that
Ese = K -
sext
÷)
dont have
reality but
in we k '
eig
the estimate I this the a
,
f! ! ) )
estimated error is
i. E sett
detff:L! !)
-
⇒ -
o
= -
? ÷)
the controller
we
compute as
⇒ det
-
- o
a =
-
Ki . ,
bus
f- the state output usinganob server
is
the d) ( la X
) t Le o
-
-
- -
-
I = cense t f
't
'
£
~
a AI + L Cy -
Y ) We want the observer much faster
-
F
p the state controller
than feedback
gaia
Tg: gaffes a. man
lets the desired eigenvalues
matrix pick
predictor Tt¥ de =
- lo de = -
lo
) ( Atco )
thus tco
is o
je Ast + L ( y Cei ft
) Ty god
= - -
0
+ too
=
observer error
dynamic
thus
E. CA -
Lc
) e
where → I -14 =
20
4 = 19.5
,
e =
R I the too
tell
-
→ =
↳ =
90.225
Therefor the observer gain
L e-
( 9.5 ,
90.25 )
Complete block diagram tracking #!/usr/bin/env python3
Problem with an Observer control # -*- coding: utf-8 -*-
"""
grate feedback Created on Mon Feb 24 09:13:35 2020 .
Ea=AeatBU-÷
@author: idr
tureen
-
U """
¥÷±e÷¥±u+uaF
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
⇒
import os
os.environ["PATH"] += os.pathsep + '/usr/local/texlive/
2018/bin/x86_64-darwin'
↳
def model(e, t, xd, K, L):
Bu
↳ Ese
dedt = Ae[0] + Bu[0] ee -
+
fu=keTjE7one
d2edt2 = Ae[1] + Bu[1]
"
7%9672.us?cei..o.*
y = e[0]
#observer
yhat = e[2] + xd[0]
Bu_observer = [Bu[0]+L[0]*(y-yhat),
→ Bu[1]+L[1]*(y-yhat)]
Heise
→
But Lcy I -
)
Ae_observer = [e[3], -0.5*e[3]]
dehatdt = Ae_observer[0] + Bu_observer[0] 3. Ese
Abet But Llg -8 )
Ht:)
-_
# Eat Kreis
xd = [np.radians(45.), 0.]
=
x0 = [np.radians(15.), 0.1]
# initial condition
fam )
# e0 = [errortheta0, errorthetadot0, errorthetahat0,
l: .lu
errorthetahatdot0]
ou -
-
-
-
e0 = [x0[0]-xd[0], x0[1]-xd[1], np.radians(10.), -1.]
.
K = [5, 7.5]
L = [19.5, 90.5]
# time points
Eta
t = np.linspace(0,10.)
Jeiadt
AI Bar L
(Y F ) → in -
+ +
-
# solve ODE
-
in -
I
-
plt.figure(0)
plt.plot(t,np.degrees(z[:,2]) ,'b-',label=r'$\hat{e}_x$')
plt.ylabel('response')
-
A- Eat Au*t BUT L Cy yn) -
plt.xlabel('time')
plt.legend(loc='best')
plt.savefig('observerehat.pdf')
-
to:* ,
plt.figure(1)
:c:
plt.plot(t,z[:,3],'b-',label=r'$\dot{\hat{e}}_x$')
an plt.ylabel('response')
plt.xlabel('time')
plt.legend(loc='best')
plt.savefig('observerehatdot.pdf')
=L: so
plt.show()
①
works ! !
thus
In = Aeta 1- But LCY I -
) higher - o
BEYOND POLE PLACEMENT
The general design structure :
ee =
④
- se
si = A Tet Bu +
①( y - CI
)
t t
stale feeback observer
design design
-
f-town what we have studied both
be derived
design can
using
Pole placement
LQ :
"
K = R BT p
'
ATP PBR BT p
-
° = t PA t Q -
Kalman
"
L - PCT ( Do Dot )
where Do is the covariance
of
the measurement
mise model .
O = At P t PA -1 DI DIT -
PE Cpo pot Jcp
until Dont
worry about
the wrathful
up
now
,
The point is
of other methods you
feedEach
.
-
-
have studied LTI
congratulation you ,
and control
system Dynamics .