question

Cyrine S avatar image
0 Likes"
Cyrine S asked Pierre G commented

Conditional Batching

Hi all! I want to perform a batching for items before sending them to a queu. The batch size is variable ie items can not be sent to the queu unless a label called "lastone" is equal to 1.

exampe

Item 1 : "lastone=0" ==> wait

Item 2 : "lastone=1"==> send the batch (2 items) to the queu

Item 3 : "lastone=0"==>wait

Item 4 : "lastone=0"==>wait

Item 5 : "lastone=0"==>wait

Item 6 : "lastone=1"==>send the batch(4 items) to the queu

I attached a simple model for better understanding.

Thank you in advance for your help.conditionalbatching.fsm

FlexSim 18.0.10
batchconditional decide
5 |100000

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

Pierre G avatar image
1 Like"
Pierre G answered Pierre G commented

Hi,

You could use a ProcessFlow to do what you want.

First, in your Queue, you can choose the option Do Not Release Item. You will have to release your items manually if you want them to continue their way.

Second, to release your items at the good moment, you can use a ProcessFlow. The idea is to create a token when an item enter in your Queue, and to push this item in an Internal List. Then, if the label lastone is equal to 0, you can destroy your token ; if not, you can pull every item you will have on your List, and release them with the SubFlow "Release le lot".

If you have any questions, ask me.


a.png (14.9 KiB)
a.png (32.7 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.

Cyrine S avatar image Cyrine S commented ·

Thank you very much for your reponse. this solution seemed to work will at the beginning, but the model has stoped after some minutes and the reason is that some of the batches take so much tame to be complete and then released, so the source was blocked. As a solution to this, i want to define a maximum wait time. So that if the max wait time has passed, even if the batch is not complete, items have to be released. Do you have an idea on how to add this to the processflow please ? Thank you in advance for your response.

0 Likes 0 ·
Pierre G avatar image Pierre G Cyrine S commented ·

Hi,

You can modify your Process Flow to do that. I added a new logic (the Max Wait Time part in the Process Flow).

The idea is to create a token in this new Max Wait Time part when an item enter the Queue (Create Tokens activity). And then the activities work like this :

Enter Zone Activity : If it's the first item of your batch, you will go to the Wait for Event activity ; if not, the max content of the Zone (which is 1) will be already reached so your token will go to the second connector and will be destroyed.

Wait for Event : Your token (which represent the first item of a batch) will wait the event of exit of your Queue. If this event happens before the Max Wait Time, you go to the first connector and you free the Zone (the items will be released by your "Création et Gestion des lots" part so you don't need to release them) ; if not, it means that the batch is not ready but you want to release your items, so your token goes to the second connector and releases manually all the items which are in the Queue.

If you have questions, ask me.

0 Likes 0 ·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered

Try batching with a Max Wait Time a bit larger than 0 e.g. 0.00000001.

The Target Batch Size is large (10000).

You set OnEntry trigger to close the output. And you append in the same trigger to open the output by the condition

item.lastone 

That is equal to the comparision item.lastone == 1, because by evaluating the label the value is 1 and this equal to true. Because you set a wait time lasting a bit longer than 0 the output will be opened when the last of the item of a time stamp had already arrived.

This is in fact not a real batching because, you don't not know or set the exact batching size.

If you get errors, please build your model from the beginning. If there are still errors please report back again.

5 |100000

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