Simulation with AnyLogic/Discrete Event Simulation/Bank Model/Step 6. Adding tellers

From Wikibooks, open books for an open world
< Simulation with AnyLogic‎ | Discrete Event Simulation‎ | Bank Model
Jump to navigation Jump to search

Step 6. Adding Tellers

Now we will create another part of the system by adding tellers that are working at the bank. Now some clients will come to see tellers, some – to access the ATM. We can model tellers using delays in the same way as we modeled ATM. However, modeling tellers using resources is much more convenient. Resource is a special unit that can be possessed by entity. Only one entity can possess a resource at a time; therefore entities compete for resources.

Step 1. Creating a new model1.gif Modify the flowchart

  1. Add Service object.
    Step 6. Adding tellers 1.png
    Service seizes resource units for the entity, delays the entity, and releases the seized units.
    Modify the object properties:
    • There is one queue for all tellers. Set up Queue capacity to be of 20 places.
    • We assume that service time is triangularly distributed with the min value of 2.5, average value of 6, and the max value of 11 minutes. Set Delay time: triangular( 2.5, 6, 11 )
      Step 6. Adding tellers 2.png
  2. Add ResourcePool object. ResourcePool object is storage for resource units. It should be connected to resource seizing and releasing objects (Service in our case). So connect it to the lower port of the service object.
    Step 6. Adding tellers 3.png
    Name the object tellers. Specify that this resource object has only four resource units: define its Capacity: 4
    Step 6. Adding tellers 4.png
  3. Place SelectOutput object. SelectOutput object is a decision making block. The entity arrived at the object is forwarded along one of two output ports depending on the user-defined condition.
    Leave the default object properties. The entity routing condition randomTrue(0.5) defines that the number of customers competing for ATM and teller service will be approximately equal.
    Connect selectOutput and service to other objects as shown in the figure:
    Step 6. Adding tellers 5.png

Since the model changed, we need to alter the model animation as well.

Step 1. Creating a new model1.gif Modify the animation

  1. Draw a polyline to animate the waiting customers queue. Draw it from left to right. Name the polyline queueBeforeTellers.
    Step 6. Adding tellers 6.png
  2. Draw a polyline with four points to the right of queueBeforeTellers. This polyline will indicate where teller animations are placed. Name it tellerPlaces.
    Step 6. Adding tellers 7.png

Now we will animate our tellers by defining two images representing tellers being idle and busy. AnyLogic will automatically switch between these images when the resource unit becomes seized and released.

Step 1. Creating a new model1.gif Animate tellers

  1. Drag Image from the Presentation stencil to the place shown in the figure with a blue crossed rectangle.
    Step 6. Adding tellers 8.png
  2. Go to the Properties of the image shape. Name the image busyTeller.
  3. Define the image that this shape will display. Use Add Image button to add Teller Busy.png. You can find this file in the folder where Billing Department sample model is located (somewhat like <AnyLogic folder>\plugins\com.xj.anylogic.examples.<build number>\models\Billing Department).
    You will see the added image in the preview area.
    Step 6. Adding tellers 9.png
  4. Select the Original Size check box. If Original Size option is not selected, the picture is shown to fit the rectangle of the image shape, and otherwise the picture is shown without any distortions.
  5. Create one more image to show relaxing teller. Name it idleTeller and choose Teller Idle.png as the image displayed by this shape.

Now we will animate the flowchart by setting up animation properties of the flowchart objects.

Step 1. Creating a new model1.gif Animate the model logic

  1. Now we need to animate customers queue. Therefore, modify the service properties:
    • Set queueBeforeTellers as Animation guide shape (queue)
      Step 6. Adding tellers 10.png
  2. To animate tellers, modify the tellers properties:
    • Specify tellerPlaces as Animation guide shape
    • Choose Set as Animation type
    • Set idleTeller as Idle unit animation shape
    • Set busyTeller as Busy unit animation shape
      Step 6. Adding tellers 11.png

In the current model the number of tellers is fixed. However, we may need to vary it dynamically at the model run time. AnyLogic provides a set of controls enabling changing the model parameters. Now we will add a slider to vary the number of tellers at run time.

Step 1. Creating a new model1.gif Add a slider to vary the number of tellers

  1. Add a slider. Open the Controls stencil of the Palette and drag the Slider element from there into the graphical editor. Place it below our ResourcePool object to let the user know that this slider will vary the capacity of this particular object.
    Step 6. Adding tellers 12.png
  2. We want to vary the number of tellers in the system from 0 to 4. Therefore, set 4 as slider’s Maximum value.
  3. Type tellers.capacity as the slider's Default value.
  4. Specify tellers.set_capacity((int)value); as slider's Action.
    Step 6. Adding tellers 13.png

Run the model. You can see tellers being animated with our images. Now you can change the number of tellers with the slider. Therefore, you can see how many tellers you need for the specific customer arrival rate.

Step 6. Adding tellers 14.png