Chapter 6 of 8

Discrete-Event Simulation and Service Risk

Learning objectives

  • Advance a single-server queue by hand through an event trace and compute waiting time, utilization, and idle time
  • Explain why average-based capacity calculations understate congestion and delay
  • Use independent replications to build a confidence interval and size the number of runs needed for a target precision

Why averages mislead about congestion

A receiving dock that averages six trucks per shift and can unload eight looks comfortable, and a spreadsheet built on averages will report spare capacity and no waiting. Reality routinely disagrees, because arrivals and service times vary. Queues form whenever a short interarrival gap coincides with a long service time, and the queue that forms does not disappear the moment conditions normalize; it drains only at the rate the excess capacity allows. The consequence is that waiting time is driven by variability, not just by the ratio of demand to capacity, and it grows non-linearly as utilization climbs. At moderate utilization an increase in demand raises waiting modestly; near full utilization the same increase can multiply it. This is why capacity plans built on averages consistently underestimate delay, and why the fix for a congested dock is often variability reduction, through appointment scheduling or standardized unload procedures, rather than adding a door. Discrete-event simulation exists because these dynamics have no simple closed form once you add realistic features such as shift breaks, priority customers, or servers that handle several queues.

How a discrete-event model actually advances

A discrete-event simulation does not tick forward in fixed time steps. It maintains a list of scheduled future events and jumps the clock directly to the next one, updating state as it goes. For a single-server queue the logic is compact. Each entity arrives at a known time. Service begins at the later of its arrival time and the time the server became free after the previous entity. Waiting time is the service start minus the arrival. Departure is service start plus service duration, and that departure becomes the next entity's earliest possible start. Server idle time accumulates whenever an arrival occurs after the server has already gone free. Utilization is total busy time divided by the observed time span. Because the entire calculation is a table with one row per entity, a small model can be verified by hand, and a hand trace is the correct first step before trusting any simulation package: if you cannot reproduce eight rows manually, you cannot audit eighty thousand. The trace also yields the distribution of waiting time, not just its mean, which is what service commitments are actually written against, since a promise is usually about the worst case rather than the average.

Replications and simulation uncertainty

A single simulation run is one sample from a random process, so its output is an estimate carrying sampling error, and reporting that estimate without its uncertainty makes the result look more precise than it is. The remedy is independent replications: run the model many times with different random number streams, treat each run's summary statistic as one observation, then compute the mean, the sample standard deviation across runs, and a confidence interval using the t distribution with degrees of freedom one less than the number of runs. The half-width of that interval is the honest precision of the answer. If the half-width is wide relative to the difference between two design options, the simulation has not yet distinguished them and more runs are required. Because the half-width shrinks with the square root of the run count, halving it requires roughly quadrupling the number of replications, which sets a practical limit on precision. Two further cautions apply. A model that starts empty and idle understates congestion during its early period, so a warm-up interval should be discarded before statistics are collected when the goal is steady-state behaviour. And when comparing two designs, driving both with the same random number streams, a technique called common random numbers, removes a large share of the noise from the comparison and lets a given number of runs resolve a much smaller difference.

Worked example

Problem

Eight trucks arrive at a single receiving door at Marlow Instruments. Interarrival times in minutes are 0, 12, 25, 18, 7, 30, 14, 11, meaning truck 1 arrives at time 0 and each later truck arrives that many minutes after the previous one. Unload times in minutes are 20, 14, 22, 10, 16, 12, 9, 15. Trucks are served first come first served by one crew that never breaks. Build the event trace, then compute average waiting time, maximum waiting time, average time in system, server utilization, and total idle time. Then, given ten independent replications of the same model that returned average waits of 14.2, 9.6, 18.5, 11.3, 22.7, 8.4, 16.1, 13.9, 20.2, and 12.6 minutes, compute a 95 percent confidence interval for the mean wait using t = 2.262 for 9 degrees of freedom, and the number of replications needed for a half-width of 2.0 minutes.

