390 likes | 627 Views
Model-Based Design. Edited and Presented by Janos Sztipanovits, Co-PI ISIS, Vanderbilt University. Model-Based Design. Model-based design focuses on the formal representation, composition, and manipulation of models during the design process. Domain Specific Modeling Languages (DSML).
E N D
Model-Based Design Edited and Presented by Janos Sztipanovits, Co-PI ISIS, Vanderbilt University
Model-Based Design Model-based design focuses on the formal representation, composition, and manipulation of models during the design process.
Domain Specific Modeling Languages (DSML) L = < C, A, S, MS, MC> Abstract Syntax A Concrete Syntax C Parsing MC Domain models Interchange Formats Concepts Relations Well formed-nessrules Notation forrepresenting models SemanticMapping MC MS Semantic DomainS Abstract Syntax Meta-models Mathematical abstraction for specifying the meaning of models MS DSML-s are the foundations for model-based design doTransition (fsm as FSM, s as State, t as Transition) = require s.active step exitState (s) step if t.outputEvent <> nullthen emitEvent (fsm, t.outputEvent) step activateState (fsm, t.dst) Semantic Domain Meta-models
Tool Chain Example Common Semantic Domain: Hybrid Automata Abstract Syntax: Meta-Models Domain Models and Tool Interchange Formats AIRES Vehicle Control Platform Tool Chain ECSL-DP AIF Simulink StateFlow ECSL-DP GME SL/SF ECSL-DP ECSL-DP MOML PTOLEMY SL/SF DSE EDP C OSEK/ Code DESERT
Research Agenda in Model-Based Design • Composition of Domain Specific Modeling Languages • Model Transformation • Model Synthesis
Domain Models and Tool Interchange Formats Simulink StateFlow ECSL-DP GME SL/SF ECSL-DP SL/SF DSE Constructing Design Flow: Modeling and Transformations DSML1DM DSML2DM S C C S Transformation T DSML-1 DSML-2 MC2 MC1 MS2 MS1 - Large influence of concrete syntax - No clear role of semantics • It is not clear what are we doing? A A
Domain Models and Tool Interchange Formats Abstract Syntax: Meta-Models Simulink StateFlow ECSL-DP Meta-Model SL/SF Meta-Model ECSL-DP GME SL/SF ECSL-DP SL/SF DSE DSML1DM DSML2DM ECSL-DP Meta-Model SL/SF ECSL-DP S C C S Transformation T DSML-1 DSML-2 MC2 MC1 MS2 MS1 SL/SF DESERT A A MDSML1,DSML2 MOFADSML1 MTLTDSML1,DSM2 MOFADSML2 MOF MOF MTL M12: MOFADSML1MOFADSML2 Abstract Syntax Metamodeling • Gives structural semantics for the models • Set-valued Semantic Domain for the metamodelsand transformations
Metamodeling Languages Metamodeling of DSML Using MOF Metamodeling of MOF Using MetaGME DSML MOF Meta GME MOFADSML MetaGMEAMOF T1 T2 GME-MOF GME/Meta MetaGMEADSML T1 Changing from GMEMeta to MOF GME-DSML GME/Meta
UMT: A Simple Model Transformation Language • Pattern specification • Pattern variables are typed with their UML classes • Cardinality of association-ends is checked • Extra (OCL) constraints define guard conditions • Graph transformation and rewrite • Create new/delete/modify objects • Attribute mapping (procedural) • “Cross-links”: edges between old/new objects • Input/output ports: pre-bound pattern variables • “High-level” control flow over the rules • Port connections imply “data flow” and control flow • Hierarchy/Sequencing/Recursion/Branching
Physical interface Physical interface Rewrite Engine Input Models Target Models Input abstract syntax Output abstract syntax Input Interface API API Output Interface GReAT UDM Results: MIC Metaprogrammable Tool Meta-Model of StateFlow using uml/OCLas meta modeling language. META-MODEL Metamodel of Transformation Meta-level: Translator design Metamodel of Input Metamodel of Output Implementation: Execution DSML: StateFlow Meta-model DOMAIN-MODEL GME, UDM & GREAT Completed tool suite, available through the ESCHER Repository
Modeling and Model Transformation Tool Chain C/G GRE GME DEBUG Tools: UMT Language, GRE (engine), C/G, GR-DEBUG
Ongoing Research on DSML-s and Model Transformations • Compositional construction of Metamodels (inheritance, packages, libraries, operators) • Compositional construction of Model Transformations • Multiple Aspect Modeling and modeling of aspect inter-dependences: - constraint-based, - transformation-based • Reasoning about properties of transformations • Formal semantics of transformations • Platform modeling and use of embedded platform models in transformations • Pushback reasoning in transformations • Generation of efficient code from graph transformations • Transformations for embedded system platforms • Using graph transformations for embedded component adaptation • Embedding graph transformations in the run-time platform Domain models Interchange Formats MC Abstract Syntax Meta-models MS Structural Semantics interface Event structure ModelEvent implements Event case ModelEvent1 Semantic Domain: Set-Valued
DSML1DM DSML2DM ? MS1: ADSML1S S C C S Transformation T DSML-1 DSML-2 MC2 MC1 MS2 MS1 MS2: ADSML2S A A MDSML1,DSML2 MOFADSML1 MTLTDSML1,DSM2 MOFADSML2 MOF MOF MTL M12: MOFADSML1MOFADSML2 Metamodeling and Model Transformation Use Cases Domain models Interchange Formats 1. Transformational Specification of Behavioral Semantics MC Abstract Syntax Meta-models MS Behavioral Semantics doTransition (fsm as FSM, s as State, t as Transition) = Semantic Domain Meta-models MS1= M12○ MS2
Metamodeling and Model Transformations Use Cases Domain models Interchange Formats 2. Semantic Anchoring of DSML-s MC Abstract Syntax Meta-models Semantic “Units” MSi= Mi○ MSU DSML-i MS S C C S Transformation T DSML-i SU doTransition (fsm as FSM, s as State, t as Transition) = Semantic Domain Meta-models MSU: ASUS MC2 MC1 MSU MSi A A MDSMLi,SU • The “Semantic Units” areMoC-s • DSML-s or their aspectsare anchored to the MoC-s using transforma-tions • The “Semantic Units” arespecified in a formalframework MOFADSMLi MTLTDSMLi,SU MOFASU MOF MOF MTL Mi: MOFADSMLiMOFASU
More On Semantic Anchoring • Step 1 • Define the DSML metamodel <A, C, Mc> • Step 2 • Select a proper MoC as a “semantic unit” (MoC library): Li = <Ai, Ci, MCi , Si , MSi > • Step 3 • Anchor the semantics: MA = A → Ai • DSML semantics: L = <A, C, Mc , Si , MA ○ MSi>
Example: HSML (Ptolemy II)->FSM MOF Set-Valued SD FSM Interpreter HSML MetaModel T FSM MetaModel FSM Data Model HSML Model t FSM Model FSM Data Inst. Syntax conversion Asml Set-Valued + Abstract State Machine SD Expressed in Instance of
DSML-1 S C DSML-1 MC1 MS1 A MOFADSML1 MOF Metamodeling and Model Transformation Use Cases 3. Semantic Integration of Tools Analysis Tool Modeling Tool T=T1 ○ T2 DSML1DM DSML2DM Semantic Unit (Common Semantic Domain) DSML-2 C S C S Transformation T1 Transformation T2 DSML-2 SU MS: ASUS MC MS MS2 MC2 A A MDSML1,SU MSU,DSML2 MTLTDSML1,SU MOFASU MTLTSU,DSML2 MOFADSML2 MOF MOF MTL MTL MS3: MOFADSML1MOFASU MS1= MDSML1,SU○ MS MS= MSU, DSML2○ MS2
xGiotto and Metropolis xGiotto Code Verification Code for the Target platform xGiotto functional description Platform Estimation Platform Selection Simulator xGiotto-to- Metropolis Platform1 Metropolis Description Mapping1 Mapping2 Platform2 Metropolis Description MMM functional description xGiotto Formal Verification Mapping3 Platform3 Metropolis Description Schedulability Results WCET Estimator
DSML-1 S C DSML-1 MC1 MS1 A MOFADSML1 MOF Metamodeling, Model Transformation and Analysis 4. xGiotto and Metropolis Metropolis Platform Architecture Modeling xGiotto Functional Modeling Tool DSML1DM DSML2DM Common Semantic Domain Simulator DSML-2 C S C S Transformation T1 Transformation T2 DSML-2 MMM MS: ASUS MC MS MS2 MC2 A A MDSML1,SU MSU,DSML2 MTLTDSML1,SU MOFASU MTLTSU,DSML2 MOFADSML2 MOF MOF MTL MTL MS3: MOFADSML1MOFASU MS1= MDSML1,SU○ MS MS2= MDSML2,SU○ MS xGiotto Functional Description Platform Models Metropolis: Common SemanticDomain and Function- Architecture Mappings
2,6 START START OUT 2,5,6 C C 2,7 E D E D 2,8 2,6,9 B A DATA DATA 2 F 1,2,8 F A OUT 3,8 B 3,4,8 2,4,8 B A DATA 2,4 4,8 1,2, 4,8 Metamodeling, Model Transformation and Analysis 5. QSS Transformed Concurrent Program Concurrent Program START DATA START while(1){ read(START, N, 1); for(i=0,y=0;i<N;i++){ read(DATA, d, 1); D = d * d; x[0] = D; read(DATA, d, 1); D = d * d; x[1] = D; y = y+x[0]+2*x[1]; } write(OUT, y, 1); } Common Semantic Domain: Petri Nets while(1){ read(START, N, 1); for(i=0,y=0;i<N;i++){ read(IN, x, 2); y = y+x[0]+2*x[1]; } write(OUT, y, 1); } DATA while(1){ read(DATA, d, 1); D = d * d; write(PORT, D, 1); } PORT IN OUT OUT MS3: MOFADSML1MOFASU Set of communicating processes Single process Find a single process that realizes a feasible execution of the original set under abounded memory
New Semantic Domains: Resource Interfaces Interface Theory (Henzinger et. al.) Component Structure Common Semantic Domain Resource Interfaces Resource interfaces = Methodology forcompositionalstate-awareresource-usageanalysis of open systems + Efficientalgorithms forfinding howa set of components can be made to work togetherusing the least amountof a scarce resource + Algorithms implemented in the tool Chic (http://www.eecs.berkeley.edu/~tah/Chic/) PORT IN PORT IN Two synthesis questions: Strategy Synthesis. (e.g. resource scheduler, sensornet routing algorithm) Given a resource bound, how can player Environment achieve her objective ? Resource Synthesis (e.g. necessary buffer size, battery capacity). What is the minimum resource requirement so that player Environment can achieve her objective ? Game algorithms can be generalized to answer both. stop slow fast fast? stop? slow? MS3: MOFADSML1MOFASU slow? fast? fast? 0 1 2 stop? slow? stop?
Model Synthesis Design Space Modeler Main Design Flow Behavioral Models And Model Components Component Abstraction (TA) Design Space Modeling (MD) Design Space Encoding (TE) DESERT Model Synthesis Flow Component Reconstruction Design Decoding Design Space Pruning We have extended the Design Space Exploration Tool with a Mozart-based constraint engine. Main Design Flow
Metamodel for HSML Ptolemy II Model
AsmL data Structure • Event & FSM class interface Event structure ModelEvent implements Event case ModelEvent1 case ModelEvent2 structure LocalEvent implements Event class FSM var outputEvents as Seq of ModelEvent var localEvents as Set of LocalEvent var initialState as State var children as Set of State
AsmL data Structure (cont’d) • State & Transition class class State var active as Boolean = false var initial as Boolean var initialState as State? var parentState as State? var slaves as Set of State var outTransitions as Set of Transition class Transition var guard as Boolean var preemptive as Boolean var triggerEvent as Event? var outputEvent as Event? var src as State var dst as State
Operational Semantics • Top-level FSM model reaction fsmReact (fsm as FSM, e as ModelEvent) = step let cs as State = getCurrentState (fsm, e) step let pt as Transition? = getPreemptiveTrasition (fsm, cs, e) step if pt <> nullthen doTransition (fsm, cs, pt) else step if isHierarchicalState (cs) then invocateSlaves (fsm, cs, e) step let npt as Transition? = getNonpreemptiveTranstion (fsm, cs, e) step if npt <> nullthen doTransition (fsm, cs, npt)
Operational Semantics (cont’d) • Do transition doTransition (fsm as FSM, s as State, t as Transition) = require s.active step exitState (s) step if t.outputEvent <> nullthen emitEvent (fsm, t.outputEvent) step activateState (fsm, t.dst)
Operational Semantics (cont’d) • Activate state activateState (fsm as FSM, s as State) = step s.active := true step if isAtomicState (s) then let t as Transition? = getInstantaneousTransition (s) step if t <> nullthen doTransition (fsm, s, t)
Operational Semantics (cont’d) • Get instantaneous transition getInstantaneousTransition (s as State) as Transition? = require isAtomicState (s) step let ts = {t|t in s.outTransitions where t.triggerEvent = null and t.guard } step if Size (ts) > 1 then error "non-deterministic error" step choose t in ts return t ifnone returnnull
Semantic Mapping Specification • The semantic mapping specification for FML consists of a sequence of mapping rules.
Semantic Anchoring Architecture of DSML-s M3 M2 M1 Syntactic Level DSML Metamodel(Set-Valued Semantics) DSM Model (Set-Valued Semantics) Meta-metamodel(Set-Valued Semantics Model Transf.Spec. Model Transf. Translation JAVA Host Language(Behavioral Semantics) TLA+ Host Language(Behavioral Semantics) Metamodel(Set-Valued Semantics) ModelSemantics ASML JAVA Host Language(Behavioral Semantics) TLA+ Host Language(Behavioral Semantics) ASML Model Simulation Host Language(Behavioral Semantics) Model Verification Semantic Domain (Behavioral Semantics) Model Execution MoC “Semantic Units” Semantic Level