removing a specific number of pallets from a pallet rack - anylogic

i would like to pick a certain amount of pallets from my racks but I have no idea how to actually do that. For example, I would like to deliver 5 pallets but i have 25 stored, if i use a wait or a queue that I release all agents get picked up.

to release 5 agents from the wait block so they can be delivered you have to do the following
List <MyAgent> deliverables=findAll(waitBlock,w->true).subList(0,5);
for(MyAgent x : deliverables){
waitBlock.free(x);
}

Related

Priority based queue in Anylogic

I am using a priority based queue to pick agents from a pallet rack. Priority of agents can be 0 or 1. If there are 10 agents in palletRack, I want to pick all the agents having priority=1 first. My problem in the current flowchart is: Agents with priority=0 are pickup up before agents with priority=1. May be because the agents enter & leave the Queue block one by one, multiple agents aren't present in the Queue block at the same time so that they can be sorted. How to resolve this?
put a hold block between queueStorage2 and pickFromStorage1 and on the on enter action of queueStorage2, you check if all your agents are there, and if they are (with whatever condition you need to check to be sure everything is there) you unblock the hold with hold.unblock();

Pallet Rack Size does not update if using pick-up

I know that for an object to be removed from a pallet rack you need "Rack Pick". However, in one of my models, I have a different configuration where I am using pick up:
Step 1: 10 agents are in the rack
Step 2: Another agent picks them up
The way AnyLogic understands the above is that the rack still holds 10 agents, so I get the error eventually that the pallet rack is full. Is there a simple turnaround for this?
you have to remove the agents from cells with this line of code
palletRack.remove(agent);
put it to your pickup block, "on pickup" trigger.

Wait block doesn't test if storage has space

My wait block should test if my pallet rack has enough space to store my pallets. So when I have 20 pallets and my store has space for 15, 15 should be stored and the other 5 pallets should wait in my wait block until the pallet rack has space again.
The problem is that I get an error that there are no empty cells which means that the pallets which don't have space not wait in my block but go trough the wait block and that causes an error.
Where is the problem? Wait block and rack pick are attached.
waitblock_function
rackpick
error
I suggest you switch to using RestrictedAreaStart and RestrictedAreaEnd blocks: Simply queue agents before and set the capacity of the restricted area to your pallet capacity.
Much easier (and less error-prone) than your manual approach.

Limit the number of resources (forklifts) used in tasks

I have pallets shipments arrive at a warehouse. Once the arrive, forklifts are used to unload then and move the shipments to storage units. The current capacity of the forklift pool is 50. What happens now that when pallets arrive with a number of shipments to be unloaded and stored, let's say 10 shipments, then ten forklifts go to the pallets and unload the 10 shipments at once. Since the flowchart a pallet arrives and a forklift is seized consequently. I want to have one of two forklifts to be associated with a pallet at until all shipments are unloaded. I tried to use restricted Area Start and End between the forklift seize block and the shipment moveTo block but that limited the number of forklifts assigned to all pallets not only the one at the time.
Thank you
This is a lot, so i will just give you the hints necessary to do what you want
step 1. You need for each pallet to have a variable associated with that shipment. This varaiable can be an id integer, or maybe a variable of type Shipment.
step 2. Then on the on seize block, you have to specify a custom resource selection that defines the forklift you can use for that pallet. It would be either a forklift that is already assigned to that shipment, or a forklift that is free and no other forklift is connected to that shipment... here the logic depends on your own case and on how many forklifts should be used per shipment
step 3. When the resource is chosen, You connect that resource to your shipment through a variable or through a link to agents, if that resource was not previously connected to it.
step 4. When there are no more pallets available, you disconnect the forklift from the shipment so you have a new forklift free for any new shipment coming through

Create a database with an arrival time and access to it in the process flow

I would like to create a database with different arrival times that my forklifts pick the pallets (rack pick) to the certain times. How could I do this? Which process blocks could I use to access to a database with arrival times?
For example at 10am on May 20 45 pallets should pick out of the pallet rack. I tested it with a delay block and it works but only with different hours where the pallets get picked and not an specific date. The important thing is the date which I get from a database.
process
Probably the easiest way is to have your in-rack agents (after your RackStore block) sit in a Wait block, and be freed from there (using the Wait block's free function) --- to then carry on to a RackPick block --- via AnyLogic dynamic events whose timings come from a database table.
(Your model as-is will just have your agents immediately exiting the rack and going to the Sink because the Queue does not stop them leaving.)
Your model startup would loop through the rows in the table and create dynamic event instances with the appropriate timeouts (delays from model start), and with a dynamic event parameter which specified the number of pallets to pick (and thus the number to free from the Wait block).