service block based on agent size in anylogic - anylogic

My shop floor is divided into 4 quadrants, each occupied by a welder. For the small products it could occupy 1 quadrant but for large products, it will occupy 2 quadrants with 2 welders working on it. How can I translate that in anylogic using service building block? I already have my product size determined at the source.

Create a ResourceType "Quadrant".
Create a ResourcePool with 4 resources of type "Quadrant"
Set up your Service block such that each bit of work needs 1 welder
before that, create a seize block that seizes "quadrant" resources based on the product type. See pic below where I assume this is stored in Product.type as a String:
don't forget to create a release block as well downstream of the Service.

Related

Batching multiple agents based on location of agent

In my model I only want to batch agent which are at the same location. So my source block generates the agents according to a database to a specific node (which is sometimes different for agents), now I want the agents that occur at the same node to batch in sizes of 2 and the one that are left over need to be batched alone.
How can I model this, I know that I can use the selectoutput (which says for example if location=node1 use this output etc) option, but do I than have to add for example manually 100 outputs if I've 100 different locations where the agents start or is there a more simple solution for this problem?
Added later:
Or is there another way to model my idea:
So I'm simulating an hospital environment, where logistic employees (in this case the transporter) based on predefined times collects the thrash on certain areas for example the databaserow I show in the picture below:
At 9:50, the thrash at thrash collection point at LAB_Office_2_H_T_N can be collected by the logistic employee.
So in my model I create this 2 agents (which are 2 containers, last column) based on this time and seize a transporter to collect this thrash. Since a logistic employee is able to collect 2 thrash in one time I want to batch it and let the logistic employee collect 2 thrash containers at once.
After that he transports it to the thrash dump area and is released.
The colors changed after the added information. You can use pickup and dropoff blocks instead. You can define your node requirements in the condition cell. You can use local variables like container and agent to code whatever you want. Or use "Quantity (if available)" option. There you can programmatically define how many units will be picked up by using your own function.

How do i recreate a loading truck case with a limited number of trucks?

I have a warehouse with many palletrack which contains raw materials that have to be loaded on trucks and moved to a second warehouse. The loading zones (where trucks are loaded) are the green rectangular nodes (see image). The problem is that I don't know how to recreate the loading. If I use a seize then every single agent will seize a truck, but if I used the pickup block (like the pickup model tutorial), the source would create more trucks than I want(they are limited).
Any tips? (i want to say thanks to all the people who are helping me this week by the way)
Although there are many ways to model this I think the best option would be to batch your agents into truckloads and then to seize the trucks. Trucks must live inside a resource pool, so that you can have a fixed number of trucks.
Since you are using a network model I would then suggest you attach the truck to the batch you created and move it around and then detach the truck and release it afterward. You can however simply seize the truck and have the batch object use the animation of a truck.

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:

Anylogic: limiting used resources

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();

Moving one agent within another agent in Anylogic

I am making simple distribution center in Anylogic.I did make truck agent and i am able to move it from one gis point to another gis point.
But I want to load some other agents(Let's say banana agent) into my truck agent and then trucks start their journey(if truck is full of banana).How can i do this?
I hope you have already solved your problem from almost a year ago. However, since there is no specific answer, I'll leave it here for anyone who might get stuck with the same problem.
Anylogic's Process Modelling Library (PML) has an element called Pickup and its opposite, Dropoff. This is used to do exactly what you asked: to load some element into a transporter (either a truck, a forklift, or even a person).
To use the block as you asked you would need a topology like in the picture:
The Queue elements are necessary to hold elements until the pickup occurs.
The Pickup element might pick elements in three modes:
While a given condition is True;
An exact amount (if available);
All available agents.
I'm assuming all trucks must be completely filled up to its maximum capacity. Hence, the chosen mode will be the second one where the exact amount will be TruckCapacity, a parameter of agent Truck.
The selected mode picks up agents (in this case Bananas) up to the desired amount. However, if nothing is available or the present amount is inferior to the desired, the native behavior of the Pickup block is to allow the container element to simply go through it and pick only what's available.
To prevent such behavior, I've created a restricted area where only 1 Truck can be at a time. Additionally, the Hold block WaitFullyLoaded (set to initially blocked) forces the container agent Truck to be fully loaded. Whenever a Banana enters the Queue waitTruck, a verification is performed to check if 1 Truck can be filled. If so, allows passage for that one truck:
if(self.size()/TruckCapacity>=1){
WaitFullyLoaded.unblock();
}
To block WaitFullyLoaded again, when the truck passes through the restrictedAreaEnd block, it performs WaitFullyLoaded.block();
The main idea is this. However, many features can be added and changed.
Hope this helps,
Luís