![]() |
![]() |
![]() |
![]() |
![]() |
Executing Transition by Transition
What You Will Learn
- To enter commands textually
- To show the next symbol to be executed
- To interpret printed trace and graphical trace
- To execute the next transition
- To issue commands using buttons
- To send signals from the environment
Executing the Start Transitions
In this exercise, you will execute the start transitions in the process instances of the system. First, however, we must set the amount of trace information that we want printed during execution. The command Set-Trace is used for setting the textual trace level.
For now, you will enter commands textually by using the text field Command: just below the text area; this field is called the input line.
- Click in the input line to place the cursor. Enter the command
set-trace 6 and hit <Return>. The value 6 specifies that we want full information about the actions that are performed during the transitions. The entered command is moved to the text area and the simulator monitor confirms the trace setting; the text area should now show:Welcome to SDL SIMULATOR. Simulating system Demongame.Command : set-trace 6Default trace set to 6Command :- To enable the GR trace, enter the command set-gr-trace 1. The value 1 specifies that the next symbol to be executed will be displayed in an SDL Editor each time the monitor system is entered.
- To have an SDL Editor window appear now, enter the command show-next-symbol. An SDL Editor window appears, showing the diagram for the process Main with its start symbol selected (this is the next symbol in turn to be executed). This SDL Editor window will be used for graphically tracing the execution of the simulator during your simulation session.
- If needed, move and resize the Simulator UI and SDL Editor windows so that they both are completely visible and fit on the screen together. A few useful advice are:
Before resizing the SDL Editor, you may hide the symbol menu and the text window by using the quick buttons. The editor window will not be used for editing any diagrams, only viewing them.
- Check and, if required, adjust the SDL Editor's option Always new window to off. (Use the command Editor Options on the View menu for this).
- You may reduce the width of the Simulator UI window somewhat, which only affects the width of the text area. You may also reduce the height, but you should make sure that all buttons in the left part of the window are still visible.
- During this simulator tutorial, you will not need to see the contents of the Organizer window. You may cover it, or minimize it by using the window system.
- Execute the command Next-Transition by simply entering n-t in the input line. All commands may be abbreviated as long as the abbreviation is unique among all available commands.
- In the text area, the textual trace information of the transition contains the process instance, the name of the initial state, and the current value of the simulation time. It ends with the Nextstate action, giving the name of the resulting process state:
*** TRANSITION START* PId : Main:1* State : start state* Now : 0.0000*** NEXTSTATE Game_Off- In the SDL Editor, the GR trace selects the next symbol to be executed. Since this is the start state of the process Demon, that diagram is loaded into the editor.
- Place and click the pointer on the input line and press the arrow key <Up>. The command you entered previously appears (n-t). Execute it by pressing <Return>.
- You can use the <Up> and <Down> arrow keys repeatedly on the input line to show previously entered commands. This feature is commonly known as a command history. You may also edit a command before it is executed, for instance by changing the value of a parameter.
- The start transition of Demon executes. Also, the SDL Editor sets the selection on the text symbol where the declaration of the timer T is found. This is a convention adopted in the SDL Suite to show that the next event to take place in the system, if no signal is sent from the environment, is the expire of a timer.
- Note that the printed trace also contains the action of setting the timer T.
Sending Signals from the Environment
To make something of interest happen in the system you have to send signals from the environment into the system. We will start by sending the signal Newgame to the Main process. For this, you can use the command Output-Via, which takes as parameters a signal name, the parameters of the signal (none in this case), and a channel name.
In this exercise, however, you will execute commands using buttons instead of entering them textually on the input line. The command buttons are arranged into different "modules" in the left part of the Simulator UI. You can "preview" the command that is executed by a button by selecting it and move the mouse pointer away from the button before you release the mouse. The associated command is then listed in the Status Bar at the bottom of the window.
- Select the signal Newgame and click the OK button.
- Another dialog is opened, asking for the channel name.
- As there is only one channel from the environment to the system, you do not have to select it explicitly. Simply click the OK button.
- Execute the next transition by using the button Transition in the module Execute (this executes the Next-Transition command). The printed trace information shows the actions of the executed transition up until the state Game_On. Note that the start of the transition is described by the combination of a state (Game_Off) and the input of a signal (Newgame):
*** TRANSITION START* PId : Main:1* State : Game_Off* Input : Newgame* Sender : env:1* Now : 0.0000* CREATE Game:1* ASSIGN GameP := Game:1*** NEXTSTATE Game_On
- Since the process Game was created in the transition, the GR trace shows that the next symbol to execute is the start state of Game. This clearly demonstrates the difference between printed trace and GR trace:
- The printed trace describes what happened in the previously executed transition, including the initial state and the reached state of the process.
- The GR trace shows what will happen next, if the system is left on its own. The start symbol of the next transition is selected, which may be in a different process diagram.
- Execute the start transition of Game with the Transition button. The Game process reaches the state Losing, and the GR trace changes back to the Demon process. The SDL Editor selection shows again the text symbol with the declaration of the timer T.
- Execute the next transition, in order to have the timer expire. This transition is a timer output, i.e., a timer that sends its signal to the process which earlier executed the Set action. A timer output is also considered to be a transition. Note that the simulation time has now been updated to 1:
*** TIMER signal was sent* Timer : T* Receiver : Demon:1*** Now : 1.0000- Execute another transition. The start of this transition is described by the combination of the Generate state and the input of the timer T. The signal Bump is now sent to the Game process:
*** TRANSITION START* PId : Demon:1* State : Generate* Input : T* Sender : Demon:1* Now : 1.0000* OUTPUT of Bump to Game:1* SET on timer T at 2.0000*** NEXTSTATE Generate- Execute the next transition to put the process Game in the state Winning. The GR trace switches back to the Demon process and indicates the next default behavior which is the expire of the timer T. However, you will instead send the signal Probe from the environment:
- Send the Probe signal by using the Send Via button as before. The GR trace switches back to the Game process.
- Execute the next transition. The Probe signal is consumed and the signal Win is output to the environment. The process returns to the state Winning and awaits a new Bump (or Probe) signal.
*** TRANSITION START* PId : Game:1* State : Winning* Input : Probe* Sender : env:1* Now : 1.0000* OUTPUT of Win to env:1* ASSIGN Count := 1*** NEXTSTATE WinningWe have now shown how you can use the commands Next-Transition and Output-Via to reach a certain point or state in the simulation.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |