modeling and simulation a single-server queue

29
Modeling and Simulation A Single-Server Queue 1 Arwa Ibrahim Ahmed Princess Nora University

Upload: bree-simon

Post on 02-Jan-2016

72 views

Category:

Documents


4 download

DESCRIPTION

Princess Nora University. Modeling and Simulation A Single-Server Queue. Arwa Ibrahim Ahmed. A Single-Server Queue:. Certainly the most common queue discipline is FIFo. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Modeling and Simulation A Single-Server Queue

Modeling and Simulation

A Single-Server Queue

1

Arwa Ibrahim Ahmed

Princess Nora University

Page 2: Modeling and Simulation A Single-Server Queue

2

A Single-Server Queue:

Certainly the most common queue discipline is FIFo.

If the queue discipline is FIFO, then the order of arrival to the service node and the order of departure from the service node are the same.

In particular, upon arrival a job will enter the queue if and only if the previous job has not yet departed the service node. This is an important observation that can be used to simplify the simulation of a FIFO single-server service node. If the queue discipline is not FIFO then, for at least some jobs, the order of departure will differ from the order of arrival.

the default assumptions are that the queue discipline is FIFO and the service node capacity is infinite, unless otherwise specified..

2

Page 3: Modeling and Simulation A Single-Server Queue

3

A Single-Server Queue: The following variables provide the basis for

moving from

a conceptual model to a specification model. At their arrival to the service node, jobs are indexed by i = 1; 2; 3; : : : For each job there are six associated time variables.

The arrival time of job i is ai. The delay of job i in the queue is di >= 0. The time that job i begins service is bi = ai + di. The service time of job i is si > 0. The wait of job i in the service node (queue and

service) is wi = di + si. The time that job i completes service (the

departure time) is ci = ai + wi.

3

Page 4: Modeling and Simulation A Single-Server Queue

4

A Single-Server Queue:

In simulation, events usually occur at random times, the randomness imitating uncertainty in real life. For example, it is not known with certainty when the next customer will arrive at a grocery checkout counter.

• The randomness needed to imitate real life is made possible through the use of (random numbers).

• Many programming languages support RANDOM functions.

• In a Single-Server queuing system inter-arrival times and service times are generated from the distributions of these random variables.

• The following table contains a set of five inter-arrival times generated in this manner.

• These five inter-arrival times are used to compute the arrival times of six customers at the queuing system.

4

Page 5: Modeling and Simulation A Single-Server Queue

5

A Single-Server Queue: 5

Page 6: Modeling and Simulation A Single-Server Queue

6

A Single-Server Queue:

• The second time of interest is the service time. This table contains service times generated at random from a distribution of service times. The only possible service times are one, two, three, and four time units.

6

Page 7: Modeling and Simulation A Single-Server Queue

7

A Single-Server Queue:

• was designed specifically for a single-channel queue which serves customers on a first-in, first-out (FIFO) basis. It keeps track of the clock time.

7

Page 8: Modeling and Simulation A Single-Server Queue

8

A Single-Server Queue: 8

• The occurrence of the two types of events in chronological order is shown in this Table.

Page 9: Modeling and Simulation A Single-Server Queue

9

A Single-Server Queue: 9

Distribution of Time Between Arrivals

Page 10: Modeling and Simulation A Single-Server Queue

10

A Single-Server Queue:

• A small grocery store has only one checkout counter. Customers arrive at this checkout

counter at random from 1 to 8 minutes apart. Each possible value of inter-arrival time has the same probability of occurrence, as shown in Table 2.6. The service times vary from 1 to 6 minutes with the probabilities shown in Table 2.7. The problem is to analyze the system by simulating the arrival and service of 20 customers.

10

Distribution of Time Between Arrivals

Page 11: Modeling and Simulation A Single-Server Queue

11

A Single-Server Queue: 1

1

Service-Time Distribution

Page 12: Modeling and Simulation A Single-Server Queue

12

A Single-Server Queue:12

The purpose of the exercise is to demonstrate how simple simulations can be carried out

in a table, either manually or with a spreadsheet, not to recommend changes in the grocery store. (System productivity).

• A set of uniformly distributed random numbers is needed to generate the arrivals at the

checkout counter. Random numbers have the following properties:1. The set of random numbers is uniformly distributed between 0 and

1.2. Successive random numbers are independent.

• Random digits are converted to random numbers by placing a decimal point appropriately.

Since the probabilities in Table 2.6 are accurate to 3 significant digits, three-place random

