anylogicagent-based-modelingevent-simulation

Why Anylogic stopDelay() function throws error when Delay block is empty?


I have an event with action

delay.stopDelay(delay.get(0));

it works fine but when the delay block gets empty error shows up enter image description here


Solution

  • that's because your delay doesn't have any agent inside

    so you need to do the following:

    if(delay.size()>0){
       delay.stopDelay(delay.get(0)); 
    }