question

Jon Abbott avatar image
2 Likes"
Jon Abbott asked anthony.johnson commented

Finding the nearest open slots to an item in a rack

Is there a way to use findSlot to identify open rack slots nearest in distance to an item that is already stored in a rack? Thanks in advance for your help.

FlexSim 20.0.5
rackflowitemfindslotflexsim 20.0.5nearest
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Phil BoBo avatar image
4 Likes"
Phil BoBo answered anthony.johnson commented

@Jon Abbott

Here's an example using the Warehousing pick options in Process Flow.

find_nearest_slot.fsm


1588807191412.png (525.7 KiB)
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

anthony.johnson avatar image anthony.johnson ♦♦ commented ·

Note this example will only compare locations within the same rack. If you want to compare locations across different racks, you need to use the Vec3.project() method to translate the location from the rack's local space to the model space.

4 Likes 4 ·
Phil BoBo avatar image Phil BoBo ♦♦ commented ·

For others that may look at this question/answer, here's another example that uses the feature of using multiple Queries in Find Slot. This example will try to avoid mixing slots with different types.

First, it looks for a slot that has an item that it matches.

Then it looks for the nearest empty slot.

Finally, it looks for the nearest slot with space regardless of what is in it.

find_nearest_slot_1.fsm

Results in this:

Instead of this:

0 Likes 0 ·
1588809826551.png (396.0 KiB)
1588809835294.png (252.9 KiB)
Jon Abbott avatar image Jon Abbott commented ·

This is great! Thanks @phil.bobo and @anthony.johnson for all of your help with this.

0 Likes 0 ·
anthony.johnson avatar image
1 Like"
anthony.johnson answered

@Jon Abbott Here's sample code I executed in a script window:

Storage.Slot other = Model.find("Rack1").as(Storage.Object).getSlot(7, 4, 1);
return Storage.system.findSlot("ORDER BY (slot.location.project(slot.storageObject, model()) - $1.as(Storage.Slot).location.project($1.as(Storage.Slot).storageObject, model())).magnitude ASC", 0, other.as(treenode));

Or you can make a command that calculates the distance and call that from the query.

5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.