Why resourcePool agents are not accessible from this block? - anylogic

I have a resourcePool block. The resource units are Worker type.
However, I cant't access this units calling the resourcePool block from conveyor Stations nor from Service blocks. No matter if I use "agent" or "unit" (in Station -> Resource choice condition), I only can access to resourcePool.agents(), which is a list from which I can't access to Worker agent.
Does anyone knows why, and how could I access to Worker agents considering they are created as Resource Units?

You use agent populations for this. Create an empty population of Worker agents and set the Resource Pool (in its Advanced properties) to add units to a custom population (and select your population).
Now all the resource units are accessible via the population.

Related

How to create a ResourcePool of agents that are instances of an agent type already existing in one of AnyLogic Libraries?

How to create a ResourcePool of agents that are instances of an agent type already existing in one of AnyLogic Libraries (for example the Conveyor agent type of the process modeling library)
I tried to do split then Conveyor and service and i combined after but it is not accurate representation of the real life and it creates lots of errors.

A question about seizing more than one ressource in Anylogic

I'm working on a supply chain project with AnyLogic. In my model which is similar to product delivery example in AnyLogic examples, there are two agents which are Retailer and Fulfillment center. Both have their own vehicles. What I'm trying to do is to share vehicles so retailers and Fulfillment centers use the vehicles of each others. What I did is to create two Ressource Pool in each agent. So in the seize block as it shown below in picture, I added two ressource sets . In each statechart of each vehicle as it shown below and after delievering products, I informed my vehicle to go back to his initial location and in this case it can be Retailer or Fulfillment center. However after simulation, I got an error message in console that tells me that my agent which is the vehicle is trying to move to unknown source
If you put 2 ResourcePools into 2 agents, you have 4 pools in total. But you only want 1 shared pool, right?
Only add 1 ResourcePool to Main and use that from both agent's Seize elements. You will not be able to select the pool in the usual dropdown list (as there is no pool in either agent) but you can easily use the dynamic code to specify it. Note that the code below assumes both agents are embedded in Main:

How to dynamically change the capacity of a Static Resource in AnyLogic

I’m working with a AnyLogic simulation on emergency department. The departments leader want to test the benefits of adding, nurses, treatments room etc. It was easy to make it so that they can dynamically change the number of nurses through the GUI, as this is a "Moving" resource type. However, how can I dynamically change a Static resource type like ED-rooms which is tied to specific Network Nodes?
It's not that I want the resource pools to be dynamically created. But it's that I want to control how big of a portion of the existing resource pool that will be used. The current capacity is 13 rooms, and I want this to be varied from 13 to 28
Using get_Capacity(n) works for non-static resources such as Nurses etc. but when I use .set_Capacity(n) for a Static Resource I get the following error:
"(ECRoom is here referring to rooms in the emergency department): java.lang.RuntimeException: root.ECRoom: Capacity definition type should be 'Direct' to support this operation"
The easiest way is to just pre-define several ResourcePool elements with static ED rooms linked to whatever node they would be using.
Then, set their normal capacity to zero and only change it to some non-zero value if the user wants it.
If you simply need to change the capacity at runtime, myResourcePool.set_Capacity(someNumber) is your friend :)
(Dynamically creating resource pools, home nodes, etc. is all possible but a whole different ball-game)

AnyLogic - Resource Pool Stored as Multiple Locations

I am using AnyLogic to model a process where an Agent needs to retrieve a resource that could be at 1 of several locations. I am having difficulty "storing" resources at multiple locations. I have "moved" the resource to one of two locations using moveTo(), but when the Agent goes to the other location - where the resource is NOT stored, it still seized the resource. Is there a way to limit the seize to only look for resources at that location?
Thanks!
In 8.3.1, your resource selection can be "Nearest the agent".
In previous versions, you can select "Customize resource choice" to select a specific agent. This might look something like agent.location == unit.location, where agent is the agent doing the seizing and unit represents a unit of the pool. If the resource agent and seizing agent both have a location variable that matches, the seize will seize that agent.

Anylogic: how to individually address to resources within a Resource Pool

I am using Anylogic where I have just one ResourcePool made by just one Resource Type unit (created through the command "Resource Agent" in the Process Library).
I define the capacity of the ResourcePool, let's say, to 20 and I would like to have each of the single element (or some of them) within the Pool with a different value for the same parameter (e.g 3 units have parameter=1 , other 4 units parameter=2 ...).
First of all how can I set individually each of this parameter? Do I need to use a population of agent? If yes how can I do that? And how can I call the resourcePoolPopulation in other location within the model?
Is there a clevere way to do that?
Hope it is clear, thanks!
That is a weak spot of resource pools, IMO. They are designed to hold a homogeneous "soup" of similar resources and it is hard to pull in a specific element.
However, not impossible, there are various ways. You can create your resource agents manually in an agent population first and add them to the pool manually after creation. Then, in the service object, tick "manual resource unit choice" (or similar) and use a criteria that matches your resource params.