Issue with Wing Parameters in VSP Script

192 views
Skip to first unread message

Mike Henson

unread,
Dec 16, 2016, 12:51:49 AM12/16/16
to OpenVSP
The attached vspscript iterates on 3 wing parameters (sweep, aspect ratio, taper ratio) to output a DegenGeom file for each combination.

The wing sweep parameter is behaving as expected but the other parameters do not appear to be update in the output DegenGeom file.  To exercise script, add a single wing component to the VSP session.

Any help or suggestions would be greatly appreciated.

Regards,
Mike


void main()
{
array< string > @type_array = GetGeomTypes();
if( type_array.size() > 0 )
for ( int i = 0 ; i < int(type_array.size()) ; i++ )
{
Print( type_array[i]);
}

array< string > @geom_ids = FindGeoms();
    if ( geom_ids.size() < 1 )
{
Print( "---> Did not find Geoms " );
return;
}


// =========================
// === Design Parameters ===
// =========================
array< float > sweep = {0.0, 15.0, 30.0};
array< float > aspectRatio = {1.0, 2.25, 3.5};
array< float > taperRatio = {0.3, 0.45, 0.6};

// ======================
// === Find Wing Geom ===
// ======================
string wingName = "WingGeom";
geom_ids = FindGeomsWithName( wingName );
if ( geom_ids.size() < 1 )
{
Print( "---> Did not find WingGeom " );
return;
}else{
Print("Found WingGeom");
}
  string wid = geom_ids[0];
Print(wid);

// File basename
string baseName = "LWD";

// Loop over Sweep
        for ( int i = 0 ; i < 3; i++ )
{
    SetParmVal( wid, "Sweep", "XSec_1", sweep[i]);
string SW = "_SW_"+formatFloat(i,'1',1);

                // Loop over AR
      for ( int j = 0 ; j < 3; j++ )
{
    SetParmVal( wid, "Aspect", "XSec_1", aspectRatio[j]);
string AR = "_AR_"+formatInt(j,'1',1);

// Loop over TR
      for ( int k = 0 ; k < 3; k++ )
{
    SetParmVal( wid, "Taper", "XSec_1", taperRatio[k]);
string TR = "_TR_"+formatInt(k,'1',1);

string fileName = baseName+SW+AR+TR+"_DegenGeom.m";
Print (fileName);

// Update model
    Update();

//==== Set File Name ====//
SetComputationFileName( DEGEN_GEOM_M_TYPE, fileName);

//==== Run Degen Geom ====//
ComputeDegenGeom( SET_ALL, DEGEN_GEOM_M_TYPE );
}
}
}
}

Rob McDonald

unread,
Dec 16, 2016, 8:53:11 AM12/16/16
to OpenVSP
Mike,

I haven't tried it yet, but the first thing that comes to mind is that the wing's driver groups may not be set in a way that aspect ratio and taper ratio are available to set.

You can do this manually through the GUI, or through the API.

Rob

Mike Henson

unread,
Jan 2, 2017, 5:38:19 PM1/2/17
to OpenVSP
Rob,

Sorry for slow reply and thanks for your suggestion.  I learned that by adding a call to the wing driver group function, the wing variables now appear to cycle correctly.

I noticed the behavior was consisent between using a vspscript and python script (attached).


Thanks,
Mike
LiuWingDesignSpace2.vspscript
wingDesignSpace2.py

Rob McDonald

unread,
Jan 3, 2017, 12:23:39 PM1/3/17
to ope...@googlegroups.com
Those examples look great Mike. Thanks for sharing them.

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.
Reply all
Reply to author
Forward
0 new messages