Tutorial

From Sigma

(Difference between revisions)
Jump to: navigation, search
(Edges)
(Edges)
Line 106: Line 106:
|center]]
|center]]
 +
Double-clicking on one of the sub-edges in the multiple edge dialog box will produce the dialog box for that particular edge. For example, if you double-click on the line for the edge from START to LEAVE, a dialog box for that edge will appear.
 +
 +
The edge between the START vertex and the LEAVE vertex has a delay time of five minutes, indicating that it will take five minutes to wash a single car. Now cancel the dialog box for this sub-edge and look at the dialog box for the sub-edge from the LEAVE vertex to the START vertex.
 +
 +
The dialog box for the edge from LEAVE to START tells us that if there are customers waiting in line (QUEUE>O) whenever a customer LEAVEs the system, the server will START service on the next customer in line. To return to the event graph for CARWASH.MOD click the Cancel button on the dialog box and clicking the Close command button on the multiple edge dialog box.
 +
 +
===Editing the Carwash Model===
 +
 +
To get a feel for editing graphical objects, double-click on the edges or vertices in the graph. Then click on some of the items in the dialog boxes and use the keyboard to enter changes to the model. (Pressing the OK button will cause your changes to be temporarily recorded in the model.)
 +
 +
After you have edited a few dialog boxes, click on the File menu and click again on the Open/Event Graph command. Click No when asked if changes to CARWASH.MOD should be saved. (Clicking Yes will save the changes you just made to the model.) Next, scroll through the list of model file names until you see CARWASH.MOD. Double-click on CARWASH.MOD to reread the initial version of this model into SIGMA. The screen in Figure 3.3 should appear again.
 +
 +
If you saved your changes to the model, CARWASH.MOD, a backup copy is also saved in your directory as CARWASH.BAK. Read CARWASH.BAK into SIGMA and save it as CARWASH.MOD, if necessary.
 +
 +
==Using Text Files==
 +
 +
Now that we have gone over the model, CARWASH.MOD, in detail, you might be interested in looking at how it is stored on your computer. The model is stored in a text file by the same name, CARWASH.MOD. To look at this file, first open the File menu and click the Text Data/Output command. A dialog box will appear. Click on the down arrow in the drop-down list under List Files of Type and then click on the Other Files option to have all the files included in the list box of file names.
 +
 +
Use the scroll bar to locate CARWASH.MOD in the list box; click once on CARWASH.MOD to insert this file into the File Name input box. Next, click the OK command button. When the text file appears, you will notice that SIGMA models are saved simply as copies of the dialog boxes for each of the objects in the simulation. Close the file.
[[Main Page|Back to Main Page]]
[[Main Page|Back to Main Page]]

Revision as of 23:32, 23 July 2008

Contents

A Tutorial on the Basics of SIGMA

An overview of the SIGMA software environment is presented in this chapter in tutorial format. All primary elements of event relationship graph modeling are explained. Technical details are presented in later sections.

Starting a SIGMA Session

Double click on SIGMA.EXE to begin a SIGMA modeling session. SIGMA does not automatically load a model, but they can easily be recalled using the File/Recall menu command.

The SIGMA Modeling Environment

A simulation graph window similar to the one in Figure 3.1 will appear when a SIGMA session begins. This is the primary window for a SIGMA modeling session. Linked to this modeling session are simulation plot windows and output windows. Note: Several SIGMA modeling sessions may run simultaneously; thus, several simulation graph windows representing different models may be open at one time.

SIGMA's Simulation Graph Window
SIGMA's Simulation Graph Window

There are three regions in the simulation graph window: the model creation area (the region in the center of the window), the menu bar (located along the top of the window), and the toolbar (located along the right side of the window).

The various push buttons in the toolbar are identified in Figure 3.2. The Start Run and End Run tools allow you to start or stop a simulation run; the Select or Edit, Create Process, and Create Single Edge tools let you quickly create a model; the Single Step tool allows you to watch the simulation as each event is executed; and the Run Time Information and Show SIGMA Version tools provide you with additional information. In addition, fifteen User Tool buttons allow you to add previously created models to a new modeling session.

SIGMA Toolbar
Image:buttons1.png Select or Edit
Image:buttons2.png Create Process
Image:buttons3.png Create Single Edge
Image:buttons4.png Show SIGMA Verion
Image:buttons5.png Start Run
Image:buttons6.png End Run
Image:buttons7.png Single Step
Image:buttons8.png User Tool

A window is activated when the mouse pointer is clicked anywhere on it. As the various windows are activated, the menu bar changes. The menu bar for the simulation graph window contains the following menus: File, Edit, Run, Variables, Zoom, Window, and Help. The simulation plot window contains the File, Edit, Options, Window, and Help menus; the output window contains the File, Edit, Search, Window, and Help menus.

