Search code examples
anylogic

Changing the movement speed due to the PedGroupAssemble block in Anylogic


Logic Logic2

I have a museum model in which a group of 10 people gathers in the PGA (PedGroupAssemble) block, one of whom must be a Guide. If the guide is not found within 30 minutes, the visitor must go to see the paintings alone. I implemented this through an event in the Pedestrian agent, a flag, and a cancellation in the PGA block. If you cancel one member of the group, all of them will be canceled - I took this into account, and those who still have to wait return to the PGA block, and the one who has already waited goes to watch the paintings alone. The problem is that those who initially wanted to go alone, and those who waited for the guide and went with the group, move at a normal speed, and those who canceled in the PGA block slow down several times, and walk 10 meters in 10+ minutes. At the same time, there are no lags, Fps is 40+, and the problem is not the high load, namely that pedestrians slow down after cancellation in the PGA block. The logic is in the images above. There are no places where I would change the speed of movement.

UPD: in case of "UnsupportedOperationException" error, please visit this question: in anylogic exception with Agent.setspeed()


Solution

  • Use ped.setSpeed() but be careful where you use that code: enter image description here

    The ped keyword only exists in certain blocks and boxes. Use the little lightbulb and code-complete (never just type stuff)