26
For a simple one floor healthcare facility, the patient flow through a single room was simplified to the following: Figure: X, patient flow through a single room. This served as a basis for the creation of a real time simulation which outputs wait times and patient throughput for specific inputs determined by the user. Process After the software is installed and executed, six variables will have to be input by the user: 1) Rooms: the number of rooms available for use. 2) Doctors: the number of physicians available for treating patients. 3) Nurses: the number of nurses available for preparing rooms which have been used. 4) Treatment Time: The average time, in minutes, required for the treatment of a patient, taking into account the patient and physician travel time to reach the room.

Interdisciplinary design Simulation section

Embed Size (px)

Citation preview

For a simple one floor healthcare facility, the patient flow through a single room was simplified to the following:

Figure: X, patient flow through a single room.

This served as a basis for the creation of a real time simulation which outputs wait times and patient throughput for specific inputs determined by the user.

ProcessAfter the software is installed and executed, six variables will have to be input by the user:

1) Rooms: the number of rooms available for use.2) Doctors: the number of physicians available for treating patients.3) Nurses: the number of nurses available for preparing rooms which have been used.4) Treatment Time: The average time, in minutes, required for the treatment of a patient, taking

into account the patient and physician travel time to reach the room.5) Room Preparation Time: The average time, in minutes, required for a nurse to prepare a used

room, taking into account the nurse’s travel time to reach the room.6) Patients per Hour: The amount of patients set to arrive, distributed evenly throughout each

hour.

A few screenshots of the interface are shown in the appendix along with the coding structure.

The following might occur during the input process:

1) If a non-integer is entered at any point, the user will be notified and must re-input an integer value.

2) If the number of doctors is greater or less than the number of rooms, the user will be notified.3) If the number of nurses is greater than the number of rooms, the user will be notified.4) If the treatment time input is more than 300 minutes, the user will be notified and must re-input

a value less than 300.5) If treatment time is more than 2 hours, the user will be notified.6) If the room preparation time input is more than 300 minutes, the user will be notified and must

re-input a value less than 3007) If the room preparation time is more than 30 minutes, the user will be notified.8) If the patient flow per hour is more than 600, the user will be notified and must re-input a value

less than 600.9) During the input of patient flow per Hour, the user is notified that patients are distributed

evenly throughout each hour. It is also shown that the simulation runs for a 12 hour day, and that patients whose treatment time will exceed 6 pm will not be admitted.

10) A recap of all inputs is shown, with the option of re-inputting all variables or starting the simulation.

When the “Start Simulation” option is chosen, a timer starts ticking where one minute of simulation time is equivalent to one real-life hour. Since patient flow is distributed evenly throughout the hour, if a flow of six patients per hour is chosen, the first patient will arrive at the 10 th minute of simulation time (10 seconds real-time), and every 10 minutes after that. If the patient’s treatment time will exceed the 12 hour mark (12th minute real-time), he will not be admitted and the flow stops.

A full room usage cycle can be illustrated by looking at figure X above. If a patient arrives and both a doctor and a room are available the treatment begins. After the treatment time is complete, the patient leaves the system and the doctor is ready to take in a new patient. A nurse would then prepare the room in order to make it available for further use. After the room preparation time is complete, the room is ready to handle a new patient.

To explain this full room usage cycle in simulation terms, consider the default value of “patients waiting” in the interface is zero. Every time a patient arrives, this value is increased by “1”. The default values of “Doctors Idle” and “Rooms Available” are the inputs given by the user. Every 6 seconds of simulation time (0.1 seconds real-time) the simulation checks if the three aforementioned variables are greater than zero. If they are, they are all decreased by one. After the value of “treatment time” in simulation minutes has passed, the value of “patients passed” and “Doctors Idle” in the interface increases by one. If the value of “Nurses Idle” is more than zero, it will then decrease by one. After the value of “room preparation time” in simulation minutes has passed, the value of “Rooms available” and “Nurses Idle” increases by one.

RestrictionsDue to time and coding skill constraints, a number of restrictions are inherent to the simulation. If these restrictions were to be removed, the ability to gain more meaningful and insightful data will increase. Possible improvements on the simulation include:

