3

I am using the PedGoTo block in Anylogic pedestrian library to direct pedestrians to the nearest exit (TargetLine). But since there are walls between pedestrians and exits, I can't just calculate straight line distance. In PedGoTo Anylogic official reference guide, it says

In Reach target mode the path is automatically calculated by the library.

I wonder if there's a function to calculate this path like path = getPath(ped, targetLine), and I can get the distance of this route, like path.getDistance()?

  • Are there paths to the different exists? You can just use the length of each path to try and find the nearest exit? – Jaco-Ben Vosloo Jan 11 '22 at 07:57
  • @Jaco-BenVosloo As I'm trying to model a quite large office area with about 6 exits, it might be too complex, but I will bear that in mind in feature projects. Thanks : ) – Chenwei Jin Jan 11 '22 at 09:20

2 Answers2

1

Afaik there is no such method. The reason is that the Ped library constantly re-evaluates the path taken and adjusts it based on new conditions.

So if you want to compute the nearest exits, you have to do it manually. Easiest would be to use paths, as Jaco-Ben suggested.

However: This may not actually be a good idea, depending on your actual scenario. In reality, people also do NOT know the nearest exit, typically (unless it is trivial).

PS: Also check the example model on fire exit behavior

Benjamin
  • 10,603
  • 3
  • 16
  • 28
  • 1
    I'm also modeling a fire evacuation like the example model, but currently, I'm focusing on the route to choose when the fire starts in different places, in the future if time allows, I might take different behaviors into account. Thanks :) – Chenwei Jin Jan 11 '22 at 09:28
0

I don't think there is an API for the pedestrian library similar to what you have with the GIS map.

You can however record the distance as the pedestrian is traveling - and once you have these distances you can perhaps use them in a future scenario? You will need to manually record all the distances in a separate run and then store the values to be used in a next run.

Here is a simple examplke in case it helps you.

enter image description here

What I would do then is to run this for a number of locations that pedestrians will be at when they need to choose an exit. Store the final distance in a separate txt file with a starting location as the key... and then in the next run of your simulation, you use these distances as an approximation of the distance to the exits and let the pedestrain then decide where to go to based on their current location and shortest distance to the exist...

So for every agent, you find the nearest point you have a distance to exists for and then use that, plus the distance to the exists

This seems like a lot of work... but for now I don't see any other way. Would love to see if anyone gets a better solution!

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