View
0
Download
0
Category
Preview:
Citation preview
1copy 2011 The MathWorks Inc
Opportunity in Embracing ImperfectionIs simulation the real thing
Pieter J MostermanSenior Research ScientistDesign Automation Department
Adjunct ProfessorSchool of Computer Science
2
In your opinion what lasting legacy has YACC brought to language development
YACC made it possible for many people who were not language experts to make little languages (also called domain-specific languages) to improve their productivity Also the design style of YACC - base the program on solid theory implement the theory well and leave lots of escape hatches for the things you want to do that dont fit the theory - was something many Unix utilities embodied It was part of the atmosphere in those days and this design style has persisted in most of my work since then
Interview with Stephen C Johnson in ldquoThe A-Z of programming languages YACCrdquo Computerworld 09072008httpnewsidgnocwartcfmid=094E3B6E-17A4-0F78-311509693E8E95C1
3copy 2011 The MathWorks Inc
Opportunity in Embracing ImperfectionIs simulation the real thing
Pieter J MostermanSenior Research ScientistDesign Automation Department
Adjunct ProfessorSchool of Computer Science
4
The importance of computation
Together with theory and experimentation computational science now constitutes the ldquothird pillarrdquo of scientific inquiry
5
The importance of computation
Resolved That the House of Representativesmdash3) encourages the expansion of modeling and simulation as a tool
and subject within higher education4) recognizes modeling and simulation as a National Critical
Technology
6
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
7
The science in engineering a system
Discard detail but keep pertinent behavior
experimentation theoryhttpimagesjscnasagov
8
The science in engineering a system
Where is the heat
But often no analytical solution
experimentation theory
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
2
In your opinion what lasting legacy has YACC brought to language development
YACC made it possible for many people who were not language experts to make little languages (also called domain-specific languages) to improve their productivity Also the design style of YACC - base the program on solid theory implement the theory well and leave lots of escape hatches for the things you want to do that dont fit the theory - was something many Unix utilities embodied It was part of the atmosphere in those days and this design style has persisted in most of my work since then
Interview with Stephen C Johnson in ldquoThe A-Z of programming languages YACCrdquo Computerworld 09072008httpnewsidgnocwartcfmid=094E3B6E-17A4-0F78-311509693E8E95C1
3copy 2011 The MathWorks Inc
Opportunity in Embracing ImperfectionIs simulation the real thing
Pieter J MostermanSenior Research ScientistDesign Automation Department
Adjunct ProfessorSchool of Computer Science
4
The importance of computation
Together with theory and experimentation computational science now constitutes the ldquothird pillarrdquo of scientific inquiry
5
The importance of computation
Resolved That the House of Representativesmdash3) encourages the expansion of modeling and simulation as a tool
and subject within higher education4) recognizes modeling and simulation as a National Critical
Technology
6
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
7
The science in engineering a system
Discard detail but keep pertinent behavior
experimentation theoryhttpimagesjscnasagov
8
The science in engineering a system
Where is the heat
But often no analytical solution
experimentation theory
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
3copy 2011 The MathWorks Inc
Opportunity in Embracing ImperfectionIs simulation the real thing
Pieter J MostermanSenior Research ScientistDesign Automation Department
Adjunct ProfessorSchool of Computer Science
4
The importance of computation
Together with theory and experimentation computational science now constitutes the ldquothird pillarrdquo of scientific inquiry
5
The importance of computation
Resolved That the House of Representativesmdash3) encourages the expansion of modeling and simulation as a tool
and subject within higher education4) recognizes modeling and simulation as a National Critical
Technology
6
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
7
The science in engineering a system
Discard detail but keep pertinent behavior
experimentation theoryhttpimagesjscnasagov
8
The science in engineering a system
Where is the heat
But often no analytical solution
experimentation theory
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
4
The importance of computation
Together with theory and experimentation computational science now constitutes the ldquothird pillarrdquo of scientific inquiry
5
The importance of computation
Resolved That the House of Representativesmdash3) encourages the expansion of modeling and simulation as a tool
and subject within higher education4) recognizes modeling and simulation as a National Critical
Technology
6
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
7
The science in engineering a system
Discard detail but keep pertinent behavior
experimentation theoryhttpimagesjscnasagov
8
The science in engineering a system
Where is the heat
But often no analytical solution
experimentation theory
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
5
The importance of computation
Resolved That the House of Representativesmdash3) encourages the expansion of modeling and simulation as a tool
and subject within higher education4) recognizes modeling and simulation as a National Critical
Technology
6
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
7
The science in engineering a system
Discard detail but keep pertinent behavior
experimentation theoryhttpimagesjscnasagov
8
The science in engineering a system
Where is the heat
But often no analytical solution
experimentation theory
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
6
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
7
The science in engineering a system
Discard detail but keep pertinent behavior
experimentation theoryhttpimagesjscnasagov
8
The science in engineering a system
Where is the heat
But often no analytical solution
experimentation theory
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
7
The science in engineering a system
Discard detail but keep pertinent behavior
experimentation theoryhttpimagesjscnasagov
8
The science in engineering a system
Where is the heat
But often no analytical solution
experimentation theory
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
8
The science in engineering a system
Where is the heat
But often no analytical solution
experimentation theory
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
9
experimentation theory computation
The science in engineering a system
A computational solution
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
10
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
11
experimentation theory computation
The science in engineering a system
A computational solution
Not much heat at the nozzles hellip letrsquos change the material hellip
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
12
Computational methods to add more detail
Same computational approximationInformation beyond what is in a first principles model
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
13
Same computational approximation
Computational methods to add more detail
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
14
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
15
Model quality
information
appr
oxim
atio
nanalytic
computation
decreasingerror
error level
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
16
Computational methods are not that mature
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
17
Computational methods are not that mature
ldquo hellip engineers used Crater during STS-107 to analyze a piece of debris that was at maximum 640 times larger in volume than the pieces of debris used to calibrate and validate the Crater modelrdquoH W Gehman Jr et alldquoReport of Columbia Accident Investigation Board Volume Irdquo National Aeronautics and Space Administration August 2003
Dr Scott LiebermanmdashAP PhotoTyler Morning Telegraph
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
18
httptatwitudelftnlnwusersvuikinformationfig06gif
Technology maturation a comparison
Brooklyn Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement
1849 1883 1940
hellip till failure
httpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
19
Technology maturation a comparison
Brooklyn Bridge Akashi-Kaikyō Bridge
Tacoma Narrows BridgeSzeacutechenyi Chain Bridge
ldquoComputational Science Demands a New Paradigmrdquo Douglass E Post and Lawrence G Votta Physics Today 2005
Conservative Cautious improvement Firm methodology
1849 1883 1940 1998
hellip till failure
httpwwwlibwashingtoneduspecialcollexhibitstnbhttpblogteacollectioncomthe-lion-on-szechenyi-chain-bridge-3067
httphelpforsnarodruUSANew_Yorknew_york_2html httpwwwweirdlyoddcom10-tallest-bridges-in-the-world
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
20
Premise
Approximation is not the culpritndash Model-Based Design is successfully exploiting computation ndash But still very ad hoc lots of testing required
Embrace the imperfectionndash Create better models without reducing the approximationndash Use computational methods to
Enhance model information Enhance domain information Analyze and design complex execution engines
ndash Requires precise definition of the execution semantics Differential equations difference equations discrete event etc Approximations
Treat computation as equal to experiment and theory
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
21
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
22
Design of an engineered system
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
23
Increasingly more detail
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
24
Target stack
System behavior
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
25
Target stackHost stack
Simulation studies
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
26
Host stack Target stack
Model-Based Design
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
27
Host stack Target stack
Model-Based Design
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
28
Host stack Target stack
Executable specifications
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
29
Host stack Target stack
Model elaboration
Elaborate
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
30
Host stack Target stack
Automatic code generation
Elaborate
Synthesize
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
31
Host stack Target stack
ExploreVerifyTest
Elaborate
Synthesize
ExploreVerifyTest
ExploreVerifyTest
Raises level of abstraction
Enables continuous testing
Model-Based Design
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
32
Mapping an application
General purpose
Application specific
Sing
le a
pplic
atio
n
Application to be implemented
Technology divergence
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
33
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Application specific
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
34
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Compile technology into application
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
35
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
36
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Reuse shared transformation technology
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
37
Application specific
Mapping an application
General purpose
Sing
le a
pplic
atio
n
Modular timing engine to enable reuse
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
38
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
39
Computer Automated Multiparadigm Modeling for technology reuse
F0
SY SE
FM
SY SE For graphical syntax often a meta model is used
A syntax a semantic domain and a mapping
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
40
Define semantics as a syntactic transformationmdashsemantic anchoring
FISE
SY
F0
SY SE
FM
SY SE
TL R
IL R
IL R
IhelliprArr
FT
SY SE Transformation model
Target semantic domain must be subsumed
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
41
Modeling a model transformation
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
42
Modeling a model transformation
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
43
Modeling a model transformation
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
44
Model-Based Design
Host stack Target stack
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
45
Model-Based Design
Host stack Target stack
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
46
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
47
Can we develop a unifying semantic domain
Multi-domain models comprise many formalisms hellip
F0
SY SE
FU
SY
SE
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
48
v
x
Modeling a physical system
vx
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
49
v
x
Modeling a physical system
vx
Letrsquos develop a numericalsolver to compute a solution hellip
From first principles hellip Hookersquos Law
Newtonrsquos SecondC
xxF 0minusminus=
maF =
A bit of calculus
dttdxtv
dttdvta
)()(
)()(
=
=
Cxtx
dttdvm
dttdxtv
0)()(
)()(
minusminus=
=An ideal oscillator
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
50
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kxkx
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
51
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx
1ˆ +kx1+kε
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
52
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
53
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
54
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
55
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
56
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+ke tεWhen x(t) changes little hk can be large
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
57
Numerical integration
kt
kx
)( txfx =
kkkke htxtxtx )()()(ˆ 1 +=+
Euler step h in time along
1+kt
1+kx1+kε
kkk
kkt htxtxtxtx2
)()()()(ˆ 11
++= +
+
Trapezoidal average the end points
Taylor series expansion for error analysis
)(2
)(1
)()()( 321 kk
kk
kkk hOhtxhtxtxtx +++=+
)( 1+kt tε
Change step size based on estimate 211 2
)()(ˆ)(ˆ kk
ktke htxtxtx
asympminus ++
)( 1+ke tε
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
58
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally
v
x
vx
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
59
Sophisticated solver hellip
Letrsquos compute a solution to the ideal oscillator
We can make the error small hellip but only locally It accumulates for lsquolong timersquo behavior So hellip how come the JSF flies
v
x
vx
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
60
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
verify
void main () int i
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
61
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
62
Engineering an embedded system
physical theoretical
dttdvmtF )()( =
validate
In collaboration with Hans Vangheluwe McGill University
computational
validate
verify
void main () int i
refine
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
63
Host stack Target stack
Create executable models in all phases
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
64
Host stack Target stack
Make the computational approximation the primary design deliverablemdashthe real thing
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
65
So that gets the job done hellip but hellip
More than 50 of the modeling effort is in verification validation and testing
Semantics of models is buried in the execution engine Engine code base is extensive and complex
ndash Interaction of approximationsndash Interaction and interfacing of different formalisms
How can we mature the field Model the semantics of the execution engine
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
66
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
67
system
model
model
systemunder study
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
68
Computer Automated MultiparadigmModeling
(CAMPaM)
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
69
With the most appropriate formalism
At the most appropriate level of abstraction
So what is a model anyway
Jean Beacutezivin
ldquoEverything is a modelrdquo
Jean-Marie Favre
ldquoNothing is a modelrdquo
Pieter J Mosterman
ldquoNothing is not a modelrdquo
Hans Vangheluwe
ldquoModel everythingrdquo
systemmodel
system under study
model
system
In collaboration with Hans Vangheluwe McGill University
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
70
Host stack Host stack Target stack
analyzebehavior
Modeling the execution engine
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
71
Host stack
Modeling the execution engine
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
72
Host stack
Create abstractions in the simulation stack hellip
specification
implementation
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
73
Host stack
Create abstractions in the simulation stack hellip
declarative model
imperative model
implementation
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
74
Host stack
analyze
Analyze as little as possible
declarative model
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
75
Host stack
analyzedesign
reuse
Further facilitate design reuse hellip
declarative model
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
76
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 55
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
77
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope
1 6 5125
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
78
A declarative formalism with fix-point semantics
1z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
79
A declarative formalism with fix-point semantics
1 6 5121z21
Constant Gain Delay Scope5
02 0003 04 01
ndash Repeated application of a monotonically increasing partial function converges to a fixed point
ndash One implementation is a data dependency schedule
1z21
Constant Gain Delay Scope
1 6 5125
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
80
Dynamic systems evolve over time
Sequences of fix-point evaluations Define input and output signals as (potentially infinite)
streams of valuesndash Stream(Type) = Type Stream(Type)
Delay as a function applicationndash Delay x0 u = x0 u
ndash A variable has a lsquoclockrsquo that encodes its sample time
1z2 4 7 hellip5
5 2 4 hellip
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
81
Multiple rates a potential problem hellip
Streams are only practical if we can limit the stream entries being accessed
Not this
even+
x4x3x2
x4
x0+x0 x1+x2 x2+x4 hellip x0 x1 x2 x3 x4 hellip
x0 x1 x2 x3 x4 hellip
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
82
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip
x0 x2 x4 hellip
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
83
Clock calculus to detect
Require compatible clocks the synchronous assumption
Match against base clock
even+
x0 x1 x2 x3 x4 hellipx0 x1 x2 x3 x4 hellip
T T T T T hellip
T F T F T hellip T T T T T hellip 0 pad
x0 x2 x4 hellip x0 0 x2 0 x4 hellip
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
84
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBaseFind greatest common divisor (Ts)
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
85
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
86
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
Ts
T F T F T TFT T T T T T T
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
87
2 7 3 hellip
Source
Ts = 2 (s)
T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
SourceDelayBase
T F T F T TFT T T T T T T
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
88
hold
2 7 3 hellip
Source
Ts = 2 (s)T T T T T T T
A multi-rate system example
1z2Gain Delay Scope
Ts = 1 (s)
Source
DelayBase
T F T F T TF
T T T T T T T
T F T F T F TRTT T T T T T T
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
89
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
90
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
T T T T T T T
Ts
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
91
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
Ts2Ts
time
T T T T T T T
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
92
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
time
Ts2Ts
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
93
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluations
t(0)
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
94
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variable
t(0)t(1)
t(2)
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
95
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0
t(0)t(1)
t(2)t(3)
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
96
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
97
evaluation
Can we use this framework to define a variable-step solver
Separatendash Time (explicit)ndash Evaluations (ordered)
Time as a function of evaluationsndash Step is variablendash Step may be 0ndash Step may be negative
Time may recedet(0)t(1)
t(2)t(3)
t(4)
t(5)
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
98
A stream based functional solver
minus= sum =
otherwiseeoddif
eyihiuey
e
e
ie
)()1(
)()()( 1
( )sum =
minus+minus=
e
itihiuiuey
1 2)1()()1()(
Euler integration
Trapezoidal integration
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
99
previous increment
A stream based functional solver
minusminusminusminus= sum =
otherwiseeoddif
eyipihiuihiuey
e
e
ie
)()1(
)()2()2()()()( 1
( ) ( )sum =minus
minusminus+minusminus
minus+minus=
e
it ipihiuiuihiuiuey1
)1(2
)3()2()3(2
)1()()1()(
( ) toleheueheueued ltminusminusminusminusminus+minus
= )2()2(2
)3()2()3()(
previous increment
Euler integration
Trapezoidal integration
Error computation
increment
increment
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
100
2 7 3 hellip
Source
Ts = 2 (s)
Rate transition a function of time
1s2Gain Integrator Scope
hold (t)
Now we can create a variable step solver inside 1s that maps onto the synchronous paradigm
Dynamically compute lsquoholdrsquo output as an argument of time
No predetermined sequence of output values
)()( sTtuty =
t
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
101
Unifying formalisms with different semantics
Newtonrsquos Law and Hookersquos Lawndash Differential equations as before
Control behaviorndash Sampled data (periodic Ts=05)
Contact behaviorndash Discontinuous changes hellip
Fpull
R C
m
Fg
x=0Ffloorx
==
=else
kifkif
kFpull
0110020
)(
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
102
Modeling the contact behavior
Simultaneous inequalities
Finite state machine
free contact
0ltx
0gex
lt
+minus=
otherwisetxif
CtxtRvtFfloor
0)(
0
)()()(
0)( =tFfloor
+minus=
CtxtRvtFfloor)()()(
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
103
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
104
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
105
Computational simulation
Position vs time Time vs evaluations (detail)
Simultaneous inequalities Finite state machine
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
106
But time is a function of evaluations
Simultaneous inequalities
Which t should tevent really map ontoball
smoothfloorsmoothball
eventevent
eventeventfloor
metF
geta
otherwiseetxif
CetxetRvetF
))(())((
0))((
0
))(())(())((
+=
lt
+minus=
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
107
Different choice of semantics
50 100 150 200 250 300-01
-008
-006
-004
-002
0
002
004
evaluations
posi
tion
evaluated onaccepted time step
always evaluated
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
108
Comparing with an analytic solution
032 034 036 038 04 042 044 046-012
-01
-008
-006
-004
-002
0
002
time
posi
tion
evaluated on acceptedtime step
analytic solution
always evaluated
Justyna Zander Pieter J Mosterman Greacutegoire Hamon and Ben Denckla ldquoOn the Structure of Time in Computational Semantics of a Variable-Step Solver for Hybrid Behavior Analysis in the Proceedings of the IFAC World Congress Milan Italy August 2011
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
109
Characteristics of the semantic domain
Declarativendash Purely functional (no side effects)
Ordered evaluations Untimed
ndash Time as explicit function t(e)ndash Time is not strictly increasing
Broadly applicable to dynamic systemsndash Differential equations difference equations discrete events
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla Towards Computational Hybrid System Semantics for Time-Based Block Diagrams in 3rd IFAC Conference on Analysis and Design of Hybrid Systems (ADHS09) A Giua C Mahulea M Silva and J Zaytoon (eds) pp 376-385 Zaragoza Spain September 16-18 2009 plenary paper
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
110
Agenda
Outline Model-Based Design Problem statement A solution approach Outlook
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
111
Conclusions
Computation the good and not so goodbull Quantitative approximationndash Potential for higher quality models
Exploit computational methodsndash We must formalize the computational execution semanticsndash Model at a declarative level
Define solvers using a functional stream-based approachndash Precise computational semantics of the execution engine
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
112
Opportunities
First principles in computational form New generation of modeling and simulation tools
ndash More robust in less time (less bugs more reliable and consistent approximation)
Bring disciplines togetherndash Engineering Computer Science Physics Mathematics
Exploit the abstractionndash Automatic code generation ndash Computational methods for
Analysis Design Synthesis
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
113
Control synthesis using model checking
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
114
Control synthesis using model checking
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
115
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
116
A counterexample
Pieter J Mosterman Justyna Zander Greacutegoire Hamon and Ben Denckla A Computational Model of Time for Stiff Hybrid Systems Applied to Control Synthesis in Control Engineering Practice in press
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
117
Controlled acceleration of mounted component
0 001 002 003 004 005-20
-15
-10
-5
0
time
acce
lera
tion
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
118
Acknowledgments
Justyna Zander Harvard University
Fraunhofer Institute FOKUS Berlin
Greacutegoire HamonMathWorks
Ben DencklaIndependent Thinker
Hans VangheluweUniversity of Antwerp
McGill University
Many thanks for their continuing collaboration
119
reg
119
reg
Recommended