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.

Currently, the STD Editor is not very useful without Ptolemy, we include the documentation within Tycho only for the sake of uniformity.

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 use the keyboard accelerator 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 use the e keyboard accelerator key.

Draw/Edit a Transition

To draw a transition, either drag down the Edit menu and choose New Arc, or use the A keyboard accelerator key. 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 use the e keyboard accelerator key.

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

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 within the Tycho STD Editor instead of within vem. However, to work with other domains, an icon in vem is required to represent the corresponding FSM galaxy described in an STD file.
  1. In Ptolemy, Tycho can be started by typing a y while the mouse is over a facet.
  2. To make an icon in vem for the STD file, first open the file from within the Tycho window started from within Ptolemy.
  3. Then drag down the Special menu and choose Make Icon...
  4. 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. This may be confusing, but the reason is to avoid using a Octtools handle, which would require adding Octtools knowledge to Tycho.

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.

If the mouse is over a FSM galaxy icon inside vem and the i key is pressed, then Tycho will automatically display the corresponding STD file inside a STD editor. (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-1998, The Regents of the University of California. All rights reserved.
Last updated: 05/19/98, comments to: tycho@eecs.berkeley.edu