next up previous contents
Next: 2.4 SVM Command-line Parameters Up: 2. SIMULATION IN SVM Previous: 2.2 Installation   Contents

2.3 HelloWorld Example

The design and simulation of a HelloWorld example is discussed in this section. This model has two states A (default state) and B (final state). When simulation is started, only event e is accepted, which changes the model from state A to state B, and prints a ``Hello World!'' message.

To design a textual model manually, the designer writes the description according to the DCharts textual syntax (see my master's thesis) and saves it in a .des file. For this example, the textual description is listed below:

DESCRIPTION: # description of the model
    Hello World Example

STATECHART:  # definition of the state hierarchy
    A [DS]
    B [FS]

TRANSITION:  # one single transition
    S: A
    N: B
    E: e
    O: [DUMP("Hello World!")]

This description is saved as HelloWorld.des. Several important points about this description are explained below:

To run the model, first make sure that HelloWorld.des is in the current directory and the SVM directory is added to the PATH environment variable. Execute the following command:

svm HelloWorld.des
The default graphical interface (Figure 2.1) will be shown, and the simulation is started.

Figure 2.1: Screenshot 1 of the HelloWorld example
Image simple1_1.png

First-time users may not be familiar with this default graphical interface, and brief explanation may be required. There are two separate windows: the right one is the main window, and the left one is the state hierarchy window.

To send event e to the HelloWorld model, the user should either use the left mouse button to double click the event name in the enabled event list, or type in e in the command box and then enter. This event triggers the only transition defined in the model, and message ``Hello World!'' is printed in the output box (Figure 2.2).

Figure 2.2: Screenshot 2 of the HelloWorld example
Image simple1_2.png

Now, because state B (the current state) is a final state, there is no enabled event any more, and the enabled event list becomes empty. To close SVM, the user should either enter command exit in the command box, or click the ``exit'' button with the left mouse button, or close the main window.


next up previous contents
Next: 2.4 SVM Command-line Parameters Up: 2. SIMULATION IN SVM Previous: 2.2 Installation   Contents
Thomas Huining Feng
2004-04-05