Modeling and Simulation - Aalborg...
Transcript of Modeling and Simulation - Aalborg...
A summary of Modeling and Simulation
Text-book: Modeling of dynamic systemssystems
– Lennart Ljung and Torkel Glad
ContentContent
• What’re Models for systems and signals?– Basic concepts– Types of modelsTypes of models
• How to build a model for a given system?– Physical modeling
Experimental modeling– Experimental modeling • How to simulate a system? y
– Matlab/Simulink toolsC t di• Case studies
S stems and modelsSystems and models
• Part one – Models, p13-78 S t i d fi d bj t ll ti f• System is defined as an object or a collection of objects whose properties we want to study
• A model of a system is a tool we use to answer questions about the system without having to doquestions about the system without having to do an experiment
M t l d l– Mental model – Verbal model – Physical model – Mathematical model
H t b ild d lid t d lHow to build and validate models
• Physical modeling: laws of nature • Experimental modeling: Identification
• Any models have a limited domain of yvalidation
T pes of mathematical modelsTypes of mathematical models
• Deterministic & stochastic • Dynamic & static • Continuous time & discrete time• Continuous time & discrete time • Lumped & distributed p• Change oriented & discrete event driven
Models for systems and signalsy g(Chapter 3)
• Block diagram models: logical decomposition of the functions of thedecomposition of the functions of the system and show how the different yparts(blocks) influence each other
u(t)
h(t)
u(t)Tank model (1) h(t)
u(t)
q(t)h(t)q(t)
Bernoulli’s law: v(t)=sqrt(2gh(t))
E ample of Flo d namicExample of Flow dynamic ( ) 2 1( ) ( )dh t a h h t u t
dt A A= − +u(t)
( ) 2 ( )dt A A
q t a gh t=h(t)q(t)q(t)
Parameters & SignalsParameters & Signals
• Parameters: system parameters & design tparameters
• Signals (variables): – external signals: input and disturbance
Output signals– Output signals – Internal variables
Description of s stemsDescription of systems
• Differential/difference equations – High-order DE Transfer functions
• Linearization – equilibrium point (stationary), q p ( y),Taylor expansion
• Laplace transform/Z-transformLaplace transform/Z transform – First-order DE (define internal variables)
state space modelsstate space models • Linearization – equilibrium point, Taylor expansion• State variables
Si l d i ti Ti d iSignal descriptions: Time-domain
• Deterministic & analytic: u(t)=sin(200t)• Deterministic & sampled: {u(n)}• Non deterministic & analytic: u(t)=• Non-deterministic & analytic: u(t)=
sin(2t)+w(t)• Non-deterministic & sampled: {u(n)} of
random variable u(t) stochasticrandom variable u(t) – stochastic processes (DE sem6)p ( )
Si l d i ti F d iSignal descriptions: Frequency domain
• Concept of frequency – harmonic signals• High freq. & low freq. Signals • Fourier transform• Fourier transform • Amplitude spectrump p• Power Spectrum of a signal is the sqaure
of the absolute value of its Fourier transformtransform
• FFT algorithms (DE 6sem)
S t d i ti Ti d iSystem descriptions: Time-domain
Deffierential/differenece equations • ODE (lumped) & PDE (distributed)• Linear & nonlinear• Linear & nonlinear
Effects of system to input signalEffects of system to input signaly p gy p g
S t d i ti f d iSystem descriptions: frequency domain
• Laplace transform/Z-transformT f f ti f li l d ODE• Transfer functions for linear lumped ODE
• Bode plot/Nyquist plotBode plot/Nyquist plot
Link between time and frequency q ydomain – systems
• Response to input – Bode plot• Stability – pole locations• Performance (overshoot settling time• Performance (overshoot, settling time,
resonance freq.) – pole locations• Bandwidth • robustness
Example Effects of Group DelayExample Effects of Group Delayp p yp p y
The filter has considerable attenuation at ω=0 85π The group delay at ω=0 25πat ω=0.85π. The group delay at ω=0.25πis about 200 steps, while at ω=0.5π, the group delay is about 50 steps
C ti f t d i lConnection of systems and signals
• Time-domain: ODE( ) 2 ( ) ( ) ( ) ( )y t y t y t u t u t+ + = +&& & &( ) 2 ( ) ( ) ( ) ( )( ) ( 1) 2 ( 2) ( ) ( 1)
( ) ( 1) ( 1)( ) ( ) ( )
y t y t y t u t u ty k y k y k u k u k
X k AX k BU kX t AX t BU t
+ + = +− − + − = − −
= − + −⎧ = + ⎧& ( ) ( 1) ( 1)( ) ( ) ( )( ) ( )( ) ( )
X k AX k BU kX t AX t BU tY k CX kY t CX t
= +⎧ = + ⎧⎨ ⎨ == ⎩⎩
• Frequency domain: ( ) 1Y s s +q yTF 2
1
( ) 1( )( ) 2 1( ) 1( )
Y s sG sU s s sY z zG z
−
+= =
+ +
−= = 1 2
1
( )( ) 1 2
( ) ( )
G zU z z z
G s C sII A B
− −
−
− +
= −G(s)U(s) Y(s)
Link betwen continuous time and discrete time models
• Sampling mechanism • Aliasing problem • See more from Digital control course• See more from Digital control course….
ContentContent
• What’re Models for systems and signals?– Basic concepts– Types of modelsTypes of models
• How to build a model for a given system?– Physical modeling
Experimental modeling– Experimental modeling• How to simulate a system? y
– Matlab/Simulink toolsC t di• Case studies
Physical modelingPhysical modeling
Part II in textbook pp.79-121
Principle and PhasesPrinciple and Phases• Use the knowledge of physics that is relevant to
the considered systemthe considered system
Ph 1 t t th bl d iti• Phase 1: structure the problem: decomposition (cause and effect, variables) block diagram
• Phase 2: formulate subsystems • Phase 3: get system model via simplificationPhase 3: get system model via simplification
E l d li th h d b f• Example: modeling the head box of a paper machine (pp.85-95)
F l ti f h i l d liFormulation of physical modeling
• Conservation laws – Mass balance– Energy balanceEnergy balance – Electronics (Kirchhoff’s laws)
• Constitutive relationships
Simplification of modelingSimplification of modeling
Principles• Neglect small effects (approximation)• Separate time constants• Separate time constants
(T_max/T_min<=10~100, stiffness problem)• Aggerate state variables: to merge several
similar variables into one variable whichsimilar variables into one variable, which often plays the role of average or total value p y g
Some relationships in ph sicsSome relationships in physics
• Electrical circuits • Mechanical translation• Mechanical rotation• Mechanical rotation• Flow systemsy• Thermal systems• Lagrange modeling method
F BRP’ l t• For more, see BRP’s lectures….
Newton’s 2 lawNewton s 2 law
m a = ∑ F∑
27
Newton’s 2 law for RotationNewton s 2 law for Rotation
J dω/dt = ∑ τ∑
DC motor with Permanent MagnetDC motor with Permanent Magnet
29
Electro-Mechanical Energy ConversionElectro Mechanical Energy Conversion
F = Bl I (ved fastholdt svingspole) F: Kraften på membranen
Force produced by current: Surround
Chassis or basketF: Kraften på membranen B: magnetfelt L: svingspolens trådelængde I: strømmenCone
Voice coil
Electro Magnetic force (EMF) and
I: strømmenS N
Input
Cone
D t Electro Magnetic force (EMF) and back EMF
S N
Input Dust cap
Current produced by membrane velocity:
Suspension
Magnet
emf = Bl vemf: modelektromotorisk kraft
velocity:
v: membranens hastighed
Block Diagram: LoudspeakerBlock Diagram: Loudspeaker
Uin(t) + ∫1/Le
i(t) F(t) x(t)+ ∫ ∫1/mm
a(t) v(t)Bl
- ∫Re+
- ∫ ∫rm+e
+ +
v(t) 1/cm
m+ +
Bl
• Thermal systems, Head flow, modelling of y , , ggeometric problems (for DE5); mm4 2007 DE5 pptDE5.ppt
• Time and Frequency Response of 1.Time and Frequency Response of 1. and 2. order systems (for M5); mm4 2007 M5 tM5.ppt
• Linearization; mm5 2006 pptLinearization; mm5 2006.ppt• Linearization: solution of exercise; mm5
soulution.ppt
Lagrange modeling methodLagrange modeling method
• Generalized coordinate• Kinetic energy T• Potential energy V• Potential energy V• External forces along gerneralized g g
coordinator Q
Experimental modelingExperimental modeling (nonparametric identification)(nonparametric identification)
Part III in textbook pp.189-223•Estimation of transient response •Estimation of transfer function•Estimation of transfer function
Estimation of transient responsep(direct method)
• Transient responses: impulse response, step response• Arrange experiment (input signal)• Arrange experiment (input signal) • Curve fitting, range scaling, time constant g, g g,• Transient analysis is easy and most widely
used • Potential problem: poor accuracy due to• Potential problem: poor accuracy due to
disturbances and measurement errors etc.
Estimation of transient responsep(Correlation analysis)
• Need knowledge of stochastic processes(SEM6)• Procedure:• Procedure:
– Collect data y(k), u(k), k=1,2,….,NSubstract sample means from each signal:
0( ) ( ) ( )k
ky t g u t k v t
∞
=
= − +∑– Substract sample means from each signal:
1 1
1 1( ) ( ) ( ), ( ) ( ) ( ),N N
t t
y k y k y t u k u k u tN N= =
= − = −∑ ∑
– Form signal via whitening filter L(q) (polynomial, lease square): 1 1t t
– Impulse response:
( ) ( ) ( ), ( ) ( ) ( )F Fy k L q y k u k L q u k= =
p p
2ˆ ( ) 1 1ˆˆˆ ( ) ( ) ( ), ( )ˆ
F F
F F
N N Ny uN N
y u F F N F
Rg where R y t u t u t
N Nτ
ττ τ λ= = − =∑ ∑
1 1
( ) ( ) ( ), ( )F Fy u F F N F
t tN
g yN Nτ λ = =∑ ∑
Estimation of transient responsep(Correlation analysis)
Basic properties: • Quick insight into time constants and time delays • Mo special inputs are required• Mo special inputs are required. • Poor SNR can be compensated by longer dtata
recordes• Limitation: input u(t) is uncorrelated withLimitation: input u(t) is uncorrelated with
disturbance v(t). This method won’t work properly when the dtata are collected from a system underwhen the dtata are collected from a system under output feedback ( ) ( ) ( )ky t g u t k v t
∞
= − +∑0
( ) ( ) ( )kk
y g=∑
Estimation of transfer functions(frequency analysis -1)
• Direct frequency analysis (Bode plot)
H(ejω) = |H(ejω)| e<H(ejω)Input x(n) and output y(n) relationship|Y(ejω)| = |H(ejω)| |X(ejω)|<Y(ejω) = <H(ejω) + <X(ejω)
Estimation of transfer functions(frequency analysis -2)
• AdvantagesEasy to use and requires no complicated data– Easy to use and requires no complicated data processingR i t t l ti th th it– Requires no strustural assumptions other than it being linear
– Easy to concentrate on freq. Ranges of special interest
• Disadvantages– Graphic result (Bode plot)Graphic result (Bode plot) – Need long time of experimentation
Estimation of transfer functions(Fourier analysis -1)
• Principle: ( )( )( )
Y jG jU j
ΩΩ =
Ω
0 0
( )
( ) ( ) , ( ) ( )
( )ˆ
T Tj t j tT T
U j
Y j y t e dt U j u t e dt
Y j
− Ω − Ω
Ω
Ω = Ω =
Ω∫ ∫
1 1( ) ( ) , ( ) ( )
( )
N Nj kT j kT
T Tk k
Y j T y kT e U j T u kT e
Y j
ω ωω ω− −
= =
= =∑ ∑( )ˆ ( )( )
T
T
Y jG jU j
ΩΩ =
Ω( )( )( )
TN
T
Y jG jU j
ωωω
=
2 | ( ) |c c V jω
• Evaluation: 2 | ( ) || ( ) ( ) | ,
| ( ) | | ( ) |u g N
NN N
c c V jG j G jU j U j
where
ωω ωω ω
− ≤ +
0( ) ( ) ( ) ( )
lim : | ( ) | u
system y t g u t d v t
input itation u t c
τ τ τ∞
= − +
≤∫
0: | ( ) | gsystem property g d cτ τ τ
∞=∫
Estimation of transfer functions(Fourier analysis -2)
• Advantages: – Easy and efficient to use (FFT) – Good estimation of G(jw) at frequenciesGood estimation of G(jw) at frequencies
where the input has pure sinusoids Di d t• Disadvantages: – The estimation is wildly fluctuating graph,The estimation is wildly fluctuating graph,
which only gives a rough picture of the true frequency domain (see Fig8 13 pp 209)frequency domain (see Fig8.13, pp.209)
Estimation of transfer functions(Spectra analysis -1)
• Principle: 2
( ) ( )* ( ) ( ) ( )* ( )* ( )
( ) ( ) ( ) ( ) | ( ) | ( ) ( )yu uu yy uu
yu uu yy uu vv
R k g k R k R k g k g k R k
G Gω ω ω ω ω ω ω
= = −
Φ = Φ Φ = Φ +Φ
• Spectra estimation (Black-Tukey’s spectral
yu uu yy uu vv
p ( y pestimate) - Window function
1 NN ∑
1( ) ( ) ( )N
NR k k∑1
1( ) ( ) ( )
( ) ( ) ( )
Nuu
t
N j k
R k u t k u tN
k R kγ
γ ω
=
−
= +
Φ
∑
∑
1( ) ( ) ( )
( ) ( ) ( )
Nyu
t
N j k
R k y t k u tN
w k R k eγ
γ ωω
=
−
= +
Φ =
∑
∑
• Estimation: ( ) ( ) ( )N j k
uu uuk
w k R k eγ ωγ
γ
ω=−
Φ = ∑( ) ( ) ( )yu yuk
w k R k eγγ
ω=−
Φ = ∑
2( ) | ( ) |ˆ ( ) ( )( ) ( )
yu yuN vv yyG j
γ γγ γ
γ γ
ω ωω ω
ω ωΦ Φ
= Φ = Φ −Φ Φ( ) ( )uu uuω ωΦ Φ
Estimation of transfer functions(Spectra analysis -2)
• Advantages: Common method for signals and systems– Common method for signals and systems
– Only assume system is linear, and requires no ifi i tspecific input
– Adjusting the window size usually leads to a good picture
• Disadvantages:g– Graphic result (Bode plot)
This method won’t work properly when the dtata are– This method won t work properly when the dtata are collected from a system under output feedback
Experimental modelingExperimental modeling (parametric identification)(parametric identification)
Chapter 9 in textbook pp.227-257• Estimation of Tailor-made model• Estimation of ready made model• Estimation of ready-made model
Parametric modelsParametric models
• Tailor-made model: constructed from basic h i l i i l U k tphysical principles. Unknown parameters
have physical interpretation (grey-box)p y p (g y )• Ready-made model: describe the
ti f th i t t t l ti hiproperties of the input-output relationships without any physical interpretation (black-without any physical interpretation (blackbox)
Tailor made model identificationTailor-made model identification
• Can be done by conventional physical i t ti d texperimentation and measurement
methods, e.g., , g ,• Estimate the time constant using step
response• Esitmate the DC-gain usinf steady• Esitmate the DC-gain usinf steady
response
Read made modelsReady-made models
• Box-Jenkins (BJ) modelC(q)/D(q)
Output error (OE) model
B(q)/F(q)
• Output error (OE) model B(q)/F(q)
• ARMAX model C(q)
ARX d lB(q) 1/A(q)
• ARX model
B(q) 1/A(q)
Ready-made model yidentification
• System identification (IRS7) P.236-252• Summary on p.252-253
• Chapt 10 system identification as a tool for p ymodel building...
ContentContent
• What’re Models for systems and signals?– Basic concepts– Types of modelsTypes of models
• How to build a model for a given system?– Physical modeling
Experimental modeling– Experimental modeling • How to simulate a system? y
– Matlab/Simulink toolsC t di• Case studies
P t IV Si l ti d d lPart IV Simulation and model use
• Simulation Matlab/Simulink, Labview
• Block diagram• Block diagram • Numerical methods (DE 6sem), p.318-327( ), p• Model validation and use
ContentContentWh t’ M d l f t d i l ?• What’re Models for systems and signals?– Basic conceptsBasic concepts– Types of models
• How to build a model for a given system?Physical modeling– Physical modeling
– Experimental modeling • How to simulate a system?
M tl b/Si li k t l– Matlab/Simulink tools• Case studies – BeoSound 9000 sledgeCase studies BeoSound 9000 sledge
control