Anylogic: limiting used resources - anylogic

I am currently modelling the entire production process of a company with limited human resources.
Part of the model is visualized here:
The Model: In the example there are multiple blocks but the focus for me is on the resource using blocks. The assemblers use 2 resources, the service, seize and rackstore blocks use 1 resource each. As you can imagine they are all fully utilized as I only have a resourcepool of 6 people (and there are more processes beyond this)
Question: Because of this full utilization my entire process is blocked because there are no free resources. Therefore I would like to ask if it would be possible for me to limit e.g. the blue part of the example flow to 3 employees using the same resourcepool? That way I can set priorities between the processes and make the process work again.

Use hold blocks to stop products to flow if the used resources are equal to 3
The code:
On enter delay (when the resource is seized)
resourcesInAssembler++;
if(resourcesInAssembler==3){
hold2.block();
hold1.block();
hold.block();
}
On exit (when the resource is released)
resourcesInAssembler--;
hold.unblock();
hold1.unblock();
hold2.unblock();

Related

Trasporters are jammed at a specific location in AnyLogic

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

Same resource from resource pool for subsequent process

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.

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)

How to change shift group size of resource pool dynamically during simulation in anylogic?

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')

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.