0
votes

I'm facing an issue with the project I'm developing using Anylogic. I would like to have a rack store block and a rack pick block to select a pallet rack programmatically, choosing it from an array list.

In particular, rack store is working in this way: rack store block

The rack pick block gives me an error, saying that the first pallet rack does not contain the agent, even though, by debugging, it says that that pallet rack has no free space and moreover the agents in it are of the correct type and the agent to be picked seems to be correctly positioned in the pallet rack. The rack pick block is the following: rack pick block

The info I was talking about the item are visible here and I printed them with the following piece of code:

traceln(palletRackListKuka.get(0).getByIndex(0).agentInfo());
traceln("class is " + palletRackListKuka.get(0).randomAgent().getClass());
traceln("has space is " + palletRackListKuka.get(0).hasSpace());

How can I solve this? Please ask for further details in case I was not clear enough.

1

1 Answers

1
votes

The way RackStore and RackPick work is that the agent flowing through the blocks is the one stored and picked.

Thus your error is likely because the pallet rack you choose (programmatically) in your RackPick block is not the same pallet rack you stored that agent in when it passed through the RackStore block earlier. Your console statements just show that the pallet rack has some agents of the required type, not the agent that is flowing through the RackPick block.

You can just add the pallet rack you stored the agent in as an extra field (variable) inside it, which you then reference when picking it.

Edit: To do that, you are already providing an expression for the pallet rack to store in, so instead make that a function call to a function you create (returning a type PalletRack) which selects the pallet rack and stores it in a type PalletRack variable inside your IndustrialContainer agent.

If you want 'decoupled' picking (i.e., what to pick is determined externally in some way) that is something different where you have to have some mechanism to then

  • choose which specific agent you want to pick (say out of 1000 instances of the same product) which will typically relate to your 'storage/retrieval policy';

  • 'inject' that agent into a RackPick block to pick it (e.g., via an Enter block).

See the Distribution Center example model for a version of this.