question

Noah Z avatar image
4 Likes"
Noah Z asked jing.c commented

Way to pull global table column statistics for Experimenter Performance Measure?

I'd like to tally global table column statistics and report out on them by experimenter run. I know we can pull individual global table values but is there a built-in function that allows me to report summary info on column data from a global table automatically such as: SUM, STDEV, AVERAGE without me having to loop through the rows of the column and calculate the statistics in the OnRunStop trigger?

FlexSim 7.7.4
global tableexperimenterstatisticsdatafunctions
5 |100000

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

Regan Blackett avatar image
3 Likes"
Regan Blackett answered Ben Wilson edited

Noah,

I think the getdatastat() function is just what you are looking for:

https://answers.flexsim.com/articles/14290/getdatastat-4.html

Basically it can look at a set of data and give you it's Min, Max, Sum, Stddev, or Variance. You could probably write your own experiment performance measure that returns the result of getdatastat() to get you where you need to go.

· 1
5 |100000

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

Phil BoBo avatar image
5 Likes"
Phil BoBo answered Brandon Peterson commented

You can use the getdatastat() command, such as:

  1. int column = 1;
  2.  
  3. double sum = getdatastat(STAT_SUM, gettablerows("GlobalTable1"), gettablenum("GlobalTable1", count, column));
  4.  
  5. double stddev = getdatastat(STAT_STD_DEV, gettablerows("GlobalTable1"), gettablenum("GlobalTable1", count, column));
  6.  
  7. double average = getdatastat(STAT_MEAN, gettablerows("GlobalTable1"), gettablenum("GlobalTable1", count, column));
· 4
5 |100000

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

Brandon Peterson avatar image
4 Likes"
Brandon Peterson answered jing.c commented

If you have trouble understanding how the getdatastat() function works then here is a user library with some functions for finding the Min, Max, Ave, Variance, and Standard Deviation from a range within a table. I included a sample model that has demo code in a script window that prints the results to the output console.

The functions I wrote do the calculations manually but I could have used the same commands that Regan and Phil replied with. I'm not sure which method would be faster.

Good Luck,

Brandon


· 1
5 |100000

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