Description
PART 1
Write a program to simulate the operation of the triage area of an emergency department in a
small, rural hospital.
The emergency department has four areas to handle patients. The areas are Triage, Trauma
Care, Acute Care, and Prompt Care. All patients initially visit the triage area so that their cases
can be prioritized based on clinical need.
The program shall implement a discrete-event simulation with an M/M/1 FIFO queue. Inter-
arrival times and service times shall be based on exponential distributions. The means for the
inter-arrival and service times shall be input to the program as command line parameters.
The simulation clock shall use the next-event time advance method. The simulation shall end
when 100 patients have been discharged from the triage area.
At the end of the simulation your program should report the following metrics.
• Mean inter-arrival time in minutes
• Mean service time in minutes
• Length of the simulation in minutes
• Average wait time for patients in minutes.
• Average number of patients in the queue.
• Number of patients still in the queue at the end of the simulation
You can implement your assignment using Java, C++, or Python. The program shall create at
least two object types: a server object type and a patient object type. These object types shall
be defined in separate files.
Submit your source code files and any required build script using the directory structure below.
hw1/
[build script]
src/
[source files]
Upload your submission to Blackboard as a zipped file: lastname-firstname.hw1.zip.
A description for PART II of the assignment will be posted next week. PART II will be due on
Sept 18.
INFORMATION FROM IN CLASS DISCUSSION
Info on exponential distribution can be found on Page 28 in textbook.
Most of the logic needed can be found in Example 1.4 in textbook.
Also, check the flowcharts in the textbook for arrival, departure,
and other events for proper modeling.
T = -B*ln(u(0,1)) where -B is -lambda
Max Queue size should be 100 patients. If we get beyond that,
terminate program and print why. Perhaps make Queue size a
command line parameter.
Mr. Apostal’s Class structure for PART I:
Customer/Patient
ArrivalTime
DelayInQueue
DepartureTime ?
Server
BusyStatus
QueueOfPatients
SysClock
SimTime
NextArrivalTime
NextDepartTime
Driver
(Drives the program)
INFORMATION FROM BLACKBOARD ANNOUNCEMENTS
Program #1 Note:
The generated random numbers for inter-arrival and service times should
be floats or doubles (32- or 64-bit–this may depend on the language you use).
Report metrics at the end of the program should be rounded to 3 decimal positions.
Program #1, Additional Note:
If the number of patients in the triage area (queue) is greater than or equal to 100,
your simulation should stop. Your program should then print a message stating why the
simulation was stopped (ex “number of patients in queue exceeded pre-defined threshold”).
In this case the program should not print any report metrics. Also, the threshold value
should be a command-line argument.
Program #1, Generating Exponential Random Numbers:
To generate random variates (random variables) from an exponential distribution,
see the 5th edition of the text, section 1.4.3, bottom half of p. 28. You can also
read in the Wikipedia article, Exponential distribution, the section on Generating
Exponential Variates. The symbol beta (β) is sometimes used to refer to the mean
time of an exponential distribution. The symbol lambda (λ) = 1 / β