0% found this document useful (1 vote)
117 views21 pages

Simulation Simulation: Modeling and Performance Analysis With Discrete-Event Simulation G y

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 21

Computer Science, Informatik 4 Communication and Distributed Systems

Simulation
Modeling and Performance Analysis with Discrete-Event Simulation g y
Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Chapter 2
Simulation Examples

Computer Science, Informatik 4 Communication and Distributed Systems

Simulation using a Table


Introducing simulation by g y manually simulating on a table
Can be done via pen-and-paper or by using a spreadsheet
Repetition i xi1 1 2 : n Inputs xi2 xij xip Response yi

Three steps
1. Determine the characteristics of each inputs to the simulation. 2. Construct a simulation table consisting of
p inputs xij, j=1,2,,p one response yi, i=1,2,,n

3. For each repetition i, generate a value for each of the p inputs xijj and calculate the response yi.

Next some simulation examples using tables tables.


Chapter 2. Simulation Examples 3 Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Simulation of Queueing Systems A queueing system is described by


Calling population Arrival rate Service mechanism System capacity Queueing Q e eing discipline

Calling population Waiting line Server

Chapter 2. Simulation Examples

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Simulation of Queueing Systems


Single server q g queue
Calling population is infinite Arrival rate does not change Units are served according FIFO Arrivals are defined by the distribution of the time between arrivals inter-arrival time Service times are according to distribution Arrival rate must be less than service rate stable system Otherwise waiting line will grow unbounded unstable system

Queueing system state g y


System
- Server - Units (in queue or being served) - Clock

State of the system


- Number of units in the system - S Status of server (idl b f (idle, busy) )

Events
- Arrival of a unit - Departure of a unit

Calling population

ti+1

ti

Arrivals
Waiting line Server
Dr. Mesut Gne 5

Chapter 2. Simulation Examples

Computer Science, Informatik 4 Communication and Distributed Systems

Simulation of Queueing Systems


Arrival Event

If server idle unit gets service, otherwise unit enters queue.

Departure Event

If queue is not empty begin servicing next unit, otherwise server will be idle.

How do events occur?

Events occur randomly I t Interarrival ti i l times {1 6} {1,...,6} Service times {1,...,4}

Chapter 2. Simulation Examples

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Simulation of Queueing Systems


Customer C t 1 2 3 4 5 6 Interarrival I t i l Time 2 4 1 2 6 Customer Number Arrival Time A i l Ti on Clock 0 2 6 7 9 15 Service S i Time 2 1 3 2 1 4 Arrival Time [Clock] 0 2 6 7 9 15
7

The interarrival and service times are taken from distributions!

Time Service Begins [Clock] 0 2 6 9 11 15

Service Time [Duration] 2 1 3 2 1 4

Time Service Ends [Clock] 2 3 9 11 12 19


Dr. Mesut Gne

The simulation run is build by b ild b meshing hi clock, arrival and service times!

1 2 3 4 5 6

Chapter 2. Simulation Examples

Computer Science, Informatik 4 Communication and Distributed Systems

Simulation of Queueing Systems


Chronological ordering of events
Clock Time 0 2 2 3 6 7 9 9 11 12 15 19 Customer Number 1 1 2 2 3 4 3 5 4 5 6 6 Event Type Arrival Departure Arrival Departure Arrival Arrival Departure Arrival Departure Departure Arrival Departure Number of customers 1 0 1 0 1 2 1 2 1 0 1 0

Number of customers in the system

Chapter 2. Simulation Examples

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 1: A Grocery
Analysis of a small grocery store y g y
One checkout counter Customers arrive at random times from {1 2 {1,2,,8} minutes 8} Service times vary from {1,2,,6} minutes C Consider th system f 100 id the t for customers
Interarrival Time 1 2 3 4 5 6 7 8 Service Time 1 2 3 4 5 6
Chapter 2. Simulation Examples 9

Probability 0.125 0.125 0.125 0.125 0.125 0.125 0 125 0.125 0.125 Probability 0.10 0.20 0.30 0.25 0.10 0.05

Cumulative Probability 0.125 0.250 0.375 0.500 0.625 0.750 0 750 0.875 1.000 Cumulative Probability 0.10 0.30 0.60 0.85 0.95 1.00
Dr. Mesut Gne

Problems/Simplifications
Sample size is too small to be able to draw reliable conclusions Initial condition is not considered

Computer Science, Informatik 4 Communication and Distributed Systems

Example 1: A Grocery
Customer

Interarrival Time [Minutes] 1 1 6 3 7 5 415

Arrival Time [Clock]

Service Time [Minutes] 4 2 5 4 1 5

Time Service Begins [Clock] 0 4 6 11 15 18 ... 416

Time Service Ends [Clock] 4 6 11 15 16 23 418

Waiting Time in Queue [Minutes] 0 3 4 3 4 0 1 174

Time Customer in System [Minutes] 4 5 9 7 5 5 3 491

Idle Time of Server [Minutes] 0 0 0 0 0 2 0 101

1 2 3 4 5 6 100 Total

0 1 2 8 11 18 415

2 317

Chapter 2. Simulation Examples

10

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 1: A Grocery
Average waiting time Probability that a customer has to wait Porpotion of server idle time Average service time
w=

Waiting time in queue = 174 = 1.74 min


Number of customers 100

p( wait ) =

Number of customer who wait 46 = = 0.46 Nunber of customers 100 Idle time f Idl ti of server = 101 = 0.24 Simulation run time 418

p(idle server) =

s=

Service time
Number of customers
s =0

317 = 3.17 min 100

E ( s ) = s p ( s ) = 0.110 + 0.2 20 + L + 0.05 6 = 3.2 min

Average time between arrivals

