IBM
Contents Index Previous Next



Looking at the External Behavior


What You Will Learn

Setting Trace and Signal Logging

During this exercise, you will look at the external behavior of the system, which is the same as actually playing the Demon game. To achieve this, we will set the system trace to 1. This means that you will see only signals sent to the environment and none of the actions performed during transitions. In order to log the external behavior on a file, you will also use the signal log facility.

  1. As usual, restart the simulator.
  2. Set the trace value for the system to 1.
  3. To log the signals sent to and from the environment, enter the command signal-log in the input line and hit <Return>. (This command has no associated button or menu choice.)
    The Signal-Log command takes two parameters, which are now asked for in dialogs. The first parameter is a unit name. All signals sent to, from or through the specified unit will be logged to file.
  4. Instead of selecting one of the units in the list, enter the unit name env in the dialog's text field and click OK. This is the way to specify the environment of the system.

Figure 98 : Specifying the environment

The second parameter is a the name of a file name to which information about the signals will be written. A file selection dialog is opened.
  1. In the File field, enter the file name signal.log and click OK.

Adding Buttons for Common Commands

When you are playing the Demon game, you are sending signals to the system from the environment. You will start by sending the signal Newgame. Since this is an action often performed in the simulation of this system, we will first define a new button that executes the proper command. In this way, you only need to click the button to send the signal.

  1. In the Send Signal module, select Add from the Group menu to the far right:

Figure 99 : Adding a new button to a module

  1. In the dialog, enter Newgame as the button label, but do not hit <Return>. Enter output-via newgame - as the command definition.

Figure 100 : Adding a button

  1. Click Apply. The new button appears in the module, and the dialog is ready for another button definition.
  2. Since sending the Probe signal also is a common action, add a button Probe in the same way as above.
  3. If you wish, add buttons for the signals Result and Endgame in the same way. Finally, close the dialog with the OK button.
    (If the Error message "Button label must not be empty" occur, just ignore the message.)

Playing the Game

You are now ready to start playing the game. You will use the new buttons to send signals to the game, and the command Proceed-Until to execute transitions up to the next point in time when you want to send a signal.

  1. Send the signal Newgame with a click on the Newgame button.
  2. Execute transitions until the time is 5.5 by selecting Until Time (in the Execute menu). Enter the value 5.5 in the dialog. This executes the command Proceed-Until 5.5. This will execute all transitions up to the point in time when the simulation time first becomes equal to the specified time value.
  3. Send a Probe signal.
  4. Execute transitions until the time is 10.3. Note the output of the signal Win or Lose to the environment.
  5. Send a Probe signal again. Then, send another Probe signal. The two signals will enter the input port of the Game process. Check this by selecting Input Port in the Examine menu:
    Input port of Game:1
    
    Entry   Signal name          Sender
    
    *1      Probe                env:1
    
     2      Probe                env:1
    
    
    
  6. Send the signal Result. Use the button if you have defined one; otherwise, use the Send Via button or enter the command on the input line.
  7. Execute transitions until the time is 13.5. Note the output of the signals Lose or Win (one for each Probe) and Score to the environment.

Examining the Signal Log File

  1. Exit the simulation by choosing Stop Sim in the Execute menu. This is needed to finish the signal logging. The Simulator UI itself is not closed by this command.
  2. Examine the file signal.log from outside the simulator. The file contains a specification of all signals sent to and from the environment. It should look like this:
    Signal log for system Demongame with unit Process 
    env on file ...
    
    0.0000 Newgame from env:1 to Main:1
    
    5.5000 Probe from env:1 to Game:1
    
    5.5000 Win from Game:1 to env:1
    
    10.3000 Probe from env:1 to Game:1
    
    10.3000 Probe from env:1 to Game:1
    
    10.3000 Result from env:1 to Game:1
    
    10.3000 Lose from Game:1 to env:1
    
    10.3000 Lose from Game:1 to env:1
    
    10.3000 Score from Game:1 to env:1
    
    Parameter(s) : -1
    

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