- The ability to input precisely when each patient arrives, or to change arrivals into some set distribution (e.g. Poisson/normal distribution).

- The ability to pause and change a variable while the simulation is running, such as adding a doctor, changing treatment time or adding a sudden patient influx at some point during the work day.

- Allowing the simulation to run for a variable set of time instead of a 12 hour work day (12 minutes real-time).

- Automatic graphing and plot outputs, to be written into spreadsheet software such as Microsoft Excel.

- The option to obtain instant graph outputs instead of having to wait for the simulation to finish running in real time, or at least the decrease of the ratio of real-time to simulation-time so that it completes in less than 12 minutes.

- More variable inputs (such as tool availability, room usage time), and standard deviation factors for how long treatment and room preparation times last.

- Changing the code so that time values are more accurate than approximate.- The ability for more than one nurse to work on the same room, in order to decrease room

preparation time.- Individualized instead of cumulative idle and wait times; one for each doctor, patient, nurse and

room.

These are some of many possible improvements that can be implemented to the real-time simulation tool.

Optimization ExampleTo show how the tool can be used to optimize a system, it is to be applied on a fictional facility which contains four available treatment rooms.

For the first run, the following inputs were set:

Table Y: first run input values

Rooms

Doctors

Nurses

Treatment Time (min)

Room Prep Time (min)

Patients per Hour

4 3 2 30 10 8

The simulation was run for 4 hours (4 minutes real-time) while manually taking data values by pausing every 5th of an hour (12 seconds real-time). This data is shown in table Z in the appendix, and was used to create the two plots shown below.

Figure 1: first run variable status

Figure 2: first run cumulative idle times

As can be seen from the figures the number of available doctors and rooms decreases over time to zero and remains there, while the cumulative doctor idle time remains at a set constant of about 31 minutes. This shows that all rooms and doctors are occupied throughout most of the 4 hours.

The amount of patients waiting and cumulative patient wait time however are on an increase throughout most of the 4 hours. There is no reason to continue the full run of the simulation as it is apparent that the current inputs cannot handle a flow of 8 patients per hour.

In addition, there is at least one nurse waiting throughout the 4 hours, while the cumulative nurse idle time is on the rise. This indicates the system has more nurses than required to prepare the 4 rooms for this set of inputs.

This run succeeded in passing 20 patients, with 8 waiting their turn by the 4 th hour.

In an attempt to maximize patient throughput, the following inputs were used for the second run:

Table V: second run input values

Rooms

Doctors

Nurses

Treatment Time (min)

Room Prep Time (min)

Patients per Hour

4 3 1 25 10 8

The simulation was once again run for 4 real-time minutes, while manually taking data every 12 seconds. This data is shown in table B in the appendix.

For this run, it was assumed 5 minutes were taken off each treatment time average in an attempt to pass more patients. The number of nurses was also decreased to 1 in light of the last run’s information.

Using the data in table B to plot the same graphs yields the following figures:

Figure 3 second run variable status

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3 3.2 3.4 3.6 3.8 40

50

100

150

200

250

Cumulative Patient Wait Time Cumulative Doctor Idle Time Cumulative Nurse Idle Time

Time Elapsed (Hour)

Tim

e (m

in)

Figure 4: second run cumulative idle times

As can be seen from the figures, the amount of available rooms decreases to zero and remains there. However, the number of idle doctors reaches 1 multiple times throughout the 4 hours, indicating that 1 nurse was not enough to prepare all 4 rooms in time for this set of inputs. This can be observed in figure 4, as the doctor idle time is rising while the nurse idle time flatlines.

This run succeeded in passing 21 patients, with 7 waiting their turn by the 4 th hour.

In light of the second run, the number of nurses available was increased back to 2 in order to deal with the decreased treatment time. Table K summarizes the inputs used in the third run:

Table K: third run input values

Rooms

Doctors

Nurses

Treatment Time (min)

Room Prep Time (min)

Patients per Hour

4 3 2 25 10 8

Data was collected in the same method as for the first and second runs, and yielded the data shown in table Q in the appendix. The graphs acquired from this table are shown below:

Figure 5: third run variable status

Figure 6: third run cumulative idle times

As can be deduced from figure 5, the number of rooms and doctors available decreased to zero and remained there for the most part. The amount of nurses idle remained at one while the amount of patients waiting was rising.

