Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
• Ways to study a system
1.2 Systems, Models, and Simulation(cont’d.)
– Simulation is “method of
last resort?” Maybe …
– But with simulation there’s
no need (or less need) to
“look where the light is”
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.3 Discrete-Event Simulation(cont’d.)
• 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
– Events
 Arrival of a new customer
 Service completion (and departure) of a customer
 Maybe – end-simulation event (a “fake” event) – whether
this is an event depends on how simulation terminates (a
modeling decision)
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.3.1 Time-Advance Mechanisms
• 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
– Next-event time advance (usually used) … described in detail
below
– Fixed-increment time advance (seldom used)
 Generally introduces some amount of modeling error in terms of when
events should occur vs. do occur
 Forces a tradeoff between model accuracy and computational efficiency
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.3.1 Time-Advance Mechanisms(cont’d.)
• 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, which is executed
 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
1.3.1 Time-Advance Mechanisms(cont’d.)
• Next-event time advance for the single-server queue
(assume the following notation for time variables, all the
time variables are random)
ti = time of arrival of ith customer (t0 = 0)
Ai = ti – ti-1 = interarrival time between (i-1)th 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 = total time that ith customer completes service and departs
ej = time of occurrence of the jth event (of any type), j = 1, 2, 3, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Representation of the system schematically
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Representation of the system schematically
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Representation of the system schematically
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Representation of the system schematically
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.3.2 Components and Organization of a
Discrete-Event Simulation Model
• Each simulation model must be customized to target system
• But there are several common components
– System state – variables to describe state at a particular time
– Simulation clock – current value of simulated time
– Event list – times of future events (as needed)
– Statistical counters – to collect information about sys. performance
– Initialization routine – initialize model at time 0
– Timing routine – determine next event time, type; advance clock
– Event routines – updates system state when an event type occurs
– 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
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.3.2 Components and Organization of a
Discrete-Event Simulation Model(cont’d.)
General Flow Control
in a Next Event Time
Advance Simulation
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4 SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM
1.4.1 Problem Statement
• Consider the single-server queueing model
• Assume interarrival times are independent and
identically distributed (IID) random variables
(identically distributed means that the interarrival
times have the same probability distribution)
• Assume service times are IID, and are independent of
interarrival times
• Queue discipline is FIFO
• Start empty and idle at time 0
• First customer arrives after an interarrival time, not at
time 0
• Stopping rule: When nth customer has completed
delay in queue (i.e., enters service) … n will be
specified as input
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.1 Problem Statement(cont’d.)
• The objective of the model is to measure the performance of
the system by estimating the following quantities:
– Expected average delay in queue (excluding service time) of the n
customers completing their delays (will be denoted by d(n))
 Why “expected?”
– Expected average number of customers in queue (excluding any in
service) (will be denoted by q(n))
 A continuous-time average
 Area under Q(t) = queue length at time t, divided by T(n) = time simulation
ends.
– Expected utilization (proportion of time busy) of the server
 Another continuous-time average
 Area under B(t) = server-busy function (1 if busy, 0 if idle at time t), divided
by T(n) ,
• The first objective gives the performance from the customer
point of view while the second and third objectives are
typical requirements by the management of such a system.
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Expected average no. of customers in the queue
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Expected average no. of customers in the queue
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Expected utilization of the server
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Demonstration Example
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation
• Given interarrival times (all times are in minutes):
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
• Given service times:
2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
• Arrival times = 0.4, 1.6, 2.1, 3.8, 4, 5.6, 5.8, 7.2
• Departure times = 2.4, 3.1, 3.3, 4.9, 8.6, 9.2
• n = 6 delays in queue desired
• “Hand” simulation:
– Display system, state variables, clock, event list, statistical
counters … all after execution of each event
– Use above lists of interarrival, service times to “drive” simulation
– Stop when number of delays hits n = 6, compute output
performance measures
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Status
shown is
after all
changes
have
been
made in
each
case …
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
1.4.2 Intuitive Explanation(cont’d)
Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …
Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
Final output performance measures:
Average delay in queue = 5.7/6 = 0.95 min./cust.
Time-average number in queue = 9.9/8.6 = 1.15 custs.
Server utilization = 7.7/8.6 = 0.90 (dimensionless)

