question

Majid A avatar image
0 Likes"
Majid A asked Matt Long commented

On MaxWaitTimer, release batch instead of individual tokens

I need to keep creating batches in the process flow until certain time upon which, the last partial batch needs to be released. I am using the MaxWaitTimer in the Batch activity but individual tokens get released instead of the partial batch. I do have the Batch activity setup to release batch and not tokens.

Thanks for the help.

FlexSim 18.0.1
batchmax wait timer
5 |100000

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

1 Answer

Matt Long avatar image
0 Likes"
Matt Long answered Matt Long commented

Without a model I'm not exactly sure how you have your Batch properties set up, but my guess is that you've told the batch that it "Failed". The releasebatch() command has two required parameters and a third optional parameter:

releasebatch(node batch, int failed [, int/str/obj connector])

The pick option in the OnWaitTimerFired trigger allows you to define each one of these:

From the command help for releasebatch:

"If failed is 1, all tokens in the batch will be released and the release quantity and label values will be ignored."

My guess is that you have the Failed box checked. Uncheck Failed to have the batch release at it's current state rather than all of the individual tokens that made up the batch.


batch.png (6.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.

Majid A avatar image Majid A commented ·

@Matt Long,

Thanks, that worked. Is there a way we can get a list of all current batches in a Batch activity?

0 Likes 0 ·
Matt Long avatar image Matt Long Majid A commented ·

Unfortunately there currently isn't an easy way to do that. I've added it to the dev list to take a look at getting something implemented.

The following code will return an array of all the batches in a batch.

Array tokens = gettokens(current, batchActivity);
Array batches = Array(0);
for (int i = 1; i <= tokens.length; i++) {
	treenode batch = getbatch(tokens[i]);
	if (batches.indexOf(batch) == -1){
		batches.push(batch);
	}
}
return batches;

You could implement this in a user command for easy access.

0 Likes 0 ·