Discrete-Event Simulation: Finding the Real Bottleneck in a Queue
How simulating every customer and every minute of waiting reveals the real bottleneck before a manager hires more staff
Key takeaways
Discrete-event simulation follows individual customers through a process with limited resources. Its clock jumps from one event to the next, so hundreds of mornings run in seconds.
Queueing formulas are exact under strict assumptions and make an excellent test of a simulation program, but they break down when the arrival rate changes, stages are chained, and customers leave.
In the coffee shop example, adding a cashier shortens the visible line but barely helps. Adding a barista cuts the share of customers staying over five minutes from 24.3% to 3.7%.
One run proves nothing. Use many replications, confidence intervals, and common random numbers, which here narrow one comparison more than fivefold at no extra cost.
Wrong input assumptions distort the tail most: an exponential service time more than doubles the share of long stays under the best option, and an average arrival rate hides more than half of them under the current one.
Almost everyone has stood in a line and wondered why the business does not simply add staff. The harder question is where to add them. Hospitals, airports, call centers, and fast-food counters face the same puzzle every day: demand comes in random bursts, work passes through several stages, and the place where people visibly pile up is not always the place that is slow.
Hat Nau, a fictional coffee chain followed throughout this series, has exactly this problem. In the article on Monte Carlo simulation, we assessed the risk of opening a new branch. Now the branch is open. From 7:30 to 8:15 a.m., when office workers stop for coffee on their way to work, the line grows visibly long. A few customers look at the queue, shake their heads, and leave. Some regulars complain on social media that they have to wait "ten minutes or more." The branch manager has three options: keep things as they are, with 1 cashier and 2 baristas; add 1 cashier, because the crowd at the ordering counter is the first thing customers see; or add 1 barista, because some believe the drink station is where things really slow down.
Testing each option in the real shop for a few weeks would be expensive, slow, and disruptive. Moreover, the number of customers varies randomly from day to day, so a week-long trial would be hard to interpret with confidence. Discrete-event simulation (DES), one of the most widely used types of simulation in operations management, lets us try all three options on a computer, each over hundreds of mornings, in a few seconds.
This article has four sections. Section 1 explains what DES is, how it works inside, and why we do not simply use a queueing formula. Section 2 builds and runs the Hat Nau counter model step by step, from input data to the comparison of options. Section 3 introduces real-world applications. Section 4 summarizes the practical process, the common pitfalls, and code you can run yourself.
1. Understanding Discrete-Event Simulation
This section answers three questions in order: how DES views a system, how a computer "runs" a DES model, and why a formula is not enough.
1.1. How does DES view a system?
A world of entities, resources, and queues. As introduced in What Is Simulation?, DES describes a system as a process through which entities flow, competing for limited resources. Figure 1 draws that process for the Hat Nau counter.
The entities are the customers. Each has their own attributes: arrival time, order, the time needed to order, and the time needed to prepare the drink. The resources are the cashier and the baristas, each able to serve only one customer at a time. A queue forms when a customer needs a resource that is busy; the shop has two queues, one to order and one to receive the drink. The process is the sequence of steps: arrive, line up, order, wait for preparation, receive the drink, leave the counter.
This view is very close to how operations managers already draw process maps on paper. That is one reason DES is readily accepted in business: the model "looks like" the real system.
Events and state. The state of the counter at any moment is described by a few numbers: how many cashiers are busy, how many customers are waiting to order, how many baristas are busy, and how many customers are waiting for drinks. The state changes only when an event occurs. The Hat Nau model has five types of event: a customer arrives; a customer starts ordering; a customer finishes ordering and moves on to wait for preparation; a barista starts preparing the drink; and the customer receives the drink and leaves. A customer who turns away at once is handled within the arrival event.
Between two consecutive events, nothing changes. This is exactly what "discrete" means: the state jumps at separate points in time instead of changing smoothly.
1.2. Inside the DES "engine"
The simulation clock and the future event list. DES packages, from free libraries to expensive commercial software, revolve around two core components (Banks et al., 2010). The simulation clock is a variable that stores the current time in the simulated world. The future event list holds the scheduled events, sorted by the time at which they will occur. The main loop of the program is very simple:
Take the earliest event off the list.
Advance the clock to that exact time.
Update the system state and record statistics.
Schedule any new events that result. For example, when a customer starts ordering, the program draws a random ordering time and schedules the corresponding "finishes ordering" event.
Return to step 1 until there are no more events or the simulation time is up.
This mechanism is called next-event time advance. The clock does not tick second by second; it jumps straight to the next event, skipping periods in which nothing happens. This is why a personal computer can simulate 200 mornings at the Hat Nau counter for all three options in a few seconds.
Seeing the first 14 events of a morning. Table 1 records the first 14 events of a fairly busy simulated morning under the current option (1 cashier, 2 baristas). Times are in minutes after 7 a.m.; the last four columns show the state right after the event.
Follow customer 2, who arrives at 0.22 minutes while the cashier is busy with customer 1, and so must wait. At 0.94 minutes customer 1 finishes ordering and moves to the drink station; the cashier becomes free and immediately calls customer 2. Customers 3 and 4 arrive while the cashier is still busy with customer 1, so the ordering queue reaches three people even though both baristas are idle. The entire "logic" of the model lies in simple rules like these, applied over and over to about 150 customers each morning.
Two ways to write a model. There are two common styles of programming a DES model. In event scheduling, the programmer writes a handler for each type of event, such as "handle arrival" or "handle end of ordering." This gives full control but becomes hard to read in large models. In process interaction, the programmer describes the journey of an entity from start to finish: "customer arrives, requests cashier, orders, requests barista, receives drink, leaves." The software turns this description into events and manages the event list.
Much modern software uses the second style because it is closer to the way people think about processes. Python's SimPy library, used in the code at the end of this article, is an example: according to its official documentation, it is a process-based discrete-event simulation framework based on standard Python (Team SimPy, n.d.).
1.3. Why not just use a formula?
Little's law. Queueing theory already offers many elegant formulas. The best known and most general is Little's law, proved by John Little in 1961 (Little, 1961):
L = λ × W
Here L is the average number of customers in the system, λ is the average arrival rate, and W is the average time each customer spends in the system. Looking back 50 years later, Little himself observed that the formula became well known because of its theoretical and practical importance (Little, 2011). For example, if Hat Nau wants an average of no more than 4 customers in the shop, with 1.2 customers arriving per minute, then each customer can stay only about 3.3 minutes on average (4 / 1.2).
The Erlang C formula. Little's law links three averages to one another. It does not tell us what W itself is. To compute waiting times we need a more specific model, most commonly the M/M/c queue: customers arrive in a Poisson process at a constant rate λ, service times are exponential with mean s, there are c servers, and the system has been running long enough to settle down (Banks et al., 2010). Let a = λs be the workload and ρ = a/c the utilization, with ρ < 1. The probability that a customer has to wait, the Erlang C formula, is:
Pwait = [ac / (c!(1 − ρ))] / [1 + a + a²/2! + … + ac−1/(c − 1)! + ac / (c!(1 − ρ))]
The average wait is then Wq = Pwait × s / [c(1 − ρ)]. Try it on the Hat Nau drink station at the average rate for the whole morning: λ = 1.225 customers per minute, s = 1.25 minutes, and c = 2, so a = 1.531, ρ = 76.6%, Pwait = 66.4%, and Wq = 0.664 × 1.25 / (2 × 0.234) ≈ 1.77 minutes. Table 2 does this for each stage at three arrival rates, next to a long simulation under the same assumptions (20 runs of 50,000 customers each).
Table 2 shows two things. When its assumptions hold, the simulation reproduces the formula, so the formula is a good test of the program. But at peak time with 2 baristas, the formula answers "infinite," because no steady state exists when ρ = 100%. That answer is of no use to a shop whose peak lasts only 45 minutes.
The Hat Nau counter violates most of these assumptions. The counter has at least four features that rule out a direct use of the formulas. First, the arrival rate changes over time: sparse at 7 a.m., dense from 7:30 to 8:15, then sparse again. Second, there are two stages in series, ordering and then preparation, with a different number of staff at each. Third, preparation times are not exponentially distributed, as Section 2.1 will show. Fourth, customers may balk, leaving when they see that the line is too long.
Each feature is perfectly ordinary, but together they go beyond what classical queueing formulas can handle. With DES, each is just a few more lines of code.
2. Building and Running the Hat Nau Counter Model
This section goes through the full life cycle of a DES study: preparing input data, building and verifying the model, running experiments, and analyzing the results to make a decision.
2.1. Input modeling
The quality of a DES model depends heavily on its input data. Preparing them is called input modeling. In our hypothetical case, Hat Nau's manager had staff observe and record activity for two weeks.
Arrivals at a rate that changes by time of day. The data show three distinct periods, as in Table 3.
Within each window, customers arrive independently and at random. A suitable model for such arrivals is the non-homogeneous Poisson process, a Poisson process whose rate changes over time. A common technique for generating such arrivals on a computer is thinning, proposed by Lewis and Shedler (1979): generate arrivals at the maximum rate (1.6 customers per minute), then keep each one with a probability equal to the ratio of the rate at that time to the maximum rate. At 7:10, for instance, each arrival is kept with probability 1.0 / 1.6 = 62.5%. Figure 2 shows one morning generated this way.

