question

Alberto F2 avatar image
0 Likes"
Alberto F2 asked Jordan Johnson commented

Export Calculated Tables after each replication in Experimenter

Hello everyone,

I am trying to export a csv file containing the data in a "Calculated Table" after each replication of the simulation.

I have checked the box "save statistics data for each replication".

1636538676945.png

I have inserted a Custom Code at the end of each replication,

1636538853057.png

And in that code I am trying to export the csv file using the function exporttable(), however, nothing seems to happen after the experimenter's run.

1636539833081.png

do you know if I am doing something wrong? or if there is a second strategy to follow for this task?

Thanks a lot for the support

FlexSim 21.2.4
experimentercalculated tableexport datacsv filesexporttable
1636538676945.png (39.7 KiB)
1636538853057.png (36.7 KiB)
1636539833081.png (18.5 KiB)
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

Fiorenzo A avatar image
1 Like"
Fiorenzo A answered Jordan Johnson commented

Hi Alberto,

your method is correct but you must change the code in the "End of Replication" trigger. Try with the code in the picture below.

Everytime the Experimenter runs a single replication, it opens and runs the model on a new Flexsim, copies the single replication data on the father model, on the node childexfolder, finally closes the child model.

This trigger infact is executed two time: the first time on child model, than on the father model.

You must export the data table that you need only when the trigger is runned by the child model.

For this reason I use the line 8 of the code.

In the line 15 of the code I suggest to write not only the name of the new file, but the full path of the file that you will have.

1636557057098.png


In this way you can save on csv file, in a specifi path, your experimenter data.

Also at the end of Experimenter, on view result you can have the possibility to see from Flexsim all this result tables. Go on the tab Statistics Tables, you can find all data tables of the model for all the scenario and replications.


1636557945951.png


I hope I was helpful.


1636557057098.png (86.2 KiB)
1636557945951.png (76.5 KiB)
· 2
5 |100000

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

Alberto F2 avatar image Alberto F2 commented ·

Thank you very much, that was very helpful, now it works perfectly

1 Like 1 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ commented ·

Any table in the Statistics Table can be queried with a Calculated Table. Create a new Calculated Table, and on the Calculations tab, click the "Enable Direct Editing" button. Then add a query like this:

SELECT * FROM Experiment.[St1]

Click the Update button to run the query. Then you can export the Calculated Table either in the Excel Export, or you can use the exporttable() command:

exporttable(Model.find("Tools/CalculatedTables/St1"), "data.csv", 1)
0 Likes 0 ·