question

Sebastien avatar image
0 Likes"
Sebastien asked Sebastien commented

Using gettokens with Batch activity

Hi !
I am trying to check how many tokens are waiting inside a batch activity.

I tried the following

treenode batchActivity = getactivity(processFlow, "Batch");
Array tokensInBatch = gettokens(processFlow, batchActivity);
print("[Decide] Waiting for Batch:"+ numtostring(tokensInBatch.length));


But I only get 0. I tried this method for counting the tokens in a Breath activity and it worked, so I guess the Batch activity is a bit different due to the tokens being batched.

Yet is there a way to get all the tokens waiting to be batched with code ?

FlexSim 20.2.3
tokensbatch
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

Ralf Gruber avatar image
0 Likes"
Ralf Gruber answered Sebastien commented

Sebastien,

the exact code you were using above works for me, assuming that your variable processFlow is a valid reference to the process flow holding the batch activity you are looking into. Used 20.2.3 as well:

gettokens.png

Sure there is not anything else wrong?


gettokens.png (40.4 KiB)
· 1
5 |100000

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

Sebastien avatar image Sebastien commented ·

I can't believe I had forgotten about another Batch activity I had in the model. So the value was taken from it and not from the new one.

The code is working.

Thank you @Ralf Gruber for your help.

0 Likes 0 ·