alyre
alyre

Reputation: 25

In Anylogic: recalculate route cyclically when not in idle state

I have problems with the animation of my transporter agents in anylogic. They get stuck and then they no longer move in the simulation. However, the fleet thinks they are busy and this ruins my results.

I would like my agents to recalculate their route cyclically when they are not idle.
In the TransporterFleet-Block under "Actions" I put in on transporters state changed":

if (agent.getState() != TransporterState.IDLE){
    agent.eventRecalculation.restart();
}
if (agent.getState() == TransporterState.IDLE){
    agent.eventRecalculation.reset();
}

with eventRecalculation being a cyclic event that happens every 20 seconds. This is reset at the start-up of the model to stop it from happening from the beginning.

Anylogic now gives me the error code: agent cannot be resolved. How do I solve this?

Upvotes: 0

Views: 163

Answers (1)

Emile Zankoul
Emile Zankoul

Reputation: 2213

In the on transporters state changed field you refer to the transporter as unit not agent

Upvotes: 2

Related Questions