=
E ( ) =

Times between arrivals

Number of arrivals - 1

415 = 4.19 min 9 99

a + b 1+ 8 = = 4.5 min 2 2

Average waiting time of those who wait Average time a customer spends in system

wwaited =

Waiting time in queue


Number of customers that wait

174 = 3.22 min 54

t=

Time customers spend in system = 491 = 4.91 min


Number of customers 100

t = w + s = 1.74 + 3.17 = 4.91 min


Chapter 2. Simulation Examples 11 Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 1: A Grocery
Interesting results for a g manager, but
longer simulation run would increase the accuracy
Occurrences (N of Trials) No.
18 16 14 12 10 8 6 4 2 2 0 0 0 0,5 1 1,5 2 2,5 3 3,5 4 4,5 >4.5 2 1 0 0 1 7 5 15

Average of 50 Trials
Histogram for the Average Customer Waiting Time
17

Some interpretations
Average waiting time is not high Server has not undue amount of idle time, it is well loaded ;-) Nearly half of the customers have to wait (46%)

Average customer waiting time [min]

Chapter 2. Simulation Examples

12

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 2: Call Center Problem Consider a Call Center where technical personnel take calls and provide service Two technical support people (2 server) exists
Able more experienced, provides service faster Baker newbie, provides service slower

Rule R l
Able gets call if both people are idle

Find out how well the current arrangement works

Chapter 2. Simulation Examples

13

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 2: Call Center Problem Interarrival distribution of calls for technical support
Time between Arrivals [Minute] Probability Cumulative Probability Random-Digit Assignment

1 2 3 4

0.25 0.40 0.20 0.15 0 15

0.25 0.65 0.85 1.00 1 00

01 25 26 65 66 85 86 00

Service time distribution of Able


Service Time [Minute] Probability Cumulative Probability Random-Digit Assignment

Service time distribution of Baker


Service Time [Minute] Probability Cumulative Probability Random-Digit Assignment

3 4 5 6

0.35 0.25 0.20 0.20

0.35 0.60 0.80 1.00

01 35 36 60 61 80 81 00
14

2 3 4 5

0.30 0.28 0.25 0.17

0.30 0.58 0.83 1.00

01 30 31 58 59 83 84 00
Dr. Mesut Gne

Chapter 2. Simulation Examples

Computer Science, Informatik 4 Communication and Distributed Systems

Example 2: Call Center Problem


Simulation proceeds as follows Step 1:

Step 2:

For Caller k, generate an interarrival time Ak. Add it to the previous arrival time Tk-1 to get arrival time of Caller k as Tk = Tk-1 + Ak

Step 3:

If Able is idle, Caller k begins service with Able at the current time Tnow Ables service completion time Tfin,A is given by Tfin,A = Tnow + Tsvc,A where Tsvc,A is the service time generated from Ables service time distribution. Caller ks waiting time is Twait = 0 0. it Caller ks time in system, Tsys, is given by Tsys = Tfin,A Tk If Able is busy and Baker is idle, Caller begins with Baker. The remainder is in analogous. If Able and Baker are both busy, then calculate the time at which the first one becomes available, as follows: Tbeg = min(Tfin,A, Tfin,B) Caller k begins service at Tbeg. When service for Caller k begins, set Tnow = Tbeg. g g Compute Tfin,A or Tfin,B as in Step 2. Caller ks time in system is Tsys = Tfin,A Tk or Tsys = Tfin,B - Tk

Chapter 2. Simulation Examples

15

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 2: Call Center Problem


Caller Nr. Interarrival Time Arrival Time When Able Avail. When Baker Avail. Server Chosen Service Time Time Service Begins Ables Service Compl. Time Bakers Service Compl. Time Caller Delay Time in System

1 2 3 4 5 100 Total 2 4 2 1 1

0 2 6 8 9 219

0 2 4 8 12 221

0 0 0 0 0 219

Able Able Able Able Baker Baker

2 2 2 4 3 4

0 2 6 8 9 219

2 4 8 12 12

0 0 0 0 0 0 211

2 2 2 4 3 4 564

Chapter 2. Simulation Examples

16

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 2: Call Center Problem


One simulation trial of 100 caller 62% of callers had no delay y 12% of callers had a delay of 1-2 minutes
Caller delay

Average caller delay g y

400 simulation trials of 100 caller 80 5% of callers h d 80.5% f ll had delay up to 1 minute 19.5% of callers had delay more than 1 minute
Chapter 2. Simulation Examples 17 Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 3: Inventory System Important class of simulation problems: inventory systems Performance measure: Total cost (or total profit) Parameters
N Review period length M Standard inventory level Qi Quantity of order i

Chapter 2. Simulation Examples

18

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Example 3: Inventory System Events in an (M, N) inventory system are


Demand for items Review of the inventory Receipt of an order at the end of each review

To T avoid shortages, a b ff stock i needed id h buffer k is d d Cost of stock


Storage space Guards

Chapter 2. Simulation Examples

19

Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Appendix: Random Digits

Producing Random Numbers from Random Digits Select randomly a number, e.g.
- One digit: 0.9 - Two digits: 0.19 - Three digits: 0 219 0.219

Proceed in a systematic direction direction, e.g.


- first down then right - first up then left
Chapter 2. Simulation Examples 20 Dr. Mesut Gne

Computer Science, Informatik 4 Communication and Distributed Systems

Summary This chapter introduced simulation concepts by means of examples Example simulations were performed on a table manually
Use a spreadsheet for large experiments (Excel, OpenOffice) Input data is important Random variables can b used R d i bl be d Output analysis important and difficult The used tables were of ad hoc, a more methodic approach is needed

Chapter 2. Simulation Examples

21

Dr. Mesut Gne

You might also like