Beruflich Dokumente
Kultur Dokumente
Outline
Problem statement Determining events and variables Statistical counters Detailed explanation Simulation output and discussion
Problem statement
Consider a single-server queuing system for which the inter-arrival times A1, A2,are Independent and Identically Distributed (IID) random variables (have the same probability distribution). A customer who arrives and finds the server idle enters service immediately, and the service times S1, S2,of the successive customers are IID random variables that are independent of the interarrival times.
Problem statement
A customer who arrives and finds the server busy joins the end of a single queue. Upon completing service for a customer, the server chooses a customer from the queue (if any) in a FIFO manner. The simulation begins in the empty and idle state (no customers in queue) in t=0 and the server waits for the arrival of the first customer which occurs at t0 + A1. We wish to simulate this system until a fixed number of customers (n) have completed their delays in the queue.
Problem statement
To measure the performance of this system, we will look at the estimates of 3 factors:
The average delay in the queue of the n customers d(n) The average number of customers in the queue q(n) The utilization of the server u(n)
There is no completely general way to determine the number and definition of events in general for a model. It is also difficult to specify the state variables, especially in complex models. There are some principles and techniques to help simplify the structure and avoid logical errors.
Events are represented by nodes. The nodes are connected by directed arrows showing how events can be scheduled from other events/ themselves. One thick arrow indicates that one event at the end of the arrow may be scheduled from the beginning of the arrow in a (possibly) nonzero amount of time (delay). One thin arrow indicates that one event at the end of the arrow may be scheduled from the beginning of the arrow immediately.
Arrival
Enter Service
Departure
Strongly-connected components are the node (s) within which it is possible to move from every node to every other node by following the arrows in their directions. In any strongly-connected component of nodes that has no incoming arrows from other event nodes outside the component there must be at least one node that is initially scheduled.
Arrival
Enter Service
Departure
For simplicity the event node that has incoming arrows that are thin can be eliminated (enter service node is eliminated). End of-simulation can be introduced as an event node.
Arrival
Departure
End of simulation
Statistical counters
For each customer i the delay is denoted by Di. The average delay of n customers is then can be calculated as:
^
d n
Di 0
Di
i 1
^ estimated
Statistical counters
The number of customers j in the queue is donated by Q(t) and this number of customers continued for a period Tj. jT j ^
q n q n
^
j 0
Tn
Q t T
j 0 j
Q j t T j area
Tn
Statistical counters
Server utilization u(n) is the time when the server was busy Tk compared to the total time of simulation T(n)
n k 0 u
BT
Tn
Q(t), B(t)
0.5 1 2 3 1.5 2.5 3.5 0
0 0.3 0.6 0.9 1.2 1.5 1.7 2 2.2 2.4 2.7 3 3.2 3.5 3.8 4 4.3
t
Statistical counters
4.6 4.9 5.1 5.4 5.6 5.8 6.1 6.4 6.7 7 7.2 7.5 7.8 8.1 8.4 8.6 8.9
Detailed explanation
Display system, state variables, clock, event list, statistical counters all after execution of each event Use above lists of inter-arrival, service times to drive simulation Stop when number of delays hits n = 6, compute output performance measures
Detailed explanation
Arrival event Schedule the next arrival event
Yes
Return
Detailed explanation
Departure event Server = idle Yes No Queue empty?
Compute delay for the customer entering service Add 1 to the number of customers delayed Schedule departure event for this customer
Return
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, 2.0, 0.7, 0.2, 1.1, 3.7, 0.6,
Detailed explanation
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)
Event types: 1 for arrival, 2 for departure Modularize for initialization, timing, events, library, report, main Stopping rule: n = 1000 (rather than 6) Interarrival and service times drawn from an exponential distribution (mean b = 1 for interarrivals, 0.5 for service times)
Density function
How to draw (or generate) an observation (variate) from an exponential distribution? Proposal:
Assume a perfect random-number generator that generates IID variates from a continuous uniform distribution on [0, 1] denoted the U(0, 1) distribution see Chap. 7 Algorithm:
1. Generate a random number U 2. Return X = b ln U