FACILITIES FOR MODEL CONSTRUCTION

6.1 FACILITIES FOR MODEL CONSTRUCTION

The most fundamental modeler/machine interaction in Arena is model construction. The modeler builds a model in the foreground by dragging and dropping module objects from template panels in the Project bar onto the model window canvas, and Arena reacts

108 Model Testing and Debugging Facilities

Figure 6.1 A simple Arena model of a single-server queue (file test1.doe).

in the background by constructing the associated SIMAN code. The model is saved in a file with the extension .doe. The automatically generated SIMAN code is placed in two files, both accessible via the SIMAN option of the pull-down Run menu:

A model file (with the .mod extension) contains the model logic in the form of SIMAN blocks. It is well worth the effort to become familiar with SIMAN code, as this knowledge can significantly speed up model debugging. The extensive Arena Help menu further facilitates this task. An experiment file (with the .exp extension) lists all model elements, including project information, resources, queues, statistical outputs, and many others. It is important to examine this file and double-check model components, especially during the model construction process.

As an example, consider the simple model of Figure 6.1 depicting an Arena model called test1, which was accordingly placed by Arena in file test1.doe.

Model test1 consists of a sequence of Create, Seize, Delay, Release, and Dispose modules in tandem, and has a resource called Resource 1 with a queue called Seize 1.Queue. Panel 6.1 below displays the test1.mod file of the model test1 in file test1.doe.

; Model statements for module: Create 1 ; 5$

CREATE, 1,HoursToBaseTime(0.0), Entity 1:HoursToBaseTime(EXPO(1)):NEXT(6$); 6$

ASSIGN: Create 1.NumberOut¼Create 1.NumberOut þ 1: NEXT(0$);

Model statements for module: Seize 1 ; 0$

QUEUE,

Seize 1.Queue;

SEIZE, 2,Other:Resource 1,1:NEXT(10$); 10$

DELAY:

0.0,,VA:NEXT(2$);

Model statements for module: Delay 1 ; 2$

DELAY: EXPO( 0.8 ),,Other:NEXT(3$); ; ;

Model statements for module: Release 1 ; 3$

RELEASE: Resource 1,1:NEXT(4$); ;

Model Testing and Debugging Facilities 109

; Model statements for module: Dispose 1 ; 4$

ASSIGN: Dispose 1.NumberOut¼Dispose 1.NumberOut þ 1; 11$

DISPOSE:

Yes;

Panel 6.1 Contents of file test1.mod

An inspection of Panel 6.1 reveals that each line starts with an integer followed by

a dollar sign. These are Arena-assigned labels for blocks, which are used to identify the blocks in SIMAN code for control transfer (“go-to”) by a NEXT instruction. A walk-

through of Panel 6.1 reveals the following sequence of SIMAN blocks that implement the mapping from Arena modules to SIMAN blocks.

1. The Create1 module is mapped into two SIMAN blocks: CREATE and ASSIGN. The CREATE block models a random source of incoming entities with an expo- nential interarrival time distribution of mean 1. The ASSIGN block counts the total number of created entities.

2. The Seize1 module is mapped into two SIMAN blocks: QUEUE and SEIZE. The QUEUE block, called Seize 1.Queue, holds incoming entities that contend for access to the SEIZE block for one unit of the resource called Resource 1 (entities contend with priority 2).

3. The Delay1 module is mapped into a SIMAN DELAY block that models an exponen- tially distributed service time with mean 0.8 time units for the entering entity.

4. The Release1 module is mapped into a SIMAN RELEASE block that releases one unit of the Resource 1 resource previously seized by the entering entity.

5. The Dispose1 module is mapped into two SIMAN blocks: ASSIGN and DIS- POSE. The ASSIGN block keeps track of the outgoing entity count, while the DISPOSE block simply disposes of the entering entity.

Note that Arena modules are mapped to a variable number of SIMAN blocks. For example, the Create module is mapped into two SIMAN blocks, while the Release module is mapped into just one. Observe that connections between modules are represented by the keyword NEXT and a parenthesized number followed by a $ sign. Recall that these numbers serve as block labels. As a matter of fact, the blocks in a .mod file are implicitly numbered starting at 1; the number 0 stands for the “environment” (the “complement” of the system). These numbers are not shown in the file, but they are useful in accessing the blocks from the Run Controller for debugging purposes, as will

be shown later in this chapter. Next, Panel 6.2 displays the test1.exp file of the model test1 from file test1.doe.

PROJECT, "Testing mod/exp files","Industrial Engineer", ,,No, Yes,Yes,Yes,No,No,No,No,No,No;

VARIABLES: Dispose 1.NumberOut,CLEAR(Statistics),CATEGORY ("Exclude"):

Create 1.NumberOut,CLEAR(Statistics),CATEGORY ("Exclude");

QUEUES:

Seize 1.Queue,FIFO,,AUTOSTATS(Yes,,);

PICTURES: RESOURCES:

Resource 1, Capacity(1),,,COST(0.0,0.0,0.0),CATEGORY (Resources),,AUTOSTATS(Yes,,);

110 Model Testing and Debugging Facilities

DSTATS: NR(Resource 1),Resource 1 Utilization,"", DATABASE(,"Time Persistent","User Specified",

"Resource 1 Utilization"); REPLICATE,

1,,,Yes,Yes,,,,24,Hours,No,No,,,Yes;

ENTITIES: Entity 1, Picture.Report,0.0,0.0,0.0,0.0,0.0,0.0,AUTOSTATS

(Yes,,);

Panel 6.2 Contents of file test1.exp.

A walk-through of Panel 6.2 reveals the following sequence of items:

1. The PROJECT item provides model identification.

2. The VARIABLES item lists each model variable, along with its initial value (default is 0).

3. The QUEUES item lists model queues, along with their queueing discipline (default is FIFO) and capacities (default is infinity).

4. The PICTURES item lists entity picture names.

5. The RESOURCES item lists model resources, along with their capacity, schedule, and failure/repair information.

6. The DSTATS item lists statistics specified with the Time Persistent option in the Type column of the Statistic spreadsheet, along with their attributes. The test1.exp file would also list statistics specified with the Tally option in the Type column of the Statistic spreadsheet under a TALLIES item for each of its counterparts in the .mod file; here, that list is empty, so the TALLIES item is omitted. A FREQUEN- CIES item would similarly be included for statistics specified with the Frequency option in the Type column of the Statistic spreadsheet, analogously to the TALLIES item.

7. The REPLICATE item lists the data from the Replication Parameters dialog box of the Setup option in the Run menu.

8. The ENTITIES item lists each entity name and the corresponding picture name. It should now be clear to the reader that the .mod file and the .exp file reflect the

information in the .doe file. Furthermore, a simulation model should be as compact as possible to increase its running efficiency: Since every module is mapped into a set of SIMAN blocks (statements), which are compiled to create an executable file, models should be “cleansed” of any unnecessary modules.