question

Claire Krupp avatar image
0 Likes"
Claire Krupp asked Claire Krupp commented

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

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

FlexSim 23.1.3
global tablestatistics collectortime plot
1694103152388.png (35.5 KiB)
1694103318102.png (19.9 KiB)
1694103454669.png (26.4 KiB)
1694103822619.png (32.5 KiB)
1694103933825.png (23.7 KiB)
1694104342534.png (5.0 KiB)
1694104444665.png (4.7 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.

1 Answer

·
Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Claire Krupp commented

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.

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

Claire Krupp avatar image Claire Krupp commented ·
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 0 ·
Claire Krupp avatar image Claire Krupp commented ·

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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