question

James Riebau avatar image
0 Likes"
James Riebau asked Jason Lightfoot edited

How do I find a slot ordered by distance to an object in the model?

Hello,

In my warehouse model I'm working on I'm trying to prioritize which slots are chosen to put pallets away in floor storage. I would like to order the slots by closest to the docks.

In my find slot task was trying to reverse engineer the query for ‘ORDER By Distance from Object', to change the object from current pallet to another object in the model, but I really don't have a clue how to do it. I placed a cylinder in the center of my docks that I want to use as my object to measure from.

Can anyone help me with this?

screenshot-2022-02-17-115805.jpg

Thanks,

Jim

PutawayTest.fsm

FlexSim 22.0.0
warehousefindslotorder bydistance from object
5 |100000

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

1 Answer

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Jason Lightfoot edited

You can add a second parameter and use the sampler to point it to the cylinder

1645120122782.png

- then you can use:

WHERE slot.Part == 0 AND slot.zoneID == $1.StorageGroup AND slot.hasSpace($1) ORDER BY (slot.location.project(slot.storageObject, model()) - $2.as(Object).location.project($2.up, model())).magnitude ASC


Or you can add a label on the item pointing to the cylinder and reference $1.yourlabel instead of $1 in the distance part:

WHERE slot.Part == 0 AND slot.zoneID == $1.StorageGroup AND slot.hasSpace($1) ORDER BY (slot.location.project(slot.storageObject, model()) - $1.yourlabel.as(Object).location.project($1.yourlabel.up, model())).magnitude ASC

putawaytest_jl.fsm


1645120122782.png (5.8 KiB)
putawaytest-jl.fsm (947.7 KiB)
· 1
5 |100000

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

James Riebau avatar image James Riebau commented ·
Thanks, that was easy.
0 Likes 0 ·