Chapter 3. Define the FSM metamodel

3.1.  Fsm metamodel presentation

We want to represent IO/state machines. Inputs and outputs can be attached on each transition. To illustrate finite state machine, here is a simple example. This state machine recognizes the "hello!" motif and produces the "world!" motif. Here, we present this finite-state machine in a specific graphical syntax where states are represented as squares and transitions by arrow between squares. Input and outputs are present above transitions. Here, "h/w" says that we consume an "h" to produce a "w".

Example of IO/State machines

Figure 3.1.  Example of IO/State machines

This simple state machine can be modeled and executed easily in Kermeta. See the following meta-model presented in a class diagram syntax. You can retrieve this metamodel named fsm.ecore into fr.irisa.triskell.kermeta.samples.fsm.demoAspect/metamodels/fsm.ecore

FSM metamodel

Figure 3.2.  FSM metamodel

3.2. Create the fsm meta-model

In this tutorial we want to create the fsm metamodel with EMF. To start with, create a new EMF project (File-> New-> Other -> Eclipse Modeling Framework -> Empty EMF Project) and name it org.kermeta.fsm.emf . Then create a new folder model on it. If you want to create an EMF metamodel for fsm from scratch you can follow the tutorial "How to create an EMF meta model?"" and use the EMF Sample reflexive editor to create a metamodel like in the following figure into the folder model. Name it fsm.ecore. Otherwise, you can simply copy the file fsm.ecore from fr.irisa.triskell.kermeta.samples.fsm.demoAspect/metamodels/fsm.ecore to org.kermeta.fsm.emf/model folder.


An FSM EMF editor is ever deployed into the Kermeta Eclipse. It is available in File-> New -> Other -> Kermeta -> FSM Samples -> Fsm Model.

At this stage of the tutorial, you should have the following metamodel:

A simple fsm metamodel

Figure 3.3.  A simple fsm metamodel

Then you can use this metamodel to create instances of models conform to it, like detailed in the next section.