Search code examples
anylogicagent-based-modelingstatechart

Accessing specific Agent during Runtime by clicking on it in 2D-view, debugging


I am debugging my simulation. There is a patient (agent) that is stuck where it should not be. I want to see where in the statechart the patient is stuck but I find it tedious to punch through the list of agents in Developer panel every time and make an investigating effort to exactly pinpoint which one is stuck among several agents. Is it possible to make the patients clickable so that I can click the stuck patient and access it's statechart directly from 2D-view?

Picture of simulation's 2D-view


Solution

  • First, you need a 2D representation of your Person agent (currently, it seems you use a 3D object, keep it though). Draw a small rectangle below the 3D person in your agent type.

    In its "on click" property, write _origin_VA.navigateTo()

    At runtime, you can click on your individual agents now (only in 2D view, never in 3D) and it will jump into it.

    Read more about View Areas to refine this further, see the help.

    And some more from my own blog: https://www.benjamin-schumann.com/blog/2016/3/28/anylogic-user-interface-vol-4-the-view-area

    https://www.benjamin-schumann.com/blog/2016/4/29/a-tiered-interaction-approach-to-anylogic-animation

    https://www.benjamin-schumann.com/blog/2016/4/22/dynamic-animation-tweaks-for-anylogic

    https://www.benjamin-schumann.com/blog/2016/4/14/build-your-own-level-up-button-in-anylogic