Creating the FSA meta-model

We are ready to start creating the FSA formalism we used to build the "water" model. First of all, please reload AToM3 to reset everything we have done in the past steps. You should get this starting screen:  


Ok, let's make a quick design of what we want in the FSA formalism:

Some model attributes: author, modelname, description

       - Name, Appearance (change depending on initial or final state)

       - Input/Output, Appearance

State are connected through transitions
Some constraints to prevent the user from entering invalid inputs/outputs

As a first step, let's setup the model attributes:  


The name property is *very* important since it will be the name of the generated file for our formalism.
Let's set it to "FSA"

Let's add 3 strings to the list of attributes. To do that, select new , then string (double-click on the type!) and specify a name
{author, modelname, description}  

You should get a screen like this:  


Before generating a partial FSA formalism, let's add an entity "state" to our meta-model:  


Edit the properties of the entity0: Set up its name to "state" and add an string attribute name (with a default value "state0") to get this:  


Now, we need to specify an appearance for our "state" entity. Indeed, we cannot build FSA without a graphical expression for the state! In order to specify the appearance, click on the "appearance" button in the properties of the entity:  


**Note: If some attributes of the entity don't appear on the left, you may need to reload the properties screen of the entity to confirm its state.

As you may have guessed, we draw the graphical appearance of our entity in the canvas with the option buttons on the right. In order to use any of those options, we only need to click on one of the buttons and then click on an area of the canvas. Beware, a button remains selected after its action is performed on the canvas. If we quickly define the graphical options:  



This options is used to select/move an object on the canvas.  



This options is used to delete an object on the canvas.  



This options is used to draw a line on the canvas. A left-click inserts a point in the line and a right-click confirms the drawing.  



This options is used to draw a polygon on the canvas. A left-click inserts points (to create angles) and a right-click close the polygon by connecting the (x,y) position of the mouse to the starting point.  



This options is used to draw a circle/oval on the canvas.  



This options is used to draw a rectangle on the canvas.  



This options is used write text on the canvas.  



This options is used to draw an attribute of the entity on the canvas. Hence, its attributes can be part of its graphical appearance. To use it you first click on the "attribute" button, then you select an attribute and, finally, you left-click on the canvas.  



This options is used to add connectors to a graphical object. Connectors are used in AToM3 to connect objects together. Indeed, the end-point of a relationship will always be connected to a connector.  



A left-click on an object in the canvas brings its properties screen.  

Set constraints  


This options is used to add python-coded constraints to the graphical appearance, allowing, for example, a change in the appearance depending on the value of some attributes.  

In our case, we will draw a circle object with those options:

Pink colored (set "pink" as a fill-color in the properties)
4 connectors on the border
The "name" attribute on the center of the circle

You should get this screen:  


Now, if we confirm the appearance and the properties of the entity, we are left with this partial FSA meta-model:  


There is one thing left before generating the FSA formalism: add a relationship between the states! In order to do that, we need to add a relationship from the "state" entity to itself, like this:  


Then, we just need to specify a simple graphical appearance for the relationship. Go in the properties screen of the relationship, then select "appearance" and set the "fill" attribute to "black" in the FirstSegment/SecondSegment sections. Also, set the name of the relationship to "transition":  


We have finished to create a partial FSA meta-model. To generate the formalism, first save the model in your working directory (did you setted it in AToM3 options?). Then, go in the "model" tab of the top menu and select "generate code". Voila! AToM3 just generated a partial formalism for creating FSA! We will try it in the next step.