AnyLogic
Expand
Font size

Using resources

The following blocks of Process Modeling Library:

offer a variety of ways to define the type and number of resources to be seized.

  • If you require resource(s) of one single type (say, two workers), choose the units of the same pool option in the Seize resources parameter. Then choose the required ResourcePool block from the Resource pool parameter drop-down list (or just select the block in the graphical editor). And finally, specify how many resources are required to complete the operation in the Number of units field below.

  • You may seize any number of different resources, e.g. one robot and two controllers. Just choose Seize resources: (alternative) resource sets, then choose the resources in the list below and finally specify the number of resource units in the right part of the list:

  • Moreover, you can set several alternative resource sets for the operation. Then, when the required agents enter the block, the first resource set is checked for availability. If resources of some type from the first set are busy, the second given set is checked for availability, and so on. The first ready resource set is chosen to perform the operation.

Priorities and preemption policies

A set of resources may have multiple tasks with different priorities and preemption policies.

  • If all tasks have the same priority, they will be executed in the usual way following their occurrence schedule. If two tasks have the same priority, but one of them was suspended for some reason, this suspended task will be picked1.
  • If you have configured no preemption policy for the tasks, these tasks will be executed one after another following their occurrence schedule.
  • The occurrence of one task does not reset the countdowns for other tasks.
1Each resource unit may receive requests from different sources. When a single resource unit receives multiple tasks, suspended and new, with identical priority values, some rules apply to the picking order:
  • The suspended tasks from the individual queue of the resource unit have the highest priority.
    This queue is formed by agents waiting in blocks that have the Task preemption policy set to Wait for original resource.
  • After that, the suspended tasks from the queue of the ResourcePool block are processed.
    This queue is formed by agents waiting in the blocks that have the Task preemption policy set to Seize any resource.

Once the suspended tasks from these queues are completed, the resource unit begins to process new tasks from their individual queues, and after that, the queue of the ResourcePool block.

If this order does not suit your needs, manually increase the task’s priority by code, using the On task suspended action of the block.

How can we improve this article?