OpenVSP API Documentation 3.52.0
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++;
}
void Print(const std::string &data, bool new_line=true)
@ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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)

string prop_id = AddGeom( "PROP" );
if ( PCurveGetType( prop_id, PROP_CHORD ) != LINEAR ) { Print( "ERROR: PCurveConvertTo" ); __failure++; }
@ LINEAR
See also
PCURV_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
[in]newtypeint Curve type enum (i.e. CEDIT)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PCurveDeletePt()

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

Delete a propeller blade curve (P Curve) point

string prop_id = AddGeom( "PROP" );
// A cubic edit curve holds its points in groups and will not give one up on its own, so put
// the curve into a form where a single point can go.
int n = PCurveGetTVec( prop_id, PROP_CHORD ).size();
PCurveDeletePt( prop_id, PROP_CHORD, 1 );
if ( int( PCurveGetTVec( prop_id, PROP_CHORD ).size() ) >= n ) { Print( "ERROR: PCurveDeletePt" ); __failure++; }
void PCurveDeletePt(const std::string &geom_id, const int &pcurveid, const int &indx)
Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
[in]indxint Point index
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

string prop_id = AddGeom( "PROP" );
array < double > @tvec = PCurveGetTVec( prop_id, PROP_CHORD );
if ( tvec.size() == 0 ) { Print( "ERROR: PCurveGetTVec" ); __failure++; }
Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
Returns
vector <double> Array of parameters
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PCurveGetType()

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

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

string prop_id = AddGeom( "PROP" );
int t = PCurveGetType( prop_id, PROP_CHORD );
if ( t < 0 ) { Print( "ERROR: PCurveGetType" ); __failure++; }
See also
PCURV_TYPE
Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
Returns
int Curve type enum (i.e. CEDIT)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.).

string prop_id = AddGeom( "PROP" );
array < double > @valvec = PCurveGetValVec( prop_id, PROP_CHORD );
if ( valvec.size() == 0 ) { Print( "ERROR: PCurveGetValVec" ); __failure++; }
if ( valvec.size() != PCurveGetTVec( prop_id, PROP_CHORD ).size() ) { Print( "ERROR: PCurveGetValVec" ); __failure++; }
std::vector< double > PCurveGetValVec(const std::string &geom_id, const int &pcurveid)
Parameters
[in]geom_idstring Parent Geom ID
[in]pcurveidint P Curve index
Returns
vector <double> Array of values
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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

string prop_id = AddGeom( "PROP" );
int n = PCurveGetTVec( prop_id, PROP_CHORD ).size();
PCurveSplit( prop_id, PROP_CHORD, 0.55 );
if ( int( PCurveGetTVec( prop_id, PROP_CHORD ).size() ) <= n ) { Print( "ERROR: PCurveSplit" ); __failure++; }
int PCurveSplit(const std::string &geom_id, const int &pcurveid, const double &tsplit)
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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();
}
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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)

string prop_id = AddGeom( "PROP" );
array < double > tvec = PCurveGetTVec( prop_id, PROP_CHORD );
array < double > valvec = PCurveGetValVec( prop_id, PROP_CHORD );
SetPCurve( prop_id, PROP_CHORD, tvec, valvec, PCurveGetType( prop_id, PROP_CHORD ) );
if ( PCurveGetTVec( prop_id, PROP_CHORD ).size() != tvec.size() ) { Print( "ERROR: SetPCurve" ); __failure++; }
void SetPCurve(const std::string &geom_id, const int &pcurveid, const std::vector< double > &tvec, const std::vector< double > &valvec, const int &newtype)
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)
Here is the call graph for this function:
Here is the caller graph for this function: