IBM
Contents Index Previous Next



Changing the System


There are a number of commands in the simulator monitor that change the behavior of the system. These commands should be used with care, since it is no longer the original system that is simulated after such a command has been issued. These commands are still useful, especially in debugging situations, for making minor changes so that it is possible to continue the simulation after an error has been detected. They can also be used to force the system into certain situations, that otherwise would require a large number of transitions to be attained.

What You Will Learn

Some Preparations

In the following two exercises, you will be changing processes and timers. Before continuing, you will set up the simulation and the Simulator UI in a suitable way.

  1. Restart the simulator.
  2. Open the Command window through the View menu. You will now change the commands executed in the Command window. The List-Process command is to be replaced by Examine-PId, and a new command, List-Timer, will be added.
  3. In the List-Process command module, select Edit from the Command menu to the far right. (This menu works in the same way as the Group menu in the button modules.)
  4. In the dialog, change the command to examine-pid and click OK.
  5. Go to the Command window's menu bar and select Add Command from the Command menu. In the dialog, enter the command list-timer and click OK.
  6. A new command module is added to the window. Resize the window so that all three modules are visible.
    • You may also reduce the number of text lines displayed in a module by selecting Size from the module's Command menu. In a dialog, you can set the number of lines with a slider.

Figure 107 : Adjusting the number of lines

  1. Set the system trace value to 6 to get full trace.
  2. Execute the two first transitions so the processes Main and Demon are started.
  3. If the GR trace in the SDL Editor window makes it difficult to see the output in the Command window, set the system GR trace to 0.

Creating a Process

In this exercise, we will put the system in the state it would be in after the reception of a Newgame signal. This will be accomplished without actually sending the signal. Instead, we will manually create an instance of process type Game, using the Create command.

  1. Create the Game process by selecting the Create Process entry (in the Change menu). Select the process Game, and click OK.
  2. In the next dialog, select the parent process Main and click OK. This sets up the Parent-Offspring link between the process instances.

Figure 108 : Creating the process Game from process Main

To complete the actions taken when a Newgame signal is received, you must also set the GameP variable in Main, and put Main in the state Game_On. This is done with the commands Assign-Value and Nextstate. However, these commands operate on the process next to execute, which at this stage is Game, as can be seen in the ready queue printed in the Command window.

Figure 109 : The Ready Queue

Next process to execute is Game.

Therefore, you first have to change the current process, also known as the process scope.
  1. Change the scope by selecting Set Scope in the Examine menu. Select the process Main in the dialog and click OK.
    The Examine-PId command in the Command window shows that Main is the current process. The variable GameP must be set to the value of Offspring in Main. In the Command window, check that this value is Game:1.

Figure 110 : Process Main is the current process

The Offspring of the current process is Game:1.

  1. Assign the GameP variable by selecting Variable in the Change menu. In the dialogs that follow, select the variable GameP, and enter the PId value Game:1.
  2. To put the Main process in the correct state, use the State entry in the Change menu. Select the state Game_On and click OK.
    The system is now in exactly the state it would be in after the reception of a Newgame signal. Even though you have changed the process scope, the next transition to be executed is still the start transition of Game. (You can check this by viewing the process ready queue. See Figure 109.)
  3. Execute the next transition and check that the Game process is started.

Changing the State of Timers

In this exercise, we will execute Set and Reset actions on timers directly in the monitor system. At this stage, the timer T is active, as it has been set by the Demon process. You can check this by looking at the List-Timer module in the Command window.

Figure 111 : The timer T is active

  1. Reset the timer by choosing Reset Timer in the Change menu. Select the timer T and click OK.
  2. Try to execute the next transition and note the message printed:
    No process instance scheduled for a transition
    
    
    
    The system is now completely idle, i.e., there are no transitions in the system that can be executed. The Command window shows that both the ready queue and the timer queue is empty. To restart the system you must perform a set operation on timer T in process Demon.
  3. Choose Set Timer in the Change menu, select the timer T and enter a time value of 10.
  4. Execute the next transition and check that the timer was set at time 10 (look at the trace in the main window).
    *** TIMER signal was sent
    
    *   Timer    : T
    
    *   Receiver : Demon:1
    
    *** Now      : 10.0000
    

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