Model Execution and Meta Layout

33
Model Execution and Meta Layout in Eclipse Snapshots of the KIELER Project Christian Motika and Miro Sp ¨ onemann Real-Time Systems and Embedded Systems Group Department of Computer Science Christian-Albrechts-Universit ¨ at zu Kiel, Germany Eclipse Summit, 08/27/2009 Eclipse Summit 2009 Model Execution and Meta Layout in Eclipse 1 / 33

description

KIELER is the Kiel Integrated Environment for Layout Eclipse Rich Client. This talk reports about recent developments in the project which enhance graphical modeling (Eclipse GEF/GMF) by execution semantics of models (simulation) and automatic graphical layout.

Transcript of Model Execution and Meta Layout

Page 1: Model Execution and Meta Layout

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

Page 2: Model Execution and Meta Layout

IntroductionKIELER Execution Manager

Use Case: PtolemyUse Case: Model Railway

Part I: Model Execution in Eclipse

Eclipse Summit 2009 Model Execution in Eclipse 2 / 33

Page 3: Model Execution and Meta Layout

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

Page 4: Model Execution and Meta Layout

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

Page 5: Model Execution and Meta Layout

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

Page 6: Model Execution and Meta Layout

IntroductionKIELER Execution Manager

Use Case: PtolemyUse Case: Model Railway

DataComponentsGUI And ThreadsInterface

KIEM Components

Eclipse Summit 2009 Model Execution in Eclipse 6 / 33

Page 7: Model Execution and Meta Layout

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

Page 8: Model Execution and Meta Layout

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

Page 9: Model Execution and Meta Layout

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

Page 10: Model Execution and Meta Layout

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

Page 11: Model Execution and Meta Layout

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

Page 12: Model Execution and Meta Layout

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

Page 13: Model Execution and Meta Layout

IntroductionKIELER Execution Manager

Use Case: PtolemyUse Case: Model Railway

M2M TransformationSimulation Engine

Simulation with Ptolemy

Eclipse Summit 2009 Model Execution in Eclipse 13 / 33

Page 14: Model Execution and Meta Layout

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

Page 15: Model Execution and Meta Layout

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

Page 16: Model Execution and Meta Layout

IntroductionKIELER Execution Manager

Use Case: PtolemyUse Case: Model Railway

InstallationRailway Controller DSLSimpleRailCtrl Editor

Track Layout

Eclipse Summit 2009 Model Execution in Eclipse 16 / 33

Page 17: Model Execution and Meta Layout

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

Page 18: Model Execution and Meta Layout

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

Page 19: Model Execution and Meta Layout

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

Page 20: Model Execution and Meta Layout

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

Page 21: Model Execution and Meta Layout

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

Page 22: Model Execution and Meta Layout

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

Page 23: Model Execution and Meta Layout

IntroductionThe Interface

The Background

Part II: Meta Layout ofGraphical Models

Eclipse Summit 2009 Meta Layout of Graphical Models 23 / 33

Page 24: Model Execution and Meta Layout

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

Page 25: Model Execution and Meta Layout

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

Page 26: Model Execution and Meta Layout

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

Page 27: Model Execution and Meta Layout

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

Page 28: Model Execution and Meta Layout

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

Page 29: Model Execution and Meta Layout

IntroductionThe Interface

The Background

Layout ProvidersCustom Layout OptionsCompound StructuresMeta Layout

Meta Layout

Live Demo...

Eclipse Summit 2009 Meta Layout of Graphical Models 29 / 33

Page 30: Model Execution and Meta Layout

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

Page 31: Model Execution and Meta Layout

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

Page 32: Model Execution and Meta Layout

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

Page 33: Model Execution and Meta Layout

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