Simulation Examples and General Principles Chapter 2 & 3 Simulation Examples and General Principles
Basic Steps Determine the characteristics of the inputs. Usually modeled as probability distributions Construct a simulation table. Problem specific Often consists of a set of inputs and one of more responses Repetitions Repeatedly generate a value for each input and evaluate the function.
Simulation table Repetition xi1 xi2 … Xip Yi 1 2 N
Simulation Examples and General Principles Simulation examples (chap. 2) Concrete & specific cases in various areas Example: 1 + 2 + 3 + …. + 100 = ? General principles (chap. 3) Generalized representations and concepts i, n, S
Simulation of Queuing Systems A queuing system consists of: Calling population. Often infinite: a unit leaves, there is no change in the arrival rate. Arrivals. Random. Service mechanism. A unit will be served in random length based on a probability distribution. System capacity. No limit (waiting line length) Queuing discipline. Order of service, e.g., FIFO.
Simulation of Queuing Systems
Queuing Systems Arrivals and services are defined by the probability distribution of time between arrivals and the distribution of service times, respectively. Service rate vs. arrival rate Unstable or explosive State Number of units in a system and status of server Event Stimulus that causes system state to change. Simulation clock Trace of simulation time.
Single-Channeling Queuing System What are the entities? What are the states? What are the events? When do events occur or how to model events? How do the states change when the events occur?
Single-Channeling Queuing System Service-just-completed flow diagram
Single-Channeling Queuing System Unit-entering-system flow diagram
Single-Channeling Queuing System Potential unit actions upon arrival
Single-Channeling Queuing System Server outcomes after service completion
Single-Channeling Queuing System Simulation example: Consider the following two tables represents the arrivals (interarrival) and service times in a grocery store.
Single-Channeling Queuing System service times Interarrival and clock times
Single-Channeling Queuing System Service time of the first customer is 2 and it can start at 0, thus it will finish at 2 Simulation table
Single-Channeling Queuing System Service time of the second customer is 1 and it can start at 2, thus it will finish at 3 Simulation table
Single-Channeling Queuing System Simulation table
Single-Channeling Queuing System Simulation table
Single-Channeling Queuing System Simulation table
Single-Channeling Queuing System
Single-Channeling Queuing System
Another example (single server)
Another example (single server)
Another example (single server)
Another example (single server)
Another example (single server)
Another example (single server)
Summary of Simulation Table Based Approach Basic simulation concepts: Determine the characteristics of the input data. Construct a simulation table. Generate random variables from the input models & calculate values of the response. Analyze the results. Main problem with simulation table approach: Can’t deal with complex dependencies.
Other Examples The Able Baker Carhop Problem: Two channels. Inventory Systems Simulation of an (M, N) inventory system. Reliability Problem Evaluation of alternatives Military Problem Random Normal Numbers Lead-Time Demand Histogram
Able-Baker example (two servers) Two servers queuing example
Able-Baker example (two servers)
Able-Baker example (two servers) We will start using excel to construct the simulation table for this example. (see www.bcnn.com) Usually the row for first customer is filled manually. You need a random function to provide random digits (two digits in this case) Fill in the other values based on the provided tables and these random digits (manually) Write formulas to fill in the rows (usually) starting from row 2
Able-Baker example (two servers) Simple formulas: next arrival clock time = previous arrival clock time + interarrival time C2=C1+B2 B2 value is based on the interarrival table and random digits generated A B C D E F G H I J k L
Able-Baker example (two servers) Simple formulas: When able available = max number currently in column I D2=max(I$1:I1) … D10=max(I$1:I9) A B C D E F G H I J k L
Able-Baker example (two servers) More complex formulas: Next person will be served (directly or after a wait) by Able if he arrive and finds able free or able becomes free before Baker F2=IF(OR(D2<=C2,D2<=E2),"Able","Baker") A B C D E F G H I J k L
Able-Baker example (two servers) Time service begin: to fill it for Able if he is the intended person If the server person is Able, then the service will begin at the max of either the arrival or when Able is available. Else, the service will begin by Baker at the max of the customer arrival time and Baker being available H2=IF(F2="Able",MAX(D2,C2),MAX(E2,C2)) A B C D E F G H I J k L
Able-Baker example (two servers) The time service is completed by Able If Able is the person serving, then it will be after service time begin plus service time. Else, it will be Blank I2=IF($F2="Able",$H2+$G2,"") A B C D E F G H I J k L
Able-Baker example (two servers)
Able-Baker example (two servers) In addition to the performance measures we usually compute, the a frequency diagram like the following is an important measure.