ComputationalModel |
To model the flow digram from Figure 1 we first abstract the delivery requests and request runs as Arena submodels. The submodel for requests only generate requests, so a single submodel with only an exit point is needed. The submodel for a delivery run has the load of deliveries as input and outputs the load of deliveries after the delivery run finishes, so it has a single entry and exit point. The following flash tutorial shows how to add the appropriate submodels in Arena:
Adding submodels for Courier Model
Next, we want queues that store delivery entities until a delivery run occurs. The next flash tutorial shows how to add a Hold module and a Variable to implement this queue for Inner City deliveries:
Adding waiting queue for Courier Model
Next, we want to create logical entities to take care of triggering delivery runs if the oldest delivery request has waited long enough. Each time a delivery request comes in and there are no other deliveries waiting we note down its arrival time and create a timing entity using a Delay module. When the timing entity leaves the system a calendar event will be generated. We will see how this calendar event is used later. The following flash tutorial shows how to create the timing entity for the Inner City deliveries:
Adding timing entity to Courier Model
Next, we create logical entities to trigger a delivery if:
- The amount of time since the oldest delivery arrived has reached the maximum time;
- The number of deliveries waiting has reached the maximum load.
The arrival of a new delivery creates a calendar event, as does the disposal of the timing entity created just before. Hold modules will scan the simulation state each calendar event, so we can use one of these to trigger a delivery. We will use a second Hold module to delay the logical entity until the deliveries have been loaded, it will then wait until the next trigger event:
Adding trigger entity to Courier Model
Now that we can trigger the loading of a delivery run, we want to combine all the deliveries into a single load, finish loading and make a delivery run. Once the run is finished we want to separate the deliveries and let them leave the system:
Adding deliveries to Courier Model
Now the logic of the model is complete except for the arrivals and delivery runs. You complete model should look like that in Figure 2.
Figure 2 Courier Model with complete logic
To start off with we will try some simple distributions. Use exponential interarrival times with mean 10 minutes and 20 minutes for Inner City and Metropolitan delivery requests (make sure to use EXPO(10) and EXPO(20) for the first arrival times too). We will use triangular distributions with min, mode and max of 10, 15, 20 and 25, 45, 90 for Inner CIty and Metropolitan delivery runs respectively. Add the appropriate Create and Process modules to your submodels. Connect them to the appropriate entry and exit points. Finally, make sure you have an infinite number of couriers by editing the capacity of your Resources.
Now run your model for 50 replications. Each replication should run for 8 hours (i.e., 1 day of the courier operation) and the Base Time Units are minutes.
Debugging
You should notice that your model appears to "stall". If you look carefully you will see the logic entity that triggers Inner City delivery runs in an infinite loop. This happens because our hold condition is not quite correct. We rely on a request arriving and resetting the oldest delivery time. However, this does not happen before the truck is loaded, so the initial trigger hold does not work. We need to wait for a delivery after we load the truck. By adding an extra condition to the timing trigger, we can fix the problem. Figure 3 shows this extra condition, that the delivery queue must have at least one delivery AND that the oldest delivery has been there for too long for a delivery run to take place.
Figure 3 Extra condition for timing trigger
After debugging and re-running you model you should get some output such as 0.5782 Inner City couriers being used on average and 18.84 Inner City delivery runs on average. However, we are just using some very crude estimates of input data to verify our model.
You can also use animation to check your model, such as animating queues and times to make sure the maximum load and maximum time restrictions are enforced. You can visualise the utilisation of the couriers and the number of each type of courier on the road at any one time:
Adding animation to Courier Model
Finding Input Distributions
As discussed previously, the courier company has recorded data on their delivery requests and delivery runs. This data is given courier.xls.
We can use Arena's built-in Input Analyzer to determine distributions that fit the data well. First, we need to break the data up into separate text files as shown in Figure 4.
Figure 4 Splitting data into text files
Then, we can use the Input Analyzer:
Analysing Inner City delivery requests
The Input Analyzer uses the Chi Square and Kolmogorov-Smirnov goodness-of-fit tests to detremine which distributions fit best.
Once you have determined the best distributions, you can cut-and-paste their expressions into the appropriate submodels and run your simulation model again. Some results are shown in Figure 5.
Figure 5 Results after input analysis
|