Simulation with AnyLogic/Discrete Event Simulation/Bank Model/Step 3. Creating a model animation

''' Step 3. Creating a Model Animation '''

Although the flowchart is animated, you may want to see the actual bank department layout animated. That is also possible! For each model you can create an animation to visually represent your model. You can create any animation you want. Now we will draw the layout consisting of the ATM and a queue. Then we will animate clients standing in the queue and using the ATM. We also want to visualize the current status of the ATM.

Now we will draw the layout of our bank. You draw the layout on the same diagram where you draw a flowchart. However, if you have existing image of the layout, you can simply import this picture as the bank layout instead of drawing it by yourself.

Draw an oval to depict the ATM
 * 1) Draw ATM as an oval. First, open the Presentation stencil of the Palette view. This stencil contains shapes and controls you can add on your presentation. To open some stencil of the Palette view, just click on the corresponding tab of the view.
 * 2) Drag the Oval [[File:Step 3. Creating a model animation 1.gif]] element from the Presentation stencil into the graphical editor (right in the place shown in the figure below). [[File:Step 3. Creating a model animation 2.png]]

Draw a polyline to depict a queue to ATM
 * 1) Double-click on the Polyline [[File:Step 3. Creating a model animation 3.gif]] element in the palette so as its icon should turn into [[File:Step 3. Creating a model animation 4.gif]]. Now you can draw a polyline point by point: subsequently click at each polyline point on the diagram and double-click to place the end point and finish drawing.
 * 2) Draw queue path as shown in the figure below. Please place the starting point (indicated in editing points mode with bold point inside) at the left, since by default entities will start waiting in a queue at polyline's end point (near ATM oval). [[File:Step 3. Creating a model animation 5.png]]

Draw a rectangle to indicate a status of the ATM
 * 1) Drag the Rectangle [[File:Step 3. Creating a model animation 6.gif]] element in the Presentation stencil into the graphical editor. Place it between the queue path and the ATM oval. [[File:Step 3. Creating a model animation 7.png]]
 * 2) Set up some properties for the ATM drawn. Click the Dynamic tab of the Properties view to open dynamic properties of the rectangle. Type run-time color expression for the shape in the rectangle's Fill Color dynamic property: ATM.size > 0 ? red : green [[File:Step 3. Creating a model animation 8.png]]
 * 3) Note that ATM here is the name of the Delay object we created. The expression determines the rectangle color at run time. The size function returns the number of entities currently being processed. The color will be red, if a customer is served at this time, and green otherwise.

Now we are ready to animate the layout. This is done by setting up the animation properties for the logic flowchart objects. To modify properties of the object, first open its properties in the Properties view by clicking on the object in the graphical editor or in the Project view.

Set up animation for queue
 * 1) Set up queue animation. To animate a queue, just specify the queue path. Therefore, set polyline as the Animation guide shape. [[File:Step 3. Creating a model animation 9.png]]

Set up animation for ATM
 * 1) Set oval as the Animation guide shape.
 * 2) Change Animation type to Single. Many objects of the Enterprise Library support several animation styles. For example, a queue can show its contents like a line of items, a disordered heap of items, arranged items, and so on. For more information on animation styles please refer to Enterprise Library Reference Guide, Animating Enterprise Library Objects help topic. In this case, the ATM will be animated by a single animation of a customer being served. [[File:Step 3. Creating a model animation 10.png]]

Now you can run the model and observe its behavior. If you want to speed up the simulation significantly, switch to virtual time mode by clicking the Toggle real/virtual time mode toolbar button. Switching to virtual time mode allows you to view simulation run at its maximum speed. Therefore, you can simulate a long period of time.

Note that when the ATM station is serving a customer, it becomes red, and when it is idle, it is green.