Chapter 5 – Model Simulation
5.1 – Simulation Options
Accessed from the Simulation menu, the Options dialog contains the settings and information you will use to run your model. Be sure to review these settings before running the simulation of the model. Once you are familiar with these options and have set them according to your objectives, you can run the simulation.
If the first entity arrives in the model at 8:00am the simulation clock will jump ahead to that event. This happens when there is a daily pattern or scheduled arrival of entities to occur at 8:00am. If no events are occurring in the simulation, the clock jumps ahead to a point when some action is taking place.
Each ProcessModel simulation begins at 12:00 a.m. (midnight) on Monday morning (of the first week).
5.1.1 – Run Tab
Run length The length of time for running the simulation. You may use any constant or expression to indicate the length of time the simulation will run.
The longest a model can run a simulation for is 71,582 hours or 2,982.6 days or 8.17 years approximately. The smallest time allowed is.06 seconds, .001 minutes, or .000017 hours.
Warmup length The length of time to run the simulation before collecting statistics. Many systems require a time to warm up before they are running at a steady state, and if you collected statistics during this warm-up period, your results would likely be skewed. This option allows you to define that time to allow your model to warm up before you begin collecting statistics. Again, any constant or expression may be used in this field. The scoreboard values will reset after the warmup period ends. This is the designed purpose of the warm up length.
The longest warm-up length allowed is 2,270 hours.
Replications The number of replications to run for increasing the statistical significance of output results. If your model has any random behavior defined using one or more probability distributions, the simulation results will also be random. Running multiple replications allows you to use a meaningful sample size when interpreting the results since each replication uses a different seed to generate random numbers.
Report time units Allows you to select the default time units to use when you run the model.
Show Animation If checked, the process will be animated during the simulation. Disabling the animation enables the simulation to run faster and consumes less memory.
Show Scoreboard Check to display basic performance measures (entities processed, value-added time, etc.) during the simulation.
Scoreboard Time units Allows you to select the time unit displayed in the scoreboard at the time of simulation.
Disable subprocesses Causes the simulation to be run the main model only (no submodels are executed). Individual submodels can be disabled in the Activity dialog.
The ProcessModel simulation clock runs straight time using 24 hour days, 7 days per week. If there is a need to avoid the shift files to compensate for evenings and weekends, just run straight work time (not being concerned with the “day of week”), it can reduce the simulation run length to 40 hours per week. For example, a normal 7 day work week is 168 hours (7 x 24). To run a model without shift files for 4 weeks, using a 5 day workweek at 40 hours per week, reduce the run length from 672 hours (4 x 168) to 160 hours (4 x 40). Caution: Daily Pattern or Scheduled arrivals can not be used with this technique because the clock is no longer tracking 24 hour days. Continuous, Periodic, or Ordered arrivals will need to be used.
5.1.2 – Files Tab
External Files This option allows you to include shift files for activities and resources.
Create shift file Allows you to create a shift file for the model.
Interrupt activity to go off shift or on break When you check this option, ProcessModel will interrupt an activity or resource (whether or not it is currently busy) to cause it to go off shift or on break. Use this only for activities or resources you can interrupt.
5.1.3 – Graphics Tab
ProcessModel version 5.6.2 and above do not support this feature. The Graphics tab allowed you to use a custom graphics library in the model and was provided primarily for compatibility with earlier versions of ProcessModel. If you have models built in version 2.1 or earlier and you don’t want to add any custom entity icons to the models, uncheck the “Use custom graphics library for simulation” box. This will conserve the disk space required to generate a custom graphics library.
5.1.4 – Output Tab
Show standard deviation When you check this option, ProcessModel will show standard deviation in the cycle time calculation of the Output Summary.
Number of cycle time Allows you to choose the size of the cycle in which the standard deviation is sampled. Larger samples use more processing memory.
Statistics Allows you to choose if resource stats will be shown by unit or in a summary of all units.
5.2 – The Simulation Window
From the Simulation menu, select Simulate Chart (or Run Scenarios) to run a ProcessModel flowchart. When you run the simulation, the Simulation Window appears and ProcessModel compiles the model into simulation code for execution. Your model then starts running according to the options you have selected.
The simulation window is set to run maximized and does not allow switching to other programs running on your system. The simulation window can either be minimized or re-sized. As long as it is not running maximized, you will be able to switch between it and other programs currently running. There is no method of programmatically changing the size or priority of the simulation window. It must be changed manually. However, the status and location of the window will be saved when you end the simulation. So the next time you run a simulation, it will use the same window settings it used previously.
5.2.1 – Scoreboard
In addition to your flowchart, a scoreboard appears on the Simulation Window to illustrate performance measures if the scoreboard option is selected in the Options dialog.
Entity1, Entity2,… Entities for which statistics are gathered are displayed across the top of the scoreboard.
Qty Processed The number of entities of this particular type that have been processed, meaning those that have exited the system.
Avg. Cycle Time (time unit) The average time the entity type spent in the system. Expressed in terms of the time unit selected in the Simulation/Options dialog.
Avg. VA Time (time unit) The average value added time—time the entity type spent in activity time. Expressed in terms of the time unit selected in the Simulation/ Options dialog.
Cost per Unit The average cost of the entity type.
Since entity names can be changed during a simulation, statistics are collected based on the name assigned to the entity when it exits the system.
Variables may also be shown on the Scoreboard (see variables).
The decimal places shown in the simulation when displaying a real variable using a Label is fixed at 2 decimal places and can not be changed.
5.2.2 – Run-time Menus
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.
5.2.3 – Run-time Controls
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.