Lecture_Modelling in AnyLogic
Lecture_Modelling in AnyLogic
4. Drag a Queue block from the PML on to the graphical editor and
then release the mouse button so it is near the Source block.
5. On the Properties tab, select the Maximum capacity checkbox
to set its capacity to infinite.
Building the flowchart process of one line and
one seller (without an explicit resource)
6. Drag a Delay block from the PML onto the graphical editor
▪ Keep the default delay time distribution: a triangular distribution
with a minimum of 0.5, maximum of 1.5 and mode of 1 second.
▪ The delay’s default capacity is 1: serve one customer at a time.
▪ This is the same as having one ticket seller in the booth
Building the flowchart process of one line and
one seller (without an explicit resource)
7. Drag a Sink block from the PML onto the graphical editor
8. In the Projects panel (on the left), select the Simulation experiment
in your model.
9. In the Properties panel (default on the right) that displays, under
Model time, set the Stop time to 3600 (one hour, in seconds)
Building the flowchart process of one line and
one seller (without an explicit resource)
10. On the Properties panel, in the Randomness area, make sure the
random number generation (RNG) is set to Fixed seed
Building the flowchart process of one line and
one seller (without an explicit resource)
11. Run the simulation experiment, setting the time speed to virtual
mode; wait until the one‐hour process (in simulation time) is complete
12. Click the source, queue, and delay blocks to open their inspection
windows
Run 1
Run 2
Run 3
Building the flowchart process of one line and
one seller (without an explicit resource)
# # Arrivals Queue Length at time = 1hr Average queue length
Run 1 7202 3599 1817.187
Run 2 7315 3703 1864.164
Run 3 7097 3478 1754.625
Run 1
Run 2
Run 3
𝑳𝒒 has reduced to
39.44. 26.3 & 24.12
Building the flowchart process of one line and
one seller (without an explicit resource)
▪ Here 𝜆 = 𝜇 (2 customers/second)
▪ Question # 1: why is our “average queue length > zero” ?
▪ The answer lies in variability.
▪ We know 𝜆 =2 customers/second
▪ After 100 seconds, expected number of arrivals is 200
▪ However, actual (realized) value might be 198, 200, 205, or 210
▪ The same is true for the service time
▪ Although 𝜇 =1, the actual value for each transaction might differ
Building the flowchart process of one line and
one seller (without an explicit resource)
▪ The answer depends on the time the delay overflows into the
queue.
▪ Build up effect in beginning has greater effect than at the end
▪ Another important factor is Utilization of a server.
▪ For 1 server, Utilization was straight forward (100 %)
▪ For 2 servers, we need to change our modelling approach.
Modifying the process flowchart (two explicit
resource units)
▪ Click Save As to save a copy with a different name
▪ To modify the model, do the following:
1. Delete the Queue block.
2. Drag a Seize block from the PML on to the graphical editor, and
then release the mouse button to place it before the Delay block.
3. Add a Seize block before and a Release block after the Delay.
4. Add a ResourcePool and set its capacity to 2 to represent two
sellers.
5. Click the Seize block and do the following:
a. Change Seize policy to units of the same pool.
b. Select the ResourcePool block in the resource pool drop‐down
menu.
c. Check the Maximum queue capacity checkbox to set the
embedded queue’s capacity to infinity
Modifying the process flowchart (two explicit
resource units)
5. Click the Delay block and check the Maximum queue capacity
checkbox to make sure the delay doesn’t limit the entities the
resources can serve in parallel
menu.
This setting makes the ResourcePool capacity the controlling
constraint and sets the number of parallel servers.
Modified model with explicit resources
Modifying the process flowchart (two explicit
resource units)
▪ We’re ready to run the modified model and compare the outputs
▪ The original (implicit) model’s Queue block has an internal
statistics object that automatically records the queue’s length.
▪ The embedded queue inside the Seize block doesn’t have an
internal statistics object.
▪ We can’t monitor the average queue length without manually
adding it to the model.
▪ In the modified model, we can see the utilization of resource units.
▪ Utilization of two sellers were 99%, 97%, and 99%.
▪ A persistent high utilization of a resource is a sign the resource is
near its capacity
Run 1
Run 2
Run 3
Modifying the process flowchart (two explicit
resource units)
▪ A persistent high utilization of a resource is a sign the resource is
near its capacity
▪ A good chance the lack of resources will slow or block the system
▪ Blocked or Slow points (bottlenecks) limit the flow of entities in a
process
▪ Sellers are working at max capacity (only having 1‐2% idle time)
▪ We can add 1 more resource.
▪ Utilization dropped below 70% and people were served with almost
no line!
Run 1
Run 2
Run 3
Modifying the process flowchart (two explicit
resource units)
Some Important Questions to Ask:
1. Can we predict the system’s behavior before we run the
simulation? Is there an analytical solution for our problem?
2. How long should the simulation run? Will the model show similar
behavior if it runs longer?
3. Besides the average queue length, which metrics should we use
to gauge system performance?
4. How do some metrics influence others? Can we use one metric to
estimate another?
5. How should we handle the randomness in the simulation outputs?
We saw each run’s output was different. How can we be confident
about our claims when the outputs are random? Were three runs
enough to claim the other runs will be similar?
6. Are there archetype queueing systems we can learn from?
M/M/1/∞/∞
M/M/2/∞/∞
Queue with Truncation (Capacity=9)
Queue with Truncation (Erlang Loss)
M/M/c/∞/d (finite‐source queues)
M/M/c/∞/d (finite‐source queues)
M/M/c/∞/d (finite‐source queues)