anylogic

Resetting an objects counter in anylogic


Is there a way to reset the .count() of a source or a sink or any other object for that matter?

At the end of a day I'd like to record, how many agents passed through an element using the .count() function.


Solution

  • There is not (for good reason).

    But you can always create your own counters and reset them any time you like:

    1. drag in a variable myCounter of type int, initial value 0
    2. in your Sink, add to the counter in the code box: myCounter++
    3. reset anytime by simply by calling myCounter=0