question

Amit Kulkarni avatar image
0 Likes"
Amit Kulkarni asked Amit Kulkarni edited

Find Nearest Open Slot Exception

I'm modifying the logic from this post to find the nearest slot in multiple racks that use AGV network. But I end up getting following error, perhaps due to queries that I am using while finding a storage slot. Also @anthony.johnson mentioned to use Vec3.project() method to query multiple racks, which I don't know how do. Any pointers are appreciated. Sample model is attached.

time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Find Nearest Slot>labels/1/2
time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Find a Storage Slot>labels/1/2
time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Which Rack?>labels/1/2
time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Slot Placement Strategy>variables/codeNode
time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Find Nearest Slot>labels/1/2
time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Find a Storage Slot>labels/1/2
time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Which Rack?>labels/1/2
time: 120.000000 exception: FlexScript exception: MODEL:/Tools/ProcessFlow/ProcessFlow/Slot Placement Strategy>variables/codeNode


NearestSlotTwinForkAGV_11.4.2020.fsm



FlexSim 20.2.3
flexsim 20.2.3sql querieswarehousing
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 Amit Kulkarni edited

The project method of a location just finds the point in 3D space relative to another object - and it takes two parameters in the example the FromObject and the ToObject. By setting the ToObject to model() it's asking for the absolute location in model space and not relative to the containing object/Rack.

By subtracting one location in model space from another you get the vector between the two - and the magnitude of that is the distance between them.

· 12
5 |100000

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

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

I've altered the queries to this but it's still causing an exception

You appear to be using findSlot to assign the token label slotItem, but that's probably going to be a slot, while parameter two above is clearly assuming it's a slotItem.

0 Likes 0 ·
Amit Kulkarni avatar image Amit Kulkarni Jason Lightfoot ♦ commented ·

@jason.lightfoot Thanks for the response. Here is what I changed based on your latest comment :

1. Find a Storage Slot now assigns to token label MySlot, which I assume is a slot. and made corresponding changes to where this label is used.

Query 2 in above image checks all racks in the model that have label "Active" with value 1. Do I have to modify this to find an empty slot in any rack with the project method? Also, the label "MySlot" is used to define the rack to which it belongs and set destination for the AGV to drop off.


After running the model, along with the exception, I now get a invalid FlexScript code error in Query 2 in "Find Nearest Slot" activity.

Invalid FlexScript code: ((param(1).as(Storage.Slot).project(param(2).as(Storage.Slot).StorageObject,model())) - (param(3).as(Storage.Slot).location.project(param(4).as(Storage.Slot).storageObject,model()))).magnitude

Do you think the way "Which Rack?" and "destination" activities are defined are causing this issue?

NearestSlotTwinForkAGV_11.5.2020.fsm


0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Amit Kulkarni commented ·

I've changed a few things that were not needed or missing - see the other comment with the model attached (ending jl_4.fsm)

1 Like 1 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Attached is a version of the model without transport assigning to closest free slot across two Racks.

nearestslottwinforkagv-1142020_jl_4.fsm

0 Likes 0 ·
Amit Kulkarni avatar image Amit Kulkarni Jason Lightfoot ♦ commented ·

I really appreciate your help on this topic and I now better understand what you did with the queries.

Any reason, why you removed the transport logic in this model? When I added the AGV logic, the pallets disappear when the AGV arrives at the loading point and the model crashes. This logic is part of a bigger model and the AGV functionality is a key part of it.

NearestSlotTransport.fsm

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ Amit Kulkarni commented ·

Yes - with the transport in place, the search for a matching slot-item wasn't finding anything. I'll try and get to the bottom of why that is.

0 Likes 0 ·
Show more comments

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.