Even though the cumulative idle times plot is similar to the first run, decreasing the treatment time by 5 minutes allowed for 24 patients to be passed instead of 20, with only 4 awaiting treatment instead of 8, by the 4th hour.

For the fourth run, the amount of doctors was increased by 1 to test for a possible increase in patient throughput. The follow table summarizes variable inputs used in the fourth run:

Table W: fourth run input values

Rooms

Doctors

Nurses

Treatment Time (min)

Room Prep Time (min)

Patients per Hour

4 4 2 25 10 8

The simulation was run in the same manner as before, and the following graphs were created based on table H in the appendix:

Figure 7 fourth run variable status

Figure 8 fourth run cumulative idle times

The fourth run’s patient output was identical to the third run, but it had at least 1 idle doctor throughout the 4 hours, with the cumulative doctor idle time on a constant rise. This indicates that the 4 th physician is not needed for this set of inputs, and does nothing to affect patient output.

So far, the simulation has shown that for this set of inputs, the facility is not able to handle 8 patients per hour without the costly addition of a room or a further decrease in treatment time, both of which can be impractical.

For the fifth simulation run, the number of doctors was brought back to 3, and the simulation was run to test the facility’s ability to handle 7 patients per hour instead of 8. The following set of data was used:

Table L: fifth run input values

Rooms

Doctors

Nurses

Treatment Time (min)

Room Prep Time (min)

Patients per Hour

4 3 2 25 10 7

This time, as no significant backup of patient flow was observed, the simulation was allowed to run for the full 12 hours (12 minutes real-time), while taking values at 12 second intervals. The values obtained are shown in table J in the appendix. This data was used to obtain the following figures:

Figure 9 fifth run variable status

Figure 10 fifth run cumulative idle times

By observing figure 9 above, it can be seen the amount of doctors and rooms decreased to zero and remained there for the most part throughout the simulation. The maximum amount of patients awaiting treatment at any given time was 2.

Even though the cumulative patient wait time increases to 501 minutes, all patients were effectively passed through the system. It is worth noting that the simulation stopped the patient in-flow half way through the final hour (as their treatment time would exceed the 12 th hour). By the 12th hour, 79 patients have been passed with the final 2 under treatment. 2 of the 3 doctors are treating the final patients, while 1 nurse is cleaning a room. This comes out to 3 out of the 4 rooms are being occupied at the end of the shift.

A sixth simulation run was conducted to test how the facility handles 6 patients per hour with the same inputs. The following initial data was used:

Table N: sixth run input values

Rooms

Doctors

Nurses

Treatment Time (min)

Room Prep Time (min)

Patients per Hour

4 3 2 25 10 6

This run was also conducted for the full 12 hours, and the results are shown in table E in the appendix. These results were used to plot the graphs shown below:

0 0.4 0.8 1.2 1.6 2 2.4 2.8 3.2 3.6 4 4.4 4.8 5.2 5.6 6 6.4 6.8 7.2 7.6 8 8.4 8.8 9.2 9.6 1010.4

10.811.2

11.6 120

1

2

3

4

Rooms Available Doctors Idle Nurses Idle Patients Waiting

Elapsed Time (Hours)

Figure 11 sixth run variable status

0 0.6 1.4 2 2.6 3.2 3.8 4.4 5 5.6 6.2 6.8 7.4 8 8.6 9.2 9.810.4 11

11.60

100

200

300

400

500

600

700

800

Cumulative Patient Wait Time Cumulative Doctor Idle Time Cumulative Nurse Idle Time

Tim

e (m

in)

Figure 12 fifth run cumulative idle times

As can be observed from figure 11, the amount of available rooms and idle doctors both cycled between zero and one, while the amount of idle nurses remained at one throughout most of the simulation. However, the number of patients awaiting treatment remained at zero through the whole duration.

Both the doctor and nurse idle time is on the increase, while the patient waiting time is non-existent. At the 12th hour, all 69 patients have been passed, and only 1 room was occupied by a nurse. It is worth noting that the simulation once again stopped admitting patients half way through the final hour due to their treatment time exceeding the 12th hour.

