question

立洲 avatar image
0 Likes"
立洲 asked Jason Lightfoot commented

how to calculate mean and standard deviation

I want to collect and calculate the mean and standard deviation in the Global Table. I would like to ask how to use Process Flow to calculate


how to calculate mean and standard deviation.fsm

FlexSim 20.0.10
meanstandard deviationcalculate
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

Jason Lightfoot avatar image
1 Like"
Jason Lightfoot answered Jason Lightfoot commented


Table gt1=Table("GlobalTable1");
int numrows=gt1.numRows;
string sql="SELECT SUM([Process time])/count(*) FROM GlobalTable1";
Table result=Table.query(sql);
double mean=result[1][1];
gt1[numrows]["Mean"]=mean;
sql="SELECT SUM(Math.sqr([Process time]-"+string.fromNum(mean,6)+")) FROM GlobalTable1";
result=Table.query(sql);
gt1[numrows]["SD"]=Math.sqrt(result[1][1]/numrows);


· 7
5 |100000

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

立洲 avatar image 立洲 commented ·

@Jason Lightfoot Thank you for your reply. In addition, I also want to find the maximum and minimum values. I don't know how to write the code. Please help me too.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ 立洲 commented ·

When do you want to find those - every time a row is added? Use MAX([Process time]) and MIN([Process time]) as described here.


0 Likes 0 ·
立洲 avatar image 立洲 Jason Lightfoot ♦ commented ·

在每 20 次結束時

0 Likes 0 ·
Show more comments