question

Andres Pallaro avatar image
0 Likes"
Andres Pallaro asked Andres Pallaro commented

Verify inventory of an item Type before pulling all the batch from list

Hello,

I am working on a model where I have an station processing products by batches of the same item Type label. It pulls a first item and then, for pulling the missing items of the batch, I have another pull from list with a query referencing the first item Type label.


What I need is a special query on the first pull from list ( on yellow) where, before pulling all of the items of the same label, it verifies if it can fullfill the complete batch, if not it will select another first item with a diferent Type label.

I send the conceptual model.

Batching Pull from list Conceptual Model.fsm


1634672078263.png

FlexSim 21.2.3
list pullbatch processingpull query
· 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.

Omar Aguilera Rico avatar image Omar Aguilera Rico commented ·

I think this is what you are looking for, if you don't tell me.

batching-pull-from-list-conceptual-model_2.fsm

1 Like 1 ·
Andres Pallaro avatar image Andres Pallaro Omar Aguilera Rico commented ·
Thanks Omar!
0 Likes 0 ·

1 Answer

·
Eric M avatar image
0 Likes"
Eric M answered Andres Pallaro commented

Hi @Andrés Pallaro, here's a model with a few added activities (in green) that make sure there are enough items of a specific type before continuing on with the batching process.

1634686921936.png

The key here is the custom code activity which runs a query to filter the list by items of the same Type as the first item. The total count is then stored in the label token.itemBatchSize which can be seen in the code below. More information on how to use queries in Flexsim can be found here.

Table Result = Table.query("SELECT * FROM ItemList1 WHERE Type = $1",token.Type);
int Count = Result.numRows; 
token.itemBatchSize = Count + 1; // +1 accounts for first pulled item

The decide activity then checks if there are enough items to batch and the token moves on if there are. If there aren't enough items to fulfil the Capacity, the item is pushed back onto the list and another item is pulled. It's important to note that the Max Wait Timer on the Push to List is greater than 0. This is in case a time comes when there aren't enough items of any type in the storage to fulfil a batch. If it's set to 0, the model will be stuck in a loop pushing and pulling items from the list. Greater than 0 allows the model time to keep moving until more items come into the storage.

Let me know if you have any questions!

batching-pull-from-list-conceptual-model-em.fsm


· 4
5 |100000

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

Andres Pallaro avatar image Andres Pallaro commented ·

Thanks for your answer Eric, it seems really concise and efficient!


I have one question when implementing it on the original model. I changed the name of the list to "WIP Pew Horno" and the field to filter by on the list to "tiempoH8". Also the token label is different "tiempoH".

1634748245757.png

The issue is that it gives me this message.

time: 0.000000 exception: FlexScript exception: No resolved tables at MODEL:/Tools/ProcessFlow/ProcessFlow/Custom Code: Batch Size>variables/codeNode

Am I missing something?

0 Likes 0 ·
Andres Pallaro avatar image Andres Pallaro commented ·

I see the image did not send, but here is the original model.

Original Model - Batching pull from list.fsm

0 Likes 0 ·
Eric M avatar image Eric M Andres Pallaro commented ·

Try removing the spaces in the List name.

1634759310232.png

And then adjusting that in the code:

Table Result = Table.query("SELECT * FROM WIPPreHorno WHERE tiempoH8 = $1",token.tiempoH); 

Also, I noticed the way the connectors are on the decide, the Run Carga activity should have a quantity of token.itemBatchSize - 1 instead of token.capacidadHorno - 1

Let me know if that solves the issue you're having.
0 Likes 0 ·
1634759310232.png (4.8 KiB)
Andres Pallaro avatar image Andres Pallaro Eric M commented ·
Hi @Eric M , It works now, Thanks a lot!
0 Likes 0 ·

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.