queue batching

queue batching

kevin.megee
Contributor Contributor
212 Views
3 Replies
Message 1 of 4

queue batching

kevin.megee
Contributor
Contributor

[ FlexSim 17.1.2 ]

I'm trying (wanting) to make a single queue batch 4 items, then 2, then 1, Or any sort of different batch sizing. Is this possible?

0 Likes
Accepted solutions (1)
213 Views
3 Replies
Replies (3)
Message 2 of 4

Ben_WilsonADSK
Community Manager
Community Manager
Accepted solution

Hi @Kevin Megee,

I've attached a sample model, built in FlexSim version 17.1, with a queue that rotates through batch sizes 4, 2, and 1:

9107-2017-10-17-10-29-49-flexsim-2017.png

In this sample model, all modifications are on the queue.

The queue is set to perform batching, and flush between batches:

9108-2017-10-17-10-43-56-queue1-properties.png

The queue has two labels. One is an array giving the batch sizes. The other keeps track of where we are in the array - specifying which index of the array is giving us our current batch size.

9109-2017-10-17-10-44-38-queue1-properties.png

The queue has three triggers set. These were all done with the standard pick options, and I'll explain each:

9110-2017-10-17-10-45-15-queue1-properties.png

OnReset - the reset trigger uses the standard Set Label option to set the BatchSizeIndex label to 0. When you start the model, it will always start at the beginning of the BatchSizeRotation array.

OnEntry - whenever a part enters the queue, we update the batch size (using the option for Update Queue's Batch Size) according to what value is read out of the labels. This is how we access the labels to look up the new batch size:

current.BatchSizeRotation[current.BatchSizeIndex+1]

This command gets the value from the queue's BatchSizeRotation label array, at index BatchSizeIndex+1 (add one since FlexSim arrays are 1-indexed, but our BatchSizeIndex value is 0 indexed).

Also, purely for visual demonstration, I set the color of the item, using the standard option Set Color By Case, where the case is based on the value BatchSizeIndex+1:

current.BatchSizeIndex+1


OnEndCollecting - when a batch is complete, we need to increment our BatchSizeIndex label to go on to the next batch size. We do this with the trigger option to Increment Value. However, we need the value to wrap back to 0 once it goes past the length of the BatchSizeRotation array. This is a 2nd trigger option (Set Label) added to the trigger, where we do a bit of modulo math:

fmod(current.BatchSizeIndex, current.labels["BatchSizeRotation"].value.length)

Here we use the fmod command to get the remainder found when dividing the value of BatchSizeIndex by the size of the BatchSizeRotation array. This is how we get the BatchSizeIndex value to stay in the range 0-2. Once it is incremented to 3, we then divide by 3 and take the remainder (0) and set that back to the BatchSizeIndex label.

Comment back with any related follow-up questions - or start a brand new question if you're moving on to another part of your model.

Message 3 of 4

kevin.megee
Contributor
Contributor

Thanks a lot, this is perfect

0 Likes
Message 4 of 4

jeffin_g
Not applicable

hi,

I am pretty new to flexsim and want to know how to label a batch of items and get its value incremented per each batch also on how to assign it to a global table and later call the values from table for packaging into totes based on dimensions.

0 Likes