question

Pietro Turrin avatar image
0 Likes"
Pietro Turrin asked Pietro Turrin commented

Operator Sorting Color Box Problem

Hi, I'm having a problem in the sorting phase of the different boxes.
The idea would be that each box must be processed by the processor of the same color. The fact that operators can pick boxes of different colors is a desired feature.
Currently the color of the box is decided and assigned to a label directly from "MainSource".
The problem I'm having is the following, the operators unload all their load in a single Queue, placing the entire load there even with boxes of non-related color.
I think that the Queue that is chosen is based on the first box that is picked which, unfortunately, commands the unloading for the rest of the load.
How can I make sure that, once the first box is unloaded, the operator goes to the Queue of the correct color?
(I realize that it is not an efficient system, but I need it to be able to understand the logic of the tokens).

Thanks for the help.

TU5 Conditional Task Tutorial V4.fsm


FlexSim 24.2.1
subflowsortingdecision
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

Emily Hardy avatar image
1 Like"
Emily Hardy answered Pietro Turrin commented

The issue is that when you unload the item, you are calling token.GroupOfItems.pop(). This will return and then remove the last value in the array GroupOfItems. However, when you run the subflow and check which queue to visit, you are looking at the first item in GroupofItems. This is leading to a mismatch. In other words you check the first item, but then you unload the last item. You have two options:

1. Unload the first item in the array using token.GroupOfItems.shift(), which returns and removes the first index of the array.

1726765742554.png

You also need to add in an "Assign Labels" when you unload more boxes to update the value of MyItem now that the previous value has been removed from the array.

1726765899601.png

2. Start with the last item in the array when you run the subflow. You can do this by setting MyItem to token.GroupOfItems[token.GroupOfItems.length] and then continue to use pop() when you unload the item.

1726765657100.png

You also need to add in an "Assign Labels" when you unload more boxes to update the value of MyItem now that the previous value has been removed from the array.

1726765960282.png


If this were my model I would use Option 2 because then it unloads the top item that the operator is carrying. I attached the model with this solution but I can send you Option 1 if you prefer.

tu5-conditional-task-tutorial-v4_EditedEH.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.

Pietro Turrin avatar image Pietro Turrin commented ·

Thank you for the response, all clear!

Have a good day

0 Likes 0 ·