Initial Data:
Imagine you need to simulate performance of a gas station. There is a 5 cubic meters petrol storage tank there. On average, each car is refueled with 20 liters.
We know the distribution of the number of incoming customers per day and it is known that 600 cars arrive at the gas station per day.
It is also known that as soon as less than 1000 liters remain in the gasoline storage, we should do some actions to refill the storage with gasoline. The refilling process takes 1 hour and exactly in an hour a new portion of gasoline in the amount of 4000 liters is poured into the gasoline storage tank and is ready for further distribution.
1. Add 2 objects to the "Functional objects" repository and name them Gasoline and Fuel Dispenser. Define their properties as you see in Figures 1 and 2.
2. Design the "Serve a customer" process diagram (Figure 3):
Design the "Refill the storage tank" diagram (Figure 4):
As a result, you should get the following structure in the "Activities" repository in the Explorer (Figure 5):
3. Create an Event instantiation model for the "Customer arrived" start event ("Events" repository object Properties Window → Simulation properties tab → Event instantiation model tab). See Figure 6 for details:
The Interval settings are the same for all 3 models (Figure 7):
See Figure 8 for the settings of the Distribution property value for the 1st model:
See Figure 9 for the settings of the Distribution property value for the 2nd model:
See Figure 10 for the settings of the Distribution property value for the 3rd model:
As a result, when you click on the Simulate event instance activations hyperlink, you get the following picture (Figure 11):
4. Setup properties of the "Refuel a car" activity ("Activities" repository object Properties Window → Simulation properties tab). See Figure 12 for details:
5. Setup properties of the arrow that follows the XOR gateway (Figure 3). The second arrow that follows the XOR gateway, is a Default sequence flow, and you don’t need to fill out its properties.
6. Setup properties for the "Pour gasoline into the tank" activity in accordance with the Figure 14:
7. Run simulation of the "Serve a customer" and "Refill the storage tank" processes. Setup the properties of the Simulation Properties Window in accordance with the Figure 15:
First of all, you need to run the simulation. Go to the Variables tab of the Simulation progress window to see the change of the "Quantity" system variable of the "Gasoline" object (Figure 16):
You see that the value of the "Quantity" variable is rather big. And that’s the result we get at the end of the simulation period.
To find out the reason for it, go to the Activities tab. Note that the number of the "Pour gasoline into the tank" task instances is rather big as well (Figure 17).
Now close the Simulation progress window and go to the Simulation Properties Window to continue the analysis. Click on the Variables statistics hyperlink and analyze the dynamics of the "Quantity" variable values (the "Gasoline" object):
Now we need to find out the reason of the frequent activation of the "Pour gasoline into the tank" task.
In fact, we haven’t thought through the conditions of moving to the next step of the "Serve a customer" process instance in the branching point (see Figure 3). According to the conditions we have defined, as soon as the value of the "Quantity" variable becomes less than 1,000, each new instance of the "Serve a customer" process activates the "Refill the storage tank" task instance. But it doesn’t reflect the reality. The "Refill the storage tank" task should be activated only once. And while this task is performed it should not be activated any more.
Let’s change our simulation model.
Let’s add one more variable for the "Gasoline" object (Figure 19):
Next, we edit the "Report the need to refuel the storage tank" activity properties. Open the Operations on variables tab (on the Simulation properties tab in the activity Properties Window) and add an operation there (Figure 20):
Now we add one more operation on the same variable to the Operations on variables tab of the "Pour gasoline into the tank" activity (Figure 21):
Open the Properties Window of the arrow that follows the XOR gateway in the "Serve a customer" process diagram and add one more condition there (Figure 22):
Thus, we have modified the model. Now as soon as the value of the "Quantity" variable of the "Gasoline" material resource is less than 1,000 liters, the "Refill the storage tank" process is activated and the "Refill storage tank checkbox" variable value changes. New instances of the "Refill the storage tank" process are not activated until the "Refill storage tank checkbox" variable value becomes 0 again.
Let’s run the simulation again with all the same settings as before.
Again, we analyze the change of the "Quantity" variable during the simulation period. Use the Variables tab in the Simulation progress window for it (Figure 23):
Now let’s open the Activities tab to find out the number of the "Refill the storage tank " process completed instances. Note that the number has significantly decreased (Figure 24):
The dynamics of the "Quantity" variable change can be also seen in the Simulation Properties window by the Variable statistics hyperlink (Figure 25):
You see that "unwanted" instances of the "Refill the storage tank" process are not activated. Chronology of each process instance can be seen in the Process chronology window (Figure 26):
If you open the Variable statistics window and analyze the changelog, you will see that some instances of the "Refuel a car" task instance tried to modify the "Quantity" variable value instance, but failed, because the variable value was equal to its minimum value (Figure 27):
Let’s analyze chronology of the 201st instance of the task (Figure 28). The number of the "Serve a customer" process instances equals the number of the "Refuel a car" process instances; thus, the regarded task instance has the same number as the process instance in the Variable statistics window.
Remember that there is the following order of events that happen to the task instance when it is activated:
Now let’s analyze the statistical data taking statistics of the "Serve a customer" process as an example (Figure 29):
Open the Duration histogram of the "Serve a customer" process (Figure 30):
See Figure 31 for the Queue time histogram of the "Serve a customer" process. It shows the time spent by process instances in the queue of the Fuel Dispenser work resource.
And see Figure 32 for the Time of waiting for material resources histogram of the "Serve a customer" process. It shows the time spent by process instances waiting for the sufficient amount of the Gasoline material resource: