Search code examples
conditional-statementssimulationanylogicrestriction

Anylogic - restrict access for pedestrian with a specific parameter


I am an Engineering Student and as part of my diploma thesis, I am simulating the passenger changeover process in metros using the Anylogic Pedestrian Library.

In the simulation, it often happens that standing passengers "leave" the standing area and somehow get into the sitting places, blocking the way from other peds that would like to occupy the seat.

All passengers come from the Passenger Agent, where they have a boolean variable wantToSit. If wantToSit = false, they are routed into the standing area, with wantToSit = true they go to take their seats.

Now, I would like to restrict the access of peds with wantToSit = false into the area drown using polygonal nodes around the seat groups, so that the phenomenon written above cannot occur, thus only sitting passengers will enter this area.

enter image description here

However, when I try to define the condition for the access restriction in the polygonal Node, I always get the error "... cannot be resolved to a variable".

Here is the variable from the Agent "Passenger": enter image description here

On the Agent "Main", where the Polygonal Node is, the auto code complete does not recommend anything for want or for ped. . For the word Passenger, see the picture below:

enter image description here

Is there a way to use the access restriction feature in this case? I don't know how to access this parameter of Passenger from Main, which is a different agent.

Thank you in advance for your help!


Solution

  • If you do the code complete action in the condition field before you type anything, you will see that the local variables available for you to use in the condition field is agent and self

    enter image description here

    And then if you choose agent you will see that the fields within your custom Pedestrian agent will become available.

    enter image description here

    Try not to type anything without code complete. It can save you a lot of time.