Simulation & Modeling: Ahmed Ezzat Labib Helwan University
Simulation & Modeling: Ahmed Ezzat Labib Helwan University
In this course:
put all this information in one place
This course provides:
an introduction to the fundamental concepts of M&S and systems
engineering, and how M&S is used in the systems engineering life
cycle.
The contents are grouped into five Parts that cover:
1. foundational elements and processes,
2. methods and methodologies,
3. experimentation and execution,
4. systems engineering fundamentals,
5. and M&S in systems engineering case studies.
Part I
Fundamentals of Modeling and Simulation
Part 1 introduces:
foundational elements and processes that serve as the
groundwork for understanding M&S.
Chapter 1 provides:
a brief introduction to M&S, and defines concepts such as
model, simulation, and abstraction.
Following this is a discussion of the relationship between the real
world, the model and the simulation,
Contents of chapter 1
Today,
M&S is considered a discipline of study and research on its own.
Terminology
Margaret L. Loper
2.1 Introduction
A good way to understand modeling and simulation (M&S) is to look at the process
through which models and simulations are developed. There are different M&S life
cycles described in the literature (Sargent 1982; Kreutzer 1986; Balci and Nance
1987; Balci 2012). Despite emphasizing different aspects, most represent similar
concepts or steps. The process shown in Fig. 2.1 captures the basic ideas represented
in most processes.
In a simulation study, there is the person who has a problem that needs to be
solved (the client) and the person or group that will solve the problem by devel-
oping a simulation model (the simulation analyst). We use client and simulation
analyst in the following discussion of the process.
M. L. Loper ()
Georgia Tech Research Institute, Atlanta, GA, USA
e-mail: [email protected]
Fig. 2.1 Modeling and simulation process. (Adapted from Benjamin 2006)
of assumptions about the real-world system associated with the problem statement,
and make sure that the client agrees with this problem definition. Even if this oc-
curs, it is possible that the problem will need to be reformulated as the simulation
study progresses, due to new information and requirements.
The simulation objectives are the questions to be answered by the simulation.
The questions could be described as different scenarios that will be investigated. The
simulation project plan is a document that includes how much time will be required,
people that will be used, hardware and software requirements if the client wants to
run the model and conduct the analysis, stages in the investigation, output at each
stage, cost of the study and billing procedures, if any. In other words, the proj-
ect plan documents how you are going to run the simulation project by itself. The
amount of detail needed in the project plan should be equivalent to the size of the
project, e.g., a large, complex simulation would need a very detailed project plan.
To illustrate how the M&S process works, we will use an example of a full-
service gas station (Birta and Arbez 2010). The station has two islands and four
service lanes, as shown in Fig. 2.2. Depending on time of day, one or two attendants
serve customers. Significant portions of the customers drive vans and light trucks,
which have larger gas tanks and take more time to fill. Drivers of passenger cars
wait longer for service behind the vans or light trucks, which leads to complaints.
The management of a full-service gas station is considering restricting the vans
and light trucks to two of the lanes to improve the flow of vehicles. They want to
use M&S to answer the question—will customer service time for passenger cars
improve by making this change?
2 The Modeling and Simulation Life Cycle Process 19
Fig. 2.2 Full service gas station. (Birta and Arbez 2010)
Having good data to drive a model is just as important as having sound model logic
and structure. Simulation analysts must decide what data are needed, what data are
available and whether it is pertinent, whether existing data are appropriate for the
required purpose, and how to gather the data. Even though data collection is iden-
tified as a separate step in the development process, constructing the conceptual
model occurs while data collection is taking place. In a real world simulation study,
the gathering and evaluation of input data is very time-consuming and difficult; a
significant amount of time used in the study is often consumed by this task.
Regardless of the method used to collect the data, the decision of how much to
collect is a trade-off between cost and accuracy. There are several potential sources
of data: historical records, observational data, similar systems, operator estimates,
vendor’s claims, designer estimates, and theoretical considerations. Systems differ
with regard to how much data are available to populate the system database. Data
rich refer to systems where data are abundant from prior experiments or obtained
from measurements. Data poor refer to systems where meager amounts of historical
data or low-quality data exist. In some cases, it is impossible to acquire better data
(e.g., combat), in others it is too expensive to collect (e.g., topography and vegeta-
tion of a forest).
In the gas station example, the simulation analyst will need to collect a variety
of data for the model. Some of the data will be used as input and some of it will
be used in the algorithms or equations used inside the simulation. Let us consider
traffic flow. How many vehicles will come into the gas station? Will the number be
constant or will it change with the time of day or the day of the week? What percent-
age of vehicles are passenger cars versus trucks or light vans? Data need to be col-
lected to answer all of these questions. In addition to traffic flow, we will need data
to represent the attendant’s behavior. How much time does it take for a particular
vehicle to have its gas tank filled? How long does it take for the attendant to process
a customer’s payment? Is it possible for customers to take longer in one of these
steps, maybe because they exited the vehicle to go to the restroom? The simulation
analyst can choose to gather empirical data (e.g., spend the day at the gas station
and count cars) or use probability distributions, based on real data, to represent
2 The Modeling and Simulation Life Cycle Process 21
these aspects of the model. Some of the data will be used as input and can be varied
during the simulation study (e.g., the number of cars visiting the gas station) and
some of the data may be used internal to the simulation as part of an equation and
be considered hardwired (e.g., size of the gas tank for each type of vehicle). The
data and any assumptions made during the collection process should be documented
with the conceptual model.
In this step, the conceptual model is coded into a computer recognizable form,
an operational model. Translating the model into computer code and then into an
executable involves selecting the most appropriate simulation methodology (e.g.,
discrete event, continuous, agents, or system dynamics which are defined and dis-
cussed in later chapters) and an appropriate computer implementation (e.g., pro-
gramming or simulation language). Simulation analysts may choose to develop
the simulation using a programming language (e.g., C, Java, FORTRAN) or use a
simulation language (e.g., MATLAB®, Simio, NetLogo, STELLA®1). Simulation
languages are higher-level software packages than programming languages. They
are usually custom made for more specific purposes and come with additional tools
to facilitate their use. Programming languages are low-level software packages,
meaning the computer code using these languages is converted into computer code
using a compiler. Programming languages are used to write custom-made software.
For example, it will take a computer programmer a lot longer to put together an
agent-based simulation using a programming language as opposed to an agent-
based framework like NetLogo. NetLogo has many internal capabilities to facilitate
creating a simulation, whereas everything has to be developed from scratch using
a programming language. However, simulations using programming languages can
have advantages such as customization and faster execution.
There are different ways a simulation analyst might want to represent traffic
flow for the gas station, depending on the purpose of the model and questions the
client wants answered. For example, traffic can be represented in a simulation as
a queueing model, as a fluid flow model, or as cellular automata. Each of these
modeling methods has advantages and disadvantages and focus on different types
of mathematics and behavior representation. There is no single right way to select a
modeling method for a simulation, but once selected there are well-defined ways to
do the implementation. Simulation languages usually implement a selected subset
of modeling methods; so developing the simulation is about combining the appro-
priate techniques and libraries needed (e.g., discrete-event simulation languages,
such as NetLogo, all represent queueing models). However, simulation languages
may not have the specific capability required; so a simulation analyst may need to
1
MATLAB® http://www.mathworks.com/products/matlab/; Simio http://www.simio.com; Net-
Logo https://ccl.northwestern.edu/netlogo/; STELLA® http://www.iseesystems.com.
22 M. L. Loper
include the concepts of vehicles, traffic flow and attendants, there would be a real
disconnect with the requirements of the problem.
In the verification process, the analyst needs to ensure that the models have
been implemented correctly into the simulation. The question being answered in
the verification is: “are the equations being solved correctly?” In real-life projects,
sometimes an independent team is assembled to go through the software code and
examine the results to make sure the simulation is working. In complex projects,
it is not feasible to verify the code line by line. In this case, a second simulation
might be built by an independent team to verify the simulation. If the models have
been implemented correctly, the results of the two independent simulations should
match, otherwise the analyst needs to track down the cause of the discrepancy.
When verifying the design and implementation of the gas station simulation, the
simulation analyst needs to make sure that the simulation runs and does not produce
errors. If a simulation language is used for the implementation, the algorithms, for-
malisms, equations, etc. have already been verified. However, the specific use of
data and combination of the equations will still need to be tested to ensure that the
logic of the simulation works and is “bug free.” For example, if the simulation were
computing average traffic flow into the gas station, a divide by zero would cause a
“runtime error” and cause the simulation program to crash.
Once the simulation of the gas station is running, the analyst will need to validate
the results of the simulation. The simulation should be executed using the “as-is”
configuration of the traffic flow in the gas station (i.e., first come, first served in any
lane of the two islands). The simulation results for customer service time of pas-
senger cars should closely match what the service time is in real life. For example,
the number of cars entering the gas station is a function of bad weather. To validate
the model, the analyst needs to gather data on the percentage of traffic reduction
during bad weather, and making sure the model reflects this as best as possible. To
validate the simulation results does require knowing what the behavior of the real
system is and how it operates. This is part of data collection: to gather this type of
information. If the simulation results are not the same (or similar, within some error
bound) as the real gas station, then the simulation analysts and client will not be able
to trust the results of the simulation when the traffic flow (i.e., passenger cars one
island, vans and light trucks one island) is changed.
2.2.6 Design Experiments
For each scenario that is to be simulated, decisions need to be made concerning the
length of the simulation run, the number of runs (also called replications), and the
manner of initialization that is required. One approach to conducting experiments is
to vary the input data for each simulation run and observe the behavior of the sys-
tem. If there are only a few input parameters, this approach will work. However, if
the simulation has tens or hundreds of input parameters, conducting a run for each
combination of the parameters can be unmanageable. In this case, a formal process
24 M. L. Loper
called design of experiments (DoE) can be used to better define which runs are
needed. DoE is a statistical approach to experimental design (described in a later
chapter) that can help minimize the number of simulation runs needed to understand
the behavior of a system under investigation. The simulation analysts may also want
to use a technique called Monte Carlo analysis (described in a later chapter) that
relies on repeated random sampling to compute the results of the simulation.
Defining the experiments for the gas station model should be considered while
developing the conceptual model. The reason is that the simulation analyst needs to
make sure the right assumptions, behaviors, and data are collected and included in
the simulation in order to support the necessary experiments. A set of experiments
an analyst might run for the gas station management would be to vary the number
of vehicles that come into the station. This could include increasing the number of
passenger cars, light trucks, and vans separately, or increasing them in different
combinations.
To illustrate the importance of thinking through experiments during the concep-
tual model development, what would happen if you were presenting the results of
these runs to the client (i.e., gas station management), and they ask you whether
the results change if Sue is working as an attendant versus Bob? Since the behavior
of the attendant was simplified and does not include personal attributes of specific
people, the simulation cannot answer that question directly. The simulation analyst
will need to understand the difference between Sue and Bob’s performance and
how that can be included in the simulation as the service time of the attendant, and
then make changes in the simulation to include that as an input parameter and not
hardwired into the equations for the attendant. The changes needed may not be that
difficult, but it requires time and resources to change the conceptual model, col-
lect data, make the changes to the simulation, do the verification and validation,
and run the experiments again. Upon presenting the new results to the gas station
management, they ask if the results are different if there is a football game at the
stadium down the block. If the simulation does not allow traffic to be input hourly
(say it was originally implemented as a probability distributed), then more time and
resources will be needed to make the changes. Defining the sets of experiments
early in the simulation process can prevent many unnecessary hours or reworking
the simulation.
The final runs, in which data are collected for analysis, are known as production
runs. They are used to estimate measures of performance (MOP) for the scenarios
that are being simulated. MOPs are a measure of a system’s performance expressed
as some quantifiable features, such as customer service time in the gas station. By
analyzing the MOP of the production runs, the simulation analyst determines if
additional runs are needed and if any additional scenarios need to be simulated. A
scenario is a description of the initial set of conditions and timeline of events used
2 The Modeling and Simulation Life Cycle Process 25
to evaluate the behavior of the system. For example, you may define one scenario to
look at the behavior of the gas station when the attendants are attentive to customers
(e.g., they are always standing at the gas pump so service can begin immediately
once a vehicle arrives) and when attendants are not attentive to customers (e.g., they
are inside waiting for a vehicle to arrive and take several minutes to get to the pump
to begin service).
In addition to determining if more runs are needed, analyzing the results could
indicate that the simulation needs to be modified. In this case, the simulation analyst
should go back to the beginning of the process to understand whether the modifica-
tions represent a change to the scope and purpose, or whether it is only a modifica-
tion to the simulation implementation.
Once the experiments have been defined, the simulation analyst will need to
decide how many times to run the simulation for each scenario in order to have
confidence in the results. Depending on the amount of uncertainty included in the
simulation, the analysts may want to run each experiment multiple times in order to
gain more insight into the impact of uncertainties on the overall results. For the gas
station, we may decide to run each experiment five times with the same input, and
then average the results. It is important for the analyst to examine the simulation
results and be on the lookout for outliers. Outliers are data points that are numeri-
cally distant from the rest of the data. Outliers need closer inspection to determine
why they numerically deviate from the rest of the data. Some outliers expose flaws
in the system uncovered by the simulation. In some instances, inputs can conspire
in such a way as to break the system. In such a case, the system design needs to be
reexamined and necessary modifications made. Such modifications usually make
the system more robust. Some outliers expose bugs in the simulation itself. In this
case, the simulation bugs need to be identified and fixed and the experiment rerun.
In addition to the number of runs, we may discover strange behavior in the results,
e.g., on Monday’s customer service time for passenger cars doubles. This would in-
dicate a behavior we would want to investigate further to understand if it is an error
in the simulation logic or if there is a valid reason for this behavior (e.g., everyone
waits until Monday to fill up their car for the week). There are many output analysis
techniques that can be used by a simulation analyst to help them analyze the results
(Nakayama 2006).
2.2.8 Configuration Control
tion works and has passed all the required tests, the configuration control manager
preserves the system in its current configuration and assigns a configuration control
number to it, so at any point in the future, it is possible to revert back to the last
saved configuration control version, in case future revisions do not work. The simu-
lation analyst must never change a parameter in the configuration-controlled ver-
sion of the program until given the authority and any changes must be documented.
Usually, the engineer develops a “working copy” until ready to incorporate and
document changes on the configuration-controlled copy. After enough changes are
made, the new configuration controlled version is created with a different configu-
ration control designation number to differentiate it from all previous releases. The
new configuration-controlled copy is typically identified by a “release” or “version”
number or date; for example, “Release 1.6” or “Version 2012_03_17” (March 17,
2012).
2.2.9 Develop Documentation
the work that was performed and will enable the simulation analyst to look at the
simulation in the future and understand what was accomplished and if the simula-
tion can be reused for another study.
2.3 Summary
The simulation process is a framework for activities, actions, and tasks that are
required to develop a simulation. The process encourages the simulation analyst
and client to communicate at every step to ensure that the problem that needs to
be solved and the approach being used to solve the problem are clearly under-
stood by all parties. Some of the steps discussed above can be performed at the
same time, while some steps are dependent on a previous step being completed
first. Developing a simulation is an iterative process, which builds from simple to
complex, as more information is known about the real-world system that is being
investigated. This means that some steps of the process will be repeated to include
or revise information. It is important to follow each of the steps, to ensure that the
simulation has the needed characteristics and accuracy to address all of client’s
requirements.
References
Balci O (1997) Verification validation and accreditation of simulation models. In: Proceedings of
the winter simulation conference
Balci O (2012) A life cycle for modeling and simulation. Simul Trans Soc Model Simul Int
88(7):870–883
Balci O, Nance R (1987) Simulation development environments: a research prototype. J Oper Res
Soc 38(8):753–763
Benjamin P, Patki M, Mayer R (2006) Using ontologies for simulation modeling. In: Proceedings
of the winter simulation conference
Birta LG, Arbez G (2010) Modelling and simulation: exploring dynamic system behaviour.
Springer, New York
Kreutzer W (1986) System simulation—programming styles and languages. Addison Wesley, New
York
Law A, Kelton D (1999) Simulation modeling & analysis, 3rd edn. McGraw-Hill Higher Educa-
tion, Boston
Nakayama MK (2006) Output analysis for simulations. In: Proceedings of the winter simulation
conference
Sargent RG (1982) Verification and validation of simulation models. In: Cellier FE (ed) Progress
in modelling and simulation. Academic, London, pp 159–169