Search code examples
eventsanylogicagent

Reduce Speed of Specific agent in the free space model


I am creating an event to taking 9 AGVs from total AGVs and reducing the speed in the free space model but its giving error. How could I resolve this issue? Looking for help and thanks.

Event of 9 AGVs with different features


Solution

  • You have to call the setMaxSpeed() method on the actual agent you loop through, not on subsetOfAgents.

    Try ((AGV)a).setMaximumSpeed(0.5);. This takes your agent a, tells AnyLogic that it is actually an AGV and this allows AnyLogic to use the method.

    NOTE: Read up on "code complete" in the help. Never type code yourself. With code-complete, it would not let you write this code at all, because it is impossible to execute