When a SIGMA session is started, the mouse pointer is normally in Create Process mode (*). It is in this mode that the graphical components of a simulation model are created. If you click the right mouse button, the mouse pointer will change to Select or Edit mode (*). This mode is used to add or change information related to specific vertices or edges. Just double-click on a vertex or edge, and an Edit Edge or Edit Vertex dialog box will appear. Add information or make changes by clicking on the appropriate box and entering the data from the keyboard. Clicking the right mouse button will cause the mouse to alternate between the Create Process mode and Select or Edit mode. Pressing the appropriate push buttons on the tool bar will also activate the Create Process mode or the Select or Edit mode.

Exploring Our Carwash Model

We will use a previously created model, CARWASH.MOD, to examine the components of a SIGMA model. To begin, start a SIGMA session. Open CARWASH.MOD by pressing the File\Open command, pressing Event Graph, and then double-clicking on CARWASH.MOD from the list of previously created models in the dialog box.. This model is represented in Figure 3.3.

An Event Graph for a Single Server Queue, CARWASH.MOD
An Event Graph for a Single Server Queue, CARWASH.MOD

Recall that CARWASH.MOD has only two state variables: QUEUE, the number of cars waiting in line, and SERVER, the status of the machine, 0=BUSY and 1=IDLE.. Four events are represented by the four vertices in the carwash model. The RUN vertex starts the simulation, the ENTER vertex models customers entering the carwash, the START vertex occurs when a car starts service in the washing bay, and the LEAVE vertex occurs when a car finishes service and leaves the washing bay. The time intervals between successive customer arrivals to the carwash are independent and random.

Network Users

WARNING: You should not use a floppy drive or a write-protected network drive as your default drive.

[[this text must be rephrased]]

NETWORK USERS: If you are running SIGMA from a network server, your default drive is probably write-protected. Thus, you will get a system error message if you run the simulation as described in Step 4. You must add a drive letter before the output file name in the Run Options dialog box. For example, you should change UNTITLED.OUT to C:\UNTITLED.OUT so you can write the output to your C: drive. (Click on the Options command under the Run menu. In the Run Options dialog box, add the drive letter to the name of the file in the Output File text box. Next, click on the OK button and proceed to Step 4.) You should not use a floppy drive as your default drive as this will slow the running of your simulation considerably.

State Variables

Click the mouse on the Create/Edit Variables command under the Variables menu to see the list of state variables for this model in the State Variable Editor dialog box. Any state variables you define can be used anywhere in your SIGMA model. We refer to them as state variables to emphasize that they are accessible to all parts of the model. Clicking on one of the state variables in this dialog box will cause the details associated with that state variable to be displayed in the input boxes above (as in Figure 3.4.)

The State Variable Editor Dialog Box
The State Variable Editor Dialog Box

The dialog box for state variables, like other SIGMA dialog boxes, has a line for a brief description of the object. These descriptions are important; they appear as comments in your SIGMA-generated simulation source code and make your model much easier to understand. Click on the Cancel command button to close the state variable dialog box and return to the simulation graph seen in Figure 3.3.

We will further explore this model by clicking the mouse on elements in the event graph. Make sure that the mouse pointer is in Select or Edit mode. Read the description in each dialog box as we

Vertices

Double-click on the RUN vertex. This vertex, whose dialog box is shown in Figure 3.5, was the first vertex created in this model. SIGMA calls the first vertex created vertex number 1; it will always be executed first when the model is run. (This first vertex is colored green on the screen.)

The RUN vertex has a parameter: the state variable, QUEUE. When CARWASH.MOD is run, you will be asked to provide an initial value for the number of customers in the QUEUE when the system opens for service. All SIGMA state variables are initialized to be equal to zero. The only state change associated with the RUN vertex is to make the SERVER available (SERVER=1). To exit, click your mouse on the Cancel command button.


The Dialog Box for the RUN Vertex
The Dialog Box for the RUN Vertex

The ENTER vertex is where customers join the line. Open the dialog box for the ENTER vertex. This vertex simply increments the number of customers waiting in line (QUEUE=QUEUE+l). Note that QUEUE has been entered as a display variable, so its value will be shown while the simulation is running. Close this dialog box and then double-click on the START vertex.

The START service vertex is where the server is made busy (SERVER=O) and the number of customers waiting in line is decremented (QUEUE=QUEUE-1). Close the START vertex dialog box and open the LEAVE dialog box.

The LEAVE vertex makes the server available to serve other customer (SERVER=1). Note that if the variable, QUEUE, were defined as the number of customers in the total system (in service as well as in line), QUEUE would be decremented in the LEAVE vertex rather than in the START vertex. Close this dialog box.

