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.
Related
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.
I have a truck agent that seizes a trailer resource from "trailer" resourcepoolblock (thanks to seize block). I want that both the agent both the resource make a rotation in the 3D animation. I did for the agent, while for the resource i tried:
"agent.resourceUnitsOfPool(trailer).trailer1.setRotation(-PI);"
But it does not work. What is the right command in order to control the 3D object of the resource?
Thanks for the help.
resourceUnitsOfPool returns a list of all resource agents seized. Assuming you're only seizing a single trailer, you could do the following.
agent.resourceUnitsOfPool(trailer).get(0).setRotation(-PI);
The above would refer to the agent and set its rotation. If you want to rotate a Shape3D object within the agent, just refer to it after the get(0).
Or you could use resourceUnitOfPool (which I assume you were trying to use. Notice unit, singular), which returns the first occurrence of resource unit of a given pool among the seized resource units, and then proceed in a similar manner.
There is a process, box enters station (i) and operator and machine are used for SETUP, then box moves to (ii) where only machine is used.
there is 1 - operator, but 2- machines.
there are 2 conveyer systems.
How to ensure that box uses same Machine resource in station (ii) as station (i)
**Or
Ensure the Machine is continually seized from station (i) to (ii)
To re-seize the same resource - When the box seizes a resource, set a variable equal to the resource that was seized. In the resource pool, you can see "on seize" and there is self, unit, agent. Agent is the one doing the seizing and unit is the one that got seized. For the second station, in the resources section, check "customize resource condition". Try something like agent.unitSeized == unit; where unitSeized is the variable you set up. See the help menu for this. You might have to play around a little on where this occurs, exact syntax.
To keep the resource seized, I would not use a station. There is no option to seize a resource with the built in station resource & release it later. I would use a position on conveyor and just handle everything manually. That is, convey to that POC, and then next block in your flowchart can be a seize. You can then delay for processing, add a convey for getting to the next POC on conveyor 2, delay for processing, release resource. This approach would work for your first case too. You can have much more control if you route to various positions, and then send to delays or other regular process blocks to get the behavior you want. If you take this approach, you could add decide blocks, so that it covers both of your cases via an input parameter.
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:
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.