question

mm_y_2406 avatar image
0 Likes"
mm_y_2406 asked Jeanette F commented

How to label tokens from resouces in a group?

Hi,

I am trying to label the tokens that is created from a triggered source creation activity. 3 tokens was created from the triggered source activity and I wanted to label these tokens accordingly to the tanks (Tank A, Tank B, Tank C) that are part of a group resource which is called Tanks. I tried labelling the token with the value: Group("Tanks")[tokenIndex], which I thought would label my first token to be Tank A, 2nd token to be Tank B and 3rd token to be Tank C but it doesn't work and it tells me that it's invalid. I'm not sure how to solve this and if anyone could help..

FlexSim 23.0.1
token label
· 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.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @mm_y_2406, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

tokenIndex is only defined for the Schedule Source where it denotes the rank of the currently created token in the current row. If one row creates 100 tokens, the index will count from 1 to 100. If ten rows create ten tokens each at the same time, the index will count from 1 to 10 ten times.

The Event Triggered Source can't know how many tokens it will create since the events are handled independently from one another. If your goal is to always repeat the same sequence (1, 2, 3) regardless of when tokens are created, you can use the output statistic of the Assign Labels activity to get an index. (Use the sampler on the activity to get the "getstat" expression)

1681213569817.png

If instead you want to label batches of simultaneously created tokens (with varying quantities of tokens), you could place a Batch activity with a max wait timer of 0s and a high batch quantity that will never be reached. In the On Wait Timer Fired trigger you have access to a parameter called tokens which is an array that contains all collected tokens so far. You can use this to number the tokens in the batch before releasing them.

1681213901010.png


1681213569817.png (9.7 KiB)
1681213901010.png (32.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.

mm_y_2406 avatar image mm_y_2406 commented ·

Hi Felix, it's not really what I'm looking for. The tokens are created 1 by 1 when the activity is triggered coming to a total of 3. The tokens that are newly created, I want them to have the label of Tank A, Tank B and Tank C respectively. I tried to use the output statistic as you showed but it doesn't work unfortunately :(

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann mm_y_2406 commented ·

Could you upload your model (or a small sample of the relevant) section, so we might be able to determine what is going wrong?

Here's an example that assigns queues to the tokens in sequence using the getstat-method.

RoundRobin_Label_Assigning_fm.fsm

0 Likes 0 ·