On average, about 147 customers come to the counter each morning (30 × 1.0 + 45 × 1.6 + 45 × 1.0). The morning in Figure 2 has 166, busier than average; it is the same morning that produced the event trace in Table 1.
Service times and the choice of distribution. For ordering and payment, the data show an average of about 0.4 minutes (24 seconds), and an exponential distribution describes it reasonably well. Preparation time is more complicated. Staff timed 200 drink preparations, obtaining a mean of 1.21 minutes, a standard deviation of 0.53 minutes, a minimum of 0.43 minutes, and a maximum of 4.20 minutes.
A very common mistake is to default to the exponential distribution for every service time, simply because it appears in queueing formulas. But the exponential distribution has its highest density right next to zero, which is absurd for drink preparation: nobody makes a latte in five seconds. Figure 3 compares two candidates, of which the lognormal distribution follows the right-skewed shape of the data closely.

To check objectively, we use the Kolmogorov–Smirnov test. It compares the empirical distribution of the data with a theoretical one; the D statistic measures the largest gap between the two cumulative distribution curves. One technical point is often missed: the p-value printed by software assumes that the parameters of the distribution were known in advance. Here they are estimated from the same data, which inflates the standard p-value (Lilliefors, 1967). Table 4 therefore adds a p-value corrected by a parametric bootstrap: draw 2,000 samples from the fitted distribution, re-estimate the parameters on each, and count the share of samples whose D exceeds the observed D.
The conclusion survives the correction, but the lognormal p-value drops from 0.835 to about 0.49. The model uses a lognormal distribution for preparation time, with a mean of about 1.25 minutes. This figure is rounded up from the observed data to reflect the shop's recent addition of a few blended ice drinks that take longer to make.
The lesson is that input modeling is not a formality. As Section 4.2 will show, choosing the wrong distribution can make a model's results substantially wrong even if everything else is correct.
Customer balking. Observation showed that when the total number of people waiting (to order or for drinks) reaches 12 or more, newly arriving customers usually turn around and leave. The model includes this rule: each arriving customer "looks at" the queues and leaves if 12 or more people are already waiting.
2.2. Building, verifying, and validating the model
With the inputs ready, we program the model, check that the program does what we intend, and then check that the model resembles reality.
Programming the model. Each customer's journey is described almost exactly as the real process: arrive, check the queue, request the cashier, order, request a barista, wait for preparation, receive the drink. Code in the process style is given in Section 4.3. Two technical details are worth noting.
The first is that this is a terminating simulation: it covers 7 a.m. to 9 a.m., starts with an empty shop, and runs until the last customer who arrived before 9 a.m. has been served. Because the manager's question concerns only this window, we do not need to worry about the long-run steady state, as we would for a system that runs continuously.
The second is common random numbers: when comparing options, each simulated morning uses the same stream of arrivals and the same service times for each customer across all three options. As a result, differences between options reflect the effect of staffing rather than random differences between mornings. Law (2007) regards this as one of the most useful variance reduction techniques for comparing alternatives.
Verification with Little's law. Verification checks whether the model has been programmed correctly. Little's law is a very convenient tool here, because it holds for every stable queueing system regardless of the input distributions. For a morning that starts and ends with an empty shop, the equality is even exact, provided that λ, W, and L are all computed on the customers who were served. In the program, W is summed from individual customers' times, while L is computed separately by integrating the number of customers present over time. Over 200 mornings of the current option, the two calculations never differ by more than 10⁻¹⁴ on any morning, which is only machine rounding. Table 5 gives the averages.
The small gap between 4.35 and 4.39 is not a bug. The product of two averages differs from the average of the products: busy mornings (high λ) are also mornings when customers stay longer (high W). A faulty program, for example one that miscounts customers or miscalculates times, will usually violate Little's law within individual mornings. The test also has a limit: it checks only how statistics are recorded and cannot detect a wrong input distribution or customers served in the wrong order.
The model passes two other tests. The first is agreement with the formula when the formula's assumptions hold, as in Table 2. The second is reading the trace of events, as in Table 1. Reading a trace event by event is manual but effective at catching logic errors, and Banks et al. (2010) list it among the basic verification techniques.
Validation against real data. Validation checks whether the model represents the real system accurately. For Hat Nau, the manager should compare the simulation of the current option with the figures observed over the two weeks: average time in the shop, the share of customers who stay a long time, and the number who leave each morning. If the figures agree acceptably, the model is credible enough to try options that have never been used. If not, the input data and assumptions must be revisited. Because Hat Nau is fictional, there are no real figures to perform this step with; in a real project it must not be skipped.
2.3. Running experiments and comparing options
The three options are A (1 cashier and 2 baristas, current), B (2 cashiers and 2 baristas), and C (1 cashier and 3 baristas). Each is simulated over 200 mornings, or 200 replications, each with a different stream of random numbers. Many replications are needed because a single morning can be "lucky" or "unlucky" depending on whether customers happen to arrive in bunches: across the 200 mornings of option A, the average time in the shop ranges from 1.92 to 6.08 minutes.
A close-up of one morning. Before looking at the averages, Figure 4 shows how the illustrative morning unfolds under the three options.