The sixth run indicates that this facility is almost perfectly optimized for handling a flow of 6 patients per hour, for this set of inputs. The patient throughput is maximized and patient wait time is minimized.

A final set of runs were conducted for the full 12 hours, to test for extra nurses or physicians.

The seventh run inputs tested for 1 less doctor and 1 less nurse:

Table G: seventh run input values

Rooms

Doctors

Nurses

Treatment Time (min)

Room Prep Time (min)

Patients per Hour

4 2 1 25 10 6

55 patients were passed, with 12 still awaiting treatment.

The eighth run inputs tested for only 1 less doctor:

Table S: seventh run input values

Rooms Doctors Nurses Treatment Time

(min)Room Prep Time

(min)Patients per

Hour4 2 2 25 10 6

55 patients were passed, with 12 still awaiting treatment.

The ninth and final run inputs tested for only 1 less nurse:

Table U: seventh run input values

Rooms Doctors Nurses Treatment Time

(min)Room Prep Time

(min)Patients per

Hour4 3 1 25 10 6

As with the sixth run, all 69 patients were passed. However, the cumulative nurse idle time decreased from 717 minutes (almost the full 12 hour duration) down to 41 minutes, while the cumulative patient wait time increased from zero to only 7 minutes. 2 rooms were occupied by 2 nurses at the end of the shift.

This final iteration provides a perfect set of conditions for the fictional facility in question.

AppendixThe 4 interface graphs should be here, starting with the one I sent through email and continuing in the presentation’s order

Data Tables for the optimization runs, Idle and wait times are in “minutes”:

Table Z: first simulation run data output

Rooms Available

Doctors Idle

Nurses Idle

Patients Waiting

Patients

Passed

Cumulative Patient

Wait Time

Cumulative Doctor Idle Time

Cumulative Nurse

Idle Time

Time Passed (Hours)

4 3 2 0 0 0 0 0 03 2 2 0 0 0 10 10 0.22 1 2 0 0 0 20 20 0.41 0 2 1 0 3 23 33 0.60 0 1 1 1 15 23 45 0.80 0 1 1 3 27 28 52 10 0 1 2 4 40 28 65 1.20 0 1 2 5 51 28 76 1.40 0 1 3 6 63 31 85 1.60 0 1 3 7 75 31 97 1.80 0 1 4 8 87 31 109 20 0 1 4 10 99 31 121 2.20 0 1 4 11 111 31 133 2.40 0 1 5 12 123 31 145 2.60 0 1 5 13 135 31 157 2.80 0 1 6 14 147 31 169 30 0 1 6 16 159 31 181 3.20 0 1 6 17 171 31 193 3.40 0 1 7 18 183 31 205 3.60 0 1 7 19 195 31 217 3.80 0 1 8 20 207 31 229 4

Table B: second simulation run data output

Rooms Available

Doctors Idle

Nurses Idle

Patients Waiting

Patients Passed

Cumulative Patient

Wait Time

Cumulative Doctor Idle Time

Cumulative Nurse Idle

Time

Time Passed (Hours)

4 3 1 0 0 0 0 0 03 2 1 0 0 0 9 9 0.22 1 1 0 0 0 21 21 0.40 0 0 0 1 3 23 33 0.60 0 0 0 2 8 25 33 0.8

0 0 0 1 3 19 30 33 10 1 0 2 5 31 37 33 1.20 1 0 2 6 43 44 33 1.40 1 0 3 7 55 51 33 1.60 0 0 2 8 67 57 33 1.80 0 0 3 9 79 62 33 20 0 1 4 11 92 68 33 2.20 0 1 4 12 103 75 33 2.40 1 0 5 13 115 82 34 2.60 0 0 4 14 127 88 34 2.80 0 0 5 15 140 94 34 30 0 0 6 16 151 99 34 3.20 1 0 6 18 163 106 34 3.40 1 0 7 19 176 113 34 3.60 0 0 6 20 187 120 34 3.80 0 0 7 21 199 125 34 4

Table Q: third simulation run data output

Rooms Available

Doctors Idle

Nurses Idle

Patients Waiting

Patients Passed

Cumulative Patient

Wait Time

Cumulative Doctor Idle Time

Cumulative Nurse Idle

Time

Time Passed (Hours)

