MANG 6059 Healthcare Modelling Practical Simul8 Simulation Workshop 2014 The arrival rate of…

MANG 6059 Healthcare Modelling

Don't use plagiarized sources. Get Your Custom Essay on
MANG 6059 Healthcare Modelling Practical Simul8 Simulation Workshop 2014 The arrival rate of…
For as low as $13/Page
Order Essay

Practical Simul8 Simulation Workshop 2014

The arrival rate of emergency patients to many healthcare delivery services often varies substantially by time. Table 1, for example, represents the hourly arrival rates of patients at an accident and emergency department over the course of a day. Such arrival processes usually fit a non-homogeneousPoisson process, which is a Poisson process whose parameter varies by time.

Table 1. Hourly arrival rate and number of doctors on duty

Hour

Arrival Rate

Number

of Doctors

1

2.15

2

2

1.60

2

3

1.33

1

4

1.06

1

5

1.27

1

6

1.04

1

7

1.79

2

8

5.00

4

9

6.04

5

10

8.88

7

11

10.77

9

12

10.35

8

13

10.46

8

14

10.33

8

15

8.35

7

16

8.21

7

17

8.04

7

18

7.81

6

19

8.13

7

20

9.19

7

21

6.69

6

22

5.58

5

23

4.81

4

24

3.04

3

In simulating systems with non-homogeneous Poisson arrivals it is quite essential that the average number of arrivals generated by the model in each hour is close to the given rates. Simulation practitioners use various approaches to achieve this. Two famous approaches are explained below:

– The first approach is what people naturally do for modelling time-dependent distributions. Inter-arrival times are simply generated using an Exponential distribution whose parameter depends on the current hour of the day in the simulation model.

– The second approach is called thinning and is based on an acceptance-rejection method. The idea behind thinning is to generate a Poisson arrival process at the fastest rate, but accept or admit only a proportion of arrivals, thinning out just enough to get the desired time-varying rate. The generic algorithm given below produces values, the arrival time of theth customer:

Step 1: let be the maximum of the arrival rate function over a cycle of length, and set and.

Step 2: Generate an inter-arrival time from the Exponential distribution with rateand set.

Step 3: Generate a random number from distribution. If then set and.

Step 4: Go to Step 2.

Your task is to compare the two approaches explained above by simulating the system given below.

Suppose patients arrive at an accident and emergency department according to a non-homogenous Poisson process with hourly rates given in Table 1. Upon arrival, each patient sees a doctor, who takes an exponentially distributed time with mean 40 minutes. For simplicity assume that after the doctor consultation all patients will be discharged home. The number of doctors on duty in the department in each hour of a day is given in the third column of Table 1.

You need to simulate the above system for 1000 days (no warm-up period) with the Simul8 package, using the two approaches explained earlier. Compare the results produced for the following measures:

· Average number of patients coming into the system in every hour of a day.

· Average waiting time of patients before being seen by a doctor, as a function of their arrival hour to the department.

The first approach is implemented as below:

1- Build the layout of the model as below. Change the title for the Work Entry Point and Work Center to ‘Arrival’ and ‘Service’, respectively.

2- Define a Resource called ‘Doctor’ and assign it to the Service Work Center.

3- Set Travel Distance to zero (File -> Preferences -> Distance -> Set to Zero).

4- Set Clock Properties as below (Data_Rules -> Properties)

a. Time Units: minutes

b. Time format: Time & Day

c. Days per week: 7

d. Start Time Each Day: 00:00

e. Duration of day: 24:00

f. Results Collection Period : 1440000 (1000 days in minutes)

5- Define the following global data items in the Information Store (see the Data_Rules tab)

a. Hour (Number): We store the current hour of the current day of the simulation in this variable. We will ask Simul8 to update it every 60 minutes later in Step 13 using Time Check Visual Logic. Set ‘On Reset’ value of this variable to 1.

b. MeanIAT (Number): Every time a new arrival needs to be generated, we set this variable to the arrival rate of the current hour of the simulation.

c. LoopIndex(Number): We use this in our loop calculations later in Step 13.

6- Define four Spreadsheet global data items in the Information Store as follows (see the Data_Rules tab)

a. ‘ArrivalRate’: to store the hourly arrival rate of patients given in Table 1.

b. ‘NumberOfDoctors’: to store the hourly number of doctors given in Table 1.