Under options A and B, the number of customers in the shop shoots up to 15 and 14 between 8:10 and 8:13. The two lines track each other closely, showing that adding a cashier barely solves the problem. Option C keeps the shop much emptier during the rush, with at most 9 customers. On this morning 3 customers leave under option A, 4 under B, and none under C.
Summary results over 200 mornings. One morning settles nothing. Table 6 summarizes all 200, and Figure 5 plots the two main measures.

Reading the results to find the real bottleneck. Table 6 tells a clear story. Adding a cashier (option B) has almost no effect: the wait to order falls from 0.44 minutes to nearly zero, but the wait for preparation actually rises slightly, from 1.56 to 1.65 minutes. The second cashier pushes customers to the drink station faster, where they queue again. Total time in the shop falls by only about 0.3 minutes.
Adding a barista (option C) makes a big difference: the wait for preparation falls from 1.56 to 0.21 minutes. The share of customers staying more than 5 minutes falls from 24.3% to 3.7%, from about 1 customer in 4 to 1 in 27. Almost no one leaves.
This is a classic lesson about bottlenecks in operations management: improving a stage that is not the bottleneck barely improves the system as a whole. The line at the ordering counter is what customers and managers see most clearly, but the real cause lies at the drink station behind it. At peak time, 1.6 customers per minute require on average 1.6 × 1.25 = 2 "barista-minutes" per minute, exactly the capacity of 2 baristas. When the workload equals 100% of capacity for 45 minutes straight, any idle minute early on can never be recovered, so queues build up. The 75% utilization over the whole morning hides this: during the peak window alone, the two baristas are busy 89% of the time.
Are the differences statistically significant? Thanks to common random numbers, we can compare pairs of mornings with identical arrivals, as in Table 7. The last column shows how wide the interval would be if each option used its own random stream.
Neither interval contains 0, so both options produce statistically significant improvements. But C's improvement is more than four times as large as B's. Statistical significance is not the same as practical significance: option B "works" statistically, but its effect is too small to be worth the investment. Table 7 also shows the value of common random numbers: for two similar options such as A and B, the interval becomes more than five times narrower without a single extra run.
How many mornings should we simulate? Are 200 replications enough? Figure 6 shows the 95% confidence interval for the average time in the shop (option A) narrowing as replications increase; Table 8 gives four points along the way.

