Skip to content
Advertisement

how to count pedestrians or other calculations in a specific area in anylogic

Now I set three services and let pedestrians run between the targetline1 and targetline2 in anylogic. Part of pedestrians will enter into services and then go to the targetline1 or 2. I want to count the total number of pedestrians only in the node(blue rectangular).

how can I calculate pedestrians only in the node area?

(I also want to calculate other things such as the total average speed and density per second in this node, and don’t want to calculate pedestrians in services. Is there any code that can be used as a condition so that only pedestrians entering the node are counted?)

Thanks!

enter image description here

Advertisement

Answer

Area nodes have code boxes you can use if you apply “access restriction”. Just set it to infinity as below (EDIT: You need to set it to Integer.MAX_VALUE instead!). Now you can count whenever a ped enters/exits, and do your studies: enter image description here

For average speeds, etc., you can use a cyclic event that regularly does calcs for all peds in your node. Simply add/remove peds (using the enter/exit code fields below) into a local collection and loop across all peds in that collection to do calcs across them.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement