Search code examples
simulationanylogic

How to call suspend function in anylogic?


  1. I create an integer to count the number of assemblies (e.g. countAssembler)
  2. On exit from FA1 (countAssembler++;)
  3. Then I have an event triggered by a condition such that when the count of assemblies reaches 10 ((countAssembler==10)), it suspends the FA1 for two hours using suspend function.

But how do I implement the suspend function? Do you have any ideas? enter image description here


Solution

  • note that the suspend function doesn't suspend the assembler, but an item that is currently being processed in the assembler...

    have a variable countAssembler count the number of items produced... then

    1. on exit you write countAssembler++;

    2. on enter delay you write the following:

      if(countAssembler==10){
      self.suspend(agent);
      create_MyDynamicEvent(2, HOUR,agent);
      }

    3. on the dynamic event you write:

      assembler.resume(agent);

    Don't forget to add the parameter needed in the dynamic event: dynamic event

    Note that the suspend will start when part 11 starts being assembled, which means that the machine will be suspended for 2 hours + the time between the 10th assembly end and then 11th assembly start... you can fix that easily but im not including it in my answer