If I add a slider to control a resourcepool capacity, increasing the slider adds the resource to the population. However, how do I delete resources from the population when i decrease the slider? And what will be the delete order be? (From last added agent?)
To destroy them, simply the the property "when capacity decreases" as below:
To test the sequence of destruction, run a few tests by addinga traceln command in the "on destroy unit" code box in the resource pool properties. It probably first destroys idle units but maybe simply destroys the oldest.
Related
1-I am modeling a production line in Anylogic that has a group of Conveyors. Each Conveyor has it's own failures and breakdowns. How can i Create a pool of Resources from the existing Library "Conveyor".
2-Is there any way to attach "Conveyor" to "Resource pool"
I tried Conveyor in Material Handling list but i does not have Resource set so that i can attach a Resource pool
You may want to "agent-ify" your conveyors: Create a custom agent type MyConveyor that has 1 conveyor and some info on downtimes, etc.
Flag these are "Use as resources" in its properties.
Then, you can use them as resources in resource-pools.
However: This probably won't solve your immediate issue right away as it is a bit advanced.
enter image description herewhat you can do is to generate a failure token (Failure agent) that is associated to a conveyor (has a conveyor as a parameter)
Then you change the speed of the conveyor to 0
conveyor.setMaxSpeed(0,MPS);
Then the token will seize a resource and the resource will act accordingly
finally when the resource is released, you change the max speed to its original
I hope you are having a great day.
Recently, I tried to build an AnyLogic model with free-space transporters, but I encountered an unexpected situation as shown below.
I thought that there is no logical reason why all the transporters are jammed in a specific position. Is there any solution or possible reason for this situation? I have attached my model for your information.
Thank you for reading this question.
The problem with the traffic jam appears to be due to the fact that there are two few attractors available for the transporters to place the items and then they get stuck waiting for an attractor to become available...
When running your model as-is I get a jam in the stage one area
And in the logic blocks, I can see that the transports are stuck in the "Move By Transporter" block.
If I assume the attractors are set to 4 for a reason I would suggest the following logic - similar to what is described here
You create a list of all the attractors available. See the neat trick in AnyLogic where if you select a bunch of objects and then right-click on them you can automatically create a collection.
You can call it something like attractorsAvailabeStage1
And create a new map to store the WIP agents that will be occupying the attractors
And have a function that will provide the available attractors.
Change the move by transporter option to move to an attractor
And also return the attractor as available once it gets moved from its location
Now you only need to prevent mew agents from entering the area if there is no more attractors left or agents on their way to the attractors
I tested it and it works great for stage 1 you need to do it for all the stages.
On second thought....
seeing that you do have resource pools and service blocks. You can achieve the same logic I described by having resources first size the locations, then go to the transport block, and then be delayed
You first seize the space in the stage, then you move to the space, then you delay it.... then you wait, then seize the space in stage 2, then move there, then release stage 1.
I would go for the latter option
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.
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:
I am facing an interesting problem with this warehouse model of mine. I have forklifts that move shipments around a network- the warehouse, and the model seems to be running fine until st some point forklifts start getting stuck at random location in the network for no reason. The longer I run the model the more forklifts are stuck. The are like completely frozen in place. At first I was defining the number of forklifts- resource pool capacity, using a schedule and I thought that might be the problem, so I went a head and changed it to constant capacity, and the problem still arises as you can see in this image.
As far the resource pool, the seize, and release blocks concerned; I kept the default settings and didn't change anything.
Here's a screenshot of the resource pool properties. I defined forklift as an agent and inside that agent is nothing but the image of a forklift and at the "use in flowchart as" box I set it to resource unit. I don't quite understand the 100 at the end of shift priority box, but I left it at the default value.
Here's a screenshot of one of seize blocks but all the block are similar
Similarly, this is screenshot of one of release blocks where the forklifts return to their home location after each task. Here I tried all the options from return to home every time to release from a given pool and choose the forklift pool or just releases the correspondent seize block, and that all didn't resolve the issue
Again, the model runs fine and only after 10% of the running time period this starts to happen. Any help would be appreciated.
I am trying to use anylogic to model labor shortage in production. I have the workers set as a resource pool with the capacity defined using shift plan, defining the number of workers by different shift. I am trying to include a event module that changes labor capacity for each shift during the middle of simulation. However, anylogic showed me an error saying I cannot change shift group size dynamically. Is there any workaround to allow this to happen? Thank you.
You can recreate the schedule within an event each time you need to perform a change.
AnyLogic's API explains this quite well, see https://help.anylogic.com/index.jsp?topic=%2Fcom.anylogic.help%2Fhtml%2Fdata%2FSchedule_API.html (sample model or 'creating and initializing schedule programmatically on model startup')