FACILITIES FOR MODEL RUN CONTROL
6.3 FACILITIES FOR MODEL RUN CONTROL
Arena provides elaborate run-control facilities that support a wide variety of run-time interactions designed to monitor a simulation run and control the way it evolves over time. More specifically, the modeler can interrupt the run and make assignments to attributes and variables, or arrange for the run to stop whenever user-prescribed condi- tions are satisfied. Furthermore, the modeler can turn on visual animation and watch the model evolve in time, while monitoring variable values and entity movements in the model. Clearly, the use of these facilities is essential in verifying model logic from model behavior.
6.3.1 R UN M ODES
Arena supports VCR-like functionality for running a replication in various modes. This functionality is accessible via options in the Run menu or the corresponding buttons on the Standard toolbar. These buttons bear the familiar VCR-like icons as follows:
The Go button initiates or resumes a replication. The Step button steps through the replication event by event. Each time it is clicked, the replication runs, processing the most imminent event (see Section 2.1), and then the replication is paused. The Fast-Forward button suspends model animation and runs the replication to completion. The Pause button pauses the replication. The modeler can resume execution by clicking on any of the buttons above. The Start Over button initializes a new replication. The End button terminates the replication.
6.3.2 M OUSE -B ASED R UN C ONTROL
The functionality of mouse-based run control is accessible either via the Run Control option of the Run menu, or the Run Interaction toolbar, shown in Figure 6.2.
112 Model Testing and Debugging Facilities
Figure 6.2 Arena Run Interaction toolbar.
This toolbar consists of six buttons from left to right as follows:
1. The Check button performs model checking as described in Section 6.2.
2. The Command button opens a command window for textual interaction with the model. Command-line run control will be reviewed in Section 6.3.3.
3. The Break button opens a dialog box that allows the modeler to insert four types of break point: Break on Time, Break on Condition, Break on Entity, Break on Module, and Break on Calendar Date Time. Break-point parameters are specified in the appropriate fields of the dialog box. Whenever the run “hits” a break point, its execution is paused, allowing the modeler to inspect the state of the model. To resume execution, the modeler clicks any of the VCR-like buttons or menu options, as explained in Section 6.3.1.
4. The Watch button opens a window that permits the modeler to add, delete, or edit expressions so as to watch their dynamic values in the course of a run.
5. The Break on Module button sets or clears a break point in a selected canvas module. Whenever an entity enters the module or resumes executing its logic, the run is paused.
6. The Animate Connectors button turns on and off entity animation over model connectors.
The functionality of the Run Interaction toolbar can also be accessed from the Run menu.
6.3.3 K EYBOARD -B ASED R UN C ONTROL
The Command button in the Run Interaction toolbar is very handy for keyboard- based interaction. It can also be accessed by clicking the Run Control option in the Run menu, and then selecting the Command option. Either action opens the Command window below the Arena model canvas as illustrated in Figure 6.3.
Figure 6.3 Arena Command window.
Model Testing and Debugging Facilities 113 The top portion of the Command window displays the five graphical objects from
left to right as follows:
1. The Block Step button is used for advancing the simulation one step (event) at a time.
2. The Enable Block Trace toggle button turns tracing on and off.
3. The next object is a pull-down menu allowing the user to select a debugging command.
4. The next button inserts the selected command at the bottom of the text panel of the Command window prefixed by a prompt that consists of the current simulation time followed by the greater than (>) character.
5. The last object is a text annotation describing the selected command and its syntax. Once the Command window is opened, the modeler can also type in commands
directly after the prompt. A list of frequently used commands follows:
1. GO starts or resumes a run.
2. GO UNTIL starts the run and stops it at the specified time. For instance,
GO UNTIL 100
starts a run and stops it at time TNOW ¼ 100.
3. END terminates the run and produces a summary report.
4. QUIT does the same without producing a summary report.
5. ASSIGN allows the user to assign values to variables or entity attributes. For example, suppose the simulation is stopped at time 25.6. Then, the command
25.6> ASSIGN
Target Inventory ¼ 250
assigns the value of 250 to the variable Target Inventory at this point in time.
6. SHOW displays the current values of expressions, variables, and attributes. For instance, the commands
SHOW NQ(Q1) þ NQ(Q2) SHOW NQ( * )
display, respectively, the sum of the number of entities in queues Q1 and Q2, and the current length of each queue in the model. The asterisk (*) is the wild card
character, and stands for “all.”
7. VIEW displays a broad range of model data. For instance, the commands
VIEW SOURCE 21..30 VIEW ENTITY 5 VIEW QUEUE Mac_q
display, respectively, the SIMAN code of block numbers 21 through 30 (recall that SIMAN blocks are implicitly numbered from 1 onward), the attributes of entity 5 (recall that all entities are numbered consecutively from 1 at creation time), and the queue called Mac_q, along with all its entities and their attributes.
8. SET commands perform a number of important functions in the Run Controller, which include the following:
a. SET BREAK sets break points at specified locations in the model. When an entity hits such a break point, Arena suspends the run and allows the modeler to “poke” into the model's state. The run can be resumed when the modeler types the appropriate command. For example,
114 Model Testing and Debugging Facilities SET BREAK 25
sets a break point in block number 25.
b. SET WATCH permits the modeler to monitor the value of a variable, attribute, or expression (in particular, whether a prescribed condition is satisfied). For example, the commands
SET WATCH NQ(Mac_q) SET WATCH NR(Mac) > 2
suspend the run, respectively, whenever the size of queue Mac_q changes, or whenever the number of busy servers in resource Mac exceeds 2.
c. SET TRACE activates the SIMAN trace to monitor the flow of entities through blocks, and the assignments made in each block monitored. For example,
SET TRACE *
displays a complete history of entity movements and variable assignments in the course of a run from the time this command was issued until the run is suspended (see the example in Panel 6.3).
9. CANCEL cancels the Run Controller option that constitutes this command's argument. For instance,
CANCEL WATCH *
cancels all the WATCH requests issued at an earlier time. In a similar vein, the commands
CANCEL TRACE * CANCEL BREAK 3
cancel, respectively, all prior trace requests, and the break point set on block 3.