VSP output files

1,292 views
Skip to first unread message

Frank

unread,
Feb 18, 2017, 1:02:55 PM2/18/17
to OpenVSP
Hello,

I'm interested in pulling the values out of a VSP file that you would typically use within a VSP script file. For example:

string wid = AddGeom( "WING", "" );                     // Add Wing
    SetGeomName( wid, "MainWing" );
    SetParmVal( wid, "Span", "XSec_1", 3.39363); // Output file would contain 3.39363 and correlate to span
    SetParmVal( wid, "Root_Chord", "XSec_1", 1.0994);                        //etc... 1.0994
    SetParmVal( wid, "Tip_Chord", "XSec_1", 1.00851);
    SetParmVal( wid, "Sweep", "XSec_1", 0);
    Update();
    InsertXSec( wid, 1, XS_FOUR_SERIES );
    SetParmVal( wid, "Span", "XSec_2", 4.00637);   
    SetParmVal( wid, "Root_Chord", "XSec_2", 1.00851);
    SetParmVal( wid, "Tip_Chord", "XSec_2", .75936);
    SetParmVal( wid, "Sweep", "XSec_2", 1.877);
    SetParmVal( wid, "Twist", "XSec_2", 1.5);
    SetParmVal( wid, "Dihedral", "XSec_2", 1.1);
    SetParmVal( wid, "X_Rel_Location", "XForm", 4.35);
    SetParmVal( wid, "Y_Rel_Location", "XForm", -.5);
    SetParmVal( wid, "Z_Rel_Location", "XForm", 1.320);

When this vspscript is run, it produces a wing. I'm interested in already having a wing, or any other geometric body in a .vsp3 file, and generating this data either in the vspscript form to be parsed or just output the data values in an organized way. None of the output file options will write this data to an easily readable file; a text file for example. If there is a way to do this, I would greatly appreciate an explanation as to how. Another idea I had to access the data was to run a vspscript on the .vsp3 file that would extract these values and write it to a text file. It seems possible based on what is given in the API, but I have been unable to obtain any results. I even ran the "dumpresults" script that came with VSP, however, no output file was ever produced. Help on this matter would be appreciated! Thanks.

Rob McDonald

unread,
Feb 18, 2017, 2:11:29 PM2/18/17
to ope...@googlegroups.com
Why do you want to do this? What are you ultimately trying to accomplish?

You should be able to write an API script to do this, you'll need
these routines...

For simple Geoms (pod) all Parms are associated with the Geom.

array<string> FindGeoms()

string GetGeomName( geom_id )

array<string> GetGeomParmIDs( geom_id )


double GetParmVal( parm_id )

string GetParmName( parm_id )


For most more complex Geoms (wing, stack, fuselage, custom), they are
made up of cross sections that have their own parms. So, you must
recurse into the XSecs and go through those parms too.

int GetNumXSecSurfs( geom_id )

string GetXSecSurf( geom_id, index )

int GetNumXSec( xsec_surf_id )

string GetXSec( xsec_surf_id, xsec_index )

array<string> GetXSecParmIDs( xsec_id )


Propellers might require further special treatment -- the blade shapes
are made of PCurves -- parameter curves.

If you care about overall global model settings, those are in Vehicle.
You'll need a few more things to track all those down.

What are you trying to do again?

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.

Frank

unread,
Feb 20, 2017, 5:37:04 PM2/20/17
to OpenVSP
My ultimate goal is to integrate VSP into Model Center. A plugin for 2 exists, but I have not been able to obtain it. In addition, a plugin for the most up to date VSP does not exist. So, my goal is to use vspscript files as the input files for a function in Model Center called Quickwrap which will run an input file through a specified program. I can link data values in the vspscript file to variables within Model Center and Model Center can change these, thus the ability to update a geometry. On the output side of things, I need to write a vspscript that will take the values out of a vsp script that has been imported into the model. Then I can manipulate these values using other functions and programs and write them back to VSP to update the geometry. The code you provided to produce an output is helpful, but what code will allow me to write the output values to an external file (text file)? 

Rob McDonald

unread,
Feb 20, 2017, 7:37:19 PM2/20/17
to ope...@googlegroups.com
Phoenix decided to not update their plugin to v3 -- though the v2
plugin was pretty slick, v2 is so old that it isn't worth dealing
with.

I know some people at NASA have developed an internal way of working
OpenVSP with ModelCenter that works for them. I believe they built on
ModelCenter's built-in parsing of XML files and then have some scripts
that work from there.

