Patients (small capsules) arrive at the entrance and are assigned an Emergency Severity Index level from 1 (critical/red) to 5 (non-urgent/blue). They wait in the queue on the left until a treatment bed on the right is free. In Priority mode the most severe waiting patient always claims the next free bed, regardless of who arrived first — the standard real-world triage rule. In First-come mode beds go strictly in arrival order, ignoring severity. The longer any patient waits untreated, the more their condition deteriorates: their severity level quietly worsens over time, and a patient already at level 1 who keeps waiting becomes an adverse event — the outcome triage exists to prevent.
bed ← argmin(severity, arrivalTime) // priority mode
bed ← argmin(arrivalTime) // first-come mode
severity(t) -= 1 every (12s / decayRate) spent waiting
- Arrival rate — how many patients per minute enter the department; higher rates stress a fixed number of beds.
- Treatment beds — the department's limited resource; fewer beds means longer queues for the same arrival rate.
- Deterioration speed — how quickly an untreated patient's condition worsens; this is why triage order, not just bed count, matters.
- Triage strategy — compare how many adverse events accumulate under priority-based triage versus naive first-come-first-served at the same load.
Real-world relevance: this is the core reason emergency departments triage instead of queuing by arrival time — under constrained beds and staff, treating the sickest patient first measurably reduces bad outcomes compared with strict queue order.