c. ‘TotalArrivals’: to tally simulated hourly arrivals into the system.

d. ‘TotalWaitingTime’: to tally patients’ waiting times in terms of their arrival hour.

Notice that the first two of above variables are input variables, i.e. we set their values before running the model, and the two remaining ones are output variables, i.e. we get Simul8 to update them as the simulation is run.

7- Enter the values for ‘ArrivalRate’ and ‘NumberOfDoctors’ using Table 1. (see Data_Rules -> Spreadsheets -> desired variable.) For each variable, enter the values in Column A. You can use ‘Copy’ and ‘Paste’ buttons below the ‘Help’ button.

8- Define two labels (Data_Rules -> Labels -> New), ‘ArrivalTime’ and ‘ArrivalHour’, where the former refers to the exact time of each arrival and the latter to the hour of day of each arrival.

9- Define a new distribution as follows:

a. Click on the Distributions menu on the Data-Rules tab,

b. Press ‘New’, type ‘ArrivalDistribution’ in the box, choose ‘Named distribution’, and press ‘Next’,

c. Select ‘Exponential’ from the distribution list,

d. Type ‘MeanIAT’ in the Average box,

e. Press the ‘Presample Visual Logic’ and type the code below:

SET MeanIAT = 60*[1/ArrivalRate[1,Hour]]

The above code means that the parameter of the Exponential distribution (MeanIAT) is set to the arrival rate of the current hour (Hour) of the system operation.

10- Open the Dialog of the Arrival Work Entry Point and do the following steps:

a. Set the Distribution to ‘Arrival Distribution’.

b. Use ‘Label Action’ to set ‘ArrivalTime’ and ‘ArrivalHour’ labels to ‘Time Stamp’ and ‘Hour’, respectively.

11- Press ‘VL On Exit’ button in the storage bin (queue) Visual Logic tab and type the following code (try to understand the code):

SET TotalWaitingTime[1,ArrivalHour] = [TotalWaitingTime[1,ArrivalHour]+Simulation Time]-ArrivalTime

SET TotalArrivals[1,ArrivalHour] = TotalArrivals[1,ArrivalHour]+1

12- Open the dialog for Service Work Center and set the ‘Distribution’ to Exponential, ‘Average’ to 40, and ‘Replicate’ to the maximum number of doctors available which is 9.

13- At this stage, we need to write 3 pieces of Visual Logic code: ‘On Reset’, ‘Time Check’ and ‘On End Run’ as below:

o Select ‘On Reset’ from Time-Based menu on the Visual Logic ribbon and type the following code:

Clear Sheet TotalWaitingTime[1,1]

Clear Sheet TotalArrivals[1,1]

SET Doctor.Max Available = NumberOfDoctors[1,1]

Note that, in contrast with numeric variables, Simul8 does not reset the values of spreadsheet variables when you reset or re-run the model. So we need to clear all output spreadsheet variables using the first two lines of the code above.

o Select ‘Time Check Properties’ from the ‘Time Check’ menu on the Visual Logic ribbon and set ‘First time check’ to 60 and’ Time interval’ to 60.

o Select ‘Time Check ’ from the ‘Time Check’ menu on the Visual Logic ribbon and type the following code (note the ‘if’ hierarchy):

SET Hour = Hour+1

IF Hour = 25

SET Hour = 1

SET Doctor.Max Available = NumberOfDoctors[1,Hour]

o Select ‘On End Run’ from Time-Based menu on the Visual Logic ribbon and type the following code (note the ‘loop’ hierarchy)

LOOP 1 >>> LoopIndex >>> 24

SET TotalWaitingTime[1,LoopIndex] = TotalWaitingTime[1,LoopIndex]/TotalArrivals[1,LoopIndex]

SET TotalArrivals[1,LoopIndex] = TotalArrivals[1,LoopIndex]/1000

TotalWaitingTime[1,i] now represents the average waiting time of patients arriving during the ith hour before being seen by a doctor, andTotalArrivals[1,i] represents the average number of patients coming into the system during the ith hour.

Make sure that you understand the code above. Now run the model and see the results.

Coursework Question – worth 40% of the total mark for this unit

Implement the second approach, the thinning method, and compare the results with the first one. You need to include the results obtained for both measures defined above (use diagrams if necessary) using the two approaches, and explain which of the two approaches produces more reasonable results and give reasons for this.

Attachments: