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 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.
- Drag the Oval element from the Presentation stencil into the graphical editor (right in the place shown in the figure below).
- Double-click on the Polyline element in the palette so as its icon should turn into . 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.
- 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).
- Drag the Rectangle element in the Presentation stencil into the graphical editor. Place it between the queue path and the ATM oval.
- 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
- 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 queue animation. To animate a queue, just specify the queue path. Therefore, set polyline as the Animation guide shape.
- Set oval as the Animation guide shape.
- 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.
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.Last modified on 1 August 2009, at 14:18