1

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!

Jaco-Ben Vosloo
  • 3,770
  • 2
  • 16
  • 33
  • Do you have a variable inside your passenger agent called `wantToSit`? The error you are getting is because either the variable does not exist. Use the code complete when writing code to get to the available parameters. If it is a dynamic parameter it will add a `()` to the end of the variable. – Jaco-Ben Vosloo Aug 16 '21 at 12:56
  • Yes, inside the Passenger Agent there is a static variable called `wantToSit` with a default value `randomTrue(0.8)`. It surely exists, as a function is working based on this value. The problem I guess is accessing this variable from the Main agent page, where the polygonal node is. – Tóth Balázs Aug 16 '21 at 13:18
  • Why did you make the variable static? This is an advanced feature and should not be used unless you know the impact. Are you sure the variable is public? Please show what you get for the auto code complete – Jaco-Ben Vosloo Aug 16 '21 at 16:44
  • I have edited the question with the pictures - see above. – Tóth Balázs Aug 16 '21 at 17:00

1 Answers1

1

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.

Jaco-Ben Vosloo
  • 3,770
  • 2
  • 16
  • 33