question

Alexander Muff avatar image
1 Like"
Alexander Muff asked Alexander Muff answered

How to index variables in Process Flow

I would like to repeat labels according to an index global variable:

Part 1 - Lot 1

Part 2 - Lot 1

Part 3 - Lot 1

Part 1 - Lot 2

Part 2 - Lot 2

Part 3 - Lot 2

Part 1 - Lot 3

Part 2 - Lot 3

Part 3 - Lot 3

FlexSim 16.2.0
global variablesvariable
· 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.

Steven Hamoen avatar image Steven Hamoen commented ·

@Alexander Muff I think it is not very clear what you are looking for. Do you want to put a label on a token based on the nth time this token passes somewhere? Or do you want to put several labels on a token? Do you want to have this table you describe on a token? Some more information is needed here....

1 Like 1 ·
Regan Blackett avatar image Regan Blackett ♦ commented ·

I might try something like this with a Schedule Source, using it's access variables for rowNumber, tokenIndex and repeatCount (for repeating schedules) configured like this.

1 Like 1 ·
Alexander Muff avatar image Alexander Muff commented ·

@steven.hamoen

Ideally, I would like to attach 2 labels to each tokens: Type and Assembly. The Type would be 1-3, indexing up each part and resetting back to 1 after 3. The assembly would be the index up after every third token.

0 Likes 0 ·
picture1.png (5.9 KiB)
Steven Hamoen avatar image
2 Likes"
Steven Hamoen answered Matt Long commented

Ok that makes it a lot clearer. To get label 1 you could do:

fmod( tokenIndex - 1, 3 ) + 1;

That would give you 1,2,3,1,2,3 etc

For label 2 you could do

(tokenIndex - 0.1)/3 + 1

That would give you 1,1,1, 2,2,2 etc

· 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.

Alexander Muff avatar image Alexander Muff commented ·

@steven.hamoen

Is tokenIndex a built in variable? I am getting an error: unknown variable "tokenIndex".

0 Likes 0 ·
picture2.png (14.9 KiB)
Matt Long avatar image Matt Long Alexander Muff commented ·

tokenIndex is only available in the Scheduled Source.

3 Likes 3 ·
Matt Long avatar image Matt Long Matt Long commented ·

If you aren't using a scheduled source but want to use the input of your activity as an 'index' you could say:

fmod(getinput(activity) -1, 3) + 1; 

etc

3 Likes 3 ·
Alexander Muff avatar image
0 Likes"
Alexander Muff answered

I am using a scheduled source. Each token is getting the same partID and setID, 1.0 and 1.3


picture3.png (17.1 KiB)
picture4.png (15.0 KiB)
5 |100000

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