question

Dylan R2 avatar image
0 Likes"
Dylan R2 asked Sam Stubbs commented

Is it possible to reorganize a queue each time a new item enters?

I'm new to flexsim and I would like to minimize setup times, which occur when an item type that is different from the previous item type is processed. i.e. there are 3 item types, so if item type 3 was the last to run, I want to check the queue to see if there are any item 3s to run before pulling the next item from the queue. Then when there are none, pull the next available item type, and search the queue for any more of that type as well, etc.

queuequeue strategyprocess flow pull from listqueue and codebased on the next item type
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

Sam Stubbs avatar image
1 Like"
Sam Stubbs answered Sam Stubbs commented

In the OnEntry trigger of the queue, you can use the action of "Sorting by Expression." Which can sort the rank of items in the queue, by whatever value you want (usually a label on the items).

Here's an example:

sorting.fsm

You may also want to check out this previous Answer on the forums:

https://answers.flexsim.com/questions/51031/flowitem-sort-in-onentry-and-onexit-triggers.html

Additionally you could utilize lists in a Push/Pull kind of system in order to enforce sorting as well.


sorting.fsm (148.2 KiB)
· 2
5 |100000

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

Dylan R2 avatar image Dylan R2 commented ·

@Sam Stubbs

I thought about using Sort by Expression, but I don't want to sort in ascending or descending order, I would like to sort based on whatever was last run through the processor (which is the next step, directly after the queue). If there is none of the previous item type run, then I would like it to take the next available item, and resort the queue to bring items of that type to the front.

Here is a picture of how I have my model set up, it's very simple as I'm trying to figure this out before I do much else.

example.png

0 Likes 0 ·
example.png (88.6 KiB)
Sam Stubbs avatar image Sam Stubbs ♦ Dylan R2 commented ·

Hmm, the logic for that is not as trivial as it seems. Your best bet is to use a list and a Process Flow then. This can effect how the Processor Pulls the item. It won't create a visual sorting within the queue, but it will behave the way you're saying. You'll need to have your list pull with a query on it. If you're unfamiliar with Process Flow, Lists and Queries. I highly recommend going through the tutorial found in the manual at Tutorials > Process Flow Tutorials > 1.1 -Use a List and a Resource.

Here's an example:

sortsametype.fsm

1 Like 1 ·
sortsametype.fsm (26.4 KiB)