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.
.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.
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
.
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
.
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.
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.
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.)