If you're comfortable with some more coding -- and/or you think you
are going to use this a lot -- I have thought about a more integrated
approach. Use SWIG to wrap the OpenVSP API to Java (this has been
done, but isn't mainstream) and then use the ModelCenter/Analysis
Server API to develop a plugin in Java.

OpenVSP's built-in scripting is built on AngelScript, a C++-like
language designed specifically to be embedded in C++ programs. We
install numerous extensions to the AngelScript language (as well as
the OpenVSP specific routines that are exposed). The installed
extensions are string, array, file, math, any.

The documentation for the file extension is here:

http://www.angelcode.com/angelscript/sdk/docs/manual/doc_addon_file.html

Here is an example (from the TestAll.vspscript example that comes with
OpenVSP) of us using the file class to write out a STL file from
triangle data transferred from the Results Manage...

https://github.com/OpenVSP/OpenVSP/blob/master/examples/scripts/TestAll.vspscript#L437

Rob

Brian

unread,
Mar 7, 2017, 10:39:57 AM3/7/17
to OpenVSP
Hello, I'm also looking to integrate OpenVSP into ModelCenter.  Eventually I'd like to get both the geometry and CFD results working.  Unfortunately my coding skills are rudimentary at best and so I was wondering what would be the easiest way to get started.  For now just to get basic parameters like wingspan and aspect ratio into ModelCenter would be great.  Of the two possible solutions you outlined above Rob, it seems that taking the wanted variables out of the OpenVSP XML files within ModelCenter would be the easiest way to do this?  Does anyone know any good resources for me to get started?

Thanks,
Brian

Jason Welstead

unread,
Mar 17, 2017, 12:22:55 PM3/17/17
to OpenVSP
Rob mentioned that we at NASA have developed an internal plugin that works with OpenVSP 3.x, and he is absolutely right.  The plugin was developed by Jim Fenbert here at NASA Langley in the Aeronautics Systems Analysis Branch.  The plugin is written in JAVA and is fully integrated with ModelCenter as a functioning native plugin much like the other plugins in ModelCenter.  The user is able to point to their .vsp3 file that they generated outside of ModelCenter, select their desired input variables while also being able to choose variables only as outputs if the users chooses to, and then execute the plugin to update the geometry much like running any other process in ModelCenter.  The plugin is also set up, although much less tested, to work with OpenMDAO.  We have been developing this plugin for over 2 years now, and it has become quite robust working with versions of OpenVSP including the lastest 3.11 version.

For various reasons that I won't drag you through, we have decided to start the process of making the plugin publicly available in the near future.  Our software release process takes a little time, but it will be coming.  If I understand your desire correctly, this should fit your needs quite nicely.  It is just a matter of allowing the software to go through the release process.

Jason

Rob McDonald

unread,
Mar 17, 2017, 12:28:01 PM3/17/17
to ope...@googlegroups.com
That is great news Jason. Thanks much to all involved.

Good luck with that journey -- I know it is not easy or quick.

Rob

Brian

unread,
Mar 20, 2017, 10:21:16 AM3/20/17
to OpenVSP
That sounds like it would fit my needs perfectly Jason, thanks for making it available.

Once you get an idea of the release date I'd love to know it.

Brian

Brian

unread,
May 17, 2017, 11:42:22 AM5/17/17
to OpenVSP
If anyone wants to use OpenVSP with ModelCenter before the NASA wrapper comes out this is the way I’ve been doing it.  It’s not the most elegant solution but it seems to be working.  It’d be great to hear any comments anyone has.
Note:  These steps are using OpenVSP in the C:\ drive in a folder called “OpenVSP” with a geometry called Basic3DOE.vsp3

In OpenVSP
1. Make a model in OpenVSP.

2. Choose the parameters you want to input into ModelCenter using the design files function under the Model tab and create a Basic3DOE.des file.

3. Under the OpenVSP Analysis tab run the Mass Prop and DegenGeom functions.  This will create Basic3DOE_MassProp.txt and Basic3DOE_DegenGeom.csv files you'll need in ModelCenter.

4. Run a simulation with Basic3DOE.vsp3 in VSPAero.  Use just one AoA, beta, and Mach # now because you’ll be able to run multiple values using ModelCenter later.  This will create the Basic3DOE_DegenGeom.vspaero and Basic3DOE_DegenGeom.history files you'll need later.


In ModelCenter

I created a model that looks like this.  The first 3 are scriptwrapper components and are all you really need to get I/O from OpenVSP.


 

1. Des_Vars Component

You need to add the Basic3DOE.des as an input file for this component.  Looking into the file within the component you need to double-click on the numbers to make the design parameters ModelCenter input variables.  Make sure to check the variable type because if your parameter has a value of, say, 5, then ModelCenter will make it an integer instead of a double.

You don’t need to write any commands in the execute tab here.

2. Mesh_and_Mass Component

Add the Basic3DOE_DegenGeom.csv and Basic3DOE_MassProps.txt as output files to this component.  From the MassProps file I added Total Mass and the X, Y, and Z CG values as output variables.  You don’t need to add in any variables from the _DegenGeom.csv file.  Use a text editor to write the following script and save it in the OpenVSP folder as Basic3DOEdegenmass.vspscript.

void main()

{

Update();
//==== Apply Design Variables (works)====//
ReadApplyDESFile('Basic3DOE.des');
//==== Run Degen Geom ====//
    ComputeDegenGeom( SET_ALL, DEGEN_GEOM_CSV_TYPE );

//==== Compute Mass Properties ====//
ComputeMassProps( 0, 35 );

}


Finally, in the component’s execute tab put in the following command.

C:\OpenVSP\vspscript.exe Basic3DOE.vsp3 -script Basic3DOEdegenmass.vspscript


3. VSPAero Component

Here you need to add Basic3DOE_DegenGeom.vspaero as an input file and Basic3DOE_DegenGeom.history as an output file.  From the .vspaero input file you can choose the variables you want like AoA, Beta, and Mach#.  You can also link the X, Y, and Z CG values from the Mesh_and_Mass component to their counterparts in the VSPAero component.  This will make your moment and stability calculations correct (I think).  From the _DegenGeom.history output file you can choose the results you want.

In the execute tab put in the following command.

C:\OpenVSP\vspaero.exe Basic3DOE_DegenGeom


4. Analysis Component
This script component isn’t necessary but I use it to get actual CL and CD values and eventually want to use the .lod file to do some basic structural analysis.

I have attached the OpenVSP and ModelCenter files I’ve been using.

Basic3DOE.vsp3
Basic3DOE.pxcz

Brian

unread,
May 17, 2017, 12:04:32 PM5/17/17
to OpenVSP
One problem I've been having while running DOE and Optimizations is that depending on the mesh certain input parameters will cause VSPAero to get outputs that are strange.  For instance a negative CD or a CL that is 4x10^8.  Is that coming from my geometry (that Basic3DOE from the previous post) or is it something that just happens using VLM sometimes?  I've had the most luck using the default 33 Num_W for Tesselation and then 20 Xsec, but this runs pretty slow on my computer and it still gives my outlying values from time to time.

Rob McDonald

unread,
May 17, 2017, 12:15:39 PM5/17/17
to ope...@googlegroups.com
Nice work -- and thanks for contributing it.

That is exactly what the DES support was meant for.

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+unsubscribe@googlegroups.com.

Rob McDonald

unread,
May 17, 2017, 12:18:10 PM5/17/17
to ope...@googlegroups.com
Hard to say without being able to examine the cases.

When you're running an automated setup like this, it is often a good
idea to add some error checking to your framework. Ideally, you can
make a copy of the errant case so it can be examined later. Perhaps
you would spot a common characteristic to the failed cases that you
can work around. Further, collecting failing cases can help the
developers track down the problems under the hood.

Rob

Brian Chell

unread,
May 17, 2017, 12:28:45 PM5/17/17
to ope...@googlegroups.com
Rob

When you say error checking do you mean within the script that runs DegenGeom?  Also I have a ton of data collected from this geometry, I'm running an optimization right now but once that's done I'll be able to dig around and see if there are any things in common with them.  I'll put them together and post on here.


> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "OpenVSP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/openvsp/J-Sg-NfNjl0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to openvsp+unsubscribe@googlegroups.com.

Rob McDonald

unread,
May 17, 2017, 12:56:41 PM5/17/17
to ope...@googlegroups.com
If you notice the problem by observing negative CD or huge CL, then
use those in an if statement to store the failed cases.

You have some way of observing an error state -- use that. Then store
everything you can about the case to diagnose later.

Rob
>> > email to openvsp+u...@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "OpenVSP" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/openvsp/J-Sg-NfNjl0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> openvsp+u...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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.

Brian

unread,
May 30, 2017, 5:20:55 PM5/30/17
to OpenVSP
I did an optimization on that same basic geometry and have attached an Excel file with the results.  I was adjusting only the wing's span (30 to 50) and chord (3 to 5).  It seems like the outlying runs generally take place when the b/c ratio is nearer to its highest or lowest values but that's not always the case.  Would that make sense?  Is this geometry prone to these kinds of results?  

Also, I'm attaching the history files for two runs on this geometry.  The first for the largest outlier (run 965 in the spreadsheet) where b = 41.060375200093 and c = 3.25586256720959, as you can see most of the iterations have large negative values for CL and CDi.  However, if I change the wing parameters by just a small amount to b = 41.5 and c = 3.15 the history file shows CL to be reasonable but with a negative CDi for iterations 2-6.  It's all a bit confusing for me, am I making a basic mistake somewhere?
      
Outlier 1.txt
new 1.txt
Basic3DOE Opt Results.xlsx

Brian

unread,
May 31, 2017, 4:42:41 PM5/31/17
to OpenVSP
I think I found the problem.  Both the wing and the horizontal stabilizer in my geometry had a a Z-relative location to the fuselage of 0.  It seems like that will sometimes cause interactions with the wakes giving me these outlying lift and drag results?  I had read from past posts on the forum that it's best to entirely remove non-lifting surfaces but that wouldn't really suit what I want to do with these optimizations.  As long as I adjust these Z-relative locations will that generally solve these problems?

Rob McDonald

unread,
May 31, 2017, 4:55:45 PM5/31/17
to ope...@googlegroups.com
Where the wing meets the horizontal slice of the fuselage is likely
the problem. You see that in the brightly colored areas in the Cp
plot from the visualization.

As you change span/chord, you are probably crossing some threashold
where the wing and fuselage panels align in some particular/subtle
way.

Having a wing that isn't exactly at mid-fuselage is probably the
easiest way to work past this problem.

Though it is significantly slower, you might also consider running the
panel code instead of the thin-surface VLM formulation.

Rob
Reply all
Reply to author
Forward
0 new messages