question

David Seo avatar image
0 Likes"
David Seo asked David Seo commented

how and when to get the slot content exactly?

I want to know how to get the number of items in the slot using 'List'.

When using List, the slot length is only ONE?

2022-01-05-000803.png2022-01-05-001040.png

The item contents in the slot are four like picture.
And one more...

After once moving the tote into the port#1, the next tote can't be moved.

What's the reason of it?

FindSlot_StorageSystem_2.fsm

FlexSim 21.2.4
slot contenthow to get the slot length
5 |100000

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

Jordan Johnson avatar image
0 Likes"
Jordan Johnson answered

In the picture, the values on the list are boxes, not slots. If you want the content of the slot that an item is in, you'd need to use this code:

Storage.Item storageItem = Storage.Item(value);
var slotItems = storageItem.assignedSlot.slotItems;
int count = 0;
for (int i = 1; i <= slotItems.length; i++) {
    Storage.Slot.Item slotItem = slotItems[i];
    if (slotItem.storageItem.state == Storage.Item.State.Stored) {
        count += 1;
    }
}

return count;

If you use slotItems.length, you'll get the number of items assigned to the slot. Assignment happens when items arrive at the rack, but it isn't undone when items leave the rack; the item may be removed from the rack, but it is still assigned to the slot. So you can use the code above to count the number of items physically in the slot.

Alternatively, you could add code to set the assignedSlot property to 0. Then slotItems.length would have the correct value.

I think the reason you can't move the second tote deals with not returning a Task Executer in the transportdispatcher code. I think the issue is that the Queue is expecting a task sequence to move the object, and so it's marked as busy. But you only use moveobject(), without making a task sequence. So the Queue isn't available for the next item.

From the manual:

"If a 0 value is returned, then the fixed resource will assume that a task sequence has been created explicitly by the user..."

"...each fixed resource object keeps track of two numbers: the number of flow items that are in transit to the object, and the number of flow items that will be transported out of the object, but have not been picked up yet. These two variables are respectively called nroftransportsin and nroftransportsout."

"The integrity of the nroftransportsin and nroftransportsout variables is essential to the correct operation of the objects involved because each object may screen further input/output based on these variables."

https://docs.flexsim.com/en/22.0/Reference/3DObjects/FixedResources/FixedResourcesConcepts/

I think you'll need to find another approach to move the items in the tote with a transporter, and moving the tote without one.

5 |100000

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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered David Seo commented

The "value" you push to the list is the item. To get from there to the Storage.Slot it is currently in, you first have to contruct the respective Storage.Item class object. From there you can access the slot with "Storage.Item.currentSlot".

Storage.Slot slot = Storage.Item(value).as(Storage.Item).currentSlot;
int SlotContent = slot.slotItems.length;
// This returns all items currently assigned to the slot

return SlotContent;

However, not all items "assigned" to the slot, and thus part of the slotItems array, have to be in the slot. In your case, since you call the Slot Assignment Strategy in the separator entry trigger, the items are already part of the array, as soon as that trigger is evaluated.

To get the actual number of items currently in the slot, you have to check the Storage.Items current state (Unassigned, Inbound, Stored, Outbound).

https://docs.flexsim.com/en/20.2/Reference/CodingInFlexSim/FlexScriptAPIReference/Warehousing/Storage.Item.html#Property-state

Storage.Slot slot = Storage.Item(value).as(Storage.Item).currentSlot;

// To get the number of items actually in the slot, we go through
// the slotItems and see if their current status is 'stored'
int SlotContent = 0;
for(int index = 1; index <= slot.slotItems.length; index++)
{
    if(slot.slotItems[index].storageItem.state == 3)
    {
        SlotContent++;
    }
}

return SlotContent;

The calculation in the separators entry trigger is also off by one, meaning one more item gets assigned to the slot than actually unpacked.

Finally, the queue is simply set to have a maximum content of one, thus blocking any further input.

findslot-storagesystem-2.fsm

Edit: More about the transport:

As Jordan mentioned, since you move the item with the "moveobject" command, the queue still expects another item to enter. As a result without further changes it will only have half of the set capacity. You can choose the "Conditional Transport" option in "Use Transport" to use the operator only if item exits through port 2. If you look at the code this generates you can also see the commands that are used to reset the output/input state of the separator and queue.

1641315191414.png


· 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.

David Seo avatar image David Seo commented ·
0 Likes 0 ·