User's Guide to the State Transition Diagram Editor

The finite state machine (FSM) has been one of the most popular models for describing control-oriented systems, like real-time process controllers. A directed node-and-arc graph, called a state transition diagram (STD), can be used to describe an FSM. It represents a system in the form of states (nodes) and transitions (arcs) between states.

The State Transition Diagram editor is automatically invoked whenever you open any file with a ".std" extension. The EditSTD class is derived from the EditBubbleAndArc class, and therefore inherits all of its features. Note that STDs are not part of Ptolemy0.6, but should be available in the next Ptolemy release.

How to use the STD Editor

Edit a new STD file

To edit a new STD for an FSM either open a file with the file extension .std , or drag down the Window menu and under Graphical Editorschoose State transition diagram editor. A message window will pop up to ask for machine type. So far there is only one type of FSM supported, called mixed Mealy/Moore machine.

Edit the Input/Output and Internal Events Names

If there are any input/output and internal events for the FSM, their names must be specified: Drag down the Special menu and choose I/O Port Names..., then enter the names for the input/output. Each name should be separated by at least one space.

Draw/Edit a State

To draw a state, either drag down the Edit menu and choose New Node, or press the hot key Shift-N. . Then a crossbar cursor will appear in the window. Press and hold (don't release) the left mouse button, and move the mouse to get a different shape of node. Release the button to finish the drawing.

To edit a state, first select the state by pressing the left mouse button on it. Then either drag down the Edit menu and choose Edit Item, or press the hot key e.

Draw/Edit a Transition

To draw a transition, either drag down the Edit menu and choose New Arc, or press the hot key Shift-A. Then a crossbar cursor will appear in the window. Press the left mouse button on the periphery of the starting state. Move the mouse and press the left mouse button to get more delicate arc. To finish the drawing, move the mouse on the periphery of the ending state and press the left mouse button.

To edit a transition, first select the transition by pressing the left mouse button on it. Then either drag down the Edit menu and choose Edit Item, or press the hot key e.

Delete a State/Transition

First select the state/transition by pressing the left mouse button on it, then drag down the Edit menu and choose Delete.

Move/Reshape a State/Transition

To move a state, press and hold the left mouse button on it, then move the mouse to the desired position. To reshape a state, first select the state, and move the cursor to the up/down/left/right periphery of the state to get an up/down/left/right arrow-shape cursor, then press and hold the left mouse button and move the mouse to reshape it.

To move/reshape a transition, first select it, then some small rectangles will appear along the arc. Press and move one of the rectangles to move/reshape the arc.


Working in Ptolemy

Note that Ptolemy0.6 does not support STDs

From the point of view of implementation, a stand-alone FSM domain in Ptolemy is not very interesting, because in most of applications, in addition to the control part, they contains many other parts, such as signal processing. Moreover, there are various Ptolemy domains. With the FSM domain mixed with them, we can get a much more powerful FSM model.

Make an Icon in VEM

Unlike other domains, an FSM galaxy is edited in a previous mentioned STD file using Tycho instead of VEM. However, to work with other domains, an icon in VEM is required to represent the corresponding FSM galaxy described in an STD file. In Ptolemy, the Tycho can be started by pressing key Y. To make an icon in VEM for the STD file, first open the file in term of Tycho started in Ptolemy. Then drag down the Special menu and choose Make Icon.... This will load the FSM galaxy into the Ptolemy kernel, and make an icon with appropriate input/output ports in the specified palette in VEM. The icon looks like a star (blue outline), but it is actually an galaxy. It may cause confusion, but the reason is to avoid using octool handle. There are two different ways to make an icon in VEM: ptkSetMkSchemIcon and ptkSetMkStar. The former one needs an OctFactHandle as one argument and is used for other VEM galaxy. The FSM galaxy uses Tycho as the editor instead of VEM, so there is no OctFactHandle for an FSM galaxy. Therefore the latter one, which uses the star (or galaxy) name instead, is more appropriate for this case. Similar to the galaxy icon in other domain, when the key I is pressed on the icon to look inside the galaxy, the corresponding STD file which describes the FSM galaxy will be automatically invoked in Tycho. (Note: if the environment variable PT_DISPLAY is set to other editor instead of Tycho, it must be unset for the look-inside to work.)

Tycho Home Page


Copyright © 1996, The Regents of the University of California. All rights reserved.
Last updated: 12/16/96, comments to: tycho@eecs.berkeley.edu