loading...
running...
How to use
Pick a preset or change beds, treatment time, arrival rate, surge and the share of each triage class; these act live without restarting. Colours: red resuscitation, orange emergent, yellow urgent, green non-urgent. The ring on a bed shows treatment progress. Compare "Triage priority" with "First come first served" at the same load, then raise the surge until rho passes 1. "Reset averages" restarts the wait statistics (for example after a surge) without clearing the department. Space pauses, R restarts.
The science
An emergency department is a queue: patients arrive at random, are triaged into acuity classes, wait for one of c beds and are treated for a random time. This page models it as an M/M/c queue with non-preemptive priority: Poisson arrivals at rate lambda, class k with share p_k, exponential treatment with rate mu per bed, and a free bed always goes to the waiting patient of the most urgent class (first come first served inside a class). Nobody is thrown out of a bed.
With a = lambda/mu and utilisation rho = a/c, the probability an arriving patient has to wait is the Erlang C formula
C(c,a) = [ a^c / (c! (1 - rho)) ] / [ sum_{n<c} a^n / n! + a^c / (c! (1 - rho)) ]
Without priorities every patient waits on average Wq = C / (c mu - lambda). With non-preemptive priority and equal service rates, Cobham's formula generalised to c servers gives the mean wait of class k:
Wq_k = W0 / [ (1 - sigma_(k-1)) (1 - sigma_k) ], W0 = C(c,a) / (c mu), sigma_k = (lambda_1 + ... + lambda_k) / (c mu)
Triage does not create capacity: Kleinrock's conservation law says the load-weighted mean wait is unchanged, sum_k lambda_k Wq_k = lambda Wq (FIFO), so waiting is moved from urgent to non-urgent patients, which is the point. The lowest class pays: its wait is the FIFO wait multiplied by 1 / (1 - sigma_(K-1)), which is large when the more urgent classes already use most of the capacity.
Checks. (1) Erlang C from the direct formula equals the Erlang-B recursion. (2) The Kleinrock conservation identity holds for the analytic waits. (3) A 150,000-patient FIFO simulation matches Erlang C within 5%. (4) The same run with triage matches Cobham for class 2 (within 7%) and class 4 (within 5%). (5) Little's law holds for the time-averaged queue length. (6) Measured bed utilisation equals lambda/(c mu). The check simulations run once in your browser when the page opens.
Honest limits. Real treatment times differ by acuity and are not exponential; arrivals follow daily and weekly cycles instead of a constant Poisson rate; patients can leave without being seen, be admitted upstairs or block beds (boarding); and nurses, doctors and imaging are separate resources. The theory applies to the steady state (rho < 1); in an overload the live averages keep drifting. This is an educational queueing model, not a staffing or clinical tool.