Driving a model from Matlab

938 views
Skip to first unread message

David Gadbois

unread,
Jun 17, 2015, 6:15:58 PM6/17/15
to ope...@googlegroups.com
Greetings,

I'm new to OpenVSP, and am struggling to find documentation on how to drive model parameters in version 3.1.2 using Matlab.  If this has been discussed already, please point me to where.  And thanks in advance for any help.

James Haley

unread,
Jun 24, 2015, 11:07:23 PM6/24/15
to ope...@googlegroups.com
David,

I'm not sure of any direct way to drive model parameters via Matlab, 

however I have been using Matlab to generate VSP scripting for the API, then running that via Matlab through the console commands. 

Been using this to generate VSPaero data for sweeps and auto-importing results.

for example,

command = 'vspaero -omp 7 model_DegenGeom';
status = dos(command);

hope this helps,

James Haley

Rob McDonald

unread,
Jun 25, 2015, 12:42:03 AM6/25/15
to ope...@googlegroups.com
David,

Sorry I forgot to reply promptly.

If you are doing a typical use-case design study, I recommend you
check out the 'Design File' support in VSP. There are presentations
about it included in the materials from past OpenVSP Workshops.

The Design File capability makes it easy for you to identify certain
variables to vary in a design study -- and then use a simplified file
to set their values. You could easily write that file from Matlab and
then use the built in scripting to automate the analysis you need from
there.

A more advanced approach is possible, but it isn't really ready for
prime time yet. One of my former students made progress on this, but
didn't finish it. He has graduated and is about to start a new full
time job, so he is very busy with life right now.

If you're adventurous, you might try to replicate what he was working on.

He used SWIG to wrap the OpenVSP C++ API with Java. SWIG is a program
for creating wrappers of C/C++ API's to other languages. The OpenVSP
source includes an example of this for Python. (first step, you need
to be able to compile OpenVSP).

Once you've generated a Java wrapper for OpenVSP, it is fairly easy to
call Java from within Matlab.

This will give you direct access to the OpenVSP API (everything that
is available in scripting) from Matlab.

Best of luck,

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.

Brad LaCroix

unread,
Jun 29, 2015, 5:54:58 PM6/29/15
to ope...@googlegroups.com
James/Rob,

Do you have a working set of files that I can use as a template in MATLAB to get started? I'm trying to go down a similar path with MATLAB where I use MATLAB to run a study in which I vary different parameters and then grab the results to process and plot in MATLAB. However, I'm having trouble getting things setup initially. For example, what does "-omp" mean, "7", and what is inside the file "model_DegenGeom"?

Thanks,
Brad

James Haley

unread,
Jun 30, 2015, 7:45:23 AM6/30/15
to ope...@googlegroups.com
Brad,

I don't have a set of Matlab files ready, I have only done a quick execution of this style for vspaero (which is where that 2 line example came from)

The -omp 7 sets the number of cores to run vspaero with, (i7 4 cores - 8 threads)

The model_degengeom is where your degengeom output file should be that you want to do the analysis on.

If you want I can send you my Matlab example after work today, but its very rough around the edges.

Brad LaCroix

unread,
Jun 30, 2015, 12:07:59 PM6/30/15
to ope...@googlegroups.com
Hi James,

Thanks for the info. Any example, no matter how rough, would be of great help.

Thanks again,
Brad

James Haley

unread,
Jun 30, 2015, 6:32:56 PM6/30/15
to ope...@googlegroups.com
Here is everything you need to run as is. simply place these in the same location as vsp, open in matlab and run. (hopefully).

I tried to comment it out the best I could but this script was just to test if I could do it, not make it user friendly :/

also it I set it to use 1 processing thread only ( I don't know your hardware setup you can change it on line 73 if you want. 

cheers,

James Haley
UTA, AVD lab
X-1_aero_DegenGeom.csv
X-1_aero_DegenGeom.vspaero
vspaero.m

James Haley

unread,
Jun 30, 2015, 6:35:35 PM6/30/15
to ope...@googlegroups.com
Forgot the data import script. here ya go. 
importfile.m

Mesut Bilici

unread,
Aug 4, 2017, 8:04:58 AM8/4/17
to OpenVSP
Hi James,

I downladed all codes written in MATLAB and run in the same location as vsp. However, I got an error message like this:

Error using textscan
Mismatch between file and format string.
Trouble reading floating point number from file (row 1u, field 3u) ==> Lunit               \n

in line 52 of importfile.m script.

Can you help about this? I couldn't fix it. 

Thank you.

1 Temmuz 2015 Çarşamba 01:35:35 UTC+3 tarihinde James Haley yazdı:
Reply all
Reply to author
Forward
0 new messages