question

Erica B avatar image
2 Likes"
Erica B asked Chris Ligetti commented

Automatically save Performance Measure Report

Hi all -

I’m looking to automatically save the Performance Measure Report after running Experimenter and am unable to find the command that would do so. Can someone help?

Thanks!

FlexSim 17.2.0
saveautomaticperformance measure report
· 1
5 |100000

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

Chris Ligetti avatar image Chris Ligetti commented ·

What our team is trying to do is run Flexsim (no UI) using a command line interface from an external software application. Specifically, we have already figured out how to update the model using OnModelOpen, change Experimenter settings, and automatically start an Experimenter Run.

The last remaining thing that we haven't been able to figure out is how to automatically create and save the HTML Performance Measure Report. Ideally, we could use a set of commands that would allow for setting the report name, save location, and automatically save the report. I would expect to place this logic on the End Of Experiment Trigger, where thereafter, we could save the model and close Flexsim.

0 Likes 0 ·

1 Answer

·
Mischa Spelt avatar image
3 Likes"
Mischa Spelt answered Chris Ligetti commented

Since the code behind all buttons and options in FlexSim can be viewed in the tree, I had a look at the code of the "Generate Performance Measure Report" button in the Experimenter results window. This is what FlexSim does. It is pretty well-commented so I will post it verbatim, and leave it to you to figure out the relevant parts.

function_s(ownerview(c), "refreshreportprefs");
//export the experiment report


//get a filename for the export and save it
string directory = modeldir();
if (stringlen(directory) < 3) directory = documentsdir();


string filepath = getfilebrowse("*.html", "HTML Document", "", directory, 1);
if (stringlen(filepath) < 4) return 0;


treenode reportfilepath = getvarnode(ownerview(c), "reportfilepath");
sets(reportfilepath, filepath);


//change the cursor to the hourglass
setcursor(3);


function_s(ownerview(c), "generatedashboarddata");
//generate the report html and images
function_s(ownerview(c), "generatereport");


//open the exported experiment report in the user's default web browser
rundocument("open", filepath);


//change the cursor back to the default arrow
setcursor(1);

The code references some other event functions on the GUI, you can find the whole thing at VIEW:/standardviews/statistics/PerformanceMeasures/Generate Report>menupopup/Performance Measure Report

· 6
5 |100000

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

Chris Ligetti avatar image Chris Ligetti commented ·

@Mischa Spelt

I copied the code and modified slightly to set the file name (with a timestamp) and the file path (as opposed to using the save dialog). When I run it, nothing seems to be happening. Perhaps there is more that I am not understanding. Any help would be greatly appreciated.

0 Likes 0 ·
Chris Ligetti avatar image Chris Ligetti Chris Ligetti commented ·

@Mischa Spelt, for some reason, I am unable to post the code that I referred to. I also tried to post a txt file of the script, and still had issues, so I am attempting to just send an image of the script (hopefully this works!). As I indicated before, nothing seems to be happening when I run this script.

0 Likes 0 ·
savereportscript.png (278.5 KiB)
Chris Ligetti avatar image Chris Ligetti Chris Ligetti commented ·

@Mischa Spelt, Issues resolved. You can ignore this! Sorry for the trouble.

0 Likes 0 ·
Chris Ligetti avatar image Chris Ligetti commented ·

test submission (cannot submit anything with code in it)

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Chris Ligetti commented ·
0 Likes 0 ·
Chris Ligetti avatar image Chris Ligetti Matthew Gillespie ♦♦ commented ·

@Matthew Gillespie Yes. I add a CODE block, paste in my script, and when I click Submit, the button disables, but the comment does not post. I only got "blocked" when I added the code in an answer, which I was avoiding since I was not answering but simply trying to reply to Mischa's suggestion. Thanks.

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.