Scarica MIDA 2 - Model Identification and Data Analysis - Polimi e più Appunti in PDF di Model identification solo su Docsity!
INTRODUCTION MIDA^2
MIDA 1 was^ a general introduction to^ statical^ learning for^ dynamical systems
MIDA2 has^ a^ focus^ on^ control oriented^ learning. We will'se^ two^ differents^ topics :
·
system Identification/^ modeling in^ a^ black^ box^ approach
· variable estimation (softwar/virtual
sensing) (sensors)
REFERENCE EXAMPLE/ MOTIVATION^ FOR^ MIDA 2
Antilock (^) Braking System (ABS) in a cari eragump (^) V(t) X(t) brak gsem^ >
System
G (output (^) y(t)) Voltage appliad^ wheel^ slip battery (^) to the servo Islittamento delle (^) ruote) motor of the (^) brake Icontrol (^) in put u(t)) Wheel (^) Slip: Yu(t)
N(t)
· g T
* force against the motion lnear speed of contact
v(t) - w(t) - r
point
Longitudinal slip^ of^ the^ wheel^ :^ X(t)^ =
adimentional (normalized)
N(t) variable
o ->best
braking point^
~ Best brake in the lower time .
↓ ↑ ↑
UnfortunatlyIs on^ the^ edge
unstable between stable (^) region and untable region (^) region y & · X 9 X It's difficult to (^) stay on (near) this (^) point.
In reality the^ driver stays In^ the^ stable
asymtotic stable^ region region ~^ slowly^ brake
ABS in needed (is mandatory In everycar) -^ ABS^ overrides the human driver when overshoots
* the^ driver does a panik brake and enters^ in
the ustable reagion and ABS overrides him and
takes controll of the
braking system
ABS is^ a control^ system :
X ABS^ V(t) X(t)
N g^ control^ ↓^ system^ g
algorithm
S In order to (^) design the ABS control (^) algorithm we need^ a model of the (^) system (model based (^) designed) How to model the^ dynamics from VIt) to^ X(t) :
There are at^ least six dynamics
V(t) actual (^) dynamics system dynamics
X(t)
Y (^) Y Y (^) Y Y Y Y
I &^ y^ y
current (^) position (^) hydrolic wheel Tire vehicle
dynamics dynamics dynamics dynamics dynamics dynamics
Inside the^ of the of the M^ M^ M
elettric (^) motor motor (^) braking E M (^) system
elettrical mechanical H
domain domain hydrolic
domain
The problem is to control the voltage in the motor , attivating the^ brake to^ control^ the sleep
of the wheel
Multi-domain (E/H/M) modeling problem -^ we can^ solve this modeling problem in
different (^) ways : (^1) .white box (^) modeling
~physical^
(first (^) principles)
modeling.
Es :^ m^.^ a^ =^ EiF
R. i =^ V
- White^ box^ modeling -^ Experimet data,^ learn^ from^ data
VIt) X(t)
G G
summary of^ the^ control^ architecture^ of^ ABS^ :
Algo for^ * control^ V(t)
,
system X(t)
reference (^) = &
design algorithm^ model
N &^ --^ ...
X(t) Software
sensing algo Problems :
1. System modeling
3
topic of
- Software (^) sensing MIDA
3. control algorithm design
- reference^ design BLACK BOX IDENTIFICATION WITH NON PARAMETRIC APPROACH IN THE (^) STATE SPACE DOMAIN TIME DOMAIN We start^ with^ a recall^ of the^3 main^ mathematical^ representation of^ a discrete time (^) dynamic linear (^) system u(t) (^) y(t) 7 g X(t)
RAPPRESENTATION I :^ STATE SPACE^ (internal representation)
↑ (^) (t) is a vector of internal variable (^) , of size n u(t) ( (^) + 2)^ (n^
> order of the
system) ↑ state^ matrix S x(t +^ 1) =^ Fx(t) + Gu(t) > state equation
output matrix In put matrix
4
y(t) =^ Hy(t)^ +^ Du(t)^ - >^ output^ equation
input/output matrix
if system is siso
& F = (n + (^) n]a = (n + 1)
and order is n If system Is
H = [1xn] D =^ (1x1) · strictly proper D^ =^0
Continuous time^ US discrete time
- (^) (t) = Ax(t) + (^) Bu(t) >^ differential x(t+ (^) 1) = (^) Fx(t) + (^) Gu(t) > (^) difference (^) equation
y(t)
= Cx(t) + Du(t) equation^ y(t) = Hy(t) + Du(t)
eig(A)^ A^ Im^ eg(t) (^) "
instability
stability instability region
stability region region^ region 1 &
-Ike
Es : X , (t + 1) = (y, (t) + 2u(t) siso system
42(t +^ 1) = Xi (t) +^ 2x2(t) + (^) u(t) & y(t) = (X,^ (t)^ +^ 2x2(t) order is n=^2 = a^ = (4) H = [12] D = (^) [0] elg(f) = (42 i^ 2 instability State (^) space representation is not (^) unique
FJF = TFT T
G-G = TG for every
invertible matrix
H -^ H^ =^ HT
D =^ D'^ =^ D Sequivalent (^) representation
We can re-write^ in (^) positive (^) power (^) by (^) multiply all^ by zt Ez +^ t W(z)^ is^ a^ rational^ function
w(z) =
z2 + (^) yz - Yg of z (^) operator
Remark :^ If^ the systemis^ strictly proper (s. p .) the^ pure delay K^ :
B(z).^ z
W(t) =
A(z)
IS H^31 is at^ least one step delay
A
u(t)
sono
D. T. Step
i t
pesponsetheoutputremainser
.
..... indicendent -^ t
no (^) sump on^ e RAPPRESENTATION 3 :^ CONVOLUTION OF^ THE^ INPUT^ WITH^ THE^ IMPULSE^ RESPONS^ OF^ THE^ SYSTEM
Impulse response^ representation
N
u(t)
- Impulse^ on^ input^ at^ D.^ T. E
- g A
y(t) (I.^ R.)
w(3) (^) Input (^) response of the (^) system w(2) -
- (^) (property of^ the (^) system) w()
. (^) st Xwid
/ system S. P.
I can be^ proven that^ the^ system 1/0 relationship can be^ described as:
convolution of ult)
y(t) = w()^
- u(t-k) With (^) the IR. of the
system
I
Invariant property of^ the system
Different (^) rapresentations of the^ same (^) system :
(^15). S.
& M &^ ↓ S
# 2 T. F. # 3 I. R.
[
can we do all the 6 transformations?
Transformation from #1 to #2 (the most used)
S.S. &
x(t+^ 1) = Fx(t) +^ Gu(t)
y(t) =^ Hx(t)
↓ z operation
zx(t) =^ Fx(t) + (^) Gu(t) (zI -^ F(x(t) =^ Gu(t) (^) -x(t) =^ (zI - F) G - u(t) ↓
Identity matrix
y(t) =^ H(zI^
- F) Gu(t) w(z) = (^) H)zI - F) G
T . F . W(z)
Example : X(t+^ 1)=^ X^ , (t) +^ u(t) S
42(t+^ 1) = (x, (t) +^ 2x2(t)^ +^ u(t)
y(t) =^ y,^ (t)
siso system of order n=^2
Fa I I
(i) +^ -^ (0)^ p^ +0]
I
O 1
O 1
&
- (8)^ F =^ & ....^ .... - Hobba ... (^) bibo)p =^ (x) 01
Example
2z2 + 2z + 14
w(z)=
yz
1 O
I a (i)
F =^ O^ O^1
-"S -13 - 44
H = (^) [ 14 122] D =^ [0]
Transformation from #2 to^
Easy/classic transformation- long polynomial division^ between^ hum^ and^ den^ of^ WIz)
I w(z) = T .F (^). (^) positive power z - 42 · z 1 J (^) - I w(z) =
Z
T. F. negative power
1 - 2z-
Time domain :
y(t) =
1 - 12z
u(t) y(t) = Ey(t - 1) + (^) u(t- 1) difference (^) equation Polynomial division^ :
z 1 - 2z t
z + 2z^2 + yyz
3
... a step
(^11) 12z-^2
- " 2z 2 + (^) "z // (^) Y4E
residual
w(z) =
z
- t = b + z + (^) 2z2 + "423 + (^) Ygz" + (^) E... I.R.
1 - 42z- w(0) w(l) w(2) w(3)
T
. Domain : (^) y(t) = (^) p. u(t) + 1. u(t- 1) + (^) E u(t- 2) + (^) Yqu(t-^ 3)^ + (^) Ygu(t- 4) convolution of (^) input
with I. R.
Some result^ can be^ obtained in^ a^ more elegant way :
y(t)= , ,z-^ u()^ = (z" i iz+^ )^
- u( geometrical Series^ : & I
& al^ -
H= 0 1
y(x)
= (z
- .(tz^ (4)^ u^ = p + (^) u(t) +ultut-2)"ut)tu Remark on (^) naming of filters^ :
z + Y2z-2 digital filter colled
W(z)=
1 +^ 43z
pole
g
Infinite Impulse Response filter
(IIR (^) filter)
y(t)
= (^) - 13ytutt w(z) =^ z
Y zz^ -^2 +
1zz
digital filter^ colled
no poles Finite^ Impulse Response
(FIR (^) filter) y(t) = u(t
- +^ u(t)u- recursive element Transformation from #3 to (^) #
Given a discrete time^ signal s(t) ,^ with^ s(t)-d if^ to
Its -trasform^ is defined^ as:
- &^ It is a function of (^) z (nott)
z(s(t)) =^ [is(t)z^
t it is^ the^ transform of^ a (^) signal t = (^) d
GIen this^ definitionIt can be proven that^ :
& (^) the T.F. of a (^) system can be obtained w(z) =^ z(w(t)) =^ [i^ w(t)z
- t by z-transform^ of^ aSpecial^ signal (the^ I.^ R. signal t = (^0) of
the system (
Recall (^2) key concepts of^ system theory-observability and^ controllability of (^) a (^) system : X(t+^ 1)^ =^ Fx(t) +^ Gu(t) E (^) y(t) =^ Hx(t) The (^) system is (^) fully observable from the (^) output (^) y(t) If (^) and (^) only if^ the (^) observability matrix :
O =^ HF is full
Il HF rank a (^) rank(8) = n (^) order (^) of the system i n -^1 HF · observability= by "watching" the^ output^ signal^ y(t)^ we^ can^ see^ lobserve)^ the^ fully state · observability is^ a^ property of^ output^ and^ state^.^ Depends^ on^ [F,^ H]
The System IS fully controllable (reachable) from the^ input u(t) if and only if the controllability
matrix : RIG FG^ FG^ ... FUG) is full^ rank^ a (^) rank(r) =^ n
controllability -^ by "driving" the^ input^ ult)^ we^ can^ influence^ (control)^ the^ full^ state
controllability
= (^) refers only to^ input^ and^ state^.^ Depends^ on^ [F,^ H]
Example :
X(t+^ 1) = (^) 2X, (t) +^ u(t)
f : x2(t+ 1) = YzX2(t)
E (^) y(t) = (^) 14X 1 (t) n =^2 x = (*2) siso F = [2] a (^) -to] H = [40] D^ = [0] ·[i] = [1] oranuco) = (^12) sy. is not (^) fully observable
n(t) X, (t+1)
z -^ 14 , (t) Y4 -^ - (^) y(t) X(t+ (^) 1) = (^) 2X, (t) + (^) u(t) ↑ Y
observation signal fi
E
X2(t+^ 1)^ =^ YzX2(t)
watching y(t)^ we^ can't^ se^ y(t)^
= (^) 14X 1 (t)
(2(t)
-2)t+1) z -^1
Y^ 2(x) ↑
n(t) x, (t+ X(t+^ 1)^ =^ 2X,^ (t)^ +^ u(t)^ +^ -X2(t)
- z 14 , (t) (^) y4 - y(t) f^ I E
X2(t+ 1) =^ YzX2(t)
↑ Y now (^) we (^) can observe (^) y(t) =^ 14X 1 (t)
-12- X2(t) too
Y 6
-2)t+1) z Y -^1 +^ 2(x) ↑
ranco sysfully observae se
Example
X(t+^ 1)^ =^ " 2X,^ (t)
X2(t+^ 1) = (^) (3x2(t) + u(t) y(t) =^ "4X,^ (t) n =^2 SISO F = [i]a-ti)
H =^ [10] D =^ [0]
R : [G FG] = [i is] rank(R)^
= 12 o not
fully controllable
X (^) , (t+1) z -^
Y 14 ,^ (t)-yt)
Y4 we can affect X2(t)
↑ -12-
but no X , (t)
u(t) -2)t+1)
N^ -^ z^ - 1^ +2(x)
↑
Remember (^) that transf #1 +# 3 : w() = HFt'G (t (^) so) HG (^) HFG... HFn
HFG HFIG^ ...
i Hn = I
HF
n-
G ... HF G
2n-^2 I In this (^) way He^ can be^ factorized^ as^ : O ·In La^ a^ ...^ +a)^ Hn =^ Q^. R
Now we^ can^ develop the^ system Identification^ algo starting from^ a^ measured (experimental)
impulse response (^) signal : N
u(t)
Our dataset^ IS^ :
- Impulse^ on^ input^ at^ D.^ T. & w(0)^ , w()^ ,^ w(2)... w(N)] E
- g A
y(t) (I.^ R.)
w(3) (^) Input (^) response of (^) the (^) system w(2) -
- (^) (property of^ the (^) system) w()
. (^) st Xwid
/ system S. P. We start (^) solving the (^) USID problem
assuming
a holse free measurement of^ the F. R.
lideal situation)
Algo ,^ starting from^ a^ noise^ free^1.^ R^.^ dataset^ [W(0) , w()^ ,^ w(2)... WINl] :
- Built Hankel matrix in (^) increasing order and chel the^ rank:
He =^ [w(ll] rance 1
Hz = [wl w] a me
H3 =
w(l) w(2) w(3)
I
w(2) w(3)^ w(4)
I rante 3
w(3) w() w(5)
: An = [ ... ] ranken Hn+ = [ ...^ ) rank (^) n stop
Stop the^ first^ time^ we^ find^ anAmatrix^ not^ fully rank.
We don't know the order of the system before , so we have experimentally estimated it.
- Take An+^ ((n +^ 1) +^ (n+^ 1) matrix of order^ n) and^ facturise it^ into (^2) rectangular matrices^ :
feasible since
rank (Hn+) =^ n
#n=[Gnx] [an
1] N (^) n+ 1
& n+: extended
observability matrix
Rn+: extended (^) controllability matrix &
3. Estimate F^ , , I^ H
E
we can make this interpretation :
- Qn+= (^) [G FG ... (^) F G] i (^) = (^) Onti(1 :) G = Rn+ ( :^ j1) To estimate#^ we (^) can consider for (^) exemple Ont (^) (Rn+)
0, = On+ (1^ :^ n^ :)
an( 82 =^ OnH(2 : n+i:)
i
H
n-^1 HFn Matrix &I and 82 are linked (^) by the^ "shift invariane (^) property" : O2 =^01.^ F^ F^ =^ Q. Oc &^ is^ squared and invertible
Algorithm :
1. Built the Hankle^ matrix^ from^ the^ dataset
w(l) (^) (2) (d) ~: nolsy data
~ w(2) (3)^ (d+1) Hqd = I N i &^ I rectangular (a)(q+1)^ (q+^ d^
matrix (^) qxd d > &
9 the^ last^ one^ must^ be
(N) -^ N = q + d^ + 1
Choise of g and^ d^ (designer choise) :
hp :^ 9(dq =^ N-d +^1 (^9) A N.. (^) 9) (^) q =^ d
-^ here^ ped^ (matrix is almost (^) squared) o (^) more
computationally
Intensive-better model quality
A (^) · (^) · 9 d' less comput (^).^ Intensive^ but worst model (^) quality
& -d
1 N
Rule of thumb : (^) 9s d In this (^) range the (^) quality is (^) alway good If N =^1000 9 =^350 , d^ =^651 ·
9 =^400 ,^ d^ =^601
9 =^450 ,^ d^ =^551
(^2). Sup of (^) #ad (fundamental new (^) step) SD is (^) implemented in matlab #qd =^ T^ (V,S,V]^ =^ svd^ (M) gxd 9449xddxd
& and N are square unitary matrices
A matrix M is
unitary
If (^) : S
det (M)=^1
M=^ =^ MT
. n ... )
diagonal,rectangular matrix
5q T (^) , Tz ... Ug are the^ so^ called^ "singular values"^ of^ 5.^. They are real^ and (^) positive numbers (^) ,
sorted in decreasing order :
51 2 525 (^53 3) ... 59
SVD makes a sort of diagonalization of a rectangular matrix.Singular values are a sort^ of
elgenvalues of^ a^ rect.^ Matrix.
If M is (^) rectangular : 5 .v^. (M)^ = elg(MMT) = elg(MT) square
- Divide the S.V. In (^) system and noise Ideal case Real case (^) : no clear (^) jump but "knee" A^ N Ti
· _system^ S.^ V^.
&
. system^
S.V (^). ⑧ (^8) sump X noise^ S.V (^). 0 Y noise^ S.^ V. .......... O In ·
q
0 & & estimated order of the (^) system
nq <^ N
(ex : n =^8 , 9 =^400 , N = 1000)
We have estimated the (^) system order n and (^) separated (^) system from nolse
Step 3 is concluded^ when a new clean Hankle^ matrix^ is^ built
N MT//11/11/IIII Fad- T · S A
Y
T
/ I
Y 5
für