Exporting Data through experimenter

Exporting Data through experimenter

Elax
Not applicable
223 Views
3 Replies
Message 1 of 4

Exporting Data through experimenter

Elax
Not applicable

[ FlexSim 23.2.3 ]

Hi all, I have a bunch of data being written to global tables at run time. At the end of each replication , I would like to export the data from the global tables to a CSV file.

It works, but I am getting weird results that are inconsistent with what I should observe. In particular, several of my iterations are giving me incomplete model runs. However, when I use "Apply the following scenario and replication to the model", I get a completely different result from what I exported. I am inclined to believe that the runs in the experimenter could be interfering with the export in a way or another.

I am using the following code:

/**Custom Code*/
Object current = ownerobject(c);
int replication = param(1);
int scenario = param(2);
treenode childexpfolder = param(3);
Map task = param(4);


if (!objectexists(childexpfolder)){
Table tbl = Table("Output_Result");
string Name = "Output_Result_" + numtostring(replication) + ".csv";
exporttable(tbl, Name,1,1);
}
0 Likes
Accepted solutions (1)
224 Views
3 Replies
Replies (3)
Message 2 of 4

moehlmann_fe
Advocate
Advocate
Accepted solution

It's hard to help without seeing the model.

Just to be safe: Your experiment only has a single scenario? Otherwise using only the replication number in the file name would lead to multiple instances trying to write to the same file.
Can you clone the global table to a Calculated Table? Then you could check the values with "View Results" and compare to what you have in the csv-files.

0 Likes
Message 3 of 4

Elax
Not applicable
Ah I found the issue. Seems to be multiple scenarios writing to the same file. Separated them and it works fine now. Thank you so much!
0 Likes
Message 4 of 4

moehlmann_fe
Advocate
Advocate
That's nice to hear! I changed my comment into an answer. It would be nice if you could accept it to mark the question as solved.
0 Likes