0
votes

I'm new to AnyLogic. How can I use the dynamic resource pool field in a Seize Block to seize a specific resource unit if another resource unit is located in a specific note?

Example:
If a unit from ResourcePool1 is located inside node1, seize resource unit from ResourcePool2. Otherwise do not seize. Is that possible?

1
If I understand correctly, the condition you want to put is on the resource's location and not the agent's. What is tricky is that, with what you're planning to do, there might be several units in Resource Pool 1, so do we need to check all of them? What if there are two units in Resource Pool 1 and one of them is in node1 and the other no? - Emile Zankoul
I only need to check whether there are any units (does not matter which or how many) from ResourcePool1 in node1 or if there aren't any. - KrisG125
just check the node1 for resources - RoyalGoose

1 Answers

0
votes

The answer to this question is not very simple. I will describe it step by step. Unfortunately, AnyLogic doesn't allow you to access separate resource units individually (there are a few functions like accessing specifically units that are seized, but this is not what you need). So follow the below steps:

  1. Go to the Agent palette then drag and drop the first element called Agent

  2. Choose "Population of Agents", then "I want to create a new agent type".

  3. Name it as needed and fill the properties as shown below and click Finish. enter image description here

  4. Click on the resource pool and specify the highlighted properties as follows: enter image description here

  5. Create a function (by dragging and dropping it from the Agent Palette)

  6. Design the function as shown below. What this function does is it checks if any unit of the resource pool is located in node1. If at least 1 is located in node1, it returns true, otherwise it returns false enter image description here

  7. Finally, go to the service and write the following. This means each time an agent enters the service, it will check the function. If it returns true, a unit of resourcePool will be seized, otherwise, a unit of resourcePool1 will be seized. enter image description here

Of course these steps are rather generic, you'll need to adjust to match the number of resourcePools, nodes, etc. But that's as detailed as I can answer.