I have measured the interarrival times (the times between successive arrivals) for my CVEN 422 class – i.e. I stood in the doorway and every time a student entered the room I wrote down the time. I then entered these times into Excel, and took their differences to get a list of the interarrival time (the times between arrivals) for the students. My raw data looks like the following:
Student Number |
Student Arrival Times (Seconds) |
Difference in Arrival Times (Interarrival Times) (seconds) |
1 | 0 | |
2 | 6.43 | 6.43 |
3 | 12.61 | 6.18 |
4 | 18.93 | 6.32 |
5 | 25.22 | 6.29 |
6 | 31.80 | 6.58 |
7 | 37.78 | 6.07 |
etc. |
After getting all the above values computed I converted the “Equations” to “Values” in Excel, and sorted them, and found that when grouped into similar time ranges, I had the following groupings:
Interarrival Times (Seconds) |
Total Number of Students Falling Within That Range |
5.9 to 6.0 | 1 |
6.0 to 6.1 | 32 |
6.1 to 6.2 | 36 |
6.2 to 6.3 | 33 |
6.3 to 6.4 | 35 |
6.4 to 6.5 | 35 |
6.5 to 6.6 | 34 |
6.6 to 7.0 | 1 |
After plotting these I notice that they closely follow a CONTINUOUS UNIFORM distribution, and make the assumption that I can indeed model student arrival times with a continuous uniform distribution, with a low value = 6.0 seconds between students and high value = 6.6 seconds. The corresponding BOSS command is:
ARRIVE {TIME = CUNIFORM(6, 6.6)};
meaning “Please born me a student every 6 to 6.6 seconds, in a uniform continuous random fashion, and run him/her through my system to see how the system will perform.”
On the next day I was measuring how often cars arrived at a traffic light, and measured the following data:
Truck Number |
Arrival Times (Seconds) |
Difference (Interarrival Times) (seconds) |
1 | 0 | |
2 | 3.5 | 3.5 |
3 | 14.0 | 10.5 |
4 | 24.5 | 10.5 |
5 | 34.5 | 10 |
6 | 45.0 | 10.5 |
7 | 62.0 | 17.0 |
etc. |
Notice that in this case the differences (the interarrival times) do not seem to be uniform – there are many more 10’s than 3.5’s. In fact, after tabulating all my readings, I get the following number of interarrival times:
Interarrival Time (Seconds) |
Number of Trucks |
3-4 | 2 |
4-5 | 3 |
5-6 | 14 |
6-7 | 25 |
7-8 | 46 |
8-9 | 66 |
9-10 | 76 |
10-11 | 76 |
11-12 | 64 |
12-13 | 43 |
13-14 | 26 |
14-15 | 12 |
15-16 | 6 |
16-17 | 2 |
Now when I plot this, it looks very much like a normal distribution curve, with a mean of about 10 seconds, and a sigma of around 14/6 seconds. To check this I first run some statistical tests to check the goodness of fit, and it does indeed reasonably approximate a normal distribution. Thus I should be able to use my calculator and its random number generator (uniform distribution between 0 & 1) and a book of Z tables to accurately simulate when the cars will arrive in the system. The corresponding BOSS command is:
ARRIVE {TIME = 0 MAX NORMAL(10,2.333)};
Note that the “0 MAX” is to prevent the ARRIVE statement from (rarely) selecting a negative time, which can happen on any NORMAL curve, regardless of how unlikely. Since that would crash the simulation you need to avoid it. Note also the you don’t need “0 MAX” on a CUNIFORM or EXPD distribution.
Finally, the next day I was measuring the time between trucks at my borrow pit, and measured the following:
Number of trucks arriving | After Time | But Before Time |
50 | 0 seconds | 0.1 seconds |
30 | 0.1 seconds | 0.2 seconds |
18 | 0.2 seconds | 0.3 seconds |
12 | 0.3 seconds | 0.4 seconds |
5 | 0.4 seconds | 0.5 seconds |
3 | 0.5 seconds | 0.6 seconds |
1 | 0.6 seconds | 0.7 seconds |
2 | 0.7 seconds | 0.8 seconds |
When plotted, this appears to be an exponential distribution with lambda = 5 trucks per minute. The corresponding BOSS command is:
ARRIVE { TIME = EXPD(0.2) };
Examples for Continuous Uniform Distribution Curves:
As seen from the figure above, the total area under the curve is 1.0, and t represents that time which gives the appropriate shaded area under the curve. Thus assume that the distribution of interarrival times for your problem is uniform continuous, ranging from lowval = 10 to highval = 25. If you generate a random 0-1 number of 0.726, that says that the next arrival time (how long you must wait for the next entity arrival) should be “t”, where t will cause 0.726 of the area under the curve to be shaded. Thus the next entity will arrive at t = 10 + 0.726*(25-10) = 20.89 seconds (or minutes, or hours) after the preceding arrival.
To get the interarrival time for a continuous uniform distribution curve starting at 0 and going to 1, simply press the rand or random button on your calculator. Thus, t = random number. To get the interarrival time for a continuous uniform distribution with a low value of 15.6 and a high number of 19.9, the time will equal:
Time = low value + randomnumber*(highnumber – lownumber)
For ARRIVE{TIME = CUNIFORM(15.6,19.9)}; with a random number = 0.234:
Interarrival time = 15.6 + (19.9 – 15.6)*0.234 = 16.6062 seconds (or whatever, time units.)
Examples for Normal Distribution Curves:
The same rules apply here. If your curve of interarrival times plots as a normal curve, having a mean, and approximately 3 sigma on either side beyond which there are very few arrivals, you can use a 0-1 random number generator to properly predict the next interarrival time. Again, the random number generated denotes what percentage of the curve should be shaded.
To get an interarrival time for a normal distribution curve, get a random number. Then enter that 0-1 number into the Z tables, and use the equations below. For example: If the mean time to deliver a load of dirt from a hill to a pit is 22 minutes, and if sigma = 4 minutes, how long is it likely to take the next truck to deliver its dirt?
Draw a normal distribution curve centered around 22 minutes, with the tail on the left end almost, but not quite touching the x axis at 22 – 3*4 = 10 minutes, and with the tail on the right almost, but not quite touching the x axis at 22 + 3*4 = 34 minutes. Then, get a random 0-1 number from your calculator (say 0.242) and shade the left 24.2% of the area under the curve. Then the right edge of the shaded area will predict the time it will likely take the next truck to travel from the hill to the pit. In this case, entering the Z tables at 0.242 (in the middle of the tables) gives Z (on the outside edge of the tables = -0.7. This is saying that you will have shaded 24.2% of the curve, if you will move to the left of center (the mean) by 0.7 sigma, draw a line and shade everything to the left of that line. The corresponding time will then be
t = mean + Zrand*sigma = 22 + (-0.7)(4) = 20.4 minutes travel time.
If the random number was greater than 0.5, then the Z will be positive, telling you that you must go to the right of the mean.
For ARRIVE{TIME = 0 MAX NORMAL(15.6, 2.34)}; with random number = 0.281:
Interarrival time = MEAN + Ztable value for the random number * SIGMA
Get Z0.281 = -0.58, so the Interarrival Time = 15.6-0.58*2.34 = 14.2428 seconds
Examples for Exponential Distribution Curves:
The figure below shows a graphical representation of an exponential distribution for the interarrival times measured between successive trucks at an intersection. In this case the average number of trucks arriving at the intersection is 5 per minute, or 12 seconds between truck arrivals. To determine the time it will take the next truck to arrive, get a 0-1 random number (say 0.4) and shade that much area under the curve. Then the corresponding interarrival time for the next truck will be given by:
Lambda = 5 trucks per minute (measured in field as total trucks/total time)
Shaded area = random number = 0.4 (from your calculator)
t = interarrival time = -ln(1 – Random Number)/Lambda = 0.102 minutes before the next truck will arrive.
For ARRIVE{TIME = EXPD(0.2)}; (i.e. lambda = 5 cars/minute) with random number = 0.393469:
Interarrival time = -ln(1-0.393469)/5 = 0.10000