question

David Besson avatar image
3 Likes"
David Besson asked Brandon Peterson commented

How to pull a batch (size OR maxWaitTime reached) with Process Flow

Flowitems arrive in a Queue and are pushed to a list.

A Fixed Resource Process Flow tells a Processor to pull a batch of flowitems on this list. The batch size is specified with a label on the Processor and the Processor can process only one batch at a time.

How can I also pull all the flowitems in the Queue when one of them reaches a maximum wait time, although the batch size is not reached ? The maximum wait time is for example defined with a label on the Queue.

This wait time is NOT the wait time of the "Pull from List" activity, BUT the time that the flowitem was spent in the queue.

how-to-pull-a-batch-size-or-maxwaittime-reached-wi.fsm

Thanks for your help!

FlexSim 16.1.0
process flowlist
5 |100000

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

Brandon Peterson avatar image
4 Likes"
Brandon Peterson answered Brandon Peterson commented

David,

I would use two pull from list activities. The first one would pull a single item but would leave the entries on the list and would not have a max wait time. Basically it would act like a gate that holds the token until the first item arrives (you could also use a wait for event activity and listen to the queue). The second pull from list would be the same one that you have now but would use the max wait time functionality. Now, because we waited in the first pull from list activity for the arrival of the first flowitem, the max wait time is the same as the time that the first flowitem is waiting.

Hope this helps!

Brandon

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

David Besson avatar image David Besson commented ·

Thank you Brandon.

But with your solution I see 1 limitation:

  • It does not work if a flowitem enters the Queue when the Processor is processing

And what about these aspects:

  • There are more than 1 processor pulling
  • There are more than 1 itemtype and the max wait time depends on the itemtype

0 Likes 0 ·
capture3.png (37.9 KiB)
Brandon Peterson avatar image Brandon Peterson ♦ David Besson commented ·

David,

You can use the reference to the item in the first pull from list in the max wait time of the second pull from list. This would allow you to use the itemtype of the item as well as any time that the item spent waiting in the queue while the processor was processing the prior batch.

In addition to your question about having multiple processors, you could also add the following:

  • What if the items can wait too long and have to take an alternate path once they have waited a certain amount of time?
  • What if a batch can be split up between multiple processors if there aren't any other batches waiting or being processed?

I think that the answers to these questions and one similar would be to model the process flow differently. In the original question and your follow up answer the flow has been based on the resources and/or the flowitems. I would suggest that the flow be based more around the concept of a batch. This would be a token created by items that enter the queue and are the first of a new batch. Depending on how you want to batch, this could be the first of an itemtype, the first since the last batch left, etc. The batch would then be responsible for pulling the items from the list until it was either full or exceeded the wait time. It could then acquire the processor(s) it needs and move the flowitems.

I hope this helps,

Brandon

5 Likes 5 ·
David Besson avatar image
0 Likes"
David Besson answered

A solution could be to change the Process Flow as follow:

And to change the OnEntry trigger of the Queue : each flowitem sends a delayed message when it is supposed to reach the maximum WaitTime, which triggers the "item Delay message" activity.

This activity is followed by a "Release token" activity, which destroy the token in the "Wait BatchSize" activity.

Your remarks are welcome!

how-to-pull-a-batch-size-or-maxwaittime-reached-wi.fsm


5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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