Time Plot from Global Table - data.rowNum only works for first time

Time Plot from Global Table - data.rowNum only works for first time

clairekruppGhafari
Advocate Advocate
195 Views
3 Replies
Message 1 of 4

Time Plot from Global Table - data.rowNum only works for first time

clairekruppGhafari
Advocate
Advocate

[ FlexSim 23.1.3 ]

I am trying to make a time plot to show me daily production totals on multiple processors. I have all the data in a Global Table, and it gets zeroed out after the plot happens each day.

After much painful trial and error, I have figured out how to use a Statistics Collector with a timed event, which reads all the rows I want from the table:

1694103152388.png

Then I got the names of the processors from data.rowValue

1694103318102.png


and the row numbers for the other columns from data.rowNum:

1694103454669.png

It worked perfectly for the first plot,

1694104342534.png

and succesfully added new rows for the second plot (something which I have been struggling to achieve!) BUT the data.rowNum is the Statistics Collector row number and no longer matches the Global Table row number. (e.g. plot 1 reads rows 1 thru 24, and plot 2 is trying to read rows 25 thru 48.)

1694104444665.png

So then I tried to create a data label with an array of row numbers, which works....

1694103822619.png

And I put that into my row number field:

1694103933825.png

but it doesn't work.

I have been looking for a standard variable to use as an index for the array "data.testLabel", but I can't find one. What is the syntax for this? Or is there some other little trick I am missing?

Thanks!

(I can't post the model because it's confidential, but I can send it to someone in the support team if it would help.)

0 Likes
Accepted solutions (1)
196 Views
3 Replies
Replies (3)
Message 2 of 4

moehlmann_fe
Advocate
Advocate
Accepted solution

If the number of rows is fixed, you can translate the statistics collector's row number into the global table row number with the modulo operator % (returns the rest of a whole number division).

int globalRow = (data.rowNum - 1)%24 + 1;

The -1 and +1 are needed so 48, 72, ... correctly map to 24.

0 Likes
Message 3 of 4

clairekruppGhafari
Advocate
Advocate
Thanks @Felix Möhlmann that' s a nice compact solution.


I did find a way to use a Label on the collector itself and update it with a Trigger "On Row Added", but I think I like yours better!


0 Likes
Message 4 of 4

clairekruppGhafari
Advocate
Advocate

To anyone wanting to use this method, DO NOT use "data.testLabel" - you don't need it.

Just put Felix's expression (data.rowNum - 1)%24 + 1 directly into the "Row" field.


0 Likes