UC Berkeley: ChessVanderbilt University: ISISUniversity of Memphis: MSI
CHESS ReviewMay 10, 2004Berkeley, CA
Model-Based Design
Edited by Janos Sztipanovits, Presented by Gabor Karsai ISIS, Vanderbilt University
CHESS Review, May 10, 2004 2
Objectives
Model-based design focuses on the formal representation, composition, and manipulation of models during the design process.
Specific research areas:1. Composition of Domain Specific Modeling
Languages2. Model Transformation3. Model Synthesis
CHESS Review, May 10, 2004 3
ConcreteSyntax
C
AbstractSyntax
A
SemanticDomain
S
Semantic
Mapping
Parsing
Concepts
Relations
Well formed-nessrules
Mathematical abstraction for specifying the meaning of models
Notation forrepresenting models
L = < C, A, S, MS, MC>
MC
MS
1. Composition of Domain Specific Modeling Languages
CHESS Review, May 10, 2004 4
Research Agenda
Research Agenda:1. Using the Meta-Object Facility (OMG) as
the meta-metamodel2. Specification of DSML semantics via meta-
modeling3. Foundation for composing DSML-s4. New Semantic Domains5. Extension of meta-programmable tools
Baseline: − Modeling of Abstract Syntax using UML class diagrams
and OCL as meta language;− Meta-programmable Graphical Model Editor (GME)
CHESS Review, May 10, 2004 5
Semantics via Meta-Modeling: Baseline
Concrete
Syntax
Abstract
Syntax
Semantic
DomainSemantics
parses to
Meta-modeling language withwell-defined semantics
Concrete
Syntax
Abstract
Syntax
Semantic
DomainSemantics
parses to
Represented by
Meta-modelSemantics
DSML
Meta-modelStructural
SemanticsDSML:StateFlow
DOMAIN-MODEL
META-MODEL
Meta-Model of StateFlow using uml/OCLas meta modeling language.
CHESS Review, May 10, 2004 6
New Direction: Precise Meta-Modeling
CS
A MC MS
DSML
MOFADSML
GMEMC,DSML
GMEADSML
GMECDSMLTLAAMOF TLASMOFTLAMS,MOF
C
SA MS
MC
MOF
TLA+TLA+ TLA+
GMEMOF
GMEMOF
GMEMOF
MOF
TLAAMOF TLASMOFTLAMS,MOF
C
SA MS
MC
MOF
TLA+TLA+ TLA+
Modeled by
Mapped into
Concrete
syntax
modeling
Abstract syntax modeling with MOF
Set-valued semantics for MOF
Meta-model
MOF/TLA+ Model
(meta-meta model)
GME
Meta-
Programmable
Model BuilderOngoing Work: (Poster: Compositional Metamodeling for DSMLs)
• Changing from UML-CD/OCL to MOF in abstract syntax modeling•Developing set-valued semantics for MOF using TLA+ as meta-language• Developing MOFADSML TLAADSML translator
CHESS Review, May 10, 2004 7
Semantics via Translation: Baseline
Concrete
Syntax
Abstract
Syntax
Semantic
DomainSemantics
parses to
Concrete
Syntax
Abstract
SyntaxSemantics
parses to
Semantic
Domain
translator
DSML
Semantics
Modeling language with
well-defined semantics
Synchronous Dataflow (SDF)
translatorBehavioral
Semantics
ASF
Hierarchical Signal Flow (HSF)
Lee, Sangiovanni-Vincentelli
CHESS Review, May 10, 2004 8
MHMA,MA
SC
A
MC MS
MACS
A
MC MS
HMA
MOFAHMA MOFAMA
HMADM
TLA+
TLASMA
MOF’THMA,MA
MOF MOF’ MOF
TLA+
TLA+TLAAMA
TLAMS,MA
MS: AHMASMA
MS= MS1○ MS2 ○ MS3
MS1: MOFAHMAMOFAMA MS2: MOFAMATLAAMA
MS3: TLAAMATLASMA
MADM
Metapr.transformer
New Direction: Translational Specification of DSML Semantics
Ongoing Work: (Poster: Compositional Metamodeling for DSMLs)
• TLA+ specification of the semantics of selected models of computations (reference models)• Specifying DSML semantics via specifying mapping between the abstract syntax of DSML and the reference models• Developing modeling and translation tools
CHESS Review, May 10, 2004 9
New Semantic Domains: HyVisual – Hybrid System Modeling Tool Based on Ptolemy II
HyVisual is a DSML designed for hybrid system modeling, specialized from Ptolemy II by combining its CT and FSM domains.
CHESS Review, May 10, 2004 10
Major Applications of Meta Modeling: Metropolis Meta Model (Formal Model)
•How are designs represented in Metropolis?Metropolis “meta-model”: a language + modeling mechanisms
–represents all key ingredients: function, architecture, refinement, platforms
–parser and API to browse designs, interact with tools
CHESS Review, May 10, 2004 11
• Must describe objects at different levels of abstraction
– Do not commit to the semantics of any particular model of computation
• Define a set of “building blocks”
– specifications with many useful Models of Computations can be described using the building blocks
– Processes, communication media and schedulers separate computation, communication and coordination
P1 P2M
S
P1.pZ.write( ) P2.pX.read( )
pX pZ pX pZ
M’ M’
Computation
Communication
Coordination
Metropolis Meta-Model
CHESS Review, May 10, 2004 12
Core Metropolis “Meta Model”
• Processes– Concurrent Computation, sequential execution within each
process– Execution within a process can be suspended with the
AWAIT statement • Interfaces
– The types of Ports, bundle function declarations• Media
– Model Communication by providing definitions of Interface Functions
– Passive, cannot run in their own threads• Netlists
– STRUCTURE and CONCURRENCY• Quantity Managers
– Performance modeling• Constraints
– Specification & Synchronization• Formal Semantics
– Operational Semantics based on Action Automata
CHESS Review, May 10, 2004 13
2. Model Transformations
Platform-BasedDesign of Embedded Systems
MatlabCode-Gen.
if (inactiveInterval != -1) { int thisInterval = (int)(System.currentTimeMillis() - lastAccessed) / 1000;
if (thisInterval > inactiveInterval) { invalidate();
ServerSessionManager ssm = ServerSessionManager.getManager();
ssm.removeSession(this); } } }
private long lastAccessedTime = creationTime;
/** * Return the last time the client sent a request associated with this * session, as the number of milliseconds since midnight, January 1, 1970 * GMT. Actions that your application takes, such as getting or setting * a value associated with the session, do not affect the access time. */ public long getLastAccessedTime() {
return (this.lastAccessedTime);
}
this.lastAccessedTime = time;
/** * Update the accessed time information for this session. This method * should be called by the context when a request comes in for a particular * session, even if the application does not reference it. */ public void access() {
this.lastAccessedTime = this.thisAccessedTime; this.thisAccessedTime = System.currentTimeMillis(); this.isNew=false; }
lastAccessedTime = 0L;
lastAccessedTime = ((Long) stream.readObject()).longValue(); maxInactiveInterval = ((Integer) stream.readObject()).intValue(); isNew = ((Boolean) stream.readObject()).booleanValue();
MatlabCode-Gen.
Domain-Specific Modeling Languages
GeneratorModel-Based GeneratorTechnology - Modeling of generators - Generating generators - Provably correct generators - Embeddable generators
ConfigurationSpecification
Analysis Tool
Code
Pi-1
Pi
Pi+1
CHESS Review, May 10, 2004 14
Research Agenda
Research Agenda:1. Meta Generators: Specification and
generation of model transformations using graph rewriting technology
2. Embeddable generators3. Generative extensions to modeling languages
Baseline: − Meta-models of the Abstract Syntax of the source and
target DSML-s;− Tools helping the procedural implementation of translators
CHESS Review, May 10, 2004 15
Model Transformation UsingMeta-Models and Graph Rewriting
RewriteEngineInput
ModelsTargetModels
Ph
ysi
cal in
terf
ace
Ph
ysi
cal in
terf
ace
Inp
ut
ab
stra
ct s
ynta
x
Outp
ut
ab
stra
ct s
ynta
xInput
InterfaceOutput InterfaceA
PI API
UDMUDM
GREGRE
Metamodel of Input
Metamodel of Output
Metamodel of
Transformation
Meta
-level: T
ransl
ato
r desi
gn
Imple
menta
tion:
Execu
tion
Formal, explicit, and precise model of the transformations
Karsai/Agrawal, ISIS
CHESS Review, May 10, 2004 16
Component Specialization
Model of Computation semantics defines communication, flow of control
Ptolemy II model
scheduler
Schedule:
- fire Gaussian0
- fire Ramp1
- fire Sine2
- fire AddSubtract5
- fire SequenceScope10
parsermethod call
if
block
method call
block
…
for (int i = 0; i < plus.getWidth(); i++) {
if (plus.hasToken(i)) {
if (sum == null) {
sum = plus.get(i);
} else {
sum = sum.add(plus.get(i));
}
}
}
…
Java actor definitions are parsed and then specialized for their context.
target code
abstract syntax tree
Specialize for data types parameter values scheduling
By token unboxing inlining partial evaluation dead code elimination
specializer
CHESS Review, May 10, 2004 17
3. Model Synthesis
ModelingControllerSynthesis
System Analysis
CodeSynthesis
ValidationVerification
TargetAnalysis
Platform
Platform Models
Plant Model Integrated Model
Design Feedback
Valid Model Code/Model
Test Vectors
Valid Code/Model
Design Feedback
Download
Valid Model
Challenge:Compose plant and controller models usinglibrary components with alternatives so as to satisfy design constraints
Example design flow:
CHESS Review, May 10, 2004 18
Research Agenda
Baseline: − Constraint-based design space exploration
coupled to a dataflow language
Research Agenda:1. Pattern-based model synthesis2. Models of Computations as design patterns3. Design constraints and design patterns for
multiple Models of Computations
CHESS Review, May 10, 2004 19
Pattern-based Model Synthesis
ComponentAbstraction (TA)
Design SpaceModeling (MD)
Design SpaceEncoding (TE)
Design SpacePruning
Design Decoding
ComponentReconstruction
SimulinkBehavioral
Models And
ModelComponents
Main Design Flow
Main Design Flow Design Space Modeler
DESERT Model Synthesis Flow
Using meta-modeling and model transformations we made the constraint based design space explorationtool suite composable with different design flows.
Neema, Sztipanovits, Karsai at EMSOFT 2003
CHESS Review, May 10, 2004 20
Example: Use of Model Translation in the DESERT Tool Chain
-Name : String
Model
BlockDefaultsAnnotationDefault
s LineDefaults
-Name : String
System
-Name : String
Block
Subsystem Reference Primitive
1
1
1 *
1
1
Port
Masked Normal
Line
InputPort OutputPort
1
*
1*
1
-dstPort
1
1
-srcPort1
11
1
1
Annotation
11
1*
Branch
DirectLineBranchedLine
DirectBranch NestedBranch
1
1..*
11..*
1
-dstPort
1
-Name : String
Parameter
-Value : String
Text
-Value : Boolean
Boolean
-Value : String
Enumeration
-Value : Integer
Integer
-Value : Double
Double
-Value : Variant
Vector
-Value : Variant
Type
1
0..*
ComponentAbstraction (TA)
Simulink®Metamodel
Abstracted Simulink Model Components
Design SpaceMetamodel
Top Related