
 
This manual introduces the user to FSM Analyzer which is the GUI portion of DECADA: Discrete-Event Control & Diagnosis Analyzer.  FSM Analyzer is a
graphical tool used for the creation, analysis and design of Finite State
Machines(FSMs).
 

                          FSM Analyzer
			   ------------

This section describes to the user the pertinent windows,
pop-up menus, the underlying software subroutines, the input/output format and 
the methodology that needs to be undertaken in order to analyze and perform 
various operations on the Finite State Machines.


Following is a breakdown of options available in the GUI.


Upper Menu of GUI

File:
-----
New:      Removes the existing text displayed file from the main window and creates a blank area for text editing.

Open:     Prompts user for an input file and displays in the main window for text editing.

Save:     Saves text in the main window to the file that was previously opened. Acts the same as Save As in case the user did not previously open a file.

Save As:  Prompts user for a filename.   Saves text in the main window to user selected file.

Exit:    Quits FSM Analyzer.

Applications:
-------------
List of applications available for execution.  When a particular application is selected the default input files along with help information for the application are displayed to the right of the main window if the User Mode is set to Beginner. The application is not executed until the Run button is pressed.

Draw:
-----
State Machine:  Opens a new window for creating an FSM graphically.  For more information see section Manipulating Input Files Graphically.

Controllability/Masking Table:  Opens a GUI for creating the controllability and masking information for a specified plant.  For more information see section Manipulating Input Files Graphically.

Settings:
---------
User Mode:  
Beginner:  Sets mode to Beginner.  This mode enables default input files and help file to be displayed when an Application is selected.

Advanced:  Sets mode to Advanced.  This mode disables default input files and help file from displaying when an Application is selected.

The selected User Mode is retained even if FSM Analyzer is closed.

Help:
-----
Displays Help files for user.



Button Menu of GUI
------------------

Run:
----
Runs the previously selected Application.  When selected the user is prompted if they would like to use the default input and output files.  If the user selects No they user are prompted to select the input and output files to process.  Note for functions requiring the controllability/masking file:  The filename used is obtained by concatenating “_events” to the first input file specified.

Show Graphic:
-------------
Opens a new window that graphically displays the FSM of the file currently opened in the main window.  Note:  If the text area has been edited it must be saved first in order to display the changes graphically.  For more information see section Manipulating Input Files Graphically.

Refresh:  
--------
Reopens the file currently displayed in the main window text area.  This function is useful when the file has been edited and saved outside from the main window.

Label Display to right of Refresh:
----------------------------------
Display the current Application selected.

Font Type:
----------
Allows user to select font style for displaying text in the main window.

Font Size:
----------
Allows user to select size of font for displaying text in the main window.  


                Manipulating Input Files Graphically
		    ------------------------------------
FSM Manipulator:

FSM Manipulator is the tool that can be used for manipulating FSM files graphically.  FSM Manipulator is the tool launched by selecting Show Graphic from FSM Analyzer.  It is also launched to display the resultant FSM after an Application is run (if in Beginner mode).

FSM Manipulator Menu:

File:
-----

New:  Non-Functional.  Use Draw->State Machine from FSM Analyzer

Open As Text:  Open a new window to manipulate a user selected file textually.

Open As Graphic: Open a user selected file to manipulate graphically in the current window.

Save:  Save current FSM to filename that was opened.

Save As:   Save current FSM to user specified filename.

Close:  Close FSM Manipulator window.

View:
-----

Show Text: Opens current FSM textually in a new window.  If the current FSM has not been saved the user is prompted if they would like to.  Any changes will not be displayed textually if the file is not saved first.

Table:
Controllability/Masking Table: Launches the GUI for creating a Controllability/Masking file.  Performs the same function as FSM Analyzer’s Draw->Controllability/Masking option.  However, the input plant filename is automatically selected to be the currently opened FSM file. 

Help:  Display help information on using FSM Manipulator.

