Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Simulation with AnyLogic/Agent-Based Modeling/Step 10. Adding agent animations

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Step 10. Adding Agent Animations Now we will create a simple animation of our model to visualize the process. We want to draw agents on our presentation. Agents will be displayed relative to the coordinates they have in the modeled environment.Product adopters and potential adopters will be shown with the shapes of different colors. Draw a shape depicting a person Open the Person class diagram by double-clicking the Person item in the Project view. Zoom the diagram in, say to 400% scale.File:Step 10. Adding agent animations1.png Drag the diagram a little bit down and to the right with the right mouse button pressed. Draw the agent shape like shown in the following figure:File:Step 10. Adding agent animations2.png Draw it using a curve. Therefore, choose the Curve File:Step 10. Adding agent animations3.gif element from the Presentation stencil of the Palette view (this stencil contains shapes and controls you can add on your presentation) and successively click at each curve point on the diagram and finally double-click to finish drawing. Place the shape right in the upper left corner in the point (0,0) (the coordinates of the mouse cursor are shown in the status bar):File:Step 10. Adding agent animations4.png Zoom the diagram out. Click on the agent shape and open the Dynamic properties of the shape. In the Fill Color property, typestatechart.isStateActive(PotentialAdopter) ? royalBlue : redFile:Step 10. Adding agent animations5.pngThe expression checks, whether the person is a potential adopter (the PotentialAdopter state of the agent's statechart is active). Adopters will be displayed with red points, potential adopters – with blue ones. Modify the model to set up agent animations properly Open the Main class diagram by double-clicking the Main item in the Project view. Select the people object in the graphical editor. On the General page of its Properties view, click the Create Presentation button. You will see the agent shape appeared in the upper left corner. Drag this shape down to the place shown in the following figure:File:Step 10. Adding agent animations6.pngThe point where we place our shape will be the upper left corner of the agent's environment area. Agents with (0,0) coordinates will be placed there. Select the environment object. Open the Advanced tab of the environments Properties view. Define the dimensions of the space our agents populate. Set up Width 650 and Height' 300.File:Step 10. Adding agent animations7.png We have finished creating the animation. Run the model and watch the dynamics on the network. File:Step 10. Adding agent animations8.png