Chapter Two
2. Basic Simulation Concepts
2.1. Modeling and Simulation Software
• A collection of symbols and ideas that approximately represent the
functional relationship of the elements in a system can be referred as
model.
Examples:
Queuing models: queues, servers, interarrival times, service times
Network models: nodes, links, traveling times
• Simulation is often viewed as a “method of last resort” to be employed
when every other technique has failed.
1
• Recent advances in simulation methodologies, availability of
software’s, and technical developments have made simulation one of
the most widely used and accepted tools in system analysis and
operation research.
o Discrete Event Simulation (this class concern)
o Continuous simulation
o Mixed simulation
o Monte Carlo Simulation
o Dynamic simulation
o Stochastic simulation
2
Discrete Event Simulation (DES)
Discrete-event simulation: Modeling of a system as it evolves over time
by a representation where the state variables change instantaneously at
separated points in time.
More precisely, state can change at only a countable number of points
in time.
These points in time are when events occur/changes
Event: Instantaneous occurrence that may change the state of the
system.
Example: end of simulation, make a decision about a system’s operation.
• It can be done by hand, but usually by computer
3
Example: Single-server queue
• Estimate expected average delay in queue (line, not service)
• State variables
• Status of server (idle, busy) – needed to decide what to do
with an arrival
• Current length of the queue – to know where to store an
arrival that must wait in line
• Time of arrival of each customer now in queue – needed to
compute time in queue when service starts
• In general, events can depict:
Arrival of a new customer
Service completion (and departure) of a customer
4
Time-Advance Mechanisms (…DES)
Pieces of a Simulation Model
• Simulation clock: Variable that keeps the current value of
(simulated) time in the model.
– Must decide on, be consistent about, time units
– Usually no relation between simulated time and (real) time
needed to run a model on a computer
• Two approaches for time advance
1. Next-event time advance (usually used)
2. Fixed-increment time advance (seldom used)
5
• More on next-event time advance
– Initialize simulation clock to 0
– Determine times of occurrence of future events – event list
– Clock advances to next (most imminent) event execution
Event execution may involve updating event list
– Continue until stopping rule is satisfied (must be explicitly stated)
– Clock “jumps” from one event time to the next, and doesn’t
“exist” for times between successive events (periods of inactivity
are ignored)
6
• Next-event time advance for the single-server queue
ti = time of arrival of ith customer (t0 = 0)
Ai = ti – ti-1 = interarrival time between (i-1)st and ith customers (usually
assumed to be a random variable from some probability distribution)
Si = service-time requirement of ith customer (another random variable)
Di = delay in queue of ith customer
Ci = ti + Di + Si = time ith customer completes service and departs
ej = time of occurrence of the jth event (of any type), j = 1, 2, 3, …
– Possible trace of events (detailed narrative in text)
7
Terminologies in Simulation Modelling
8
Components and Organization of a DES
By: Muluken A. 9
• Each simulation model must be customized to target system
• Common components, general organization
• System state – variables to describe state
• Simulation clock – current value of simulated time
• Event list – times of future events (as needed)
• Statistical counters – to accumulate quantities for output
• Initialization routine – initialize model at time 0
• Timing routine – determine next event time, type; advance clock
• Event routines – carry out logic for each event type
• Library routines – utility routines to generate random variates, etc.
• Report generator – to summarize, report results at end
• Main program – ties routines together, executes them in right order
10
• More on Entities
• Objects that compose a simulation model
• Players that move around, change status etc
• Can have “fake” entities for modeling “tricks”
• Usually include customers, parts, messages, etc.
• Characterized by data values called attributes
• For each entity there’s a record (row) in a list, with the attributes
being the columns
11
More on Attributes
• Are set of properties of a particular entity (attributes individualize
entities)
• A group of entities may have same attribute but different values for
different entities, for example:
Time of arrival
Due date
Priority
Color
• Attribute value tied to a specific entity like local variables
• Arena keeps track of some attributes automatically,
• But you may need to define attributes of your own.
12
More on Variables (Global)
• Reflects a characteristic of the whole model, not of specific entities
• Used for many different kinds of things
Travel time between all station pairs
Number of parts in system
Simulation clock (built-in Arena variable)
• Name, value of which there’s only one copy for the whole model
• Entities can access, change variables
13
More on Resources
• What entities compete for
People
Equipment
Space
• Entity seizes a resource, uses it, releases it
• Think of a resource being assigned to an entity, rather than an entity
“belonging to” a resource
• A resource can have several units of capacity
Seats at a table in a restaurant
Identical ticketing agents at an airline counter
• Number of units of resource can be changed during the simulation
14
More on Queues
• Place for entities to wait when they can’t move on
• Have names, often tied to a corresponding resource
• Can have a finite capacity to model limited space means have to
model what to do if an entity shows already full
• Usually watch the length of a queue, waiting time in it.
15
More on Statistical accumulators
• Variables that “watch” what’s happening
• Depend on output performance measures desired
• “Passive” in model - don’t participate, just watch
• Many are automatic in Arena, but some you may have to set up and
maintain during the simulation
• At end of simulation, used to compute final output performance measures
16
Approaches to Modeling and Simulation
1. Event-scheduling- modeling : as described above, coded in
general-purpose language (will be discussed well)
2. Process modeling : focuses on entities and their “experience,”
usually requires special-purpose simulation software.
Difference: The event-scheduling approach requires that the analyst concentrate
on the events and how they affect system state. The process-interaction approach
allows the analyst to concentrate on a single entity (such as a customer) and the
sequence of events and activities it undergoes as it "passes through" the system.
17
The Event Scheduling/Time Advance Algorithm
Simulation by Hand
Other Slide
18