'How do I use getDistanceTravelled() to track the distance my 5 Transporters have travelled?

im new to AnyLogic and Java so bear with me.

My Simulation uses 5 Transporters to transport Agents through a Prodcution (they take different Routes each time). I'm trying to track the Distance each individual Transporter travels until it returns to pick up a new Agent.

I think this is possible with the getDistanceTravelled() Function but I have some Questions on how to use the Function.

  1. How do I identify each Transporter from my transporterFleet?
  2. How do I track the Distance travelled for each Transporter?
  3. How can I reset the Distance travelled when the Transporter has returned to pick up a new Agent?
  4. How can I store and visualize the Distance travelled for each Transporter ?

This is an example of the blocks im using to simulate one Route for the Transporters. https://i.stack.imgur.com/XVjwp.png

I'm sorry if this is a lot to ask but I can't seem to get the hang of this Problem. Feel free to ask follow-up Questions if my explanation isn't enough. Any Help is appreciated.

Lars



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source