question

Juriaan DH avatar image
1 Like"
Juriaan DH asked Joerg Vogel edited

exporting Expermentor results

For school I have to analyse an simulation. We are using the Flexsim for students 2012 software.

I'm trying to export Experiments to Excel. Can anybody help me.

Choose One
experimenterstudent licenseexport results
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

·
Serge A avatar image
2 Likes"
Serge A answered Serge A edited

I use a Script like this to export results from FlexSim Experimenter to a reasonable CSV format:

// export Experimenter results
string outFile = currentfile().replace(/\.fs[xm]$/, ".results.csv");
treenode PMs = node("MODEL:/Tools/Experimenter/PerformanceMeasures");

fileopen(outFile, "w");
fpt("scenario,replication,metric,value\n");
for (int i = 1; i <= PMs.subnodes.length; i++) {
    treenode PM = PMs.subnodes[i];
    string PM_name = PM.name;
    string PM_name_quoted = "\"" + PM_name.replace(/[\"]/, "\"\"") + "\"";
    treenode data = node("data", PM);
    for (int j = 1; j <= data.subnodes.length; j++) {
        treenode scenario = data.subnodes[j];
        for (int k = 1; k <= scenario.subnodes.length; k++) {
            treenode rep_datum = scenario.subnodes[k];
            double value = get(rep_datum);
            string formattedValue = (value == round(value)) ? numtostring(value,0,0) : numtostring(value,0,6);
            Array valuerow = [numtostring(j), numtostring(k), PM_name_quoted, formattedValue];
            fpt(valuerow.join(","));
            fpt("\n");
        }
    }
}
fileclose();
return outFile;

So if the model file is called "MyModel.fsx", the results will be saved to "MyModel.results.csv". You should be able to import this file in Excel.

To analyze results in R, I load them like:

results <- read.table("MyModel.results.csv", header = T, sep = ",")

The data can be used with `dplyr` like this:

library(dplyr)

results %>% group_by(scenario,metric) %>% summarise(mean=mean(value), stdev=sd(value))

results %>% filter(metric == "MyMetric") %>% head
5 |100000

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

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.