Manipulating an FSM in FSM Manipulator
-----------------------------------------
The mouse is used to draw the FSM.  States of the FSM are represented as circles.  Each state has its name displayed in the center of the circle.  A final or “marked” state is depicted with an extra outlining circle.  The initial state is denoted with a triangle pointing to it.  Transitions are depicted as lines joining two states.  Each transition has a rectangle that contains the event name and an arrow depicting the direction of the transition.  When more than one event can cause a transition the transition will have multiple event rectangles.

The states can be moved around freely for easier viewing.


Manipulating a State:

States are created with the CENTER MOUSE BUTTON (if a three-button mouse is available) or with SHIFT & LEFT BUTTON.

To create a state click the center button (or shift+left button) on a clear area of the canvas.  The state is given a default name of q + current state number eg: q1 if it’s the initial state.

To move a state, drag it holding the center button down (or shift+left button).

To remove, rename, make initial, or make/unmake a state final, place the cursor within the state, and hold the RIGHT button (or CTRL & LEFT button) down while selecting the desired operation from the popup menu, then release the button.

Manipulating a Transition
--------------------------

Transitions are created with the LEFT MOUSE BUTTON.

To create a transition press and hold the left button within the origin state, and release it within the destination state.  A self loop is created by press and releasing the left mouse button on a state.

To remove a transition place the cursor within transition rectangle, press 
and hold the RIGHT mouse button (or CTRL & LEFT button) while selecting 
remove from the popup menu, then release the button.

To edit an event name, press the left button within the rectangle to 
select it. Then edit its contents using the keyboard. A lambda transition is 
created by simply leaving the contents blank or typing an *. Note:  * may be displayed as ^.

NOTE: In the current release you are not able to move the label of a 
transition unless the transition is a self loop.  In this case, you can drag the label up and down using the left mouse button.



                        Input/Output File Formats
                        -------------------------
 
This section describes the input/output file formats used by decada.

FSM File
--------
 
The first line of the file is a number representing the total number of states in
the state machine.  Next, each state of the FSM along with its transitions is specified.  The initial state is listed first while the remaining states can be entered in any order.  Below is a guideline for creating FSM files:
 
Number of states in the FSM
 
Initial State Name    Marked/Unmarked    Number of Transitions out of this State
Transition Name       Resultant State Name
Transition Name       Resultant State Name
...                   ...
 
State Name            Marked/Unmarked    Number of Transitions out of this State
Transition Name       Resultant State Name
...                   ...
 
Below is an example FSM file:
 
3
 
p0     0      2
a      p0
b      p2
 
p1     0      1
a      p2
 
p2     1      2
b      p0
c      p2
 
The above file represents an FSM with 3 states.  The initial state is p0.  This state has two transitions.  Event “a” results in a transition to state p0.  Event “b” results in a transition to state p2.  p2 is a final or “marked” state.
 
Controllability/Masking File:
 
Observer and Controllability related functions of this library require information
which is supplied through another input file.  This file is related to the plant FSM.  When calling functions that require this information the Controllability/Masking file defaults to the input plant filename with “_events” concatenated to the end eg: input plant.data requires plant.data_events to be specified.

The first line of the file has a number representing the total number of supervisors for the plant.  Following is the number of events in the plant. Next, each event name is listed followed by a 0 or 1 for Controllable/Uncontrollable. This boolean is followed by :: and the masked event name.  This repeats for each supervisor for each event.   Below is a guideline for creating Controllability/Masking files.

Number of Supervisors    Number of Events
Transition Name	Controllable/UnControllable::Masked Transition Name ...
Transition Name	Controllable/UnControllable::Masked Transition Name ...
...

Below is an example Controllability/Masking file:
 
2	3
a	1::b  0::a
b	1::b  1::*
c	0::*  1::c

The above represents a Controllability/Masking file that defines there are two supervisors with 3 events.  For supervisor 1 event “a” is controllable and is observed as event “b”.  For supervisor 2 event “a” is uncontrollable and is observed as event “a”. 

Other Files:
For the completion function there is a different input file.  This input file contains a list of events to complete the FSM with eg: see completion_events.data.