echebbi / gemoc-fsm

Executable meta-model of Finite State Machines developped with GEMOC Studio
Eclipse Public License 2.0
1 stars 0 forks source link
ecore ecore-metamodel finite-state-machine fsm gemoc gemoc-studio mde school-project sirius state-machine

Executable Finite State Machine

Motivation

This project is aimed to experiment with GEMOC Studio.

More specifically, the goal is to create a graphical editor based on Sirius that makes able to edit a Finite State Machine (FSM). Futhermore, it must be possible to simulate a FSM's execution thanks to GEMOC's Model Animator.

Screenshot of a Door FSM

Implemented features

Model
Execution
Representation

Implementation

The Wiki sums up the implementation of such a FSM and describes how to use GEMOC. This is not a tutorial, rather a capitalization of my experience on using GEMOC Studio.

The different projects present in this repository are:

Samples

The samples folder contains examples of projects defining a FSM:

Import these projects in your workspace to test them.

Use this project

Table of Contents

1. Choose the right GEMOC Studio

At the time of writing, the latest version of GEMOC Studio is the 3.0.0-SNAPSHOT. Since it is a SNAPSHOT, the product evolves over time and some versions are more stables than overs.

The different versions are built by Jenkins, and I found out the build #33 to be pretty stable. Since Melange is not currently really trustworthy I strongly advise you to use this version of GEMOC.

2. Clone the repository

To use the projects, you must clone this repository locally. You can either use Eclipse's EGit or type the following command in your terminal:

git clone https://github.com/KazeJiyu/gemoc-fsm.git

3. Import the projects

Open GEMOC Studio, then import the projects with File > Import ... > Existing Projects into Workspace.

4. Open a second GEMOC instance

In order to use the plug-ins defining a FSM, a second GEMOC Studio has to be run. To this end, go to Run > Run Configurations .... Create a new Eclipse Application then click Run.

5. Create a new FSM

First of all, create a new project: File > New > Other... > Ecore Modeling Project.

Then, create a new FSM Model: File > New > Other... > Model Model.

Caution: the name is not really explicit, it should be changed soon.

The new file should open with the XML Editor. Close it, then right-click on the file to open it with the Model Model Editor.

You can now populate the FSM by right-clicking on the root and add new children. Their attributes can be edited through the Properties view.

6. Execute the FSM

Go to Run > Run Configurations... and create a new Gemoc Sequential eXecutable Model.

You must fill the following fields:

Finally, click Run to launch the execution.

Note: to trigger a Transition, a FSM expects events. An event is merely a string that you can send by typing it into the original GEMOC Studio's console.

7. Debug the FSM

Go to Run > Debug Configurations... and create a new Gemoc Sequential eXecutable Model.

Fill the same fields than previously as well as the following ones:

Note: to benefit from the MultiDimensional Trace view, you must open the Engine Addons tab and check Generic MultiDimensional Trace.

8. Create a representation of the FSM

From the Model Explorer, right-click on the root of the FSM, below the .fsm file and select New Representation.

The new representation should be created in the .aird file and open in the diagram editor.

9. Debug the representation of the FSM

You can debug a FSM with the help of a visual support by following the steps specified in Execute the FSM. The only change is to fill the Animator field with the path to the .aird file containing the FSM's representation.

Note: the FSM's current state is colored in orange only when selected from the Multidimensional Timeline view.

Useful links

The following links provide useful informations about GEMOC Studio and its use: