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.
Options Menu
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.
Debug
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.
Trace 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: