summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbansodanurag2019-08-29 12:41:04 +0530
committerGitHub2019-08-29 12:41:04 +0530
commit10d88dab1caa3a7077c822fd79d36981b07c6433 (patch)
tree09d295cefb1094ae75e328020ae14f21452dc4ae
parent4f0d6fdea9130401afca640cef85e983c26f82e0 (diff)
downloadOpenmodelica-gsl-library-10d88dab1caa3a7077c822fd79d36981b07c6433.tar.gz
Openmodelica-gsl-library-10d88dab1caa3a7077c822fd79d36981b07c6433.tar.bz2
Openmodelica-gsl-library-10d88dab1caa3a7077c822fd79d36981b07c6433.zip
Update gsl.mo
test example in Running Statistics Chapter
-rw-r--r--External_Functions/gsl.mo32
1 files changed, 18 insertions, 14 deletions
diff --git a/External_Functions/gsl.mo b/External_Functions/gsl.mo
index 542e5e0..f6cce2a 100644
--- a/External_Functions/gsl.mo
+++ b/External_Functions/gsl.mo
@@ -6608,21 +6608,25 @@ package chap_21_9 "Median and Percentiles"
Real j[5];
Real n;
algorithm
+// all the equation should run in when statement
/* add data to rstat accumulator */
- for i in 1:5 loop
- j[i] := gsl.RUNNING_STATISTICS.chap_22_2.gsl_rstat_add(data[i], rstat_p);
- end for;
- mean := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_mean(rstat_p);
- variance := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_variance(rstat_p);
- largest := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_max(rstat_p);
- smallest := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_min(rstat_p);
- median := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_median(rstat_p);
- sd := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_sd(rstat_p);
- sd_mean := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_sd_mean(rstat_p);
- skew := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_skew(rstat_p);
- rms := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_rms(rstat_p);
- kurtosis := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_kurtosis(rstat_p);
- n := gsl.RUNNING_STATISTICS.chap_22_2.gsl_rstat_n(rstat_p);
+ when initial() then
+ for i in 1:5 loop
+ j[i] := gsl.RUNNING_STATISTICS.chap_22_2.gsl_rstat_add(data[i], rstat_p);
+ end for;
+ elsewhen terminal() then
+ mean := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_mean(rstat_p);
+ variance := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_variance(rstat_p);
+ largest := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_max(rstat_p);
+ smallest := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_min(rstat_p);
+ median := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_median(rstat_p);
+ sd := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_sd(rstat_p);
+ sd_mean := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_sd_mean(rstat_p);
+ skew := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_skew(rstat_p);
+ rms := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_rms(rstat_p);
+ kurtosis := gsl.RUNNING_STATISTICS.chap_22_3.gsl_rstat_kurtosis(rstat_p);
+ n := gsl.RUNNING_STATISTICS.chap_22_2.gsl_rstat_n(rstat_p);
+ end when;
end test;
end running_statistics;