Limiting the data exported in the experimenter?

Limiting the data exported in the experimenter?

tr_simulation
Not applicable
119 Views
10 Replies
Message 1 of 11

Limiting the data exported in the experimenter?

tr_simulation
Not applicable

[ FlexSim 22.2.2 ]

In my attached model, I go to the experimenter > view results > statistics table > select from drop down "duration of procedure phases". How do I export ONLY this table to excel? When I export, there is do much data with so many tabs...how do I limit what is exported to only this table?V4_20230207.fsm

0 Likes
Accepted solutions (1)
120 Views
10 Replies
Replies (10)
Message 2 of 11

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution

You can read the table into a global table and export from there:

treenode experimenter = Model.find("Tools/Experimenter");
Database.Connection db = function_s(experimenter, "getDBConnection");
int disconnect = 0;
if (!db.isConnected) {
    if (!db.connect()) {
        return 0;
    }
    disconnect = 1;
}
Database.ResultSet results = db.query("SELECT * FROM [/Duration of Procedure Phases]");
results.cloneTo("DurationOfProcedurePhases");
if (disconnect) {
    db.disconnect();
}

Note that the use of function_s means it may not be supported in the future and you would have to change any code that relied on that function should it cease to function correctly.

0 Likes
Message 3 of 11

tr_simulation
Not applicable
Where do I enter this code?
0 Likes
Message 4 of 11

tr_simulation
Not applicable

In addition to my comment below, how is it exported from a global table?

0 Likes
Message 5 of 11

jason_lightfootVL7B4
Autodesk
Autodesk
Wherever you like but it makes sense in a script window, in a GUI button, a dashboard button, or in the end of experiment trigger.
0 Likes
Message 6 of 11

jason_lightfootVL7B4
Autodesk
Autodesk
Felix describes a method of exporting an experimenter table in this post.


You can probably also use a local result table and export that using an exporttable command rather than having loops to fetch each record and write individual cells.


0 Likes
Message 7 of 11

tr_simulation
Not applicable

Ok, I went to the "advanced tab" on the experimenter, selected "at end of job" and added a "code snippet" and put the code in there. But the results did not appear in a global table. I get the error, "exception: FlexScript exception: Invalid row number: 1 in <no path> at MODEL:/Tools/Experimenter>variables/onEndOfJob"

0 Likes
Message 8 of 11

jason_lightfootVL7B4
Autodesk
Autodesk
I just tried using exportPFM("NumScans") from your other post in that trigger and it worked fine so I expect you've made an error. Post your model and we'll take a look.
0 Likes
Message 9 of 11

tr_simulation
Not applicable

My model is attached. I have not done munch beyond the basics in FlexSim, so I need to help to know exactly how to implement your comments with either screenshots or step by step instruction. v4-20230207-jl.fsmThanks for the help.

0 Likes
Message 10 of 11

jason_lightfootVL7B4
Autodesk
Autodesk

You just needed to create global table called "DurationOfProcedurePhases" via the toolbox menu.

However, when I deleted the results database and reran the model the output was different. This is likely because you have not specified streams where you have stochastic samples from distributions. Using streams allows you to repeat the runs, debug any that you need to , and is a variance reduction technique - so we recommend using them unless you have a valid reason not to.

0 Likes
Message 11 of 11

tr_simulation
Not applicable
Thank you!
0 Likes