Search code examples
anylogic

Pool capacity not reducing on event AnyLogic


I would like the capacity of a resource pool to go from 2 to 1 at a specific point in time. As of now, I am using an event to trigger a reduction in a variable. This variable is what I use to define as the resource pool capacity so logically I would think that the resource pool capacity would drop as well. However, when the event triggers, the variable reduces but the resource pool capacity does not, even if the resources are idle and have no tasks.


Solution

  • Resource Pool capacity is not dynamic, so if you set it as a variable, the variable will only be accessed on model start-up. Changing the variable value during model runtime will not make a difference.

    To change the capacity you need to use:

    resourcePool.set_capacity(value);
    

    Replace value with the variable name you are using.

    For your information, fields preceded by an equal sign are static while those preceded with a circular arrow are dynamic. The example below shows both:

    enter image description here