Search code examples
anylogic

How to move every 7th agent through false out port of Output Block in Anylogic?


I am working on a model, where I need to separate every 7th agent at the output block. For instance, Agent number 7, 14, 21, .... 700 should always move through the false out port of output block in anylogic.

Thank You!


Solution

    1. Add a v_Counter variable of type int next to the SelectOutput
    2. In front of the SelectOutput, drag a Delay block (with 0 delay). In the "on at exit" code box (not "on exit"!!) write v_Counter++
    3. In the SelectOutput condition, you can use v_Counter % == 0