question

Colin B avatar image
0 Likes"
Colin B asked Colin B commented

Sort flow items in a container based on label value on the item.

I have a model where flow items are assigned a unique ID, that increments. Then task executors go around and pick the flow items from racks and place them onto carts, which is a container. This picking is random, and what I need to do is sort the items on the cart (in the container) based on the label (unique ID), so that the array of items in the container is listed in ascending order of the items label value.

It seems like you can sort items in a queue based on a label value. Can you also do this for items in a container?

FlexSim 21.2.4
sortingcontainer flow item
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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Colin B commented

You could copy the code of the respective option from the queue's On Entry trigger (Control -> Sort By Expression) into the packing logic of the container flow item. Select the item in the flowitem bin, create a copy of the packing logic and add the trigger code to it.

1658822191169.png

One adjustment has be made; since there is no 'param(1)' in the packing logic, the 'olditem' assignment has to be changed.

1658822106744.png

This does not restack the items, it only changes the order in the tree.

1658822325162.png

It does also mess up the packing method itself, since that assumes that the item that entered last will be at the last position in the tree. You can fix this by using a label to keep track of the last item.

order_in_tote_fm.fsm


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

Colin B avatar image Colin B commented ·

This solution worked really well. I incorporated the solution into my larger model, and it works. One thing that I had to pay attention to and I just want to point out for others, is to be sure to add a pointer label called lastItem to the container (whether it be a tote or cart, etc.). This label is applied in the flowitem properties of the container.lastitempointerlabel.jpg

0 Likes 0 ·