question

Erik Gerritse avatar image
1 Like"
Erik Gerritse asked Jordan Johnson commented

export table from statistics collector after each experimenter run

Dear all,

After each experiment run, I would like to export a table from a statistics collector to my harddrive by running a script from the experimenter (advanced\end of replication). I can find the node 'data' of the collector in the tree, but I don't know how to export this to a csv or excel file. Does anyone know how to do this? Thanks in advance!

FlexSim 18.0.1
experimenterstatistics collectorexport
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

·
Jordan Johnson avatar image
2 Likes"
Jordan Johnson answered Jordan Johnson commented

As you have discovered, Statistics Collectors automatically record data during an experiment. To access that data after an experiment, you can use a Calculated Table:

SELECT * FROM Experiment.MyStatisticsCollector

Once it's in a Calculated Table, you can make charts of the data, or export all of it. You can also change the query to filter, sum, average, or otherwise manipulate the replication data.

· 5
5 |100000

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

Erik Gerritse avatar image Erik Gerritse commented ·

thanks!

0 Likes 0 ·
Erik Gerritse avatar image Erik Gerritse commented ·

@jordan.johnson Ive found that when I do an experiment with, say, 50 replications, I end up with an enormous table with data for all 50 replications in it. Is there a way to export data after each replication for just that replication? Or to delete the table´s contents after exporting to start with a clean table for the next replication?

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Erik Gerritse commented ·

It depends on how you want to export. If you export to Excel, I don't know a way to do that from the child processes. However, you can read this article on how to export data from child processes to a database.

0 Likes 0 ·
Erik RV2 avatar image Erik RV2 commented ·

Hey Jordan!
Do you have an example of a Statistics Collector export onRunStop?
I tried the following (without success) :

Table table = Table.query("SELECT * FROM MyStatisticsCollector)
exporttable (table, "outputFile.csv"); //an already existing csv file

Thanks!

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Erik RV2 commented ·

I don't think you can export Tables that are the result of a query. I think you need to pass a bundle or treenode table.

I can't remember what stuff works in 18.1. You may also be able to directly pass a Statistics Collector, like this:

exporttable(Table("MyStatsCollector"), "file.csv")

Give that a shot. Let me know if it doesn't work.

0 Likes 0 ·

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.