Discrete Event Simulation (DES) Example- Clinics and wait times.

Event simulation is the process of organizing the behavior of a system into an ordered sequence of items, symbolizing well-defined events. With a well-defined event created, virtual simulations can be conducted and insights gathered on areas of improvement or bottlenecks identified. For example, a lineup of customers at a bank teller waiting their turn to be served is a system. The customers would be considered entities of the system, their demographics are attributes, the atm or bank card are resources, the lineup of customers is a queue and any change to this system (i.e., the customer being served) is an event.

Within event simulation, there are discrete and continuous systems, the example above describes a discrete event simulation (a system with specific intervals and time points). A continuous event includes systems that are in a continuous state of change over time (i.e., the volume of water in a tank).

I was particularly interested in discrete event simulations and developing a model that would influence waiting times in a doctors office. A patients time spent in the clinic waiting to meet their doctor is an example of a discrete event, using a virtual simulator we can identify the bottleneck responsible for increased wait times. Our hypothetical clinic contains 2 doctors, 3 nurses and 1 administrative staff member, our problem is long patient wait periods. Through our virtual system, we can identify potential bottlenecks to determine where the prolonged wait times are and as a result recommend solutions.

I used R- simmer package (a robust framework that provides a common path in simulations) to develop my virtual simulation. There are three general processes that happen in my virtual clinic:

  1. The patient is acquired/seized by a nurse/doctor/administration staff (represents the starting point).
  2. There is a timeout period or period of time the patient is with the nurse/doctor/administration.
  3. The patient is released or exits the interaction.

Using these three processes, I built my simulation model to showcase the queue of patients at each stage and the overall sequence of the virtual clinic.


Patients will begin by seeing a nurse, the timeout time to see a nurse is 15mins (resource), the next step is meeting the doctor who will complete a full examination (resource- 20mins). Finally, the last step in the system is the administrator (resource-5mins) providing the patient with any additional paperwork. The R code contains the sequence of events, number of professionals involved in the process and the time spent with the patient.

The final output provides an overall analysis of the system, with information on the number of patients waiting in line (queue), the number of available professionals and whether the stations are active. We are interested in understanding the queue number, this will identify bottlenecks and where the wait times are highest:

simmer environment: outpatient clinic | now: 540 | next: 541.052160714821
{ Resource: nurse | monitored: TRUE | server status: 3(3) | queue status: 0(Inf) }
{ Resource: doctor | monitored: TRUE | server status: 2(2) | queue status: 53(Inf) }
{ Resource: administration | monitored: TRUE | server status: 0(1) | queue status: 0(Inf) }
{ Generator: patient | monitored: 1 | n_generated: 109 }

We can see that the queue status is quite high for patients waiting on their doctor, going back we defined that our number of doctors was 2, nurses at 3 and administration at 1. One way to decrease this queue number is to increase the number of doctors to 3 and test out our model. We may find that the queue decreases for doctors and increases at the administration, therefore we can experiment with different numbers, finding what works best for our model. In this example, we have not taken into account clinic costs and financials, which would be an important factor to consider when deciding on whether to hire more staff or types of issues that take longer to deal with (i.e., patients with ambulatory issues vs a patient with the common cold).

This model can be applied in any system that follows a defined set of activities and events, exposing the weaknesses, and potential areas for improvement and most importantly asking new questions about the functionality of a system. There are a number of internal considerations to think about prior to making the final decision, however, by creating a virtual simulation utilizing DES models we are able to identify weaknesses and strengths within a system that will assist us in making the most informed decision.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s