Last modified on 2 August 2009, at 22:41

Simulation with AnyLogic/Pedestrian Simulation/Step 2. Creating a model animation

Step 2. Creating a Model AnimationEdit

Now we will draw the model animation. To simplify drawing, we will add the subway entrance layout first. You can draw the layout in AnyLogic using the animation editor, or you can import any picture as the layout. The drawing approach is good for prototyping, when you want to experiment with draft layouts. The image approach is excellent for working with an existing layout. We will add the existing image of the subway entrance.

Step 1. Creating a new model1.gif Add subway entrance layout

  1. 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.
    Step 2. Creating a model animation 1.png
  2. Drag the Image Step 2. Creating a model animation 2.gif element from the Presentation palette into the graphical editor (in the place shown in the figure below with the crossed rectangle).
    Step 2. Creating a model animation 3.png
  3. Set up the image properties in the Properties view. Click Add Image button and navigate to layout picture. You can find the layout here: <AnyLogic folder>\plugins\com.xj.anylogic.examples.<build number>\models\Subway Entrance\entrance_layout.png
    You will see the added image in the preview area:
    Creating a model animation 1.png
  4. To preserve necessary picture size, select the Original Size option.
  5. The image should look like this:
    Creating a model animation 2.png

Now we will draw the model animation. For each model you can create an animation to visually represent your model. You need this also to define graphically environment objects of your model.

First, we will draw a border of our environment area playing a role of the walls of the subway entrance building.

Step 1. Creating a new model1.gif Draw the building walls

  1. To simplify drawing you may need to switch off the grid and zoom in the animation using the corresponding toolbar buttons:
    Creating a model animation 3.png
  2. Draw the polyline as shown in the figure below. To draw a polyline, drag the Polyline Step 3. Creating a model animation 3.gif element from the Presentation page of the Palette view into the graphical editor. Then double-click the drawn polyline to switch to editing polyline points mode. In this mode you can add new points by double-clicking on the polyline and move points by dragging them.
    Creating a model animation 4.png
  3. Set up the following properties for the polyline drawn:
    Creating a model animation 5.png
    • Name the polyline walls.
    • Change the polyline’s width to make it more noticeable on the presentation diagram.
    • Make the polyline closed. Select the Close Polyline checkbox. This makes the polyline closed by connecting the first and the last polyline’s points.
  4. Make the polylne invisible at the model runtime. Go to the Dynamic page of the polyline's Properties and type false in the Visible field.
    Creating a model animation 6.png

Frequently walls of the simulated environment are drawn by several shapes, therefore Pedestrian Library requires that all these shapes are added to one group and this group is specified as the Walls parameter of the corresponding library object. So now we will create a group and add the walls polyine to it.

Step 1. Creating a new model1.gif Create a group to contain shapes defining environment border

  1. Drag the Group Step 2. Creating a model animation 9.gif element from the Presentation palette into the graphical editor.
  2. Leave the default Name of the group: group.
  3. Add the just drawn polyline to the group. First, select it by clicking on it. The selected shape will be highlighted in blue.
  4. Right-click the selection (you should click exactly on the polyline), and then choose Grouping|Add to existing group from the popup menu.
  5. Finish adding the polyline to the group by clicking on the group.

Now you should define entry and exit points for the pedestrian flow.

Draw an entry first. Entry is a place where pedestrians appear in the simulated environment. It can be defined with a line, polyline, or a pivot containing lines and/or polylines.

Step 1. Creating a new model1.gif Draw an entry

  1. Drag the Line Step 11. Making people contacts distance-based4.gif drawing tool from the Presentation palette into the graphical editor (in the place shown in the figure below):
    Creating a model animation 7.png
  2. First, click the place where you want to draw the start point of the line.
  3. Then drag the mouse to the place where you want to draw the end point of the line and release the mouse button.
  4. Name the line entry.

Step 1. Creating a new model1.gif Draw an exit

  1. In the same way, draw the exit line as shown in the figure below. Exit line is a place where pedestrians are disposed by the simulated environment.
    Creating a model animation 8.png
  2. Name the line exit.

Note that both entry and exit lines should fit inside the environment area shape, i.e. inside walls polyline.