Step by step

  1. Arrival times are the running sum of interarrivals: 0, 12, 37, 55, 62, 92, 106, 117 minutes.
  2. Truck 1 arrives 0, server free at 0, starts 0, waits 0, departs 0 + 20 = 20. Time in system 20.
  3. Truck 2 arrives 12, server free at 20, starts max(12, 20) = 20, waits 20 - 12 = 8, departs 20 + 14 = 34. Time in system 22.
  4. Truck 3 arrives 37, server free at 34, starts 37, waits 0, departs 37 + 22 = 59. Server was idle 37 - 34 = 3 minutes. Time in system 22.
  5. Truck 4 arrives 55, server free at 59, starts 59, waits 4, departs 59 + 10 = 69. Time in system 14.
  6. Truck 5 arrives 62, server free at 69, starts 69, waits 7, departs 69 + 16 = 85. Time in system 23.
  7. Truck 6 arrives 92, server free at 85, starts 92, waits 0, departs 92 + 12 = 104. Idle 92 - 85 = 7 minutes. Time in system 12.
  8. Truck 7 arrives 106, server free at 104, starts 106, waits 0, departs 106 + 9 = 115. Idle 106 - 104 = 2 minutes. Time in system 9.
  9. Truck 8 arrives 117, server free at 115, starts 117, waits 0, departs 117 + 15 = 132. Idle 117 - 115 = 2 minutes. Time in system 15.
  10. Total waiting = 0 + 8 + 0 + 4 + 7 + 0 + 0 + 0 = 19 minutes. Average wait = 19 / 8 = 2.375 minutes. Maximum wait = 8 minutes. Three of eight trucks, 37.5 percent, waited at all.
  11. Total time in system = 20 + 22 + 22 + 14 + 23 + 12 + 9 + 15 = 137 minutes. Average time in system = 137 / 8 = 17.125 minutes.
  12. Total service time = 20 + 14 + 22 + 10 + 16 + 12 + 9 + 15 = 118 minutes. Observation span = 0 to the last departure at 132 minutes. Utilization = 118 / 132 = 0.8939 = 89.39 percent. Total idle = 132 - 118 = 14 minutes, matching 3 + 7 + 2 + 2 = 14.
  13. Replications: sum = 14.2 + 9.6 + 18.5 + 11.3 + 22.7 + 8.4 + 16.1 + 13.9 + 20.2 + 12.6 = 147.5. Mean = 147.5 / 10 = 14.75 minutes.
  14. Sample standard deviation across the ten replication means = 4.633 minutes. Standard error = 4.633 / square root of 10 = 4.633 / 3.1623 = 1.4651 minutes.
  15. Half-width = 2.262 x 1.4651 = 3.314 minutes. The 95 percent confidence interval is 14.75 plus or minus 3.314, that is 11.44 to 18.06 minutes.
  16. Replications for a half-width of 2.0 minutes, using 1.96 as a large-sample approximation: n = (1.96 x 4.633 / 2.0) squared = (4.540) squared = 20.6, so 21 replications. For a half-width of 1.0 minute, n = (1.96 x 4.633 / 1.0) squared = 82.5, so 83 replications.

Answer. The hand trace gives an average wait of 2.375 minutes, a maximum wait of 8 minutes, an average time in system of 17.125 minutes, utilization of 89.39 percent, and 14 minutes of idle time across a 132-minute span. Note the tension in these numbers: the crew is busy nearly 90 percent of the time yet the queue never exceeded one truck and five of eight trucks were served immediately. A short deterministic trace like this systematically understates congestion, both because it starts with an empty idle server and because eight observations cannot capture the rare unlucky sequence that produces a long queue. That is exactly why the replicated model matters: across ten runs the mean wait is 14.75 minutes with a 95 percent confidence interval of 11.44 to 18.06 minutes, roughly six times the hand-trace figure. The interval is wide, spanning 6.6 minutes, so this model cannot yet distinguish a design that saves five minutes from one that saves nothing; reaching a half-width of 2.0 minutes requires about 21 replications and a half-width of 1.0 minute requires about 83.

Practice

Work each question before opening the solution.

  1. Unload times are all reduced by 3 minutes through a standardized procedure, so they become 17, 11, 19, 7, 13, 9, 6, 12. Recompute the arrival-to-departure trace far enough to find the new total waiting time and the new utilization.

    Show solution for question 1

    Arrivals are unchanged at 0, 12, 37, 55, 62, 92, 106, 117. Truck 1 starts 0, departs 17, wait 0. Truck 2 arrives 12, starts 17, waits 5, departs 28. Truck 3 arrives 37, starts 37, waits 0, departs 56. Truck 4 arrives 55, starts 56, waits 1, departs 63. Truck 5 arrives 62, starts 63, waits 1, departs 76. Truck 6 arrives 92, starts 92, waits 0, departs 101. Truck 7 arrives 106, starts 106, waits 0, departs 112. Truck 8 arrives 117, starts 117, waits 0, departs 129. Total wait falls from 19 to 7 minutes, average wait from 2.375 to 0.875 minutes. Total service = 94 minutes over a 129-minute span, so utilization falls from 89.39 percent to 72.87 percent. A 3-minute reduction per truck cut total waiting by 63 percent, illustrating the non-linear relationship between utilization and delay.

  2. A manager reviews the replication results and reports to the executive team that the average truck wait is 14.75 minutes. What is wrong with that statement and how should it be phrased?

    Show solution for question 2

    It presents a point estimate from ten random runs as though it were a measured fact, omitting a sampling error of plus or minus 3.31 minutes. The honest phrasing is that the model estimates a mean wait of about 14.8 minutes, with 95 percent confidence that the true mean lies between 11.4 and 18.1 minutes based on ten replications. If a decision depends on distinguishing values inside that range, the correct response is to run more replications rather than to quote the midpoint more confidently.

  3. The team wants to compare the current dock against a proposed appointment scheduling policy, and the expected improvement is about 3 minutes of average wait. Given the variability observed, what should they do before running the comparison?

    Show solution for question 3

    A 3-minute effect is smaller than the current 3.31-minute half-width, so ten independent replications of each design cannot resolve it. They should do two things: raise the replication count to at least the 21 runs that give a 2.0-minute half-width, and use common random numbers so both designs face identical arrival and service draws. Pairing the runs this way removes the shared randomness from the difference and typically lets a far smaller number of replications detect an effect of this size, because the analysis is then on the per-replication difference rather than on two independently noisy means.