Lec2 computer simulation Modeling and Simulation.pdf

  • 1.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling • Ways to study a system 1.2 Systems, Models, and Simulation(cont’d.) – Simulation is “method of last resort?” Maybe … – But with simulation there’s no need (or less need) to “look where the light is”
  • 2.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.3 Discrete-Event Simulation(cont’d.) • 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 – Events  Arrival of a new customer  Service completion (and departure) of a customer  Maybe – end-simulation event (a “fake” event) – whether this is an event depends on how simulation terminates (a modeling decision)
  • 3.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.3.1 Time-Advance Mechanisms • 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 – Next-event time advance (usually used) … described in detail below – Fixed-increment time advance (seldom used)  Generally introduces some amount of modeling error in terms of when events should occur vs. do occur  Forces a tradeoff between model accuracy and computational efficiency
  • 4.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.3.1 Time-Advance Mechanisms(cont’d.) • 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, which is executed  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
  • 5.
    1.3.1 Time-Advance Mechanisms(cont’d.) •Next-event time advance for the single-server queue (assume the following notation for time variables, all the time variables are random) ti = time of arrival of ith customer (t0 = 0) Ai = ti – ti-1 = interarrival time between (i-1)th 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 = total time that ith customer completes service and departs ej = time of occurrence of the jth event (of any type), j = 1, 2, 3, … Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
  • 6.
    Representation of thesystem schematically Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
  • 7.
    Representation of thesystem schematically Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
  • 8.
    Representation of thesystem schematically Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
  • 9.
    Representation of thesystem schematically Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling
  • 10.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.3.2 Components and Organization of a Discrete-Event Simulation Model • Each simulation model must be customized to target system • But there are several common components – System state – variables to describe state at a particular time – Simulation clock – current value of simulated time – Event list – times of future events (as needed) – Statistical counters – to collect information about sys. performance – Initialization routine – initialize model at time 0 – Timing routine – determine next event time, type; advance clock – Event routines – updates system state when an event type occurs – 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
  • 11.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.3.2 Components and Organization of a Discrete-Event Simulation Model(cont’d.) General Flow Control in a Next Event Time Advance Simulation
  • 12.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4 SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM 1.4.1 Problem Statement • Consider the single-server queueing model • Assume interarrival times are independent and identically distributed (IID) random variables (identically distributed means that the interarrival times have the same probability distribution) • Assume service times are IID, and are independent of interarrival times • Queue discipline is FIFO • Start empty and idle at time 0 • First customer arrives after an interarrival time, not at time 0 • Stopping rule: When nth customer has completed delay in queue (i.e., enters service) … n will be specified as input
  • 13.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.1 Problem Statement(cont’d.) • The objective of the model is to measure the performance of the system by estimating the following quantities: – Expected average delay in queue (excluding service time) of the n customers completing their delays (will be denoted by d(n))  Why “expected?” – Expected average number of customers in queue (excluding any in service) (will be denoted by q(n))  A continuous-time average  Area under Q(t) = queue length at time t, divided by T(n) = time simulation ends. – Expected utilization (proportion of time busy) of the server  Another continuous-time average  Area under B(t) = server-busy function (1 if busy, 0 if idle at time t), divided by T(n) , • The first objective gives the performance from the customer point of view while the second and third objectives are typical requirements by the management of such a system.
  • 14.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling Expected average no. of customers in the queue
  • 15.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling Expected average no. of customers in the queue
  • 16.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling Expected utilization of the server
  • 17.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling Demonstration Example
  • 18.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling
  • 19.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling
  • 20.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation • Given interarrival times (all times are in minutes): 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … • Given service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, … • Arrival times = 0.4, 1.6, 2.1, 3.8, 4, 5.6, 5.8, 7.2 • Departure times = 2.4, 3.1, 3.3, 4.9, 8.6, 9.2 • n = 6 delays in queue desired • “Hand” simulation: – Display system, state variables, clock, event list, statistical counters … all after execution of each event – Use above lists of interarrival, service times to “drive” simulation – Stop when number of delays hits n = 6, compute output performance measures
  • 21.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Status shown is after all changes have been made in each case … Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 22.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 23.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 24.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 25.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 26.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 27.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 28.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 29.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 30.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 31.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 32.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 33.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …
  • 34.
    Simulation Modeling andAnalysis – Chapter 1 – Basic Simulation Modeling 1.4.2 Intuitive Explanation(cont’d) Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, … Final output performance measures: Average delay in queue = 5.7/6 = 0.95 min./cust. Time-average number in queue = 9.9/8.6 = 1.15 custs. Server utilization = 7.7/8.6 = 0.90 (dimensionless)