IBM
Contents Index Previous Next



Creating a Process Diagram


You have now created the structural elements of your SDL system. This structure needs now to be completed with the implementation, i.e. the process flow charts that describe the behavior of the system.

In the previous exercises, you have learned how to create new diagrams, either from the Organizer or from the SDL Editor, so we will not focus on these details any more. Feel free to double-click icons in the Organizer or in the SDL Editor, or to use the Organizer Edit command, depending on your preference.

In the next exercise, you will instead learn how to use the SDL Editor for drawing process diagrams. Let us start with the process Demon, which is depicted in Figure 60.

Editing the Process Demon

Figure 60 : The process Demon

On the next pages, you will find suggestions about how to use the SDL Editor to draw the diagram.

What You Will Learn

Creating the Diagram

  1. Edit the Demon diagram. When you are prompted to add a page, make sure that you specify a page with the type set to Graph Page.

Figure 61 : Specifying page type to graph page

  1. When the SDL Editor responds by displaying the (empty) diagram, you notice that the appearance of the symbol menu is different; it now contains the symbols that are allowed on a flow diagram (such as state and input symbols).

Figure 62 : The SDL Editor window for flow diagrams (on UNIX)

The diagram consists of two branches of symbols (see Figure 60 on page 95). When you append symbols to a branch, the editor may automatically interconnect the symbols with flow lines.

You may select to enter the text into each symbol once the symbol has been inserted, or insert all symbols and then edit the text, or a mix of both methods.

Creating the Left Branch with Grammar Help

To create the left branch:

  1. Select the start symbol in the symbol menu and place it in the drawing area at a suitable location.
    • Remember that when you point to or select a symbol in the symbol menu, its type is displayed in the Status Bar at the bottom of the SDL Editor window. Use this if you are not sure what symbol to pick.
  2. Double-click the task symbol in the symbol menu. An empty task symbol should now be appended to the start symbol.
    When you are to edit the task symbol containing the statement that sets the timer, let us assume, for the purpose of this exercise, that you do not have the grammar for the Set statement in mind.
    The SDL Editor provides a context-sensitive facility, the Grammar Help window, that assists you in entering correct SDL expressions. You will now use it in order to fill in a correct set expression.
  3. Select the command Grammar Help from the Windows menu. The SDL Editor responds by displaying the Grammar Help window.

Figure 63 : The Grammar Help window

  1. The use case you are to use is the set of a timer, so locate the item titled Set in the left list and select it.
    • The right list is updated to reflect the formal grammar for the expression: "SET(Now+Expr, TimerName)".

Figure 64 : The grammar for a Timer Set

  1. Insert the formal text into the task symbol by selecting the Insert command from the Edit menu. The task symbol is immediately updated.
    • You may also double-click the Set item in the list.
  2. Now, change the generic names Expr and TimerName to their actual values (1 and T, respectively).
    • You use the SDL Editor's text window for this. Drag for instance the mouse over the text to be changed and type in the new text to substitute it with.

Figure 65 : Edit the text in the text window (on UNIX)

You have now learned the basics about how to work with the Grammar Help.
  1. To finish the left branch, double-click a state symbol and enter the text: Generate

Creating the Right Branch

To create the right branch:

  1. Copy the newly added state symbol to the clipboard. You find the clipboard commands, e.g. Copy, on the Edit menu or on the pop up menu that is activated with the right mouse button.
  2. Paste the state symbol. Following Paste, you should specify the location of the new symbol; move the mouse until you point to a suitable location and terminate with a click with the left mouse button.
  3. Append an input symbol with a double-click. Enter the text: T
  4. Append the output of the signal Bump with a double-click and enter the text Bump.
  5. Copy the task symbol with the text "SET (Now+1, T)" to the clipboard. But, do not paste right now.
  6. Point to the output symbol Bump. Press the right mouse button and select the Insert Paste command. This pastes and connects the task symbol.
  7. Terminate the branch by double-clicking a state symbol and typing a hyphen (-).
  8. Finally, add a text symbol and type in the declaration of the timer T.
  9. If desired, resize the frame symbol.
  10. Save the diagram with the file name Demon.spr.

This concludes the editing of the process Demon.

Editing the Process Game

First, create the process diagram Game in the usual way. In this exercise, you will learn some other editing functions:

What You Will Learn

Figure 66 : The process Game

You may proceed editing the process diagram in Figure 66, as will be described below:

Editing the Start Transition

  1. Insert the start symbol, the following task symbol and the state symbol Losing.
  2. You will now insert two input symbols in parallel. To do this, first make sure the state symbol is selected. Then, press <Shift> and double-click two input symbols (<Shift> must be kept pressed while you do this).
  3. Release <Shift> and select the left input symbol.
  4. Fill in the name of the input symbol (Probe), and complete the left branch.
  5. Select the right input symbol, fill in the name (Bump) and complete the branch without bothering about the subbranch that starts with the input of the signal Probe in the state Winning.
  6. Select the Probe input symbol in the left branch. On the Edit menu, use the Select Tail command to extend the selection to the end of the branch.
  7. Copy the selection and Paste it. Move the selection (which appears as a set of symbols) to a suitable place and paste it with a click with the left mouse button. If Paste fails (because of insufficient space or overlap), an alert sound is issued -- please try again.
  8. Change the text in the input symbol from Lose to Win.
  9. Change the text in the task symbol to Count:=Count+1.
  10. To interconnect the state symbol Winning with the input symbol Probe: select the state symbol - a handle appears -

Figure 67 : The selected state and its handle

drag the handle while pressing the mouse and release the mouse when it points to the input Probe symbol. A line is drawn between the symbols:

Figure 68 : The two branches are connected

  1. Conclude the diagram by drawing the remaining parts and saving the diagram.

Figure 69 : Remaining parts to edit

Editing the Process Main

The process Main is the last diagram to create and edit. If you find this tedious, you may skip this exercise and create the diagram as a copy from the files that are enclosed in the distribution (how to do this is described in section "Creating a Block Diagram From a Copy" on page 90). Figure 70 shows the appearance of the diagram to create.

Figure 70 : The process Main


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