VSPAERO export to CSV through command window/VSPscript?

805 views
Skip to first unread message

Jasper

unread,
Nov 13, 2017, 7:50:40 AM11/13/17
to OpenVSP
Hello!

I am working on a python script (not using the Python API, as I am not familiar with compiling myself) that will run VSPAERO through a command window and then read in the results for further use. Up till now I always manually ran the analysis, exported the .CSV results file and used that for further work as it is a single file. However, now I am wondering if it is possible to export the VSPAERO results to the .CSV file (like the option in the GUI) through the command window as well?

I don't see the option described anywhere, and when looking at the source code, it seems that it is the openvsp/resultsmanager that actually performs this export action and not VSPAERO itself?
In case it is the results manager, would it be possible to use a VSPscript to run VSPAERO and export the results to a CSV file?

Rob McDonald

unread,
Nov 16, 2017, 1:03:55 AM11/16/17
to ope...@googlegroups.com
The Results Manager has two connotations -- in the GUI, it is the
visualization window that VSPAERO displays to look at results.

Under the hood in VSP, it is a common framework for accessing the
results of built-in analyses. It works hand-in-hand with the analysis
manager. Before the analysis and results managers, every analysis had
its own API and its own file formats. AM&RM were added to provide a
common API as new analyses were added. It mainly works on a
name/value pair system for inputs and outputs...

VSPAERO writes its results to a set of files. OpenVSP parses those
files and places the results into a RM data structure. The Results
Manager GUI displays them -- and the button 'export to CSV' really
calls a generic CSV export method on the corresponding results.

That code called when you push that button happens here...
https://github.com/ramcdona/OpenVSP/blob/master/src/geom_core/VSPAEROMgr.cpp#L2166

Most of that routine is just about safely getting a pointer to the
results object we want to dump out. Then, the real action happens on
this line...
https://github.com/ramcdona/OpenVSP/blob/master/src/geom_core/VSPAEROMgr.cpp#L2195

That is the routine that dumps a generic set of 'results' to a CSV file.

The Python API should be a 1:1 match of what is available through C++
or through AngelScript -- however, it is sometimes easiest to look at
what has been registered with AngelScript to see what is intended by
the API. In this case, you can look here to see what API calls exist
to work with the results manager...
https://github.com/ramcdona/OpenVSP/blob/master/src/geom_core/ScriptMgr.cpp#L1673

It should be pretty obvious how to mimic what the button-press code
does using these API calls -- which should equally be available
through Python.

When you run VSPAERO through the API, you will use analysis manager --
the results will be parsed and end up in results manager.

The analysis manager API calls can be used to query what is available
to your version of OpenVSP. Or you can look here if you prefer to
look under the hood:
https://github.com/ramcdona/OpenVSP/blob/master/src/geom_core/AnalysisMgr.cpp#L407

Hope this helps,

Rob
> --
> You received this message because you are subscribed to the Google Groups
> "OpenVSP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to openvsp+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Jasper

unread,
Nov 16, 2017, 8:21:01 AM11/16/17
to OpenVSP
That definitely helps a lot!
The example-script TestAnalysisVSPAERO provides a nice starting point to work with what you explained explained above:

Thanks a lot for the elaborate response Rob
Reply all
Reply to author
Forward
0 new messages