question

Michael D6 avatar image
0 Likes"
Michael D6 asked Jordan Johnson commented

Increment and then Decide

Attached is a simple model. I can use the custom code to increment the token, but it increments them all to the same value. How would I get the source to increment the value. My end goal is to create 4 items and then use the decide to move the first to Queue 2 and then the rest to Queue 3. Any help is appreciated. Increment Item Counter.fsm

FlexSim 21.2.3
increment label
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
0 Likes"
Jeanette F answered Jordan Johnson commented

Hello @Michael D6,

You can assign a label to each created token from the source by creating the label value with
1640189611651.png


1640189611651.png (3.3 KiB)
· 3
5 |100000

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

Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

You can use rowNumber instead of tokenIndex; rowNumber indicates the row of the arrival table that created the token, where tokenIndex is the nth token created on that row.

1 Like 1 ·
Michael D6 avatar image Michael D6 commented ·
Hi @Jeanette F thanks for the quick reply. It is not clear to me how I would use that. I tried to add in the value field of the counter label created and it does not increment. Would you be able to provide any additional details on this?
0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ Michael D6 commented ·
Hello @Michael D6, What I suggested works if the source created all the tokens at once. So if the source created 4 tokens at time 0 and this label was assigned then each token would have an increments value. For instance, the first token would have a 1 and the second token would have a 2.
1 Like 1 ·
José Antonio MD avatar image
0 Likes"
José Antonio MD answered José Antonio MD edited

Hello @Michael D6 ,

You have different options: create Variables, use a label on an object... or you can simply read object's statistics (see example). Then in the decide you can use the option you need.

I hope I have been helpful.

increment-item-counter_1.fsm


5 |100000

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