Post on 26-Jun-2015
description
Model Execution and Meta Layout in EclipseSnapshots of the KIELER Project
Christian Motika and Miro Sponemann
Real-Time Systems and Embedded Systems GroupDepartment of Computer Science
Christian-Albrechts-Universitat zu Kiel, Germany
Eclipse Summit, 08/27/2009
Eclipse Summit 2009 Model Execution and Meta Layout in Eclipse 1 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
Part I: Model Execution in Eclipse
Eclipse Summit 2009 Model Execution in Eclipse 2 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
MotivationOverview
Motivation
I EMF and GMF are great frameworks for modeling in Eclipse
I Model implementations, model and diagram editors, ...
I Modeling:
1. Structural modelsI E.g., class diagrams, component diagrams, ...
2. Behavioral modelsI E.g., flow charts, state machines, data flow models, ...
Eclipse Summit 2009 Model Execution in Eclipse 3 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
MotivationOverview
Motivation (cont’d)
System models are virtual as opposed to physical systems
I System models
I Generate code or documentationI System analysis and verificationI Simulation runsI ...
I Idea: Flexible definition of semantics and swapping out ofsimulation computation
I Solution proposed: KIELER Execution Manager
Eclipse Summit 2009 Model Execution in Eclipse 4 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
MotivationOverview
Overview
I KIELER Execution Manager
I Use case: Ptolemy
I M2M transformationI Simulation engine
I Use case: Model Railway
I InstallationI Railway Controller DSLI SimpleRailCtrl editor (DEMO)
I Summary
Eclipse Summit 2009 Model Execution in Eclipse 5 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
DataComponentsGUI And ThreadsInterface
KIEM Components
Eclipse Summit 2009 Model Execution in Eclipse 6 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
DataComponentsGUI And ThreadsInterface
KIEM GUI and Threads
I DataObserver vs.DataProducer
I Scheduling & DataPool
I Properties
I Execution Buttons
I Master
Eclipse Summit 2009 Model Execution in Eclipse 7 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
DataComponentsGUI And ThreadsInterface
Simple Interface
1 public interface IDataComponent {23 public void initialize() throws KiemInitializationException;45 public void wrapup() throws KiemInitializationException;67 public boolean isProducer();89 public boolean isObserver();
1011 public JSONObject step(JSONObject jSONObject)12 throws KiemExecutionException;1314 }
Eclipse Summit 2009 Model Execution in Eclipse 8 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
DataComponentsGUI And ThreadsInterface
Flexible Extensions
1 public abstract class DataComponent implements IDataComponent,2 IExecutableExtension {34 public boolean isMultiInstantiable() {return false;}56 public String[] provideFilterKeys() {return null;}78 public KiemProperty[] provideProperties() {return null;}9
10 public void checkProperties(KiemProperty[] properties)11 throws KiemPropertyException {}1213 public String[] provideInterfaceKeys() {return null;}1415 public boolean isHistoryObserver() {return false;}1617 public boolean isDeltaObserver() {return false;}1819 public boolean isMaster() {return false;}2021 }
Eclipse Summit 2009 Model Execution in Eclipse 9 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
M2M TransformationSimulation Engine
Overview
I KIELER Execution Manager
I Use case: Ptolemy
I M2M transformationI Simulation engine
I Use case: Model Railway
I InstallationI Railway Controller DSLI SimpleRailCtrl editor (DEMO)
I Summary
Eclipse Summit 2009 Model Execution in Eclipse 10 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
M2M TransformationSimulation Engine
What is Ptolemy?
I”The Ptolemy project studies heterogeneous modeling,simulation, and design of concurrent systems.“
Introduction to Ptolemy II, UC Berkeley
I Executable models to describe behavior of reactive systems
I Set of components interacting under a model of computation
I → Actor-Oriented Design
Eclipse Summit 2009 Model Execution in Eclipse 11 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
M2M TransformationSimulation Engine
Ptolemy EMF Model
I Ptolemy models can be executable
I DTD of the PtolemyXML representation (MOML)
I Acquire EMF modelI M2M transformationI Execute Ptolemy modelsI Back mapping of data/states
Eclipse Summit 2009 Model Execution in Eclipse 12 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
M2M TransformationSimulation Engine
Simulation with Ptolemy
Eclipse Summit 2009 Model Execution in Eclipse 13 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
InstallationRailway Controller DSLSimpleRailCtrl Editor
Overview
I KIELER Execution Manager
I Use case: Ptolemy
I M2M transformationI Simulation engine
I Use case: Model Railway
I InstallationI Railway Controller DSLI SimpleRailCtrl editor (DEMO)
I Summary
Eclipse Summit 2009 Model Execution in Eclipse 14 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
InstallationRailway Controller DSLSimpleRailCtrl Editor
Installation
I Standard model railway equipment combined withI Over 200 sensors and actuatorsI Controlled by distributed computer system
Eclipse Summit 2009 Model Execution in Eclipse 15 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
InstallationRailway Controller DSLSimpleRailCtrl Editor
Track Layout
Eclipse Summit 2009 Model Execution in Eclipse 16 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
InstallationRailway Controller DSLSimpleRailCtrl Editor
Train Movement
I Several track segments individually controlled
I Computers get sensor information (instantaneous trainpositions) and control voltage
I ⇒ Actions: SetSpeed, SetPointI ⇒ Trigger: EventContact, EventTimeout
Eclipse Summit 2009 Model Execution in Eclipse 17 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
InstallationRailway Controller DSLSimpleRailCtrl Editor
EMF Meta Model
Eclipse Summit 2009 Model Execution in Eclipse 18 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
InstallationRailway Controller DSLSimpleRailCtrl Editor
Generated GMF Editor
Eclipse Summit 2009 Model Execution in Eclipse 19 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
InstallationRailway Controller DSLSimpleRailCtrl Editor
Eclipse Model Execution Demo
LIVE DEMO
Eclipse Summit 2009 Model Execution in Eclipse 20 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
SummaryTo Go Further
Summary
I DSLs in Eclipse represented by EMF models
I Often only implicit execution semantics!
I Ptolemy models can be executable
I Xtend M2M transformation helps making semantics explicit
I Other simulator DataComponents imaginable
I KIELER Execution Manager seamlessly integrates executioninto the Eclipse RCP
Eclipse Summit 2009 Model Execution in Eclipse 21 / 33
IntroductionKIELER Execution Manager
Use Case: PtolemyUse Case: Model Railway
SummaryTo Go Further
To Go Further
UC BERKELEY, EECS DEPT.Ptolemy webpage.http://ptolemy.eecs.berkeley.edu/.
UNI KIEL, REAL-TIME AND EMBEDDED SYSTEMS GROUP.KIELER webpage.http://www.informatik.uni-kiel.de/en/rtsys/kieler/.
[2] [1]
Eclipse Summit 2009 Model Execution in Eclipse 22 / 33
IntroductionThe Interface
The Background
Part II: Meta Layout ofGraphical Models
Eclipse Summit 2009 Meta Layout of Graphical Models 23 / 33
IntroductionThe Interface
The Background
Automatic Layout in GMFKIELER Meta Layout
Automatic Layout in GMFI GMF supports automatic layout...
I ...but is not very flexibleI No selection of different layout algorithmsI No customization of layout optionsI No deep layout of compound structures
Eclipse Summit 2009 Meta Layout of Graphical Models 24 / 33
IntroductionThe Interface
The Background
Automatic Layout in GMFKIELER Meta Layout
KIELER Meta Layout
I Meta Layout: Allow fully flexible automatic diagram layout
I Contribute new layout algorithms using extension pointsI Customize layout options in the properties viewI Layout compound structures recursivelyI Layout different parts of a diagram with different options, or
even with different layout algorithms
I Development of special layout algorithms, e.g. for data flowdiagrams
Eclipse Summit 2009 Meta Layout of Graphical Models 25 / 33
IntroductionThe Interface
The Background
Layout ProvidersCustom Layout OptionsCompound StructuresMeta Layout
Layout ProvidersExtension points are used to
I define diagram types
I state machine, class diagram, etc.
I assign diagram types and layout options to specific parts of aGMF diagram
I e.g. assign the “class diagram” type to the diagram edit partof a class diagram editor
I contribute new layout algorithms
I call these contributions layout providers
I define which diagram types are supported by the layout provider
I define new layout options and specify which options areunderstood by a layout provider
Eclipse Summit 2009 Meta Layout of Graphical Models 26 / 33
IntroductionThe Interface
The Background
Layout ProvidersCustom Layout OptionsCompound StructuresMeta Layout
Custom Layout Options
I To be implemented soon...
Eclipse Summit 2009 Meta Layout of Graphical Models 27 / 33
IntroductionThe Interface
The Background
Layout ProvidersCustom Layout OptionsCompound StructuresMeta Layout
Compound StructuresI Apply layout providers recursively
Eclipse Summit 2009 Meta Layout of Graphical Models 28 / 33
IntroductionThe Interface
The Background
Layout ProvidersCustom Layout OptionsCompound StructuresMeta Layout
Meta Layout
Live Demo...
Eclipse Summit 2009 Meta Layout of Graphical Models 29 / 33
IntroductionThe Interface
The Background
Diagram LayoutData Flow Diagrams
Diagram Layout
I Layout providers work on an internal graph structure generatedwith EMF
I Need to map the contents of a diagram to the internal structureand back
I Done by Layout Managers using the GEF command / requestpattern
I Currently only a layout manager for GMF is implemented
I Analyzes the edit part structure at runtimeI Recursively go into the contents of an edit part to explore
compound structures
I Extension to other diagram editor generation frameworks ispossible
Eclipse Summit 2009 Meta Layout of Graphical Models 30 / 33
IntroductionThe Interface
The Background
Diagram LayoutData Flow Diagrams
Data Flow Diagrams
I Operators exchange data through ports
I Layout algorithms must respect these ports when routingconnections
Eclipse Summit 2009 Meta Layout of Graphical Models 31 / 33
IntroductionThe Interface
The Background
Diagram LayoutData Flow Diagrams
Data Flow Diagrams: Special Algorithm
I Developed a special algorithm to layout data flow diagrams
I Internal graph structure supports ports
I Integrated in the KIELER Meta Layout
I Also available as stand-alone library, successfully applied toPtolemy
Eclipse Summit 2009 Meta Layout of Graphical Models 32 / 33
IntroductionThe Interface
The BackgroundSummary
Summary
I KIELER Meta Layout provides flexible automatic diagram layout
I Customize layout algorithms and layout options
I Current implementation is able to layout all GMF diagrams
I Implemented a special layout algorithm for data flow diagrams
Eclipse Summit 2009 Meta Layout of Graphical Models 33 / 33