Simulating Single server queuing models
Consider the following sequence of activities that each customer undergoes: 1.Customer arrives 2.Customer waits for service if the server is busy. 3.Customer receives service. 4.Customer departs the system.
Example Arrival rate ( =15) customers per hour Service time = 3 minutes (service rate ( = 20) customer per hour Arrival and Service times are exponentially distributed Note: the generation of Exponential Random Variable is: –Generate uniform [0,1] RN: RAND() –Return X = -1/ * ln(RAND())
Analytical Solutions Analytical solutions for W, L, Wq, Lq exist (see Lecture 05) However, analytical solution exist at infinity which cannot be reached. Therefore, Simulation is a most.
Flowchart of an arrival event IdleBusy An Arrival Status of Server Customer joins queue Customer enters service More
Flowchart of a Departure event NOYes A Departure Queue Empty ? Set system status to idle Remove customer from Queue and begin service More
An example of a hand simulation Consider the following IAT’s and ST’s: A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4, A9=1.9, … S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Want: Average delay in queue Utilization
Initialization Time = 0 system Server System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D Statistical Counters
Arrival Time = 0.4 system System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D 0.4 A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters
Arrival Time = 1.6 system System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters
Arrival Time = System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D System 2.1 A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters
Departure Time = System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D System A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters
Departure Time = System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D 2.1 System A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters
Departure Time = System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D System A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters
Departure Time = System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D System 3.8 A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters
Departure Time = System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D System A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters
Departure Time = System state Server status # in que Times of Arrival Time Of Last event Clock Eventlist Number delayed Total delay Area Under Q(t) Area Under B(t) A D System 4.0 A1=0.4, A2=1.2, A3=0.5, A4=1.7, A5=0.2, A6=1.6, A7=0.2, A8=1.4 S1=2.0, S2=0.7, S3=0.2, S4=1.1, S5=3.7, S6=0.6 Statistical Counters