![]() |
![]() |
![]() |
![]() |
![]() |
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
On the next pages, you will find suggestions about how to use the SDL Editor to draw the diagram.
What You Will Learn
- To add symbols with the double-click facility
- To work with the clipboard functions
- To insert symbols in a flow
- To request grammar help
Creating the Diagram
- 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.
- 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).
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
- Select the start symbol in the symbol menu and place it in the drawing area at a suitable location.
- 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.
- Select the command Grammar Help from the Windows menu. The SDL Editor responds by displaying the Grammar Help window.
- The left list shows a number of "use cases", each of them identified with their name. The first one is the GRAMMAR for the selected object.
- The top of the right list shows a number of references to the Z.100 definition.
- Beneath the Z.100 references are listed the formal textual (SDL/PR) expressions that are legal to add to the symbol. (The formal expressions need of course to be replaced by the actual values that are used in your context).
- 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.
- Insert the formal text into the task symbol by selecting the Insert command from the Edit menu. The task symbol is immediately updated.
- Now, change the generic names Expr and TimerName to their actual values (1 and T, respectively).
- You have now learned the basics about how to work with the Grammar Help.
Creating the Right Branch
- 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.
- 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.
- Append an input symbol with a double-click. Enter the text: T
- Append the output of the signal Bump with a double-click and enter the text Bump.
- Copy the task symbol with the text "SET (Now+1, T)" to the clipboard. But, do not paste right now.
- Point to the output symbol Bump. Press the right mouse button and select the Insert Paste command. This pastes and connects the task symbol.
- Terminate the branch by double-clicking a state symbol and typing a hyphen (-).
- Finally, add a text symbol and type in the declaration of the timer T.
- If desired, resize the frame symbol.
- 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
You may proceed editing the process diagram in Figure 66, as will be described below:
Editing the Start Transition
- Insert the start symbol, the following task symbol and the state symbol Losing.
- 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).
- Release <Shift> and select the left input symbol.
- Fill in the name of the input symbol (Probe), and complete the left branch.
- 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.
- 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.
- 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.
- Change the text in the input symbol from Lose to Win.
- Change the text in the task symbol to Count:=Count+1.
- To interconnect the state symbol Winning with the input symbol Probe: select the state symbol - a handle appears -
- 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:
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.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |