OpenVSP API Documentation 3.51.3
Loading...
Searching...
No Matches
Propeller Blade Curve Functions

The following group of API functions may be used to control parametric propeller blade curves (PCurves). Click here to return to the main page. More...

Functions

void vsp::SetPCurve (const std::string &geom_id, const int &pcurveid, const std::vector< double > &tvec, const std::vector< double > &valvec, const int &newtype)
void vsp::PCurveConvertTo (const std::string &geom_id, const int &pcurveid, const int &newtype)
int vsp::PCurveGetType (const std::string &geom_id, const int &pcurveid)
std::vector< double > vsp::PCurveGetTVec (const std::string &geom_id, const int &pcurveid)
std::vector< double > vsp::PCurveGetValVec (const std::string &geom_id, const int &pcurveid)
void vsp::PCurveDeletePt (const std::string &geom_id, const int &pcurveid, const int &indx)
int vsp::PCurveSplit (const std::string &geom_id, const int &pcurveid, const double &tsplit)
void vsp::ApproximateAllPropellerPCurves (const std::string &geom_id)
void vsp::ResetPropellerThicknessCurve (const std::string &geom_id)

Detailed Description

Function Documentation

◆ ApproximateAllPropellerPCurves()

void vsp::ApproximateAllPropellerPCurves ( const std::string & geom_id)
extern

Approximate all propeller blade curves with cubic Bezier curves.

// Add Propeller
string prop = AddGeom( "PROP", "" );
// Take the blade curves off Bezier so the approximation has something to do.
if ( PCurveGetType( prop, PROP_CHORD ) != PCHIP )
{
Print( "ERROR: the blade curves would not convert to PCHIP" );
__failure++;
}
// Every blade curve is now a cubic Bezier.
if ( PCurveGetType( prop, PROP_CHORD ) != CEDIT ||
{
Print( "ERROR: ApproximateAllPropellerPCurves did not convert the curves" );
__failure++;
}
// A cubic Bezier is stored in groups of three, so the control point count
// is one more than a multiple of three.
array< double > tvec = PCurveGetTVec( prop, PROP_CHORD );
if ( tvec.size() < 4 || ( tvec.size() - 1 ) % 3 != 0 )
{
Print( "ERROR: the converted curve is not a cubic Bezier" );
__failure++;
}
@ PROP_CHORD
@ PROP_TWIST
@ PROP_THICK
@ PCHIP
@ CEDIT
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
std::vector< double > PCurveGetTVec(const std::string &geom_id, const int &pcurveid)
void ApproximateAllPropellerPCurves(const std::string &geom_id)
int PCurveGetType(const std::string &geom_id, const int &pcurveid)
void PCurveConvertTo(const std::string &geom_id, const int &pcurveid, const int &newtype)
void Update(bool update_managers=true)
Parameters
[in]geom_idstring Geom ID

◆ PCurveConvertTo()

void vsp::PCurveConvertTo ( const std::string & geom_id,
const int & pcurveid,
const int & newtype )
extern

Change the type of a propeller blade curve (P Curve)

See also
PCURV_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
[in]newtypeint Curve type enum (i.e. CEDIT)

◆ PCurveDeletePt()

void vsp::PCurveDeletePt ( const std::string & geom_id,
const int & pcurveid,
const int & indx )
extern

Delete a propeller blade curve (P Curve) point

Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
[in]indxint Point index

◆ PCurveGetTVec()

std::vector< double > vsp::PCurveGetTVec ( const std::string & geom_id,
const int & pcurveid )
extern

Get the parameters of a propeller blade curve (P Curve). Each parameter is a fraction of propeller radius.

Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
Returns
vector <double> Array of parameters

◆ PCurveGetType()

int vsp::PCurveGetType ( const std::string & geom_id,
const int & pcurveid )
extern

Get the type of a propeller blade curve (P Curve)

See also
PCURV_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
Returns
int Curve type enum (i.e. CEDIT)

◆ PCurveGetValVec()

std::vector< double > vsp::PCurveGetValVec ( const std::string & geom_id,
const int & pcurveid )
extern

Get the values of a propeller blade curve (P Curve). What the values represent id dependent on the curve type (i.e. twist, chord, etc.).

Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
Returns
vector <double> Array of values

◆ PCurveSplit()

int vsp::PCurveSplit ( const std::string & geom_id,
const int & pcurveid,
const double & tsplit )
extern

Split a propeller blade curve (P Curve) at the specified 1D parameter

Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
[in]tsplitdouble 1D parameter split location
Returns
int Index of new control point

◆ ResetPropellerThicknessCurve()

void vsp::ResetPropellerThicknessCurve ( const std::string & geom_id)
extern

Reset propeller T/C curve to match basic thickness of file-type airfoils. Typically only used for a propeller that has been constructed with file-type airfoils across the blade. The new thickness curve will be a PCHIP curve with t/c matching the propeller's XSecs – unless it is a file XSec, then the Base thickness is used.

// Add Propeller
string prop = AddGeom( "PROP", "" );
// The curve is rebuilt from the blade XSecs: one PCHIP station per XSec,
// each carrying that XSec's thickness to chord ratio.
array< double > tvec = PCurveGetTVec( prop, PROP_THICK );
array< double > vvec = PCurveGetValVec( prop, PROP_THICK );
string xsec_surf = GetXSecSurf( prop, 0 );
int num_xsec = GetNumXSec( xsec_surf );
if ( PCurveGetType( prop, PROP_THICK ) != PCHIP )
{
Print( "ERROR: ResetPropellerThicknessCurve did not make a PCHIP curve" );
__failure++;
}
if ( int( vvec.size() ) != num_xsec || tvec.size() != vvec.size() )
{
Print( "ERROR: ResetPropellerThicknessCurve did not follow the XSecs" );
__failure++;
}
else
{
for ( int i = 0; i < num_xsec; i++ )
{
string tc = GetXSecParm( GetXSec( xsec_surf, i ), "ThickChord" );
// A circular XSec carries no thickness Parm; its base thickness is
// used instead.
if ( tc.length() > 0 )
{
if ( !closeTo( vvec[i], GetParmVal( tc ), 1e-6 ) )
{
Print( "ERROR: station " + i + " does not match its XSec" );
__failure++;
}
}
}
// The stations run out along the blade.
for ( int i = 1; i < int( tvec.size() ); i++ )
{
if ( tvec[i] <= tvec[i - 1] )
{
Print( "ERROR: the thickness stations are not increasing" );
__failure++;
}
}
}
// Looking up the circular XSec's thickness raises an error on purpose, so
// take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
std::vector< double > PCurveGetValVec(const std::string &geom_id, const int &pcurveid)
void ResetPropellerThicknessCurve(const std::string &geom_id)
double GetParmVal(const std::string &parm_id)
std::string GetXSecParm(const std::string &xsec_id, const std::string &name)
std::string GetXSecSurf(const std::string &geom_id, int index)
std::string GetXSec(const std::string &xsec_surf_id, int xsec_index)
int GetNumXSec(const std::string &xsec_surf_id)
Parameters
[in]geom_idstring Geom ID

◆ SetPCurve()

void vsp::SetPCurve ( const std::string & geom_id,
const int & pcurveid,
const std::vector< double > & tvec,
const std::vector< double > & valvec,
const int & newtype )
extern

Set the parameters, values, and curve type of a propeller blade curve (P Curve)

See also
PCURV_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
[in]tvecvector <double> Array of parameter values
[in]valvecvector <double> Array of values
[in]newtypeint Curve type enum (i.e. CEDIT)