Page 244 - ExtendSim User Guide
P. 244

218
Batching and Unbatching
Unbatching
☞ As discussed later in this chapter, if both the Batch and Unbatch blocks are set to preserve the uniqueness of items, batch size does not need to be saved in an attribute. Instead, just check Use preserved items to determine unbatch quantities in the Unbatch block’s dialog.
Batch and Unbatch Variable model
An example of batching a variable number of items and unbatching that same number, is shown in the model below.
Batch and Unbatch Variable model
In this model, the Batch block’s Options tab indicates that the size of each batch is stored on an attribute named batchsize, which is accessed by a Get block. Attaching the Get block’s value output to the Unbatch block’s UnbatchQuantityIn connector sends information about the size of the batch to the Unbatch block, causing each batch to separate into its original number of items.
☞ Since the Batch block is set to Set batch size by first item at each connector:, the size of the batch is locked when the first item for that batch arrives in the Batch block.
Properties when items are unbatched
As happens when items are batched, when items are unbatched you can specify what the block should do with their properties. This is accomplished by selecting an Action for item properties in the Unbatch block’s Properties tab.
For example, assume a Batch block combines six bottles that have a Weight attribute, and that the bottles are then filled with liquid such that the batch weighs 12 pounds. When these bottles are subsequently unbatched, you can select one of the following actions for the Weight attri- bute:
• Preservedvalue.Thisoptioncausesthebottlestoretrievetheirpreservedvalue,ifpreserve uniqueness is turned on. (See the following topic for more information about preserving uniqueness.) In this case the weight of each bottle will be what it was before batching and the 12 pounds of weight acquired after batching is discarded.
• Batchedvalue.Withthischoice,the12poundsofweightwillbecopiedtoeachoftheresult- ing bottles.
• Distribute.The12poundsofweightwillbedividedamongeachitemequally,2poundsto each bottle.
Unbatch block property actions
Discrete Event


































































































   242   243   244   245   246