EE392m - Winter 2003 Control Engineering 2-1 Lecture 2 - Modeling and Simulation • Model types: ODE, PDE, State Machines, Hybrid • Modeling approaches: – physics based (white box) – input-output models (black box) • Linear systems • Simulation • Modeling uncertainty
40
Embed
Lecture 2 - Modeling and Simulation · 2003-01-17 · EE392m - Winter 2003 Control Engineering 2-2 Goals • Review dynamical modeling approaches used for control analysis and simulation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
EE392m - Winter 2003 Control Engineering 2-1
Lecture 2 - Modeling and Simulation
• Model types: ODE, PDE, State Machines, Hybrid• Modeling approaches:
– physics based (white box)– input-output models (black box)
• Linear systems• Simulation• Modeling uncertainty
EE392m - Winter 2003 Control Engineering 2-2
Goals
• Review dynamical modeling approaches used for controlanalysis and simulation
• Most of the material us assumed to be known• Target audience
– people specializing in controls - practical
EE392m - Winter 2003 Control Engineering 2-3
Modeling in Control Engineering• Control in a
systemperspective
Physical systemMeasurementsystemSensors
Controlcomputing
Controlhandles
Actuators
Physicalsystem
• Control analysisperspective
Controlcomputing
System model Controlhandlemodel
Measurementmodel
EE392m - Winter 2003 Control Engineering 2-4
Models
• Model is a mathematical representations of a system– Models allow simulating and analyzing the system– Models are never exact
• Modeling depends on your goal– A single system may have many models– Always understand what is the purpose of the model– Large ‘libraries’ of standard model templates exist– A conceptually new model is a big deal
• Main goals of modeling in control engineering– conceptual analysis– detailed simulation
EE392m - Winter 2003 Control Engineering 2-5
),,(),,(
tuxgytuxfx
==&
Modeling approaches• Controls analysis uses deterministic models. Randomness and
uncertainty are usually not dominant.• White box models: physics described by ODE and/or PDE• Dynamics, Newton mechanics
• Space flight: add control inputs u and measured outputs y),( txfx =&
EE392m - Winter 2003 Control Engineering 2-6
vr
tFrrmv pert
=
+⋅−=
&
& )(3γ
Orbital mechanics example
• Newton’s mechanics– fundamental laws– dynamics
=
3
2
1
3
2
1
vvvrrr
x),( txfx =&
• Laplace– computational dynamics
(pencil & paper computations)– deterministic model-based
prediction1749-1827
1643-1736rv
EE392m - Winter 2003 Control Engineering 2-7
Orbital mechanics example
• Space flight mechanics
• Control problems: u - ?
=
3
2
1
3
2
1
vvvrrr
x
),,(),,(
tuxgytuxfx
==&
=)()(
rr
yϕθ
vr
tutFrrmv pert
=
++⋅−=
&
& )()(3γThrust
state
modelobservations /measurements control
EE392m - Winter 2003 Control Engineering 2-8
Geneexpressionmodel
EE392m - Winter 2003 Control Engineering 2-9
),,(),,()(
tuxgytuxfdtx
==+
Sampled Time Models• Time is often sampled because of the digital computer use
– computations, numerical integration of continuous-time ODE
– digital (sampled time) control system
• Time can be sampled because this is how a system works• Example: bank account balance
– x(t) - balance in the end of day t– u(t) - total of deposits and withdrawals that day– y(t) - displayed in a daily statement
• Unit delay operator z-1: z-1 x(t) = x(t-1)
( ) kdttuxfdtxdtx =⋅+≈+ ),,,()(
xytutxtx
=+=+ )()()1(
EE392m - Winter 2003 Control Engineering 2-10
Finite statemachines
• TCP/IP State Machine
EE392m - Winter 2003 Control Engineering 2-11
Hybrid systems• Combination of continuous-time dynamics and a state machine• Thermostat example• Tools are not fully established yet
off on72=x
75=x
70=x
70≥−=
xKxx&
75)(
≤−=
xxxhKx&
EE392m - Winter 2003 Control Engineering 2-12
PDE models• Include functions of spatial variables
– electromagnetic fields– mass and heat transfer– fluid dynamics– structural deformations
• Example: sideways heat equation
1
2
2
0)1(;)0(
=∂∂=
==∂∂=
∂∂
xxTy
TuTxTk
tT
yheat flux
x
Toutside=0Tinside=u
EE392m - Winter 2003 Control Engineering 2-13
Black-box models
• Black-box models - describe P as an operator
– AA, ME, Physics - state space, ODE and PDE– EE - black-box,– ChE - use anything– CS - state machines, probablistic models, neural networks
Px
uinput data
youtput data
internal state
EE392m - Winter 2003 Control Engineering 2-14
Linear Systems
• Impulse response• FIR model• IIR model• State space model• Frequency domain• Transfer functions• Sampled vs. continuous time• Linearization
EE392m - Winter 2003 Control Engineering 2-15
Linear System (black-box)
• Linearity
• Linear Time-Invariant systems - LTI
)()( 11 ⋅→⋅ yu P
)()( TyTu P −⋅→−⋅
)()()()( 2121 ⋅+⋅→⋅+⋅ byaybuau P
)()( 22 ⋅→⋅ yu P
→ Pu
t
y
t
EE392m - Winter 2003 Control Engineering 2-16
Impulse response• Response to an input impulse
• Sampled time: t = 1, 2, ...• Control history = linear combination of the impulses ⇒
system response = linear combination of the impulse responses
( ) )(*)()()(
)()()(
0
0
tuhkukthty
kukttu
k
k
=−=
−=
∑
∑∞
=
∞
=
δ
)()( ⋅→⋅ hPδu
t
y
t
EE392m - Winter 2003 Control Engineering 2-17
Linear PDE System Example
• Heat transfer equation,– boundary temperature input u– heat flux output y
• Pulse response and step response
00.2
0.40.6
0.81 0
0.20 .4
0.60 .8
10
0.2
0.4
0.6
0.8
1
TIME
TEMPERATURE
COORDINATE
0)1()0(
2
2
==∂∂=
∂∂
TTuxTk
tT
1=∂∂=
xxTy
0 20 40 60 80 1000
2
4
6x 10
-2
TIME
HE
AT
FLU
X
PULSE RESPONSE
0 20 40 60 80 1000
0.2
0.4
0.6
0.8
1
TIME
HE
AT
FLU
X
STEP RESPONSE
EE392m - Winter 2003 Control Engineering 2-18
FIR model
• FIR = Finite Impulse Response• Cut off the trailing part of the pulse response to obtain FIR• FIR filter state x. Shift register
– dynamical model:– Euler integration method:– Runge-Kutta: ode45 in Matlab
• Can do simple problems by integrating ODEs• Issues:
– mixture of continuous and sampled time– hybrid logic (conditions)– state machines– stiff systems, algebraic loops– systems integrated out of many subsystems– large projects, many people contribute different subsystems
),( txfx =&( )ttxfdtxdtx ),()()( ⋅+=+
EE392m - Winter 2003 Control Engineering 2-38
Simulation environment
• Block libraries
• Subsystem blocksdeveloped independently
• Engineered for developinglarge simulation models
• Supports code generation
• Simulink by Mathworks• Matlab functions and analysis• Stateflow state machines
• Ptolemeus -UC Berkeley
EE392m - Winter 2003 Control Engineering 2-39
Model block development• Look up around for available conceptual models• Physics - conceptual modeling• Science (analysis, simple conceptual abstraction) vs.
engineering (design, detailed models - out of simple blocks)
EE392m - Winter 2003 Control Engineering 2-40
Modeling uncertainty• Modeling uncertainty:
– unknown signals– model errors
• Controllers work with real systems:– Signal processing: data → algorithm → data– Control: algorithms in a feedback loop with a real system
• BIG question: Why controller designed for a model wouldever work with a real system?– Robustness, gain and phase margins,– Control design model, vs. control analysis model– Monte-Carlo analysis - a fancy name for a desperate approach