numbers will suffice. It is necessary to list only 19 random numbers to generate times

between arrivals. Why only 19 numbers?• The first arrival is assumed to occur at time 0, so only 19 more

arrivals need to begenerated to end up with 20 customers. Similarly, for Table 2.7, two-

place randomnumbers will suffice.

Page 13: Modeling and Simulation A Single-Server Queue

13

A Single-Server Queue: 1

3

The rightmost two columns of Tables 2.6 and 2.7 are used to generate random arrivals and random service times. The third column in each table contains the cumulative probability for the distribution. The rightmost column contains the random digit-assignment. In Table 2.6, the first random-digit assignment is 001-125. There are 1000 three-digit values possible (001 through 000).

• The time-between-arrival determination is shown in Table 2.8. Note that the first random digits are 913. To obtain the corresponding time between arrivals, enter the fourth column of Table 2.6 and read 8 minutes from the first column of the table. Alternatively, we see that 0.913 is between the cumulative probabilities 0.876 and 1.000, again resulting in 8 minutes as the generated time.

Page 14: Modeling and Simulation A Single-Server Queue

14

A Single-Server Queue: 1

4

Table 2.8 Time-Between-Arrivals Determination

Page 15: Modeling and Simulation A Single-Server Queue

15

A Single-Server Queue:

• Service times for all 20 customers are shown in Table 2.9. These service times were

Generated based on the methodology described before.

15

Page 16: Modeling and Simulation A Single-Server Queue

16

A Single-Server Queue: 1

6

Page 17: Modeling and Simulation A Single-Server Queue

17

Simulation findings (Output statistics)

17

1. The average waiting time for a customer is 2.8 minutes. This is determined in the following manner:

Page 18: Modeling and Simulation A Single-Server Queue

18

Simulation findings (Output statistics)

2. The probability that a customer has to wait in the queue is 0.65. This is determined in the following manner:

18

Page 19: Modeling and Simulation A Single-Server Queue

19

Simulation findings (Output statistics)

• The fraction of idle time of the server is 0.21. This is determined in the following manner:

19

Page 20: Modeling and Simulation A Single-Server Queue

20

Simulation findings (Output statistics)4. The average service time is 3.4

minutes, determined as follows:

20

Page 21: Modeling and Simulation A Single-Server Queue

21

Simulation findings (Output statistics)

This result can be compared with the expected service time by finding the mean of the service-time distribution using the equation:

21

Page 22: Modeling and Simulation A Single-Server Queue

22

Simulation findings (Output statistics)Applying the expected-value equation

to the distribution in Table 2.7 gives an expected

service time of:

22

Page 23: Modeling and Simulation A Single-Server Queue

23

Simulation findings (Output statistics)

The expected service time is slightly lower than the average service time in the simulation. The longer the simulation, the closer the average will be to E(S).

23

Page 24: Modeling and Simulation A Single-Server Queue

24

Simulation findings (Output statistics)5. The average time between arrivals

is 4.3 minutes. This is determined in the following manner:

24

Page 25: Modeling and Simulation A Single-Server Queue

25

Simulation findings (Output statistics)This result can be compared to the

expected time between arrivals by finding the mean of the discrete uniform distribution whose endpoints are a = 1 and b = 8. The mean is given By

25

Page 26: Modeling and Simulation A Single-Server Queue

26

Simulation findings (Output statistics)The expected time between arrivals is

slightly higher than the average. However, as the simulation becomes longer, the average value of the time between arrivals will approach the theoretical mean, E(A).

26

Page 27: Modeling and Simulation A Single-Server Queue

27

Simulation findings (Output statistics)6. The average waiting time of those

who wait is 4.3 minutes. This is determined in the following manner:

27

Page 28: Modeling and Simulation A Single-Server Queue

28

Simulation findings (Output statistics)7. The average time a customer

spends in the system is 6.2 minutes. This can be determined in two ways. First, the computation can be achieved by the following relationship:

28

Page 29: Modeling and Simulation A Single-Server Queue

29

Simulation findings (Output statistics)• From findings 1 and 4 this results in:

• Average time customer spends in the system (minutes) = 2.8 + 3.4 = 6.2 minutes.

• A decision maker would be interested in results of this type, but a longer simulation would increase the accuracy of the findings.

• However, some subjective inferences can be drawn at this point.

• Most customers have to wait;

• The average waiting time is not excessive.

• The server does not have an undue amount of idle time.

• Objective statements about the results would depend on balancing the cost of waiting with the cost of additional servers.

29