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

noah_zenker
Not applicable
0 Views
9 Replies
Message 1 of 10

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

noah_zenker
Not applicable

[ FlexSim 7.7.4 ]

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?

Accepted solutions (1)
1 View
9 Replies
Replies (9)
Message 2 of 10

regan_blackett
Not applicable
Accepted solution

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.

Message 3 of 10

philboboADSK
Autodesk
Autodesk

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


Phil BoBo
Sr. Manager, Software Development
Message 4 of 10

noah_zenker
Not applicable

This is exactly what I needed. Thanks!

Message 5 of 10

noah_zenker
Not applicable

Thanks for the examples!

0 Likes
Message 6 of 10

brandon_peterson6BCRW
Autodesk
Autodesk

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

img src="https://damassets.autodesk.net/content/dam/autodesk/logos/autodesk-logo-primary-rgbblack-small_forum.png" >

Brandon Peterson
Principal Technology Consultant
>
Message 7 of 10

noah_zenker
Not applicable

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
Message 8 of 10

adrian_haws
Not applicable

@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
Message 9 of 10

brandon_peterson6BCRW
Autodesk
Autodesk

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.

img src="https://damassets.autodesk.net/content/dam/autodesk/logos/autodesk-logo-primary-rgbblack-small_forum.png" >

Brandon Peterson
Principal Technology Consultant
>
Message 10 of 10

jing_chen
Not applicable

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