question

Niket M avatar image
0 Likes"
Niket M asked Niket M commented

Gap optimizing merge controller not releasing slug

Hi guys,

The merge control in my model doesn't release slug for a period of time when the tokens are stuck in the delay : wait until the release time. All of my conveyors have slug ready during this time but the merge logic still doesn't release the slug for some reason that I am not able to understand.

I am uncertain about the confidentiality policies of my company and hence not able to attach the full model right now (example of the merge logic attached in a small model).

If you see the image below, the three conveyors merge doesn't release the slug before some token token stuck in delay : wait until the release time part of the process flow is released.
1633563725329.png1633563805526.png


Can someone explain what is the purpose of that delay?

You might not observe the same issue in the example model because it never reaches the amount of slug I have in my current setup even if I try it with different arrival times.

egmodel-merge-minimumreleasetime.fsm

FlexSim 21.2.3
gap optimizing merge controller
1633564157431.png (441.6 KiB)
1633564207730.png (554.3 KiB)
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
1 Like"
Felix Möhlmann answered Niket M commented

The example model file wasn't properly uploaded, only the screenshots are available. Could you try to upload it again?

The delay makes sure that the current slug waits until the last slug is far enough along to ensure the chosen merge gap is respected. Now, obviously something is going wrong in the calculation of that time in your model. What's weird is the large number and varying ranks of tokens in the "Wait for Last Item..." in the "Gap Stats" section of the process flow. This suggests that items passed the decision point before a token was listening for them.

Some ideas of what might be going wrong:

Does the speed of your conveyor vary? Because the speed to calculate the release times is only determined once at the start of the model run.

Did you remember to delete the code in the merge controllers "Release Strategy" option (only leave "return 0;")?

Something to check:
When a slug is released, does the value of the "nextDPClearTime" label on the token in "Merge Control" at that time, coincide with the time the last item of the slug actually passes the decision point?

(Screenshot from an example I build to look for possible cuases)

1633591100241.png

1633591242870.png


· 6
5 |100000

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

Niket M avatar image Niket M commented ·

Thanks @Felix Möhlmann, I am attaching the model here.
Conveyor speeds are not varying but yes, I did delete everything from the "Release strategy" and replaced it with 0 in the merge controller. Isn't that what we have to do when we use the Gap Optimizing Merge Controller ?
egmodel-merge-minimumreleasetime.fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Niket M commented ·

@Niket M
I'm pretty confident I found the problem. There is an error in the gap-optimizing process flow. It tries to predict if more items will get added to a slug before it gets released. It does this by checking the distance between the last item added to the slug and the next one on the conveyor (if there is one). However, it does not take into account that there might a max. slug content set, that prevents those extra items from being added to the slug.

This results in all items on the conveyor being taken into account when calculating the "clear time" of the slug, when only a fraction of them is actually released.

To fix, open the code that assigns the "lastItem" label to the token.

1633616292078.png

In line 11, add the following to the condition of the "while"-loop.

 && (!lane.getVariable("hasSlugMaxItemCount") || lastItem.as(treenode).rank < lane.getVariable("slugMaxItemCount"))

1633616261170.png

This will stop the loop if the maximum slug content would be exceeded.

egmodel-merge-minimumreleasetime_1.fsm

2 Likes 2 ·
Niket M avatar image Niket M Felix Möhlmann commented ·
I see. I added back the Release strategy (Round robin if Available) and it was working for a few seconds but then immediately started throwing error regarding the lastItem label that you mentioned in the answer. I ran the model with this fix and it seems to be working right now. Thanks a lot. Do you think this is something that can be fixed in the next release? @Felix Möhlmann
0 Likes 0 ·
Show more comments