With 5 replications the half-width is almost 1.5 minutes, far too much to compare options. With 200 it is only about ±0.1 minutes, accurate enough to make a decision. The half-width shrinks with the square root of the number of replications, exactly the 1/√N law discussed in the article on Monte Carlo simulation: going from 20 to 80 replications (four times as many) roughly halves the error.
2.4. From simulation results to a business decision
Simulation does not make decisions by itself. It provides figures for the manager to weigh. Suppose a part-time barista working an extra 2 hours in the morning costs about $2.40, the average price of a cup is $1.40, and the cost of goods sold is 40% of revenue, as in the Monte Carlo article, so that each cup leaves $0.84 of gross margin.
The directly measurable benefit is the customers retained. Option C reduces balking by about 2.3 customers per morning, equivalent to about $3.20 of revenue. But the figure to set against the wage is gross margin: 2.3 × $0.84 ≈ $1.92, which covers about 80% of the cost of the extra barista. To break even on retained customers alone, option C would have to save almost 3 customers each morning. Comparing a wage with revenue is a common mistake, and here it would make the case look better than it is.
The indirect benefit is harder to measure but may be larger: the number of customers staying more than 5 minutes falls from about 36 to about 6 per morning. For a shop that depends on morning regulars, the waiting experience directly affects whether customers come back. The manager's question becomes: is it worth about $0.48 a morning to spare 30 customers a long wait? Most managers would say yes.
The cost figures are illustrative assumptions, and each branch should substitute its own. How the waiting experience affects repeat visits in the long run is a dynamic question beyond the reach of this DES model. It is the subject of the articles on system dynamics and hybrid simulation.
3. Discrete-Event Simulation in Practice
The Hat Nau example is small, but it has the full structure of a real DES study. This section introduces fields in which DES is widely applied.
3.1. Food service and retail
Quick-service restaurants are DES's "home turf." A recent teaching case in INFORMS Transactions on Education uses discrete-event simulation to analyze congestion in the drive-through of a Chick-fil-A restaurant at a shopping center in Williamsburg, Virginia (Yuan, 2026). The chain operates more than 3,000 restaurants across 48 U.S. states, and most of its revenue comes from drive-through customers. The case is built around a renovation that added a second pickup lane; the simulation compares customers' time in the system and the length of the car line before and after. Typical questions in this field are very similar to Hat Nau's: how many staff are needed in each time slot, whether to add a second ordering lane, and how to lay out the kitchen to reduce waiting times.
3.2. Health care
Health care is one of the largest application areas of DES. The review by Günal and Pidd (2010) shows that DES has been used to model health care systems for decades, with publications increasing markedly since 2004. The authors classify studies by area of application, including emergency departments, inpatient facilities, outpatient clinics, and other hospital units. The emergency department is a typical example: patients arrive at random with varying severity, are triaged, wait for a doctor, have tests, and are then admitted or discharged. This structure resembles the Hat Nau counter but is far more complex, with many types of resources (doctors, nurses, beds, imaging machines) and priority rules based on severity.
Günal and Pidd (2010) also point to a notable limitation: most DES models in health care are built for one specific unit, and few are generic enough to be reused. This is the downside of flexibility: DES can model a great variety of processes in detail, but the price is that each model usually serves only one place.
3.3. Manufacturing and logistics
Manufacturing is one of the fields in which DES matured, because questions about capacity and bottlenecks arise there every day. One group of applications is designing and balancing production lines: identifying bottlenecks and sizing buffers between stages. A second is assessing the impact of breakdowns and maintenance, since random machine failures are a major source of variability that simple capacity calculations often ignore. A third is designing warehouses and distribution centers: the number of receiving docks, the number of forklifts, and the layout of picking areas. A fourth is seaports and airports: the number of berths and cranes, check-in counters, and security lanes.
3.4. What successful applications have in common
Despite their different fields, successful DES studies usually share three features. First, a clear question tied to a specific decision (how many staff, how many machines, what layout). Second, a system with a clear process structure and limited resources. Third, reasonably good data on arrival rates and service times. When one of these is missing, another type of simulation may be worth considering, such as system dynamics for long-term strategic questions.
4. Practicing Discrete-Event Simulation
This section turns what we have done into a process for other projects, shows common mistakes together with their measured consequences, and provides code.
4.1. A seven-step process for a DES project
A real DES project can follow seven steps:
Map the process together with the people who know the system well: staff and shift supervisors. Identify the entities, resources, steps, and priority rules.
Collect input data: arrival rates by time window, the duration of each stage, the balking rate. Receipt timestamps from the point-of-sale system are very valuable, but remember that a receipt records a customer who ordered, not one who walked away.
Select and test distributions for each random input using charts and statistical tests, as in Section 2.1.
Program the model and verify it: read the event trace, check Little's law, compare with the M/M/c formula, and try extreme cases (with no customers, the queues must always be empty).
Validate by comparing the simulation of the current system with real data.
Design the experiments: choose the options and the number of replications, and use common random numbers. For steady-state simulations, a warm-up period must also be determined and discarded (Law, 2007).
Analyze and present: report both means and confidence intervals, and the measures that decision makers care about (the share of customers staying more than 5 minutes is often easier to grasp than "average waiting time").
4.2. Common pitfalls
The first two pitfalls concern input assumptions. Table 9 reruns the model with each wrong assumption in turn, keeping everything else the same, to show how large the distortion is.
Defaulting to the exponential distribution for everything. The exponential distribution does not suit most human task times. In Table 9 the average time under option A is off by only about 7%, but the share of customers staying over 5 minutes under option C more than doubles, from 3.7% to 8.3%. A wrong distribution does the most damage in the tail, exactly where customers complain. Always check against data.
Ignoring time-varying rates. Using the average rate for the whole morning (1.225 customers per minute) instead of the 1.6 peak leaves total arrivals unchanged, yet the share of customers staying over 5 minutes under option A drops to 11.7%, less than half the correct figure. Queues respond non-linearly to utilization.
Running only once. A single simulation run is just one possible morning. Drawing conclusions from one run is like judging a café on a single day.
Looking only at averages. An average of 3.65 minutes in the shop sounds acceptable, but it hides the fact that almost one customer in four stays over 5 minutes. Splitting by time is even more revealing: among customers arriving between 7:30 and 8:15 the share is 41%, against only 4% for those arriving before 7:30. Customers experience individual waits, not averages.
Confusing terminating and steady-state simulations. The Hat Nau morning counter is a terminating simulation. A factory running 24/7 is a steady-state simulation and requires a warm-up period to be discarded. Using the wrong kind of analysis gives wrong results.
Over-detailed models. Not every detail needs to be included. Start simple, check whether the model answers the question, and add detail only when needed.
4.3. Tools and sample code
Common tools. SimPy (Python) is free and open source, suitable for people who can program and want full control over the model. Arena, Simio, and FlexSim are commercial packages with drag-and-drop interfaces and animation, well suited to presenting to management; many offer student versions. Animation is only a display layer: a very lively-looking model can still be wrong if its input parameters or underlying logic are wrong, and a SimPy model with no graphics at all can be perfectly accurate. AnyLogic supports DES, system dynamics, and agent-based modeling, and appears again in the article on hybrid simulation.
SimPy code for the Hat Nau counter. The code below reproduces the first two rows of Table 6. You can run it on Google Colab after installing SimPy with pip install simpy. Each customer's attributes (arrival, ordering, and preparation times) are generated up front for the whole morning, so the three options automatically share common random numbers.
import numpy as np, simpy
T = 120 # simulate 7:00 to 9:00 (minutes)
def arrival_rate(t): # customers per minute by time window
return 1.6 if 30 <= t < 75 else 1.0
def customer_list(seed): # one morning's customers, shared by all options
rng, out, t = np.random.default_rng(seed), [], 0.0
while True: # non-homogeneous Poisson process (thinning)
t += rng.exponential(1 / 1.6)
if t > T:
return out
if rng.random() <= arrival_rate(t) / 1.6:
order = rng.exponential(0.4)
prep = rng.lognormal(np.log(1.25) - 0.1, 0.45)
out.append((t, order, prep))
def morning(n_cashiers, n_baristas, seed):
env = simpy.Environment()
cashier = simpy.Resource(env, n_cashiers)
barista = simpy.Resource(env, n_baristas)
times = [] # time each customer spends in the shop
def customer(t_arrive, t_order, t_prep):
yield env.timeout(t_arrive) # arrive
if len(cashier.queue) + len(barista.queue) >= 12:
return # line too long, customer leaves
with cashier.request() as req:
yield req # wait for a cashier
yield env.timeout(t_order) # order
with barista.request() as req:
yield req # wait for a barista
yield env.timeout(t_prep) # preparation
times.append(env.now - t_arrive)
for c in customer_list(seed):
env.process(customer(*c))
env.run()
x = np.array(times)
return x.mean(), (x > 5).mean()
for name, (c, b) in {"A": (1, 2), "B": (2, 2), "C": (1, 3)}.items():
res = np.array([morning(c, b, s) for s in range(200)])
print(f"Option {name}: mean {res[:, 0].mean():.2f} min, "
f"over 5 min {res[:, 1].mean():.1%}")The output is:
Option A: mean 3.65 min, over 5 min 24.3%
Option B: mean 3.34 min, over 5 min 20.3%
Option C: mean 2.34 min, over 5 min 3.7%The function customer_list is the input model, morning is the logic of the counter, and the final loop is the experiment with 200 replications. Try changing the arrival rates, the number of staff, or the balking threshold. One experiment worth doing is an option D with 2 cashiers and 3 baristas: guess the result first, then run it to test your intuition about bottlenecks.
Conclusion
The strength of discrete-event simulation is that it describes a system almost exactly as it works in real life: each customer, each staff member, each queue, with all the randomness and the very specific rules of the process. Thanks to the clock that jumps from one event to the next, a computer can "live through" hundreds of mornings in a few seconds.
The Hat Nau counter illustrates three big lessons. First, input data determine the quality of the model, and distributions must be chosen on the basis of data, not habit. Second, a single run tells you nothing; you need many replications, confidence intervals, and controlled comparisons. Third, and most important for management, intuition easily misidentifies the bottleneck: the visible line at the ordering counter hides the real cause at the drink station. Simulation helps us see beneath that surface before spending money on the wrong solution.
DES does, however, have its limits. The counter model answers very well the question "what will tomorrow morning look like," but it cannot answer "if customers keep having to wait a long time, how will the number of regulars change after a year?" Questions about feedback and long-term accumulation require a different perspective: system dynamics.
Data note: Hat Nau is a fictional coffee chain. Arrival rates, service times, the 200 timed preparations, prices, and wages are illustrative assumptions. Results were computed in Python with 200 replications per option (seeds 0 to 199); the illustrative morning in Table 1, Figure 2, and Figure 4 uses seed 29.
References
Banks, J., Carson, J. S., II, Nelson, B. L., & Nicol, D. M. (2010). Discrete-event system simulation (5th ed.). Pearson. https://www.pearson.com/en-us/subject-catalog/p/discrete-event-system-simulation/P200000003161/9780136062127
Günal, M. M., & Pidd, M. (2010). Discrete event simulation for performance modelling in health care: A review of the literature. Journal of Simulation, 4(1), 42–51. https://doi.org/10.1057/jos.2009.25
Law, A. M. (2007). Simulation modeling and analysis (4th ed.). McGraw-Hill. https://highered.mheducation.com/sites/0072988436/
Lewis, P. A. W., & Shedler, G. S. (1979). Simulation of nonhomogeneous Poisson processes by thinning. Naval Research Logistics Quarterly, 26(3), 403–413. https://doi.org/10.1002/nav.3800260304
Lilliefors, H. W. (1967). On the Kolmogorov–Smirnov test for normality with mean and variance unknown. Journal of the American Statistical Association, 62(318), 399–402. https://doi.org/10.1080/01621459.1967.10482916
Little, J. D. C. (1961). A proof for the queuing formula: L = λW. Operations Research, 9(3), 383–387. https://doi.org/10.1287/opre.9.3.383
Little, J. D. C. (2011). Little's law as viewed on its 50th anniversary. Operations Research, 59(3), 536–549. https://doi.org/10.1287/opre.1110.0940
Team SimPy. (n.d.). SimPy: Discrete event simulation for Python [Computer software documentation]. Retrieved November 23, 2026, from https://simpy.readthedocs.io/en/latest/
Yuan, Y. (2026). Case—Chick-fil-A drive-through: Managing congestion with discrete event simulation. INFORMS Transactions on Education, 26(3), 207–209. https://doi.org/10.1287/ited.2023.0058cs



Discussion about this post