4 3 2 0 0 0 0 0 03 2 2 0 0 0 9 9 0.22 1 2 0 0 0 21 21 0.40 0 1 0 1 3 23 33 0.60 0 1 0 2 8 25 42 0.80 0 1 1 3 17 28 52 10 0 1 1 5 27 28 64 1.20 0 1 1 6 39 31 73 1.40 0 1 2 7 51 33 83 1.60 0 1 1 9 63 33 95 1.80 0 1 2 10 75 36 104 20 0 1 2 12 87 38 114 2.20 0 1 2 13 99 38 126 2.40 0 1 3 14 111 41 135 2.60 0 1 2 16 123 43 145 2.80 0 1 3 17 135 44 157 30 1 0 4 19 147 47 166 3.20 0 1 3 20 159 49 176 3.40 0 1 4 21 171 49 188 3.60 1 0 4 23 183 53 196 3.80 0 1 4 24 195 54 207 4

Table H: fourth simulation run data output

Rooms Available

Doctors Idle

Nurses Idle

Patients Waiting

Patients Passed

Cumulative Patient

Wait Time

Cumulative Doctor Idle Time

Cumulative Nurse Idle

Time

Time Passed (Hours)

4 4 2 0 0 0 0 0 03 3 2 0 0 0 9 9 0.22 2 2 0 0 0 21 21 0.40 1 1 0 1 0 30 33 0.60 1 1 0 2 5 42 42 0.80 2 0 1 4 14 54 50 10 1 1 1 5 22 64 61 1.20 1 1 1 6 33 76 71 1.40 1 1 1 8 46 88 78 1.60 1 1 1 9 58 97 90 1.80 1 1 2 10 69 109 99 20 1 1 2 12 81 121 106 2.20 1 1 2 13 94 131 118 2.40 1 1 3 14 105 143 128 2.60 1 1 2 16 118 155 135 2.80 1 1 3 17 130 165 147 30 2 0 4 19 142 176 155 3.20 1 1 3 20 154 188 163 3.40 1 1 4 21 166 198 175 3.60 2 0 4 23 177 210 183 3.80 1 1 4 24 190 222 192 4

Table J: fifth simulation run data output

Rooms Available

Doctors Idle

Nurses Idle

Patients Waiting

Patients Passed

Cumulative Patient

Wait Time

Cumulative Doctor Idle Time

Cumulative Nurse Idle

Time

Time Passed (Hours)

4 3 2 0 0 0 0 0 03 2 2 0 0 0 9 9 0.22 1 2 0 0 0 21 21 0.41 0 2 0 0 0 26 33 0.60 0 1 0 2 1 28 44 0.80 0 1 0 3 2 29 54 10 1 0 1 5 3 31 64 1.20 0 1 0 6 5 33 75 1.40 0 1 0 7 6 35 85 1.60 0 1 0 9 10 37 95 1.80 0 1 0 10 12 38 106 20 0 1 1 11 15 40 116 2.2

0 0 1 0 13 19 42 126 2.40 0 1 0 14 22 44 137 2.60 1 0 1 16 27 45 147 2.80 0 1 0 17 32 47 157 30 0 1 1 18 36 49 168 3.20 1 0 1 20 44 52 177 3.40 0 1 0 21 48 52 188 3.60 0 1 1 22 55 54 199 3.80 0 1 0 24 62 57 208 40 0 1 1 25 67 58 219 4.20 0 1 1 26 76 59 230 4.40 0 1 0 28 84 62 239 4.60 0 1 1 29 91 63 250 4.80 1 0 1 31 101 65 260 50 0 1 1 32 109 68 270 5.20 0 1 1 33 119 68 281 5.40 0 1 0 35 129 71 291 5.60 0 1 1 36 139 73 301 5.80 0 1 1 37 149 73 313 60 0 1 1 39 160 77 322 6.20 0 1 1 40 172 78 332 6.40 0 1 1 41 183 79 334 6.60 0 1 1 43 195 82 353 6.80 0 1 1 44 207 83 363 70 1 0 2 46 219 85 374 7.20 0 1 1 47 231 87 384 7.40 0 1 1 48 243 89 394 7.60 0 1 1 50 255 91 404 7.80 0 1 1 51 267 92 415 80 0 1 2 52 279 94 425 8.20 0 1 1 54 291 96 435 8.40 0 1 1 55 303 97 446 8.60 1 0 2 57 316 99 456 8.80 0 1 1 58 327 101 466 90 0 1 2 59 339 103 477 9.20 0 1 1 61 351 105 487 9.40 0 1 1 62 363 107 497 9.60 0 1 2 63 375 108 508 9.80 0 1 1 65 387 110 518 100 0 1 2 66 399 112 528 10.20 1 0 2 68 411 113 539 10.40 0 1 1 69 423 115 549 10.60 0 1 2 70 435 117 559 10.80 1 0 2 72 447 119 569 11

