Search code examples
anylogic

Anylogic: Source-block - Arrivals defined by stock of queue


I am testing some production simulations in Anylogic. Is it possible to link the arrival of multiple Agents (in my case: 20 pcs/arrival) to the actual stock of agents in a queue-block?

For example if there are less than 5 pcs of agents in queue then create a new arrival of 20 agents. At the beginning of the Simulation the source-block should generate 20 agents. But in the course of the simulation the condition for new arrivals should change to the stock condition in the queue.

Thank you.


Solution

  • You can create an event for time=0 (or at the Main agent startup) such as source.inject(20);. You can have the queue block after this source. This would inject 20 agents into the queue. New arrivals can follow the same logic triggered by the conditions.

    if (yourCondition==true){
         source.inject(20);
    }