In svctools, state machines can be defined in several file formats, each with their own limitations. At this page, an overview is given.
To show the file formats 'in action', a simple example state machine with initial state A and marker state B has been created. The transition from state A to state B is done via controllable event p, and back to state A will then happen with uncontrollable event q.
For the textual file formats, this machine will be encoded as example to give you an idea of what the file format looks like.
tct tool by Wonham has a
.des format, which is a binary format for storing state machines. How the information is stored in the file is not known. You can read and write these files by using the
tct tool itself, and convert them to for example the
.ads format described below.
tct tool by Wonham also has a
.ads format. This is a text format, and can be viewed by any text editor. The format is intended for manually entering state machine specifications. However, since
tct can also write such files, the file format can also be used to export state machines.
The format accepted by the
.ads format is numeric in nature. All names must be converted to numbers, and the output is also in numbers. For the example state machine, this means
.ads file of the example becomes:
# Generated CTCT ADS file pq State size (State set will be (0,1....,size-1)): # <-- Enter state size, in range 0 to 2000000, on line below. 2 Marker states: # <-- Enter marker states, one per line. # To mark all states, enter *. # If no marker states, leave line blank. # End marker list with blank line. 1 Vocal states: # <-- Enter vocal output states, one per line. # Format: State Vocal_Output. Vocal_Output in range 10 to 99. # Example: 0 10 # If no vocal states, leave line blank. # End vocal list with blank line. Transitions: # <-- Enter transition triple, one per line. # Format: Exit_(Source)_State Transition_Label Entrance_(Target)_State. # Transition_Label in range 0 to 999. # Example: 2 0 1 (for transition labeled 0 from state 2 to state 1). 0 1 1 1 0 0
This file format also supports vocal states, these are not needed for untimed state machine specifications.
sctool written by H.A. de Vos has its own textual Discrete Event System (DES) format. To prevent confusion with the
des format of the
tct tool by Wonham, files in this format use the
sctool can read and write these files.
.sct format of sctool is more compact than the
.stm format. It consists of a number of sections. Unlike the
.ads format, it allows you to use any identifier as name of a state or name of an event. The example state machine becomes:
[t] A p B B q A [s0] A [Sm] B [Eu] q
The first section is
[t] which stands for transitions. The seocnd and third line then list the transition. In the
[s0] section the start state is listed, while in the
[Sm] section the marker states are listed. If you have more marker states, put them at one line with a space between them. Finally, the uncontrollable events are listed (on one line with a space between them) in the
If you have no data for a section (for example, you have no marker states), you should eliminate the entire section from the file.
.stm format is also a text format. Its primary goal is readability and extensibility. Also, a Python API exists for reading and writing files in this format. The format is defined at http://se.wtb.tue.nl/sewiki/wonham/fileformat.
In the svctools, the
.stm format takes a central role.
sctool can read and write
.stm files, and programs ads2stm and stm2ads exist for converting from and to the Wonham
Also, programs exist to support further processing. Using
gen-dot, a state machine can be converted to the
.dot format of the Graphviz tool set (and then through the Graphviz
dot program to a large number of 2D visualization output formats).
.stm format is the most verbose of the three textual formats. The example state machine is encoded in this file format as follows:
component AB: state A state B: marked # state A is the initial state initial A action A -> B: label p event B -> A: label q
The format has been inspired by the Python syntax with its use of the colon and indentation. The empty lines are optional, as is the comment line. Other keywords such as
description may be used to add other information to the state machine.
.stm format uses the terms
event for Wonham controllable events and uncontrollable events.