A summary of Modeling and Simulation
A summary of Modeling and Simulation
A summary of Modeling and Simulation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
A <strong>summary</strong> <strong>of</strong><br />
<strong>Modeling</strong> <strong>and</strong> <strong>Simulation</strong><br />
Text-book: <strong>Modeling</strong> <strong>of</strong> dynamic<br />
systems<br />
– Lennart Ljung <strong>and</strong> Torkel Glad
Content<br />
• What’re Models for systems <strong>and</strong> signals?<br />
– Basic concepts<br />
– Types <strong>of</strong> models<br />
• How to build a model for a given system?<br />
– Physical modeling<br />
– Experimental modeling<br />
• How to simulate a system? y<br />
– Matlab/Simulink tools<br />
• CCase studies<br />
t di
SSystems stems <strong>and</strong> models<br />
• Part one – Models, p13-78<br />
• SSystem t iis ddefined fi d as an object bj t or a collection ll ti <strong>of</strong> f<br />
objects whose properties we want to study<br />
• A model <strong>of</strong> a system is a tool we use to answer<br />
questions about the system without having to do<br />
an experiment<br />
– MMental t l model d l<br />
– Verbal model<br />
– Physical model<br />
– Mathematical model
HHow tto build b ild <strong>and</strong> d validate lid t models d l<br />
• Physical modeling: laws <strong>of</strong> nature<br />
• Experimental modeling: Identification<br />
•Any y models have a limited domain <strong>of</strong><br />
validation
TTypes pes <strong>of</strong> mathematical models<br />
• Deterministic & stochastic<br />
• Dynamic & static<br />
• Continuous time & discrete time<br />
• Lumped p & distributed<br />
• Change oriented & discrete event driven
Models for systems y <strong>and</strong> signals g<br />
(Chapter 3)<br />
• Block diagram models: logical<br />
decomposition <strong>of</strong> the functions <strong>of</strong> the<br />
system y <strong>and</strong> show how the different<br />
parts(blocks) influence each other<br />
u(t)<br />
h(t)<br />
q(t)<br />
Bernoulli’s law: v(t)=sqrt(2gh(t))<br />
u(t)<br />
q(t)<br />
Tank model (1) h(t)
EExample ample <strong>of</strong> Flow Flo ddynamic namic<br />
u(t)<br />
h(t)<br />
q(t)<br />
dh() t a 2h 1<br />
=− ht () + ut ()<br />
dt A A<br />
qt () = a 2 ght ()
Parameters & Signals<br />
• Parameters: system parameters & design<br />
parameters t<br />
• Signals (variables):<br />
– external signals: input <strong>and</strong> disturbance<br />
– Output signals<br />
– Internal variables
Description <strong>of</strong> ssystems stems<br />
• Differential/difference equations<br />
– High-order DE Transfer functions<br />
• Linearization – equilibrium q p point ( (stationary), y),<br />
Taylor expansion<br />
• Laplace transform/Z transform/Z-transform transform<br />
– First-order DE (define internal variables) <br />
state space models<br />
• Linearization – equilibrium point, Taylor expansion<br />
• State variables
Si Signal l ddescriptions: i ti Ti Time-domain d i<br />
• Deterministic & analytic: u(t)=sin(200t)<br />
• Deterministic & sampled: {u(n)}<br />
• Non Non-deterministic deterministic & analytic: u(t)=<br />
sin(2t)+w(t)<br />
• Non-deterministic & sampled: {u(n)} <strong>of</strong><br />
r<strong>and</strong>om variable u(t) – stochastic<br />
processes p ( (DE sem6) )
Si Signal l ddescriptions: i ti FFrequency ddomain i<br />
• Concept <strong>of</strong> frequency – harmonic signals<br />
• High freq. & low freq. Signals<br />
• Fourier transform<br />
•Amplitude p spectrum p<br />
• Power Spectrum <strong>of</strong> a signal is the sqaure<br />
<strong>of</strong> the absolute value <strong>of</strong> its Fourier<br />
transform<br />
• FFT algorithms (DE 6sem)
SSystem t descriptions: d i ti Ti Time-domain d i<br />
Deffierential/differenece equations<br />
• ODE (lumped) & PDE (distributed)<br />
• Linear & nonlinear
Effects <strong>of</strong> system y to input p signal g
SSystem t descriptions: d i ti ffrequency domain d i<br />
• Laplace transform/Z-transform<br />
• TTransfer f functions f ti for f linear li lumped l d ODE<br />
• Bode plot/Nyquist plot
Link between time <strong>and</strong> frequency q y<br />
domain – systems<br />
• Response to input – Bode plot<br />
• Stability – pole locations<br />
• Performance (overshoot, (overshoot settling time time,<br />
resonance freq.) – pole locations<br />
• B<strong>and</strong>width<br />
• robustness
Example p Effects <strong>of</strong> Group p Delay y<br />
The filter has considerable attenuation<br />
at ω=0 ω=0.85π. 85π The group delay at ω=0 ω=0.25π 25π<br />
is about 200 steps, while at ω=0.5π, the<br />
group delay is about 50 steps
CConnection ti <strong>of</strong> f systems t <strong>and</strong> d signals i l<br />
• Time-domain: ODE<br />
&& yt () + 2 yt & () + yt () = ut & () + ut ()<br />
yk ( ) − yk ( − 1) + 2 yk ( − 2) = uk ( ) −uk ( −1)<br />
⎧ Xt & () = AXt () + BUt () ⎧ X ( k ) = AX ( k k− 1) +<br />
BU ( k k−<br />
1)<br />
⎨ ⎨<br />
⎩Yt<br />
() = CXt () ⎩Yk<br />
( ) = CXk ( )<br />
• Frequency q y domain: Y () s s+<br />
1<br />
Gs () = = 2<br />
U() s s + 2s+ 1<br />
TF<br />
U(s) G(s) Y(s)<br />
−1<br />
Y( z) 1−z<br />
Gz ( ) = = −1 −2<br />
U( z) 1− z + 2z<br />
−1<br />
Gs () = CsII ( − A) B
Link betwen continuous time <strong>and</strong><br />
discrete time models<br />
• Sampling mechanism<br />
• Aliasing problem<br />
• See more from Digital control course course….
Content<br />
• What’re Models for systems <strong>and</strong> signals?<br />
– Basic concepts<br />
– Types <strong>of</strong> models<br />
• How to build a model for a given system?<br />
– Physical modeling<br />
– Experimental modeling<br />
• How to simulate a system? y<br />
– Matlab/Simulink tools<br />
• CCase studies<br />
t di
Physical modeling<br />
Part II in textbook pp.79-121
Principle <strong>and</strong> Phases<br />
• Use the knowledge <strong>of</strong> physics that is relevant to<br />
the considered system<br />
• Ph Phase 11: structure t t th the problem: bl ddecomposition iti<br />
(cause <strong>and</strong> effect, variables) block diagram<br />
• Phase 2: formulate subsystems<br />
• Phase 3: get system model via simplification<br />
E l d li th h d b f<br />
• Example: modeling the head box <strong>of</strong> a paper<br />
machine (pp.85-95)
FFormulation l ti <strong>of</strong> f physical h i l modeling d li<br />
• Conservation laws<br />
– Mass balance<br />
– Energy balance<br />
– Electronics (Kirchh<strong>of</strong>f’s laws)<br />
• Constitutive relationships
Simplification <strong>of</strong> modeling<br />
Principles<br />
• Neglect small effects (approximation)<br />
• Separate time constants<br />
(T_max/T_min
Some relationships in ph physics sics<br />
• Electrical circuits<br />
• Mechanical translation<br />
• Mechanical rotation<br />
• Flow systems y<br />
• Thermal systems<br />
• Lagrange modeling method<br />
• FFor more, see BRP’s BRP’ llectures…. t
Newton’s Newton s 2 2law law<br />
m a = ∑ F<br />
27
Newton’s Newton s 2 law for Rotation<br />
J dω/dt = ∑<br />
τ
DC motor with Permanent Magnet<br />
29
Electro-Mechanical Electro Mechanical Energy Conversion<br />
Chassis or basket<br />
Voice coil<br />
S N<br />
Input Dust cap<br />
Magnet<br />
S N<br />
Suspension<br />
Cone<br />
Force produced by current:<br />
F = Bl I (ved fastholdt svingspole)<br />
F: Kraften på membranen<br />
B: magnetfelt<br />
L: svingspolens trådelængde<br />
I: strømmen<br />
Surround<br />
D t Electro Magnetic force (EMF) <strong>and</strong><br />
back EMF<br />
Current produced by membrane<br />
velocity:<br />
emf = Bl v<br />
emf: modelektromotorisk kraft<br />
v: membranens hastighed
U in(t) +<br />
Block Diagram: Loudspeaker<br />
-<br />
+<br />
+ +<br />
1/L e<br />
R e<br />
Bl<br />
∫<br />
v(t)<br />
i(t) F(t)<br />
+<br />
a(t) v(t) x(t)<br />
Bl<br />
1/m ∫ ∫<br />
m<br />
-<br />
+<br />
+ +<br />
r m<br />
1/c m
• Thermal systems, y , Head flow, , modelling g <strong>of</strong><br />
geometric problems (for DE5); mm4 2007<br />
DE5 DE5.ppt ppt<br />
• Time <strong>and</strong> Frequency Response <strong>of</strong> 1.<br />
<strong>and</strong> 2. order systems (for M5); mm4 2007<br />
M5 M5.ppt t<br />
• Linearization; mm5 2006 2006.ppt ppt<br />
• Linearization: solution <strong>of</strong> exercise; mm5<br />
soulution.ppt
Lagrange modeling method<br />
• Generalized coordinate<br />
• Kinetic energy T<br />
• Potential energy V<br />
• External forces along gggerneralized<br />
coordinator Q
Experimental modeling<br />
(nonparametric identification)<br />
Part III in textbook pp.189-223<br />
•Estimation <strong>of</strong> transient response<br />
•Estimation <strong>of</strong> transfer function
Estimation <strong>of</strong> transient response p<br />
(direct method)<br />
• Transient responses:<br />
impulse response, step response<br />
• Arrange experiment (input signal)<br />
• Curve fitting, g, range g scaling, g, time constant<br />
• Transient analysis is easy <strong>and</strong> most widely<br />
used<br />
• Potential problem: poor accuracy due to<br />
disturbances <strong>and</strong> measurement errors etc.
Estimation <strong>of</strong> transient response p<br />
(Correlation analysis)<br />
• Need knowledge <strong>of</strong> stochastic processes(SEM6)<br />
• Procedure:<br />
– Collect data y(k), u(k), k=1,2,….,N<br />
– Substract sample means from each signal:<br />
N N<br />
1 1<br />
y( k) = y( k) − ∑y( t), u( k) = u( k) − ∑u(<br />
t),<br />
N N<br />
t t= 1 t t=<br />
1<br />
∞<br />
∑<br />
yt () = gut ( − k) + vt ()<br />
– Form signal via whitening filter L(q) (polynomial, lease square):<br />
– Impulse p response: p<br />
y ( k) = L( q) y( k), u ( k) = L( q) u( k)<br />
F F<br />
Rˆ<br />
( τ ) 1 1<br />
g where R y<br />
tu t u t<br />
N N N<br />
N yFuF ˆ N<br />
ˆ<br />
2<br />
ˆ ττ<br />
= y ( ) ( ) ( ), ( )<br />
ˆ<br />
Fu( τ ) =<br />
F ∑ F( ) F( − τ), λN=<br />
∑ F(<br />
)<br />
FuF ∑ F F N ∑<br />
F<br />
λ N t 1 N<br />
N<br />
= t=<br />
1<br />
k = 0<br />
k
Estimation <strong>of</strong> transient response p<br />
Basic properties:<br />
(Correlation analysis)<br />
• Quick insight into time constants <strong>and</strong> time delays<br />
• Mo special inputs are required. required<br />
• Poor SNR can be compensated by longer dtata<br />
recordes<br />
• Limitation: input u(t) is uncorrelated with<br />
disturbance v(t). This method won’t work properly<br />
when the dtata are collected from a system under<br />
∞<br />
output feedback y () t = g ut ( − k ) + vt ()<br />
∑<br />
k = 0<br />
∑<br />
k
Estimation <strong>of</strong> transfer functions<br />
(frequency analysis -1)<br />
• Direct frequency analysis (Bode plot)<br />
H(ejω) = |H(ejω)| e
Estimation <strong>of</strong> transfer functions<br />
• Advantages<br />
(frequency analysis -2)<br />
– Easy to use <strong>and</strong> requires no complicated data<br />
processing<br />
– RRequires i no strustural t t l assumptions ti other th th than it<br />
being linear<br />
– Easy to concentrate on freq. Ranges <strong>of</strong> special<br />
interest<br />
• Disadvantages<br />
– Graphic result (Bode plot)<br />
– Need long time <strong>of</strong> experimentation
Estimation <strong>of</strong> transfer functions<br />
(Fourier analysis -1)<br />
• Principle: Y( jΩ)<br />
G( jΩ<br />
) =<br />
U ( j Ω )<br />
T( ω) =<br />
N<br />
∑ (<br />
− jωkT ) , T(<br />
ω)<br />
=<br />
N<br />
∑ (<br />
− jωkT )<br />
k= 1 k=<br />
1<br />
Y j T y kT e U j T u kT e<br />
Y YT ( j jω<br />
)<br />
GN( jω)<br />
=<br />
U ( jω)<br />
T<br />
• Evaluation:<br />
T T<br />
− jΩt − jΩt T( Ω ) = ∫ ( ) , ( ) ( )<br />
0<br />
T Ω = ∫0<br />
Y j y t e dt U j u t e dt<br />
ˆ Y YT ( j Ω )<br />
G( jΩ<br />
) =<br />
U ( jΩ)<br />
2 cc u g | V VN ( jjωω<br />
)|<br />
| GN( jω) −G( jω)|<br />
≤ + ,<br />
| UN( jω)| | UN( jω)|<br />
where<br />
system y() t = g( τ) u( t − τ) dτ + v() t<br />
input lim itation : | u( t) | ≤ cu<br />
∫<br />
0<br />
∞<br />
system property : τ | g( τ)| dτ = cg<br />
∫<br />
0<br />
∞<br />
T
Estimation <strong>of</strong> transfer functions<br />
• Advantages:<br />
(Fourier analysis -2)<br />
– Easy <strong>and</strong> efficient to use (FFT)<br />
– Good estimation <strong>of</strong> G(jw) at frequencies<br />
where the input has pure sinusoids<br />
• Di Disadvantages: d t<br />
– The estimation is wildly fluctuating graph,<br />
which only gives a rough picture <strong>of</strong> the true<br />
frequency domain (see Fig8 Fig8.13, 13 pp pp.209)<br />
209)
Estimation <strong>of</strong> transfer functions<br />
• Principle:<br />
(Spectra analysis -1)<br />
R ( k) = g( k)* R ( k) R ( k) = g( k)* g( −k)*<br />
R ( k)<br />
yu uu yy uu<br />
Φ ω = ω Φ ω Φ ω = ω Φ ω +Φ ω<br />
2<br />
yu ( ) G( ) uu ( ) yy ( ) | G(<br />
)| uu ( ) vv vv(<br />
)<br />
• Spectra p estimation ( (Black-Tukey’s y spectral p<br />
estimate) - Window function<br />
N<br />
N 1<br />
R Ryu ( k ) = ∑ yt ( + k ) ut ( )<br />
N<br />
t=<br />
1<br />
γ<br />
γ N − jωk Φ yu ( ωω<br />
) = ∑ w wγ ( k ) R Ryu ( k ) e<br />
k =−γ<br />
• Estimation:<br />
1 N<br />
N 1<br />
Ruu ( k) = ∑ ∑u(<br />
t+ k) u( t)<br />
N<br />
t=<br />
1<br />
γ<br />
γγ N − j jωω k<br />
Φ uu ( ω ) = ∑ wγ ( kR ) uu ( kke<br />
)<br />
k =−γ<br />
γ γ<br />
ˆ<br />
Φyu ( ω) | Φyu<br />
( ω)|<br />
γ γ<br />
GN( jω)<br />
= Φ vv =Φyy( ω)<br />
−<br />
γ γ<br />
Φ ( ωω ) Φ<br />
( ωω<br />
)<br />
uu uu<br />
2
Estimation <strong>of</strong> transfer functions<br />
• Advantages:<br />
(Spectra analysis -2)<br />
– Common method for signals <strong>and</strong> systems<br />
– Only assume system is linear, <strong>and</strong> requires no<br />
specific ifi iinput t<br />
– Adjusting the window size usually leads to a good<br />
picture<br />
• Disadvantages: g<br />
– Graphic result (Bode plot)<br />
– This method won’t won t work properly when the dtata are<br />
collected from a system under output feedback
Experimental modeling<br />
(parametric identification)<br />
Chapter 9 in textbook pp.227-257<br />
• Estimation <strong>of</strong> Tailor-made model<br />
• Estimation <strong>of</strong> ready ready-made made model
Parametric models<br />
• Tailor-made model: constructed from basic<br />
physical h i l principles. i i l UUnknown k parameters t<br />
have physical p y interpretation p (g (grey-box) y )<br />
• Ready-made model: describe the<br />
properties ti <strong>of</strong> f the th input-output i t t t relationships l ti hi<br />
without any physical interpretation (black<br />
box)
Tailor Tailor-made made model identification<br />
• Can be done by conventional physical<br />
experimentation i t ti <strong>and</strong> d measurement t<br />
methods, , e.g., g ,<br />
• Estimate the time constant using step<br />
response<br />
• Esitmate the DC-gain usinf steady<br />
response
Read Ready-made made models<br />
• Box-Jenkins (BJ) model<br />
• Output error (OE) model<br />
B(q)/F(q)<br />
B(q)/F(q)<br />
• ARMAX model C(q)<br />
• ARX model d l<br />
B(q)<br />
B(q)<br />
C(q)/D(q)<br />
1/A(q)<br />
1/A(q)
Ready-made y model<br />
identification<br />
• System identification (IRS7) P.236-252<br />
• Summary on p.252-253<br />
•Chapt p 10 system y identification as a tool for<br />
model building...
Content<br />
• What’re Models for systems <strong>and</strong> signals?<br />
– Basic concepts<br />
– Types <strong>of</strong> models<br />
• How to build a model for a given system?<br />
– Physical modeling<br />
– Experimental modeling<br />
• How to simulate a system? y<br />
– Matlab/Simulink tools<br />
• CCase studies<br />
t di
PPart t IV <strong>Simulation</strong> Si l ti <strong>and</strong> d model d l use<br />
• <strong>Simulation</strong><br />
• Block diagram<br />
Matlab/Simulink, Labview<br />
• Numerical methods (DE ( 6sem), ), p.318-327 p<br />
• Model validation <strong>and</strong> use
Content<br />
• Wh What’re t’ Models M d l ffor systems t <strong>and</strong> d signals? i l ?<br />
– Basic concepts<br />
– Types <strong>of</strong> models<br />
• How to build a model for a given system?<br />
– Physical modeling<br />
– Experimental modeling<br />
• How to simulate a system?<br />
– MMatlab/Simulink tl b/Si li k ttools l<br />
• Case studies – BeoSound 9000 sledge<br />
control