Simulation & Modeling - CH5 - Simulation Software
Simulation & Modeling - CH5 - Simulation Software
Cont’d
5.2. Comparison of Simulation Packages with
• The following are some advantages of using a simulation package rather than a
Programming Languages general-purpose programming language:
• Simulation packages automatically provide most of the features needed to build a
• One of the most important decisions a modeler or analyst must make in simulation model, resulting in a significant decrease in “programming” time and a
performing a simulation study concerns the choice of software. reduction in overall project cost.
• If the selected software is not flexible enough or is too difficult to use, then • They provide a natural framework for simulation modeling. Their basic modeling
the simulation project may produce erroneous results or may not even be constructs are more closely akin to simulation than are those in a general-purpose
completed. programming language like C.
• Simulation models are generally easier to modify and maintain when written in a
simulation package.
• They provide better error detection because many potential types of errors are
checked for automatically. Since fewer modeling constructs need to be included in a
model, the chance of making an error will probably be smaller. (Conversely, errors in
a new version of a simulation package itself may be difficult for a user to find, and
the software may be used incorrectly because documentation is sometimes lacking.)
3 4
1
1/13/2023
Cont’d
• On the other hand, some simulation models (particularly for defense-related
applications) are still written in a general-purpose programming language.
Cont’d
Some advantages of such a choice are as follows: • Although there are advantages to using both types of software, we
• Most modelers already know a programming language, but this is often not the case believe, in general, that a modeler would be prudent to give serious
with a simulation package. consideration to using a simulation package.
• A simulation model efficiently written in C, C++, or Java may require less execution • If such a decision has indeed been made, we feel that the criteria
time than a model developed in a simulation package. This is so because a simulation
package is designed to address a wide variety of systems with one set of modeling discussed in Sec. 5.4 will be useful in deciding which particular
constructs, whereas a C program can be more closely tailored to a particular simulation package to choose.
application. This consideration has, however, become less important with the
availability of inexpensive, high-speed PCs.
• Programming languages may allow greater programming flexibility than certain
simulation packages.
• The programming languages C++ and Java are object-oriented (see Sec. 5.6), which
is of considerable importance to many analysts and programmers, such as those in the
defense industry. On the other hand, most simulation packages are not truly object-
oriented.
• Software cost is generally lower, but total project cost may not be. 5 6
2
1/13/2023
Cont’d
• The process corresponding to an entity arriving to and being served at a single
server is shown in Fig. 5.1.
Cont’d
• A system or simulation model may have several different types of processes.
• Figure 5.1: Process describing the flow of an entity through a system.
• Corresponding to each process in the model, there is a process “routine” that
describes the entire history of its “process entity” as it moves through the
corresponding process.
• A process routine explicitly contains the passage of simulated time and
generally has multiple entry points.
9 10
Cont’d Cont’d
• To illustrate the nature of the process approach more succinctly, Fig. 5.2 gives • To determine whether the customer entity currently arriving can begin service,
a flowchart for a prototype customer-process routine in the case of a single a check is made (at block 2) to see whether the server is idle.
server queueing system.
• If the server is busy, this customer entity is placed at the end of the queue
• (This process routine describes the entire experience of a customer progressing (block 3) and is made to wait (at block 4) until selected for service at some
through the system.) Unlike an event routine, this process routine has multiple undetermined time in the future. (This is called a conditional wait.)
entry points at blocks 1, 5, and 9.
• Control is then returned to the “timing routine” to determine what customer
• Entry into this routine at block 1 corresponds to the arrival event for a customer entity’s event is the most imminent now.
entity that is the most imminent event in the event list.
• At block 1 an arrival event record is placed in the event list for the next
customer entity to arrive. (This next customer entity will arrive at a time equal
to the time the current customer entity arrives plus an interarrival time.)
11 12
3
1/13/2023
Cont’d
• (If we think of a flowchart like the one in Fig. 5.2 as existing for each customer entity
in the system, control will next be passed to the appropriate entry point for the
flowchart corresponding to the most imminent event for some other customer.) Figure 5.2: Prototype
• When this customer entity (the one made to wait at block 4) is activated at some customer-process routine
point in the future (when it is first in queue and another customer completes service for a single-server
and makes the server idle), it is removed from the queue at block 5 and begins queueing system.
service immediately, thereby making the server busy (block 6).
• A customer entity arriving to find the server idle also begins service immediately (at
block 6); in either case, we are now at block 7.
• There the departure time for the customer beginning service is determined, and a
corresponding event record is placed in the event list. This customer entity is then
made to wait (at block 8) until its service has been completed. (This is an
unconditional wait, since its activation time is known.) Control is returned to the
timing routine to determine what customer entity will be processed next. When the
customer made to wait at block 8 is activated at the end of its service, this makes the
server idle at block 9 (allowing the first customer in the queue to become active
immediately), and then this customer is removed from the system at block 10. 13 14
15 16
4
1/13/2023
19 20
5
1/13/2023
Cont’d Cont’d
• The second most important feature for a simulation product is ease of use (and • Hierarchical modeling is useful in modeling complex systems.
ease of learning), and many contemporary simulation packages have a graphical • Hierarchy allows a user to combine several basic modeling constructs into a
user interface to facilitate this. new higher-level construct.
• The software product should have modeling constructs (e.g., icons or blocks) • These new constructs might then be combined into an even higher-level
that are neither too “primitive” nor too “macro.” construct, etc.
• In the former case, a large number of constructs will be required to model even • This latter construct can be added to the library of available constructs and can
a relatively simple situation; in the latter case, each construct’s dialog box will then be reused in this model or future models
contain an excessive number of options if it is to allow for adequate flexibility.
• This ability to reuse pieces of model logic increases one’s modeling efficiency.
• In general, the use of tabs in dialog boxes can help manage a large number of
options. • Hierarchy is an important concept in a number of simulation packages.
• It is also a useful way to manage “screen clutter” for a graphically oriented
model that consists of many icons or blocks.
21 22
Cont’d Cont’d
• The software should have good debugging aids such as an interactive debugger. • Note that a run-time license generally has a considerably lower cost than a
• A powerful debugger allows the user to do things such as: normal developmental license or is free.
Follow a single entity through the model to see if it is processed correctly • A feature that is of considerable interest is the ability to import data from (and
See the state of the model every time a particular event occurs (e.g., a export data to) other applications (e.g., an Excel spreadsheet or a database).
machine breakdown) • Traditionally, simulation products have provided performance measures
Set the value of certain attributes or variables to “force” an entity down a (throughput, mean time in system, etc.) for the system of interest. Now some
logical path that occurs with small probability products also include a cost module, which allows costs to be assigned to such
things as equipment, labor, raw materials, work in process, finished goods, etc.
• In some discrete-event simulations (e.g., steelmaking), it may be necessary to
have certain capabilities available from continuous simulation.
• We call such a simulation a combined discrete-continuous simulation.
23 24
6
1/13/2023
27 28
7
1/13/2023
Cont’d Cont’d
• There are two fundamental types of animation: concurrent and post processed • We now discuss desirable features for animation. First, the simulation software
(also called playback). should provide default animation as part of the model-building process. Since
animation is primarily a communications device, it should be possible to create
• In concurrent animation the animation is being displayed at the same time that high-resolution icons and to save them for later reuse. The software should
the simulation is running. come with a library of standard icons, or it should be possible to import icons
• Note, however, that the animation is normally turned off when making from an external source (e.g., Google Warehouse). The software should provide
production runs, because the animation slows down the execution of the smooth movement of icons; icons should not “flash” or “jump.” There should be
a control to speed up or slow down the animation. It should be possible to zoom
simulation. in or out and to pan to see different parts of a system too large to f t on one
• In post-processed animation, state changes in the simulation are saved to a disk screen. Some software products have named animation views, so that one can
file and used to drive the graphics after the simulation is over. construct a menu of views corresponding to different parts of the simulated
system. It is desirable if the animation uses vector-based graphics (pictures are
• Some simulation software products have both types of animation. drawn with lines, arcs, and fills) rather than pixel-based graphics (pictures are
drawn by turning individual pixels on or off). The former type of graphics
allows rotation of an object (e.g., a helicopter rotor) as well as a vehicle to
maintain its proper orientation as it goes around a corner.
29 30
8
1/13/2023
Cont’d
• In general, each source of randomness in the system of interest should be • If a theoretical distribution cannot be found that is a good representation for a
represented in the simulation model by a probability distribution, not just the source of randomness, then an empirical (or user-defined) distribution based on
perceived mean value. If it is possible to find a standard theoretical distribution the data should be used. In this case, random numbers are used to sample from
that is a good model for a particular source of randomness, then this distribution a distribution function constructed from the observed system data.
should be used in the model. At a minimum, the following continuous • There should be (a single) command available for making independent
distributions should be available: exponential, gamma, Weibull, lognormal, replications (or runs) of the simulation model. This means:
normal, uniform, beta, and triangular. The last distribution is typically used as a
• Each run uses separate sets of different random numbers.
model for a source of randomness when no system data are available. Note also
that very few input random variables in real simulations have a normal • Each run uses the same initial conditions.
distribution. The following discrete distributions should also be available: • Each run resets the statistical counters.
binomial, geometric, negative binomial, Poisson, and discrete uniform.
33 34
Cont’d Cont’d
• Note that simulation results from different runs are independent and also • It should be possible to construct a confidence interval for the difference
probabilistic copies of each other. This allows (simple) classical statistical between the means of two simulated systems (e.g., the current system and a
procedures to be applied to the results from different runs. proposed system) by using the method of replication.
• There should be a statistically sound method available for constructing a • The simulation software should allow the user to specify what performance
confidence interval for a mean (e.g., the mean time in system for a part in a
factory). The method should be easy to understand and should provide good measures to collect output data on, rather than produce reams of default output
statistical results. In this regard, we feel that the method of replication is data that are of no interest to the user.
definitely the superior approach. • At least one simulation product allows the user to perform statistical
• If one is trying to determine the long-run or “steady-state” behavior of a system, experimental designs (see Chap. 5) with the software, such as full factorial
then it is generally desirable to specify a warmup period for the simulation, that designs or fractional factorial designs. When we perform a simulation study, we
is, a point in simulated time when the statistical counters (but not the state of would like to know what input factors (decision variables) have the greatest
the system) are reset. Ideally, the simulation software should also be able to impact on the performance measures of interest. Experimental designs tell us
determine a value for the warmup period based on making pilot runs. There is what simulation experiments (runs) to make so that the effect of each factor can
currently at least one simulation product that uses Welch’s graphical approach
to specify a warmup period. be determined. Some designs also allow us to determine interactions among the
35 factors. 36
9
1/13/2023
10
1/13/2023
Cont’d
• The simulation product should provide a variety of (static) graphics. First, it • It should be possible to export individual model output observations (e.g., times
should be possible to make a histogram for a set of observed data. For in system) to other software packages such as spreadsheets, databases, statistics
continuous (discrete) data, a histogram is a graphical estimate of the underlying packages, and graphical packages for further analysis and display.
probability density (mass) function that produced the data. Time plots are also
very important. In a time plot one or more key system variables (e.g., the
numbers in certain queues) are plotted over the length of the simulation,
providing a long-term indication of the dynamic behavior of the simulated
system. (An animation provides a short-term indication of the dynamic
behavior of a system.) Some simulation products allow the simulation results to
be presented in bar charts or pie charts. Finally, a correlation plot is a useful
way to measure the dependence in the output data produced from one
simulation run.
41 42
11