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.
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:
ice.master.fsm.model
: defines the ECore meta-model of a FSM ;ice.master.fsm.semantic
: defines the Kermeta 3 Aspects describing a FSM's behavior ;ice.master.fsm.xdsml.*
: defines the xDSML used by GEMOC's Model Animator ;ice.master.fsm.design
: defines the Sirius Representation of a FSM.The samples folder contains examples of projects defining a FSM:
ice.master.fsm.sample.door
: represents a door owning three states (Opened, Closed, Broken) ;ice.master.fsm.sample.device
: represents a simple device owning a state (Off) and a nested FSM (On).Import these projects in your workspace to test them.
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.
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
Open GEMOC Studio, then import the projects with File > Import ... > Existing Projects into Workspace
.
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
.
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.
Go to Run > Run Configurations...
and create a new Gemoc Sequential eXecutable Model.
You must fill the following fields:
ice.master.fsm.xdsml.FSM
;public static void ice.master.fsm.xdsml.fsm.aspects.FiniteStateMachineAspect.main(ice.master.fsm.xdsml.fsm.model.FiniteStateMachine)
;/
after validation.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.
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:
Break at start
to tell GEMOC to run the FSM step-by-step.Note: to benefit from the MultiDimensional Trace view, you must open the Engine Addons tab and check Generic MultiDimensional Trace.
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.
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.
The following links provide useful informations about GEMOC Studio and its use: