Once a simulation begins, a new menu bar appears at the top of the screen with selections for controlling the animation and for interacting with the simulation. As shown below, these menu items appear above the animation speed control bar and simulation clock.
The Simulation Window has a menu of its own, with selections for controlling many simulation parameters such as the run speed. You can also control the animation through panning, zooming and pausing.
The screen above shows the speed control bar, along with the clock selection button for controlling the format of the clock readout. In addition, each resource has a status light which changes throughout the simulation to reflect the current operational state of each resource (a maximum of 12 status lights will be shown for multi-unit resources).
Slow simulation is typically caused by a large number of entities arriving, or being moved from one location to another simultaneously. If possible, space out the arrivals so not so many entities are entering the model at the same time, the simulation speed will increase dramatically. Many calculations need to occur for every entity when it moves in the model. So the more entities moving at the same time, the longer it takes to process the required information. If there are long routing times and many entities moving on those routes, the simulation will slow dramatically. In this instance, consider using an activity (with no input queue and no output queue, and infinite capacity and a time that corresponds to the movement time. The routes that goes into and out of the activity can then be set to zero time. This should increase the simulation speed.
Run-Time Simulation Menu
The Run-Time Simulation menu has two options: End Simulation and Pause/Resume Simulation. Each of these functions is defined below.
End Simulation Choose this option to end the simulation. You will then be prompted to collect statistics or return to the model editor without collecting statistics. If running multiple scenarios, End Simulation will terminate all scenarios.
Pause/Resume Simulation Choose Pause Simulation to pause the simulation for an indefinite amount of time. With the simulation paused, you may begin a trace, zoom in or out on the animation, set up the next pause, examine different activities in the model, or interact with the model in a number of other ways. Choose Resume Simulation when the simulation is paused to continue running the simulation.
You may temporarily halt the simulation by pressing the ALT key. Pressing any key will resume the simulation.
The run-time Options menu has several selections that allow you to interact with the simulation while the model is running. These options are described in the following pages.
Animation Off/On Turns the animation on or off. Off greatly speeds up the simulation. Animation speed may also be set with the ANIMATE (ANIMATE 0-100) statement.
Zoom Zooms in or out on the animation.
Views Allows you to select a view defined while building the model.
Trace Options Lists events as they happen during a simulation. These option allow for several viewing options including sending the output to a file.
Debug Brings up the Debugger Options Dialog box for debugging the model.
User Pause Allows the user to enter a simulation clock time for the simulation to pause.
The Debugger is a convenient and efficient way to test or follow the processing of any logic defined in your model. The debugger is used to step through logic one statement at a time and examine variables and attributes while a model is running.
Before discussing the details of the Debug option, it is important to understand the following terms:
Statement A statement causes ProcessModel to take some action or perform some operation. This includes statements such as GET, JOIN, etc.
Thread A thread is a specific execution of any logic. A thread is initiated whenever a logic needs to be executed. This can be an entity running through an activity action logic, arrival logic or routing logic. Note that the same logic may be running in several threads at the same time. For example, three entities of the same type being processed simultaneously at the same multi-capacity activity would constitute three threads.
A thread or logic execution can be suspended by any statement, causing simulation time to pass (e.g. GET Res1, TIME(5 min), etc.). After such a statement completes its task, the thread is resumed. During the time a thread is suspended, other threads may be initiated, suspended, resumed, or completed. This is called thread switching.
Even though there can be several threads execution, e.g. the same logic at the same current time in the simulation, the simulation processor can only process them one at a time. So there is really only one current thread while all other threads are suspended (either scheduled for some future simulation time, or waiting to be executed after the current thread at the same simulation instant).
There can also be many threads (any number of threads corresponding to each of the time elapsing statements within the logic) which have completed their waiting time, but wait their turn to continue execution. These threads are on hold because the simulation engine is busy with another thread scheduled for the same simulation time instant. There is only one thread executed at any real time instant by the simulation engine.
The debugger window will display a unique identification number for the current, active thread. This thread ID number will help you differentiate between different instances of the same logic block while you are debugging your models.
Debugger Options Dialog Box
The Debugger Options dialog box allows the user to specify when to display the Debugger dialog box during the simulation run.
Disable debugger disables the debugger completely. By default, the debugger is enabled. Running the model with the debugger disabled increases the run speed. When running multiple replications or scenarios, or when the animation is disabled, the debugger will automatically be disabled.
DEBUG statement Displays the Debugger dialog box every time a DEBUG statement is encountered in an enabled process while running the simulation.
Global Change Displays the Debugger dialog box every time a global change occurs to a specified variable or attribute. The Debugger dialog box shows the original and new value of the element. Only one global name can be specified in this box.
User Condition Displays the Debugger dialog box when a defined user condition written as a Boolean expression becomes true, for example, when Var1=5. Only one expression can be specified in this box, although several conditions can be tested by using the OR operator.
Check Condition Allows the user to define how often to check the user condition. The options include:
• Before each statement The condition, such as v_Var1=1, will be checked before each statement is executed. This option is the most precise way to tell exactly when the user condition becomes true, but slows down the simulation the most.
• At each thread switch The condition, such as v_Var3>17, will be checked only if a statement from a different thread follows the current statement being executed.
• At each thread initiation The condition, such as a_Att1=5, will be checked only if the next statement to be executed is the first statement in a thread (the first statement in a thread is also the first statement of a logic).
Debug button Pressing the Debug button displays the Debugger dialog box before the next statement executes.
OK Closes the Debugger Options dialog box and continues to run the simulation model.
Debugger Dialog Box
The Debugger can be used in two modes: Basic and Advanced. The Basic Debugger appears initially with the option of using the Advanced Debugger. The Basic Debugger dialog box is shown:
Error Display Box Displays the error message or reason why the Debugger dialog box is displayed, such as the User-Condition becoming true.
Logic Display Box Displays the statements of the current logic being executed.
Information Box Displays either the context of the logic or local information as mentioned below.
Context Displays the module, operation, and line number (in which the debugger stopped) in the Information box.
Local Information Displays local variables and entity attributes with non-zero values in the Information box.
End Simulation Choose this option to terminate the simulation. This will prompt you about collecting statistics.
Run Continues to run the simulation, but still checks the debugger options selected in the Debugger Options dialog box.
Next Statement Jumps to the next statement in the current thread. If the last statement executed suspends the thread (e.g. the entity is waiting to capture a resource), another thread meeting the debugger conditions may be displayed as the next statement.
Next Thread Brings up the Debugger at the next initiated or resumed thread.
Into Subroutine Steps to the first statement in the next subroutine executed by this thread. Again, if the last statement executed suspends the thread, another thread meeting debugger conditions may be displayed first. If no subroutine is found in the current thread, a message is displayed in the Error Display box.
Options Brings up the Debugger Options dialog box. You may also bring up this dialog box from the Simulation menu.
Advanced Changes the Debugger to Advanced mode, providing additional options.
A trace is a list of events occurring over the course of a simulation. For example, a trace statement might state “EntA arrives at Activity1”. A trace listing also displays assignments, such as variable and array element assignments. A trace listing of a simulation run may be viewed in several ways through the trace options provided. Trace is a powerful debugging tool used to display currently scheduled and executed events. Events are the smallest actions that make up a simulation. An Example trace is shown below:
Sim Time Event
10:24.583 For Entity_ at Schedule_Hearing_inQ:
10:24.583 Schedule_Hearing is selected for routing.
10:24.583 Start move to Schedule_Hearing.
10:24.583 Entity_ arrives at Schedule_Hearing.
10:24.583 For Entity_ at Schedule_Hearing:
10:24.583 Entity_ enters Schedule_Hearing.
10:24.583 Ent Attr: VATime = 0.104951 (old value = 0.074088)
10:24.583 Ent Attr: Cost = 24.791763 (old value = 24.791763)
10:24.583 Wait 44.442 Min.
11:09.025 For Entity_ at Schedule_Hearing:
This allows the user to see exactly what and when events are occurring in the simulation. This can provide incredible insight when attempting to understand the order of events. Turn on the trace during the simulation from the menu Options/Trace Options. Select either Step or Continuous. From the example above, it is obvious that a trace could become very detailed in a large model.
Limiting the Trace to only selective events
The trace can be filtered so that only a subset of events are displayed. Filtering the Trace is shown in the screenshots that follow:
Select Step or Continuous mode to display the items selected in the filter.
Writing the trace to a file
The information displayed in a trace can be written to a file for later review. To write a trace to a file, select the menu Options/Trace Options/Output to File. The trace file will be saved to a file with the same name as the model using a .trc extension. To view the trace file, open the file with notepad or another text editor.
Proper Sequence to Trace filtered items for a specific period
- Start the simulation.
- Use the Simulation/Pause Simulation menu item set the simulation to pause at the desired time.
- Select Trace Options/Continuous mode.
- Select Trace Options/Filtered Trace… Filter the Trace to select events to monitor.
- Select Trace Options/Output to File.
- Use the Simulation/Resume Simulation menu item to restart the simulation.
- Use the Simulation/Pause Simulation menu item to set the simulation to pause at the end of the collection period.
- End the simulation.
- Open the trace file (The trace file is written to the same location as the model) with a text editor.
- TRACE STEP (turns step trace on)
- TRACE CONT (turns continuous trace on)
- TRACE OFF (turns trace off but leaves window open)
- TRACE CLOSE (turns trace off and closes window)
A trace listing is generated in one of two modes, Step or Continuous.
Off Select this option to discontinue a current trace.
Step Select this option to step through the trace listing one event at a time. Each time you click the left mouse button, the trace will advance one event. Clicking and holding the right mouse button while in this mode generates a continuous trace.
Continuous Select this option to write the trace continuously to the output device selected from the Trace Output submenu. This is useful when you do not know exactly where to begin or end the trace. Clicking and holding the right mouse button stops the trace until you release the button.
A trace may be sent to one or more output devices by checking each desired output. For example, you may select ‘To Window’ and ‘To File’ to see a listing on your screen and also save the information in a text file.
To Window Select this option to view the trace in an on-screen trace window. You may size the trace window to your liking to see more or less of the trace listing.
To File Select this option to send the trace listing to a text file. Trace statements are automatically written to a .TRC file.
In addition to the debug and trace options, animation options allow you to control the animation screen.
Animation Off Choose this option to temporarily suspend the animation. To resume the animation, select this option again. (The selection automatically changes to ‘Animation On’.) Note that running with animation off greatly increases the run speed, especially for models with a large amount of graphic detail. To increase the run speed to an even faster rate, check the Disable Animation in the Simulation Options before
running the model (see Simulation Options).
Zoom Select this option to Zoom in or out on the animation. When this option is selected you may choose a preset zoom level, enter your own zoom level, or choose Zoom To Fit Layout to fit the entire animation on one screen. The Zoom function zooms to the center of the screen. If the zoom factor causes the model layout to appear outside the layout window, the zoom function will automatically pan to show at least part of the layout.
Views The views option allows you to view individual portions of a hierarchical model. Pressing the CTR key with the number 1 shows the upper level of the model, while pressing the CTR key with the number 2 shows the first sub model, etc.
User Pause Choose this option to enter a time for the simulation to pause. The proper format for specifying a user pause is hh:mm.xx where hh represents hours, mm represents minutes, and xx represents hundredths of a minute.
The Information menu contains selections for obtaining system information during the run. The four selections on this menu are included for technical purposes.
The Window menu allows you to rearrange windows and icons and select the active window. These options are standard to all Windows applications.
In addition to the animation options discussed in the previous section, you may pan the animation screen in any direction, control the speed of the simulation, and change the format of the simulation clock display. These and other procedures are discussed in this section.
How To – Pan through the animation
1. Press and hold the left mouse button anywhere on the animation screen. This point then becomes the “anchor point” by which the entire animation is moved.
2. Drag and release the mouse where you desire the anchor point to be located.
Control the simulation speed
• Move the animation speed control bar to the left to decrease the simulation speed or to the right to increase the simulation speed.
How To – Change the format of the simulation clock display
1. Click on the simulation clock button.
2. Select a format for the clock display.