question

Craig DIckson avatar image
1 Like"
Craig DIckson asked Matt Long commented

How to access tracked variable statistics in code

I am using tracked variables to gather statistics in my model. One is of type Level, used to count the number of pieces moved; the second is of type Time series.

I would like to access the Min/Avg/Max values in code using getstat(), similar to how I can with any PF Activity, e.g., getstat(trackedvariable("vPiecesReplenished"),"Content", STAT_CURRENT);

However this returns 3.4E38 (i.e., unknown value).

(For a PF activity I use getstat(getactivity("ProcessFlow", sActivity), sStatistic, STAT_CURRENT)

I'm guessing that "Content" is not the right statistic name? What names should I use, or is there a different command? Or is it possible at all?

Thanks,

Craig

FlexSim 16.2.2
flexscripttracked variable
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

Jacob Gillespie avatar image
2 Likes"
Jacob Gillespie answered Matt Long commented

Give an empty string as the name:

  1. getstat(trackedvariable("vPiecesReplenished"),"", STAT_CURRENT);

Normally you have to specify which statistic you want from the given object, but a tracked variable is the statistic.

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