Day 1 08:00Arrivals: -In department: -
Loading Blender model...

Hospital Emergency Department Flow: Triage, Priority Queue, Bays and Imaging

Abstract patient tokens (colour = urgency level) arrive at random through the day, are sorted at the triage desk, wait in the waiting room, then take a treatment bay and a doctor in order of urgency; some go to the imaging room before they are discharged. Change the bays, doctors and arrival rate and watch door-to-doctor time and the share of people who leave without being seen. Educational model, not medical or staffing advice. Drag to orbit, pinch or wheel to zoom.

Presets

Department settings

Live results (last 24 simulated hours)

Door-to-doctor time and left-without-being-seen, by urgency

Patients waiting and bays in use, last 24 hours

waiting (triage + waiting room)bays occupiedarrivals per hour (right-hand shape)

Door-to-doctor by urgency level (mean, minutes)

Queueing theory next to this run

Each stage is treated as an M/M/c queue at the arrival rate of the current clock hour (a quasi-steady-state estimate; the real rate changes through the day, so expect differences when the rate is moving fast).

Experiment A: does the simulated queue match Erlang C and the priority formula?

A stand-alone check (separate code from the department model): 4 identical doctors, load 80 %, four priority classes with the urgency mix above, 400 000 patients. Compared with the Erlang C waiting probability and mean wait, the Cobham formula for the wait of each class, and Little's law for the queue length.

Experiment B: staffing finder

Runs this department for 12 simulated days at every combination of bays and doctors (other settings as now) and marks the combinations that meet both targets. It picks the smallest number of doctors, then bays. A single random seed per cell, so cells near the edge are noisy.

4 %
45 min
The science: queues, priorities and Little's law

Educational model, not medical or staffing advice. It uses generic numbers, abstract tokens and simplified rules. It is not calibrated to any hospital and must not be used to plan real care, staffing or triage.

Arrivals. Patients arrive as a non-homogeneous Poisson process: the rate λ(t) follows a 24-hour profile (quiet at night, a long late-morning to evening plateau) scaled so that the daily mean is the "Arrivals per day" slider; "Daily peak strength" scales how far the profile departs from flat. Arrivals are generated by thinning: candidates at the maximum rate are kept with probability λ(t)/λmax.

Triage desk. The desk is an M/M/c queue served first come, first served with c nurses. With offered load a = λ s (arrival rate times mean service time), the Erlang C formula gives the probability of waiting C(c, a) = [ac/c! · c/(c−a)] / [∑k<c ak/k! + ac/c! · c/(c−a)] and the mean wait Wq = C(c, a) / (cμ − λ), valid only while ρ = a/c < 1.

Priority. After triage a patient waits for a free bay and a free doctor. With the priority rule the waiting patient with the lowest urgency number is chosen first (first come within a level), and service is never interrupted (non-preemptive). For equal exponential service rates the exact mean wait of class k is Cobham's formula Wk = [C(c, a) / (cμ)] / [(1 − σk−1)(1 − σk)] with σk = ∑i≤k λi/(cμ). Priority makes urgent patients wait far less but pushes the delay onto the least urgent class, who are also the ones most likely to give up. Experiment A checks this.

Leaving without being seen (LWBS). Each patient who has been triaged has a random patience (exponential with a mean that grows with the urgency number; level 1 never leaves). If the wait exceeds it, the patient leaves, which is "reneging" in queueing language. It lowers the queue and the apparent wait of the people who stay, which is why a long door-to-doctor time and a high LWBS rate are read together.

Bays and blocking. A patient keeps the bay through the doctor consultation, any imaging (including the wait for the scanner) and the observation time, so the bay is held by a person who may be somewhere else. Bays are therefore the stage that fills first: with a mean bay time of about an hour, 18 bays carry roughly 18 ÷ 1.1 h ≈ 16 patients per hour before the stage is saturated. When every bay is full, new patients wait even if doctors are free; when every doctor is busy, they wait even if bays are free.

Little's law. In a stable system the average number of people inside equals the arrival rate times the average time inside: L = λ W. The results panel compares the time-averaged number of patients in the department with the departure rate times the mean time from door to leaving; the two agree once the run is long enough that the start-up transient is small. Experiment A checks the queue-length form Lq = λ Wq.

Measures. Door-to-doctor time is the time from arrival to the start of the doctor's consultation. Length of stay is the time from arrival to leaving, for patients who were treated. LWBS rate is the share of patients who left among everyone whose outcome is known (seen or left) in the window. Utilisation is the time-average share of bays, doctors, nurses or scanners in use against the capacity set at that time.

Simplifications. Exponential service and patience times (real ones are skewed and depend on the case); no transfers between levels, admissions, boarding of admitted patients, ambulance diversions, shift changes, breaks or no-shows; doctors are needed only for the first consultation, nurses only at triage; imaging is one generic scanner type; the clock repeats the same day profile every day. The patients are coloured capsules and carry no personal or medical detail. The model is not affiliated with any hospital, health system or equipment maker.

Made with 🟠 Blender · Three.js