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.

Noah Z avatar image Noah Z commented ·

This is exactly what I needed. Thanks!

1 Like 1 ·
Phil BoBo avatar image
5 Likes"
Phil BoBo answered Brandon Peterson commented

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

int column = 1;

double sum = getdatastat(STAT_SUM, gettablerows("GlobalTable1"), gettablenum("GlobalTable1", count, column));

double stddev = getdatastat(STAT_STD_DEV, gettablerows("GlobalTable1"), gettablenum("GlobalTable1", count, column));

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.

Noah Z avatar image Noah Z commented ·

Thanks for the examples!

0 Likes 0 ·
Noah Z avatar image Noah Z commented ·

Hi @phil.bobo,

I have a global table with columns that have different quantities of numbers (i.e. column 1 has 300 values and column 2 has 450 values (these vary from run to run)) and I am trying to pull the mean of the columns but getdatastat() function pulls the whole column (all the zeros after the real data). Is there a way to tell getdatastat() to ignore cells with zero values?

0 Likes 0 ·
Brandon Peterson avatar image Brandon Peterson ♦ Noah Z commented ·

Noah,

Check out the functions that I put into a user library in the other answer to this question. You can specify a range in those functions which will allow you to limit the amount of the column that is used or to use multiple columns.

1 Like 1 ·
Adrian Haws avatar image Adrian Haws Noah Z commented ·

@Noah Zenker With the new Answers forum questions should be asked individually so as to make it easier for others to benefit from them. I've reposted this second question here.

This is a link to an article on the "best practices" for using this Answers site.

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

jing.c avatar image jing.c commented ·

Thanks Brandon! I think it can be very useful!

And I updated your commands to guarantee not use deprecated command such as parval() or parnode() for avoiding these commands invalid in furtrue version.

BTW, I had test your command can be use in bundle data, so I change a little in Parameters.

ucrangestats-jingv16.fsm

1 Like 1 ·

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.