0 0 1 2 73 459 120 581 11.20 0 1 2 74 471 122 590 11.40 0 1 1 76 483 125 600 11.60 0 1 1 77 495 125 611 11.81 1 1 0 79 501 130 623 12

Table E: sixth simulation run data output

Rooms Available

Doctors Idle

Nurses Idle

Patients Waiting

Patients Passed

Cumulative Patient

Wait Time

Cumulative Doctor Idle Time

Cumulative Nurse Idle

Time

Time Passed (Hours)

4 3 2 0 0 0 0 0 04 3 2 0 0 0 9 9 0.22 1 2 0 0 0 21 21 0.41 0 2 0 0 0 30 33 0.61 1 1 0 3 0 42 57 0.81 1 1 0 4 0 49 69 1.20 0 1 0 5 0 55 81 1.40 0 1 0 6 0 60 93 1.60 0 1 0 7 0 65 105 1.81 1 1 0 9 0 72 117 21 1 1 0 10 0 79 129 2.20 0 1 0 11 0 85 141 2.40 0 1 0 12 0 90 153 2.60 0 1 0 13 0 95 165 2.81 1 1 0 15 0 102 177 31 1 1 0 16 0 109 189 3.20 0 1 0 17 0 115 201 3.40 0 1 0 18 0 120 231 3.60 0 1 0 19 0 125 235 3.81 1 1 0 21 0 132 237 41 1 1 0 22 0 139 249 4.20 0 1 0 23 0 145 261 4.40 0 1 0 24 0 150 273 4.60 0 1 0 25 0 155 285 4.81 1 1 0 27 0 162 297 51 1 1 0 28 0 169 310 5.20 0 1 0 29 0 175 321 5.40 0 1 0 30 0 180 333 5.60 0 1 0 31 0 185 345 5.81 1 1 0 33 0 192 357 60 0 1 0 34 0 200 370 6.20 0 1 0 35 0 205 381 6.40 0 1 0 36 0 210 393 6.6

0 0 1 0 37 0 215 405 6.81 1 1 0 39 0 221 417 71 1 1 0 40 0 229 429 7.20 0 1 0 41 0 235 441 7.40 0 1 0 42 0 240 453 7.60 0 1 0 43 0 245 465 7.81 1 1 0 45 0 251 477 81 1 1 0 46 0 258 488 8.20 0 1 0 47 0 265 501 8.40 0 1 0 48 0 270 513 8.60 0 1 0 49 0 275 524 8.81 1 1 0 51 0 281 536 91 1 1 0 52 0 289 549 9.20 0 1 0 53 0 295 561 9.40 0 1 0 54 0 300 573 9.60 0 1 0 55 0 305 585 9.81 1 1 0 57 0 312 597 101 1 1 0 58 0 319 609 10.20 0 1 0 59 0 325 621 10.40 0 1 0 60 0 330 632 10.60 0 1 0 61 0 335 644 10.81 1 1 0 63 0 341 656 111 1 1 0 64 0 348 668 11.20 0 1 0 65 0 355 680 11.40 0 1 0 66 0 360 692 11.61 1 1 0 67 0 369 704 11.83 3 1 0 69 0 382 717 12

Real time simulation code:

The real time simulation was created using 001 game creator v.1.014.001

http://www.engine001.com

Graphical representation of software initiation (variable inputs): http://www.engine001.com/script/PtyxFE

Graphical representation of Timer ticks (every 0.1 seconds once simulation starts): http://www.engine001.com/script/xyp9ZR

