Creating a finite state automata model


Now we will view in detail how we can create a FSA with ATOM3. If you are not familiar with Finite State Automata, we strongly suggest that you visit the very small tutorial in the ressources even if we will go over the basic concepts in this tutorial. Now, if you have correctly followed the previous steps, you should see something like that on your screen:  

 

As you can see, the FSA formalism is loaded on the left of the canvas. From the "state" button, you can add states in the canvas and connect them through transition with the "connect" button.

There are two main things to keep in mind when creating a FSA with ATOM3:

Setting the allowed input/output for you model
Designing the model in the canvas

To Set the input/output, Right-Click (popup menu), then click on "Model" and then select "Edit model attributes"

Please note: if more than one formalism is open (as in this picture), you'll be given a choice of which model your editing the attributes for! So choose FiniteStateAutomata. 

 

WARNING: Many of the following images are old, but apart from the primitive toolbar of the older AToM3, the images are quite valid for the newest version of AToM3.

Then, as you can see on the next picture, we can specify various attributes for the model. Its always a good idea to specify the author and description for documentation purpose. Sometime, the model name is used by ATOM3 to generate several files, so it is preferable to specify it:  

 

Now, if you click on "Input_alphabet", we will be able to add possible inputs for the model. After clicking, the interface for a list of strings will appear. You can "add", "edit" or "remove" elements that will constitute the valid list of inputs for your model. We decided to create a simple model of water entering into a "boiling" state so a valid input could be "Heat". We clicked on "new" and typed in "Heat":  

 

Following the same procedure, we can add an output:  

 

Ok, now it is time to design the model in the canvas. First, we click on the button "State" (on the left) and we Control-Right-Click on the canvas to add one state (keep up the Control-Right-Click to populate your canvas quickly!):  

 

Now lets edit the properties of the automata we drew on the canvas.

Put your mouse cursor over it. Then do one of the following:

  • Double-click on it
  • Press E
  • Control-Right click then choose Edit-Nearest or Edit-Overlap (overlap works better sometimes, when lots of stuff on the canvas)

Now set the state to "normal" (non-boiling) and it is the initial state:  

 

We add a new state on the canvas and do the same steps to setup its properties. We set its name to "boiling" and it is the final state:  

 

Now, it's time to connect the two state and relate them with the input "Heat".

  1. Put your cursor over "Normal"
  2. Control-Left-Click (or Right-Click then "Create Arrow" )
  3. Put your cursor over "Boiling"
  4. Left-Click

NOTE: you can put intermediate points for your arrow to follow, but you know this since you've read the Modeling Tutorial...  

 

After that, we will edit the input/output of the connection we just created. Now edit the connection (just press E with the cursor over it, or use the Right-Click popup menu). We set the input to "Heat" and the output to "Steam". Take note that if we had not added "Heat" and "Steam" to the lists of allowed inputs/outputs, ATOM3 would have prevented us from setting them:  

 

Finally we get our FSA:  

 

Now save the model, the below image is of a different model... but it's the same story:

  1. Press Alt-S (or Right-Click, File Menu, Save As)
  2. Choose the starting point for the file dialog... the User Model Directory will be ideal here
  3. Give any name for your model, it will automatically recieve the extension "_MDL.py" for easy loading later