Skip to content
This repository was archived by the owner on Sep 17, 2019. It is now read-only.

GuideTutorialMarkedGraph

Xavier Crégut edited this page Apr 10, 2015 · 48 revisions

GEMOC xDSML definition tutorial with MarkedGraph

Overview / What is expected at the end of this tutorial

This tutorial aims at demonstrating the power of the GEMOC studio to define an executable semantics and provide graphical animation for a DSML. It relies of the marked graph language.

Show an animated GIF or a video.

Note
A screencast of this tutorial can be found here (five URL when it will be available)…​

Install the projects defining the Marked Graph AS and CS

Import the Marked Graph AS and CS

Marked Graph is a Petri net in which every place has exactly one incoming arc and exactly one outgoing arc. As a consequence, it a concurrent language (several transitions may be fired) and has no conflict.

In this section, we first initialize the xDSML project for MarkedGraph with the provided Abstract Syntax (AS) and Concrete Syntax (CS). The next subsections explains MarkedGraph and can be skipped by the reader who already know that language.

Abstract Syntax

The Domain Model defines :

  • a marked graph as a set of places and transitions.

  • Each Place has exactly one input transition and one output transition and a token count.

  • A transition has several input places and several output places.

Abstract Syntax of MarkedGraph
Figure 1. Abstract Syntax of MarkedGraph

Concrete Syntax and Sample Model

The one of Wikipedia? Another one ?

Set up an xDSML project

Create an xDSML Project

Create a new xDSML project (New > Project > GEMOC Project / new xDSML Project), with the desired name (for instance org.gemoc.example.markedgraph).

TODO: Add a screenshot

Open xDSML View

A file project.xml has been created. When opened, it provides the xDSML view which summarizes all the important resources used in an xDSML project (which are part of and managed by other projects). This view is a kind of dashboard or control center to have quick access to any important resource of the project.

TODO: Add a screenshot

Select the AS

TODO: Click on …​ and select the ecore…​

TODO: Click on xxx to open the resource…​

TODO: Click on the genmodel and select generate all

TODO: Add a screenshot

Select the Graphical Editor XXX…​

TODO : Select desgin project.

Define the Execution Semantics

TODO: Provide the execution semantics overview.

A transition can be fired if there is at least one token in every of each entry place. When fired, one token is removed from each entry place and one token is added to each output place.

Only one transition is fired at a time.

One want to know the number of token in any place during the execution. For example, it can be shown as a number inside the circle representing a place and the size of the circle can be XXX proportionel at the number of it contains.

% XXX: Fireable transitions may be drawn in green.

Define DSA

When executing a Marked Graph model, we want to know the number of token of each place (it is an ED). When transition are fired (EF), tokens are moved from input places to outout places (XXX not really moved).

The DSA of Marked Graph is composed of :

  • one ED called runtimeTokenCount defined on Place . It represents the number of token in a place when the model is executed.

  • one EF called initialize() defined on MarkedGraph. It initializes the runtime token count of each place with the initial token count.

  • one ED called fire() on Transition. It to remove one token from each of its input places and add one token to all its output places.

Create the DSA Project

Click on K3 project in the xDSML view (Behavioral definition / DSA definition). The wizard to create of new Kermeta 3 project is launched with the name of the project initialized (k3dsa is the last name).

Clicking again on K3 project will now allow to choose and open markedgraph.xtend. It has been initialized with a template that can be discarded.

Implement the DSA

Fill in the following code in the markedgraph.xtend resource:

link:MarkedGraph/markedgraph.xtend[role=include]

Create the Extented Model with Melange

Note: This step should become transparent in a next version of the GEMOC Stutio.

Define DSE

Create the DSE Project

Right click on the ECL project in the DSE definition part. Select the Ecore file markedgraph.ecore and the root container model element: markedgraph::MarkedGraph. The file markedgraph.ecl is created in the org.gemoc.example.markedgraph.dse.

Define the ECL part

Here is the definition of the ECL.

The first part…​

Warning
Errors are present because the used Relations are not yet defined…​
link:MarkedGraph/markedgraph.ecl[role=include]

What should be explained?

  • The main principles (we can fire as much transition has the initial token count of a place, thus a delayed is introduce)

  • We want to ensure that one init is done before any fire (and only once)

Provide a pointer to another tutorial (or a new part of this one) which explains how to capitalize pieces of MoCC in a library.

Provide a pointer to a MoCCML version which uses constraint automata to define the MoCC.

Define MoCC

Give the implemntation of the Relation used in the DSE.

MoCCLib…​ To be done…​

TODO: How to explain the defined relation?

Define Animation Viewpoint

The purpose of the animation is to show the number of token in each places as well as the executable transitions.

As the animation is close to the graphical concrete syntax, we extend the existing diagram description.

Extend the existing diagram description

TODO: Explain…​

XXX: In Which eclipse?

TODO: The aird has to be provided!

Add a link to a tutorial for Sirius Animator.

Animate a Model

Start a runtime Eclipse

Import the project with a sample model

Create a Launch Configuration

Start the model

Select a logical step

What else?

Questions/Remarks…​

Questions on the MoCC from summerSchool :

  • why delayedBy p.initialMarking and not delayedBy 1? =⇒ Because we can make as much read as there is initialMarking token in the place. Any write in that place, means that a new read can be done.

  • is it still right if the initial marking is P2 = 1 (all other places is 0) ? =⇒ No. But in any case, this initialMarking will result in a deadlock.

  • what if there is several places which are initially marked? =⇒ See read/write semantics

  • typo in the DelayFor expression on slide 93: two times outputTransition.fireCall

Questions on the implementation :

  • A transition has no more that one input or output place. Should be any number !

Questions:

  • use execute for the EF on transition instead of fire and use fire (or trigger) for the DSE instead of fireCall.

Questions de forme :

  • Utilisation des abbréviations (MoCC, DSA, EF, ED, AS, CS, etc.) : Prévoir un lexique sur le site ?

  • Éviter d’avoir trop de sections : par exemple, supprimer ED, EF.

TODO :

  • Donner des éléments pour la mise au point : FAQ ?

  • regarder le dash board de Mélanie

  • regarder les outils rédigés par Didier, Florent et Issa.

Clone this wiki locally