The event vertices are relatively straightforward in discrete event models. The complexity of the models comes at the edges of the event graph, where the dynamic and logical relationships between events are specified.

Edges

Next, we will examine each of the edges in our model. Figure 3.6 is the edge dialog box that you should see if you double-clicked on the edge between the RUN vertex and the ENTER vertex.

Edge Dialog Box from RUN Vertex to ENTER Vertex Schedules the First Customer Arrival
Edge Dialog Box from RUN Vertex to ENTER Vertex Schedules the First Customer Arrival

We see that this edge has the condition (1==1). As in the C programming language, == is a test for equality in SIGMA. Thus, this edge unconditionally (1==1) schedules the first customer to ENTER the system. There is no time delay between starting the RUN and the first customer ENTERing the system. Here no attribute values are passed, and the execution priority, used to break time ties between events scheduled to occur at the same clock time, is set to a neutral value of 5. (Attributes and priorities are important aspects of SIGMA; they allow simple models to represent complex systems. Both are discussed in greater detail in Chapter 6.) Click the Cancel button on this edge dialog box.

Unconditional edges test the condition (1==1), which is always true.

Double-click on the self-scheduling edge from the ENTER vertex to the ENTER vertex, which perpetuates customer arrivals. The most notable item in this dialog box is the delay time. Here, the Delay between successive customers ENTERing the system will be a time uniformly distributed between 3 and 8 minutes. This is done by making the delay time for this edge equal to the expression, 3+5*RND. RND is a SIGMA function providing a fraction that behaves like a random number between 0 and 1. Thus, 5*RND will be a number somewhere between 0 and 5; adding 3 will shift the range of this number to between 3 and 8. Close this dialog box.

Open the dialog box between the ENTER vertex and the START vertex. The item of interest on this edge is Condition: SERVER>0. This means that a customer ENTERing the system will START service without delay only if that customer finds that the server is available, i.e., if the condition SERVER>0 is true. Close this dialog box.

Double-click on the edge between the START vertex and the LEAVE vertex. Note that this edge is a double edge: with one edge from the START vertex to the LEAVE vertex and another edge in the reverse direction, from LEAVE to START. The dialog box for this multiple edge is shown in Figure 3.7.

Multiple Edge Dialog Box between START and  LEAVE Vertices
Multiple Edge Dialog Box between START and LEAVE Vertices

Double-clicking on one of the sub-edges in the multiple edge dialog box will produce the dialog box for that particular edge. For example, if you double-click on the line for the edge from START to LEAVE, a dialog box for that edge will appear.

The edge between the START vertex and the LEAVE vertex has a delay time of five minutes, indicating that it will take five minutes to wash a single car. Now cancel the dialog box for this sub-edge and look at the dialog box for the sub-edge from the LEAVE vertex to the START vertex.

The dialog box for the edge from LEAVE to START tells us that if there are customers waiting in line (QUEUE>O) whenever a customer LEAVEs the system, the server will START service on the next customer in line. To return to the event graph for CARWASH.MOD click the Cancel button on the dialog box and clicking the Close command button on the multiple edge dialog box.

Editing the Carwash Model

To get a feel for editing graphical objects, double-click on the edges or vertices in the graph. Then click on some of the items in the dialog boxes and use the keyboard to enter changes to the model. (Pressing the OK button will cause your changes to be temporarily recorded in the model.)

After you have edited a few dialog boxes, click on the File menu and click again on the Open/Event Graph command. Click No when asked if changes to CARWASH.MOD should be saved. (Clicking Yes will save the changes you just made to the model.) Next, scroll through the list of model file names until you see CARWASH.MOD. Double-click on CARWASH.MOD to reread the initial version of this model into SIGMA. The screen in Figure 3.3 should appear again.

If you saved your changes to the model, CARWASH.MOD, a backup copy is also saved in your directory as CARWASH.BAK. Read CARWASH.BAK into SIGMA and save it as CARWASH.MOD, if necessary.

Using Text Files

Now that we have gone over the model, CARWASH.MOD, in detail, you might be interested in looking at how it is stored on your computer. The model is stored in a text file by the same name, CARWASH.MOD. To look at this file, first open the File menu and click the Text Data/Output command. A dialog box will appear. Click on the down arrow in the drop-down list under List Files of Type and then click on the Other Files option to have all the files included in the list box of file names.

Use the scroll bar to locate CARWASH.MOD in the list box; click once on CARWASH.MOD to insert this file into the File Name input box. Next, click the OK command button. When the text file appears, you will notice that SIGMA models are saved simply as copies of the dialog boxes for each of the objects in the simulation. Close the file.

Back to Main Page

Personal tools