IBM
Contents Index Previous Next



Generating Message Sequence Charts


In this exercise, we will demonstrate the power of Message Sequence Charts as a method of illustrating, in a graphical way, the dynamic behavior of the system. This can easily be done when simulating the system by using MSC trace. MSC trace transforms some of the SDL events that take place into MSC events; typically sending of signals and dynamic creation of processes. The trace can then be graphically logged in an MSC Editor during the execution.

Earlier in this tutorial, you drew a Message Sequence Chart which illustrated a simple sequence of messages. We will now run the simulator and generate the MSC trace of the events which actually take place.

What You Will Learn

Initializing the MSC Trace

  1. Restart the simulation.
  2. Make sure the GR trace is disabled to avoid having the SDL Editor window being updated and raised (select the SDL Level : Show entry in the Trace menu and verify that system GR trace is 0).
    By default, the MSC trace is enabled for the entire system. You must, however, explicitly start the interactive logging of MSC events:
  3. Choose MSC Trace : Start in the Trace menu. A dialog is issued, where you are prompted to specify the amount of symbols to include in the MSC trace. You will include states in the MSC trace, so select 1 and click OK.

Figure 112 : Specifying to include states in the MSC trace

  1. An MSC Editor is opened, displaying an MSC diagram named "SimulatorTrace." If needed, move and resize the window to make it fit on the screen together with the Simulator UI.
    • Before resizing the MSC Editor, you may hide the symbol menu and the text window by using the quick buttons. You should not edit the generated MSC, so there is no need for these windows.
      Initially, the system has three active instances, the processes Main_1_1 and Demon_1_2, as well as env_0 which has been introduced in order to represent the environment to the system:

Figure 113 : The initial appearance of the MSC

Tracing the Execution in the MSC

  1. Send the signal Newgame from the environment. This is now displayed in the MSC Editor as a message sent from the instance env_0.
    At this stage, the message is connected to the instance Main_1_1, since it has not yet been consumed. Instead, the message is temporarily drawn as a "lost" message, indicated by the filled circle. You may also see the text "Main_1_1" associated with the circle, indicating the intended receiver of the message.

Figure 114 : The sent Newgame signal

  1. Execute the next transition. A condition symbol with the text Game_Off appears on the instance axis for the process Main. This symbol shows that the process has started executing and has reached the corresponding SDL state, Game_Off.

Figure 115 : The Condition symbol

  1. Execute the next transition. The timer T is set in the Demon process. The vertical coordinate is incremented downwards in the MSC, enhancing the impression of an absolute order of events. Also, a condition symbol with the text Generate is drawn on the instance axis.
  2. Execute the next symbol only (use the Symbol button). The Main process consumes the Newgame message; the filled circle disappears. Note that the start point and the end point of the message have different vertical positions, since the timer T was set after the message was sent.
  3. Execute the next symbol. An instance of the Game process is created, thus adding a new instance head and instance axis. The MSC should now look like this:

Figure 116 : The MSC after creating the Game process

  1. Execute the next transition by clicking the Transition button twice. The second transition causes the Game process to enter the state Losing.
  2. Execute the next three transitions. The timer signal T is consumed and the signal Bump is sent and consumed. The Game process is now in the state Winning. Note how the signal interchange is shown in the MSC.
  3. Next we illustrate a message which is consumed immediately. Send the signal Probe from the environment and execute the next transition. First, the message Probe is displayed (marked with filled circle), then it is redrawn, keeping its horizontal alignment.
  4. The system responds with the signal Win.
  5. Send the signal Result and execute the next transition. In the MSC, you can see that the message Score has the parameter 1.
  6. End the game by sending the Endgame signal and execute the next two transitions. The Game process is stopped.

The MSC should now look like in the figures below. (You may note a dotted horizontal line in the MSC diagram on screen. This indicates where a page break will occur if you would print out the diagram.)

Compare this diagram with the one in Figure 83. You will notice differences between the hand-drawn and the generated diagram. These discrepancies are quite natural, since it is impossible to predict the dynamic behavior of a system just by looking at the SDL diagrams.

Figure 117 : The finished MSC 1(2)

Figure 118 : The finished MSC 2(2)

Trace-Back to SDL Diagrams

From the generated MSC diagram, you may obtain a trace back to the SDL source diagrams.

  1. From the MSC Editor's Window menu, select Info Window. A window is opened, containing information about the graphical object which is currently selected. (The amount and type of information depends on what sort of object you have selected.)

Figure 119 : The Info window

The window shows information related to the message Bump.

  1. Select a few different objects in the MSC Editor and note how the information in the Info window changes.
  2. Select the message Bump and click on the button Show SDL Symbol in the Info window. An SDL Editor is opened, in which the symbol corresponding to the actions of sending or consuming the SDL signal Bump is selected:
    • If you have selected the message Bump by clicking on a point which is closer to the start point of the message than to the end point, the corresponding SDL output symbol will be selected.
    • Otherwise, the corresponding SDL input symbol will be selected.

Ending the MSC Trace

  1. Stop the logging of MSC events by selecting the MSC Trace : Stop entry in the Trace menu.
  2. In the MSC Editor, save the generated MSC diagram under the file name SimulatorTrace.msc.
  3. Exit the MSC Editor.

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