Textual code of software initiation (variable inputs):

SET Actor("main").NonExistent = 1:g2MsgBox.Show("Welcome to the Automated Patient System Simulation.¶Please Input Number of Rooms:\T")

MsgBox.HideSET Rooms = MsgBox.InputIF Rooms <= 0 MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g2ELSE IF Rooms = Math.Multiply(Rooms, 1) IF Rooms = Math.Round(Rooms, 0) :g7 MsgBox.Show("Please Input Number of Doctors:\T") MsgBox.Hide SET Doctors = MsgBox.Input IF Doctors <= 0 MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g7 ELSE IF Doctors = Math.Multiply(Doctors, 1) IF Doctors = Math.Round(Doctors, 0) IF Doctors > Rooms MsgBox.Show("Number of Doctors greater than number of rooms." & "\Q" & "ok" & "\Q" & "Re-input number of Doctors") MsgBox.Hide IF MsgBox.SelectedNumber = 0 :g14 MsgBox.Show("Please Input Number of Nurses:\T") MsgBox.Hide SET Nurses = MsgBox.Input IF Nurses <= 0 MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g14 ELSE IF Nurses = Math.Multiply(Nurses, 1) IF Nurses = Math.Round(Nurses, 0) IF Nurses > Rooms MsgBox.Show("Number of Nurses greater than number of rooms." & "\Q" & "ok" & "\Q" & "Re-input number of Nurses") MsgBox.Hide IF MsgBox.SelectedNumber = 0 :g21 MsgBox.Show("Please Input Treatment Time in Minutes¶Note: please include doctor and patient travel time to room.\T") MsgBox.Hide SET Treatment_Time = MsgBox.Input IF Treatment_Time <= 0 MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g21 ELSE IF Treatment_Time = Math.Multiply(Treatment_Time, 1) IF Treatment_Time = Math.Round(Treatment_Time, 0) IF Treatment_Time > 300 MsgBox.Show("Treatment time cannot be more than 300 minutes.") MsgBox.Hide GOTO g21 ELSE IF Treatment_Time > 120 MsgBox.Show("Treatment Time is more than 2 hours." & "\Q" & "Ok" & "\Q" & "Re-input Treatment Time") MsgBox.Hide IF MsgBox.SelectedNumber = 0 :g30 MsgBox.Show("Please Input Room Preparation Time in Minutes¶Note: please include Nurse travel time to room.\T") MsgBox.Hide SET Room_Prep_Time = MsgBox.Input IF Room_Prep_Time <= 0 MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g30 ELSE IF Room_Prep_Time = Math.Multiply(Room_Prep_Time, 1) IF Room_Prep_Time = Math.Round(Room_Prep_Time, 0) IF Room_Prep_Time > 300 MsgBox.Show("Room Preparation cannot be more than 300 minutes.") MsgBox.Hide GOTO g30 ELSE IF Room_Prep_Time > 30 MsgBox.Show("Room Preparation is more than 30 minutes." & "\Q" & "Ok" & "\Q" & "Re-input Room Preparation Time") MsgBox.Hide IF MsgBox.SelectedNumber = 0 :g39 MsgBox.Show("Please Input Patient Arrivals Per Hour.¶Note: Patient arrivals will be distributed evenly throughout each hour.¶Note: Simulation runs for a 12 hour day.¶Note: Simulation does not admit patients whose treatment times will exceed 6 pm.\T") MsgBox.Hide SET PPH = MsgBox.Input IF PPH <= 0 MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g39 ELSE IF PPH = Math.Multiply(PPH, 1) IF PPH = Math.Round(PPH, 0) IF PPH > 600 MsgBox.Show("Patient Arrivals per hour must be 600 or below.") MsgBox.Hide GOTO g39 ELSE IF PPH > Math.Multiply(Rooms, 2) MsgBox.Show("Patient arrivals per hour is more than double the number of rooms" & "\Q" & "Ok" & "\Q" & "Re-input Patient Arrivals per Hour") MsgBox.Hide IF MsgBox.SelectedNumber = 0 :g48 SET Spawn("|this:1").Delay = Math.Divide(60000, PPH) SET Spawn("|this:1").Interval = Math.Divide(60000, PPH)

