Homework 1: Discrete-Event Simulation

Hints, Partial solution, Suggested format of Log File, Directions for mailing homework to Lab Instructor,

Write in C a program to do the discrete-event simulation of a system representing a pediatrician's office. We assume that there is a pediatrician and a nurse and that we have five types of patients:

  1. Patients that see first the nurse then the pediatrician
  2. Patients that only see the nurse
  3. Patients that only see the pediatrician
  4. Patients that see first the pediatrician then the nurse
  5. Patients that see first the nurse, then the pediatrician, then again the nurse.

Thus the situation is as described in the following queueing network:

                 +<----------------------------------------------+
                 |                                               ^
         SWITCH1 v  ----+       +--+  SWITCH2                    |
 INPUT ---->x----+-->||||------>|  |---->x------------------------>+---> OUTPUT
            |       ----+       +--+     |                       | ^
            |       QUEUE1     SERVER1   |                       | |
            |                            |               SWITHC3 +-+
            v                  (nurse)   v    ----+     +--+     |
            x--------------------------->x---->||||---->|  |---->x
                                              ----+     +--+
                                             QUEUE2     SERVER2
                                                     (pediatrician)

where SERVER1 is the nurse and SERVER2 is the pediatrician. QUEUE1 and QUEUE2 are, respectively, waiting rooms for the nurse and for the pediatrician.

The user is asked at run time to specify:

Determine:

Run the program a number of times with different values for the parameters and random seed. Examine in correspondence the utilizations and queue sizes. If for a given choice of parameters by changing the random seed we obtain utilization and size values that are stable [i.e. do not change much, say, change at most 10%], then we have a good simulation.

This homework is assigned on January 16 and it is due February 2 by 5pm. Mail the homework to the TA. Be sure to receive within 24 a message back from the TA confirming that he has received the homework. If you do not receive the reply from the TA contact both the instructor and the TA.

ingargiola@cis.temple.edu