Font size

Phase 2. Creating 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.

Adding space markup shapes

Set up space markup for the ATM

  1. Draw the ATM as a point node. First, open the  Space Markup palette  in the  Palette view .
  2. Drag the  Point Node element from the  Space Markup palette into the graphical editor and place it under the flowchart.

  3. Select the point node in the graphical editor to open its  Properties view . Enter the expression that will allow to change the color of the shape at runtime in the Color property:
    ATM.size() > 0 ? red : green
    ATM here is the name of the  Delay block we created. The expression determines the point node color at run time. The size() function returns the number of agents currently being processed. The color will be red, if a customer is being served at the moment, and green otherwise.
  4. Click the ATM block in the flowchart to open its  Properties view.
  5. In the Agent location option select the point node that you have drawn previously. You can either click the down arrow and select the point node from the list of appropriate space markup elements, or you can click the button, located on the right, to select this space markup shape from the graphical editor (the rest of the elements in the editor will be greyed out).

Set up space markup for the queue

  1. Draw the queue as a path. First, open the  Space Markup palette in the  Palette view.
  2. Double-click the  Path element in the palette. A pencil icon will appear next to it, which means that you have switched to the drawing mode.
  3. Click in the graphical editor to put the first point of the path. Do more clicks to add turning points. Finish drawing with a double-click.

  4. Click the queue block in the flowchart and go to its  Properties view.
  5. In the Agent location option select the path you have drawn previously. You can either click the down arrow and select the path from the list of appropriate elements, or you can click the button, located on the right, to select this space markup shape from the graphical editor (the rest of the elements in the editor will be greyed out).

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  Run as fast as possible (virtual time mode) control. Switching to virtual time mode allows you to view simulation run at its maximum speed. Therefore, you can simulate a long period of time.

Adding 3D animation

Both of the elements we have drawn by default are shown in 2D and 3D. You can check this property in the Advanced section of their properties view. Now we want to create 3D animation for our model.

First of all you should add 3D window on the diagram of your agent type.

 3D Window plays the role of a placeholder for 3D animation. It defines the area on the presentation diagram where 3D animation will be shown at runtime.

Add 3D window

  1. Drag the  3D Window element from the 3D section of the  Presentation palette to the graphical editor.
  2. The grey area will appear on the screen. Locate it where you want your 3D presentation to be shown at the model runtime:

Now you can run your model and observe simple 3D animation.

When you create a 3D window, AnyLogic adds a view area that allows you to easily navigate to the 3D view at runtime. To switch to this 3D view while the model is running, open the developer panel by clicking the Developer panel control in the right corner of the control panel. In the developer panel, expand the select view area to navigate list and select [window3d] from the list.

You can navigate through the 3D scene using the commands described below:

In order to Use the mouse as described here
Move the scene 1. Press the left mouse button in the 3D view and hold the mouse button pressed.
2. Move the mouse in the required direction.
Rotate the scene 1. Press Alt key (macOS: Option key) and hold it pressed.
2. Click in the 3D scene window and, while holding Alt and the left mouse button down.
3. Move the mouse in the required rotation direction.
Zoom in/out the scene 1. Scroll the mouse wheel in the 3D window away from / towards you.

Adding 3D objects

Now we want to add a customer figure. By default the customers are drawn as colored dots and shown as colored cylinders in 3D animation. We want to create our custom type of client and animate it in 3D. We will create a new agent type for this purpose.

Create a new agent type

  1. Open the  Process Modeling Library in the  Palette view.
  2. Drag the  Agent type element into the graphical editor.

  3. The New agent wizard will open on the Creating new agent type step. Enter Customer as the Agent type name, and leave the Create the agent type "from scratch" selected. Press Next.

  4. In the next step select 3D as the animation type and select Person from the list of the 3D figures.

  5. Click Finish. The new  Customer diagram will open. You can find the Person 3D figure in the axis origin. Switch back to the  Main diagram.

Configure flowchart to use the new type

  1. On the  Main diagram, select the source block in the graphical editor.
  2. Choose  Customer from the New agent drop-down list.

  3. Go to the  Properties view of the node element and set Visible control to no. This way the markup shape will be invisible during animation on model runtime.
  4. In the same manner make the path element invisible at runtime too.
  5. Run the model and switch to 3D view to see our customers moving in the queue.

Add an ATM figure

  1. Open the  3D Objects palette in the  Palette view.
  2. Drag the ATM 3D figure from the Supermarket section of this palette onto the node in the graphical editor. In the displayed Auto scale 3D object dialog box click the Yes button.

  3. If you run the model now and check 3D animation in window3D mode, you will notice that our ATM does not face the customers' flow and we need to rotate it.
  4. Select the atm 3D object in the graphical editor and open the section Position in its  Properties view.
  5. Choose 0 degrees from the drop-down list of the Rotation Z option.
  6. Run the model to double-check that the ATM is facing the customers now.

Demo model: Bank Office - Phase 2 Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).
How can we improve this article?