SET Spawn("|this:1").Count = Math.Multiply(PPH, 12) Interface("start").Show(1, 1, 1) MsgBox.Show("Variable Input Complete." & "\Q" & "Start Simulation" & "\Q" & "Re-input Variables") MsgBox.Hide IF MsgBox.SelectedNumber = 0 Interface("start").Show(0, 1, 1) Interface("sim running").Show(1, 1, 1) SET Spawn("|this:0").Paused = 0 SET Spawn("|this:1").Paused = 0 ELSEIF MsgBox.SelectedNumber = 1 Interface("start").Show(0, 1, 1) GOTO g2 ENDIF ELSEIF MsgBox.SelectedNumber = 1 GOTO g39 ENDIF ELSE GOTO g48 ENDIF ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g39 ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g39 ENDIF ENDIF ELSEIF MsgBox.SelectedNumber = 1 GOTO g30 ENDIF ELSE GOTO g39 ENDIF ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g30 ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g30 ENDIF ENDIF ELSEIF MsgBox.SelectedNumber = 1 GOTO g21 ENDIF ELSE GOTO g30 ENDIF ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g21 ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g21 ENDIF ENDIF ELSEIF MsgBox.SelectedNumber = 1 GOTO g14 ENDIF ELSE GOTO g21 ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g14 ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g14 ENDIF ENDIF ELSEIF MsgBox.SelectedNumber = 1 GOTO g7 ENDIF ELSE IF Doctors < Rooms MsgBox.Show("Number of Doctors less than number of rooms." & "\Q" & "ok" & "\Q" & "Re-input number of Doctors") MsgBox.Hide IF MsgBox.SelectedNumber = 0 GOTO g14 ELSEIF MsgBox.SelectedNumber = 1 GOTO g7 ENDIF ELSE GOTO g14 ENDIF ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g7 ENDIF

ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g7 ENDIF ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g2 ENDIF ELSE MsgBox.Show("Input must be a positive integer not equal to zero.") MsgBox.Hide GOTO g2 ENDIFENDIF

Textual code of Timer ticks:

IF Nurses > 0 SET Spawn("|this:4").Paused = 0 :g3 IF Patients > 0 SET Spawn("|this:2").Paused = 0 IF Rooms > 0 IF Doctors > 0 SET Spawn("|this:3").Paused = 0 SET Doctors = Doctors - (1) SET Patients = Patients - (1) SET Rooms = Rooms - (1) IF Patients > 0 SET Spawn("|this:2").Paused = 0 :g13 IF Doctors > 0 SET Spawn("|this:3").Paused = 0 :g15 Pause(Math.Multiply(Treatment_Time, 1000)) SET Patients_Passed = Patients_Passed + (1) SET Doctors = Doctors + (1) IF Doctors > 0 SET Spawn("|this:3").Paused = 0 :g20 IF Nurses > 0 SET Spawn("|this:4").Paused = 0 SET Nurses = Nurses - (1) IF Nurses > 0 SET Spawn("|this:4").Paused = 0 :g25 Pause(Math.Multiply(Room_Prep_Time, 1000)) SET Rooms = Rooms + (1) SET Nurses = Nurses + (1) IF Nurses > 0 SET Spawn("|this:4").Paused = 0 ELSE SET Spawn("|this:4").Paused = 1 ENDIF ELSE SET Spawn("|this:4").Paused = 1 GOTO g25 ENDIF ELSE SET Spawn("|this:4").Paused = 1 Pause(100) GOTO g20 ENDIF ELSE SET Spawn("|this:3").Paused = 1 GOTO g20 ENDIF ELSE SET Spawn("|this:3").Paused = 1 GOTO g15 ENDIF ELSE SET Spawn("|this:2").Paused = 1 GOTO g13 ENDIF ELSE SET Spawn("|this:3").Paused = 1 ENDIF ELSE :g38 IF Doctors > 0 SET Spawn("|this:3").Paused = 0 ELSE SET Spawn("|this:3").Paused = 1 ENDIF ENDIF ELSE SET Spawn("|this:2").Paused = 1 GOTO g38 ENDIFELSE SET Spawn("|this:4").Paused = 1 GOTO g3ENDIF

Interface design and idle/wait timer codes were omitted.