IBM
Contents Index Previous Next



Generating and Starting a Simulator


Once you have designed and analyzed a complete SDL system, it is possible to simulate the system, i.e. to interactively inspect and check its actual behavior. To be able to simulate the DemonGame system, you must first generate an executable simulator and then start the simulator with a suitable user interface.

Note:

In order to generate a simulator that behaves as stated in the exercises, you should use the SDL diagrams that are included in the distribution instead of your own diagrams. To do this:

  • On UNIX: Copy all files from the directory
    $telelogic/sdt/examples/demongame
    to your work directory ~/demongame.
  • In Windows: Copy all files from the directory
    C:\IBM\Rational\SDL_TTCN_Suite6.3\sdt\examples\demongame
    to your work directory
    C:\IBM\Rational\SDL_TTCN_Suite6.3\work\demongame.

If you generate a simulator from the diagrams that you have created yourself, the scheduling of processes (i.e. the execution order) may differ.

If you choose to copy the distribution diagrams, you must then re-open the system file demongame.sdt from the Organizer.

What You Will Learn

Generating the Simulator

To generate an executable simulation program, do as follows:

  1. Make sure the system diagram icon is selected in the Organizer.
  2. Select the Make command from the Generate menu. The Make dialog is opened:

Figure 88 : The Make dialog (on UNIX)

Figure 89 : The Make dialog (in Windows)

  1. Adjust the options in accordance to the figure, i.e.
    • Analyze & generate code on
    • Makefile and Generate makefile on
    • Compile & link on
    • Use standard kernel on. Make sure that a Simulation kernel is specified to the right; if not, select it from the option menu.
  2. Click the Make button.
  3. Select the Organizer log from the Tools menu. Check that no errors occurred. The Organizer's status bar should read "Analyzer done" and the Organizer Log should report no errors between the "Make started" and "Make completed" messages.
  4. If errors were reported, bring up the Make dialog again, but click the Full Make button instead. This time, no errors should be reported.
    • Another problem could be with the C compiler used on your system. If you still receive errors, try changing to a Simulation kernel reflecting your C compiler, e.g. gcc-Simulation or Microsoft Simulation, and repeat the Make process.

Starting the Simulator

The generated simulator is now stored on a file called demongame_xxx.sct (on UNIX) or demongame_xxx.exe (in Windows) in the directory from which you started the SDL Suite (the _xxx suffix is platform or kernel/compiler specific). The simulator contains a monitor system that provides a set of commands which can be used to control and monitor the execution of the simulator.

It is possible for you to execute the simulator directly from an OS prompt, in which case you have to enter all commands to the monitor system textually using a simple command-line interface.

The SDL Suite provides a user-friendly graphical interface to the simulator that is started from the Organizer.

  1. From the Tools menu, select the sub-menu SDL and the command Simulator UI. The Simulator UI window is opened:

Figure 90 : The main window of the Simulator UI (on Windows)

The text area to the right informs you that no simulator is running. The text area displays the textual input/output from the monitor system, such as entered commands, the results of commands, and error messages.
  1. To start a simulator, select Open from the File menu, or click the Open quick button.
  2. In the file selection dialog, the generated simulator file described above should be listed. Select it and click OK or Open.
  3. The text area of the Simulator UI greets you with a welcome message to acknowledge that the simulator has been started:
    Welcome to SDL SIMULATOR. Simulating system Demongame.
    
    
    

When a simulator is started, the static process instances in the system are created (in this case Main and Demon), but their initial transitions are not executed. The process in turn to be executed is the Main process.

The Simulator UI is now ready to accept commands to the monitor system. Whenever it is possible to enter a command, the prompt Command: is issued in the text area.


http://www.ibm.com/rational
Contents Index Previous Next