Assignment 4 - SEG-2106 - Winter 2016

Concurrency: A simulation in Java

Given: March 24. Due date : April 12 - You may work in a group of two - revised April 1

Description of the system to be modeled: Emergency service in a hospital

Note: This problem is adapted from a case study in the book by Thomas J. Schriber et al., Introduction to Simulation using GPSS/H, John Wiley & Sons, 1991, pp. 258.

The patients arrive at the emergency of a hospital. When they arrive, they are classified by a nurse in the following categories: (1) CW (can wait), and (2) NEA (needs immediate attention). On average, 15% of the patients will be classified NEA, the other 85% CW. There are three (3) nurses that do this classification.

The CW patients see a doctor and then can go back home.

The NEA patients also see a doctor and 20% of them can then go back home. The other 85 80% have to do a test in the laboratory of the hospital, then see the same doctor again before they can go home.

There are six (6) doctors in the emergency. They are partitioned into two groups of 3 doctors each: Group A looks after NEA patients, and Group B looks after CW partients. The laboratory performs one test after another (in FIFO order).

Here is some information about the duration of the different interventions. It is assumed that the durations have uniform distributions; for each intervention is indicated the average duration and the maximal deviation from the average, for example "10 +- 4" means that the duration has a uniform distribution between 6 and 14 minutes.

Your simulations

The purpose of the simulation is to determine the average time that the CW and NEA patients remain in the emergency, and to determine the fraction of time the nurses and doctors are busy (their "utilisation") - the same for the laboratory.

For most of the shared resources used by the patients, you can assume a single waiting queue. However, for the group of doctors looking after the NEA patients, the scheduling is not clearly defined by the above text: Do the patients coming back to the same doctor have priority over new NEA patients ? - Also it is not evident how you could organize your simulation program such that NEA patients coming back will be seen by the same doctor they saw previously. You should explain all this in your report.

Note: For your simulation program, you should use one of the approaches discussed in class.

Your Tasks

  1. Write a Java program that simulates emergency of a hospital, as described above.
  2. Determine the average time the CW and NEA patients remain in the hospital.
  3. Determine the fraction of time the nurses, the doctors and the laboratory are busy.
  4. Determine the expected error of your results. Explain how you have determined the expected error of your results. (Suggestion: Do several simulation runs and compare the different results obtained - as discussed in class).
  5. Answer the following questions:
    1. Is the waiting time in the hospital (time in the hospital minus processing time) acceptable ? - Compare the average time in the hospital (as measured above) with the average processing time (time for classification of a patient, the doctor rendezvous and possibly the laboratory testing time) - for CW and NEA patients.
    2. Is there a bottleneck in the emergency room organization ? - A bottleneck is a shared ressource for which the waiting time is extremely long (compared with its processing time or long enough to deteriorate strongly the overall average response time of the system.
    3. Could the average waiting time in the hospital be improved by exchanging the number of doctors in Groups A and B (keeping their total number the same) ?
    4. Assume that the second hospital in town is foreseen to close, and the number of patients coming to this hospital would double. Is it necessary to add some additional personnel (doctors and/or nurses) to the emergency room ? - Would the laboratory become a bottleneck ? - Please provide a reasoned discussion of the requirements based on simulations about this hypothetic situation.


  1. On paper: Report about your work on points (1) to (4), and discussion of your answers to the questions under point (5).
  2. By e-mail to the TA ( Vishawdeep Kaur Dhaliwal [] ) : your simulation program.

Last update: March 24, 2016