Skip to content Skip to sidebar Skip to footer

Method The Measure The Time An Agent Is Not In Use During A Simulation

I have a simulation for a supply chain delivery simulation where three vehicle agents are moving from a manufacturer to customers, the model is based on the AnyLogic webinar for De

Solution 1:

alternative to @Benjamin's proposal is to just on exit do:

agent.timeDriving+=time()-agent.getBlockEnterTime()

Solution 2:

First, make sure your trucks are custom agent types that you created yourself, lets call them Truck. Also, your MoveTo blocks must know that it is Truck agents flowing through it (set "Agent type" under "Advanced" to Truck)

Add a variable timeDriving and another timerStart to it. The former is used to sum all driving durations. The latter is used temporarily to measure when driving starts.

Then, use the code boxes in all MoveTo elements as below: enter image description here

Post a Comment for "Method The Measure The Time An Agent Is Not In Use During A Simulation"