This group of functions is available for manipulating VSPAERO control surface groups through the API. Note, VSPAERO also includes rectangle type sub-surfaces as possible control surfaces. Click here to return to the main page.
More...
◆ AddAllToVSPAEROControlSurfaceGroup()
| void vsp::AddAllToVSPAEROControlSurfaceGroup |
( |
int | CSGroupIndex | ) |
|
|
extern |
Add all available control surfaces to the control surface group at the specified index
string wid =
AddGeom(
"WING",
"" );
{
Print(
"ERROR: CreateVSPAEROControlSurfaceGroup did not add a group" );
__failure++;
}
if ( num_avail < 1 )
{
Print(
"ERROR: no control surfaces are available to add" );
__failure++;
}
{
Print(
"ERROR: a new control surface group is not empty" );
__failure++;
}
{
Print(
"ERROR: AddAllToVSPAEROControlSurfaceGroup did not add them all" );
__failure++;
}
{
Print(
"ERROR: control surfaces are still available after adding them all" );
__failure++;
}
void Print(const std::string &data, bool new_line=true)
std::vector< std::string > GetActiveCSNameVec(int CSGroupIndex)
void AddAllToVSPAEROControlSurfaceGroup(int CSGroupIndex)
std::vector< std::string > GetAvailableCSNameVec(int CSGroupIndex)
int CreateVSPAEROControlSurfaceGroup()
int GetNumControlSurfaceGroups()
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
std::string AddSubSurf(const std::string &geom_id, int type, int surfindex=0)
- Parameters
-
| [in] | CSGroupIndex | int Index of the control surface group |
◆ AddCpSlice()
| std::string vsp::AddCpSlice |
( |
int | cut_type, |
|
|
double | location ) |
|
extern |
Add a new VSPAERO control surface group using the default naming convention. The control surface group will not contain any control surfaces until they are added.
string wid =
AddGeom(
"WING",
"" );
if ( num_group != 1 ) {
Print(
"Error: CreateVSPAEROControlSurfaceGroup" ); __failure++; }
- See also
- AddSelectedToCSGroup
- Returns
- int Index of the new VSPAERO control surface group
Delete a VSPAERO control surface group. The control surfaces it held go back to being available, and the groups above it slide down to fill the gap.
string wid =
AddGeom(
"WING",
"" );
{
Print(
"ERROR: DeleteVSPAEROControlSurfaceGroup did not remove the group" );
__failure++;
}
{
Print(
"ERROR: the deleted group did not release its control surfaces" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print(
"ERROR: DeleteVSPAEROControlSurfaceGroup accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
void SetVSPAEROControlGroupName(const std::string &name, int CSGroupIndex)
void DeleteVSPAEROControlSurfaceGroup(int CSGroupIndex)
- See also
- CreateVSPAEROControlSurfaceGroup, GetNumControlSurfaceGroups
- Parameters
-
| [in] | CSGroupIndex | int Index of the control surface group |
Add a Cp slice to the VSPAERO Cp Slicer. The CpSlicer analysis has nothing to slice until at least one has been added.
{
Print(
"ERROR: AddCpSlice did not add a slice" );
__failure++;
}
if ( !closeTo(
GetParmVal(
FindParm( slice_id,
"CutPosition",
"CpSlice" ) ), 0.5, 1e-9 ) )
{
Print(
"ERROR: AddCpSlice did not place the cut" );
__failure++;
}
{
Print(
"ERROR: GetCpSliceID does not agree with AddCpSlice" );
__failure++;
}
std::string AddCpSlice(int cut_type, double location)
std::string GetCpSliceID(int slice_index)
std::string FindParm(const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
double GetParmVal(const std::string &parm_id)
- See also
- GetNumCpSlices, GetCpSliceID, DelCpSlice, DeleteAllCpSlices
- Parameters
-
| [in] | cut_type | int Slice direction enum (X_DIR, Y_DIR or Z_DIR) |
| [in] | location | double Location of the cut along that axis |
- Returns
- string Cp slice ID
◆ AddSelectedToCSGroup()
| void vsp::AddSelectedToCSGroup |
( |
const std::vector< int > & | selected, |
|
|
int | CSGroupIndex ) |
|
extern |
Add each control surfaces in the array of control surface indexes to the control surface group at the specified index.
- Warning
- The indexes in input "selected" must be matched with available control surfaces identified by GetAvailableCSNameVec. The "selected" input uses one- based indexing to associate available control surfaces.
string wid =
AddGeom(
"WING",
"" );
array < int > cs_ind_vec( cs_name_vec.size() );
for ( int i = 0; i < int( cs_name_vec.size() ); i++ )
{
cs_ind_vec[i] = i + 1;
}
{
Print(
"ERROR: AddSelectedToCSGroup did not add them all" );
__failure++;
}
{
Print(
"ERROR: control surfaces are still available after adding them all" );
__failure++;
}
void AddSelectedToCSGroup(const std::vector< int > &selected, int CSGroupIndex)
- See also
- GetAvailableCSNameVec
- Parameters
-
| [in] | selected | vector <int> Array of control surface indexes to add to the group. Note, the integer values are one based. |
| [in] | CSGroupIndex | int Index of the control surface group |
◆ AutoGroupVSPAEROControlSurfaces()
| void vsp::AutoGroupVSPAEROControlSurfaces |
( |
| ) |
|
|
extern |
Creates the initial default grouping for the control surfaces. The initial grouping collects all surface copies of the sub-surface into a single group. For example if a wing is defined with an aileron and that wing is symmetrical about the xz plane there will be a surface copy of the master wing surface as well as a copy of the sub-surface. The two sub-surfaces may get deflected differently during analysis routines and can be identified uniquely by their full name.
string wid =
AddGeom(
"WING",
"" );
string vert_id =
AddGeom(
"WING" );
string control_group_settings_container_id =
FindContainer(
"VSPAEROSettings", 0 );
Print(
"\tSetting control surface group deflection angles..." );
string deflection_gain_id;
deflection_gain_id =
FindParm( control_group_settings_container_id,
"Surf_" + aileron_id +
"_0_Gain",
"ControlSurfaceGroup_0" );
deflection_gain_id =
FindParm( control_group_settings_container_id,
"Surf_" + aileron_id +
"_1_Gain",
"ControlSurfaceGroup_0" );
string deflection_angle_id =
FindParm( control_group_settings_container_id,
"DeflectionAngle",
"ControlSurfaceGroup_0" );
{
Print(
"ERROR: AutoGroupVSPAEROControlSurfaces did not make a group per surface" );
__failure++;
}
else
{
for ( int i = 0; i < 2; i++ )
{
{
Print(
"ERROR: group " + i +
" does not hold its control surface copies" );
__failure++;
}
{
Print(
"ERROR: group " + i +
" was not named" );
__failure++;
}
}
}
if ( deflection_gain_id.length() == 0 || deflection_angle_id.length() == 0 )
{
Print(
"ERROR: the control surface group Parms were not created" );
__failure++;
}
std::string GetVSPAEROControlGroupName(int CSGroupIndex)
void AutoGroupVSPAEROControlSurfaces()
void SetGeomName(const std::string &geom_id, const std::string &name)
std::string FindContainer(const std::string &name, int index)
double SetParmValUpdate(const std::string &parm_id, double val)
void Update(bool update_managers=true)
- See also
- CreateVSPAEROControlSurfaceGroup
◆ CreateVSPAEROControlSurfaceGroup()
| int vsp::CreateVSPAEROControlSurfaceGroup |
( |
| ) |
|
|
extern |
◆ DelCpSlice()
| void vsp::DelCpSlice |
( |
int | slice_index | ) |
|
|
extern |
Delete a single Cp slice from the VSPAERO Cp Slicer
{
Print(
"ERROR: DelCpSlice removed the wrong slice" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print(
"ERROR: DelCpSlice accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
void DelCpSlice(int slice_index)
- See also
- AddCpSlice, DeleteAllCpSlices
- Parameters
-
| [in] | slice_index | int Cp slice index |
◆ DeleteAllCpSlices()
| void vsp::DeleteAllCpSlices |
( |
| ) |
|
|
extern |
Delete all Cp slices from the VSPAERO Cp Slicer
{
Print(
"ERROR: DeleteAllCpSlices left slices behind" );
__failure++;
}
if ( GetNumTotalErrors() != 0 )
{
Print(
"ERROR: DeleteAllCpSlices complained about an empty slicer" );
__failure++;
}
- See also
- AddCpSlice, DelCpSlice, GetNumCpSlices
◆ DeleteVSPAEROControlSurfaceGroup()
| void vsp::DeleteVSPAEROControlSurfaceGroup |
( |
int | CSGroupIndex | ) |
|
|
extern |
Delete one VSPAERO control surface group, by index.
- See also
- CreateVSPAEROControlSurfaceGroup
- Parameters
-
| [in] | CSGroupIndex | int Index of the control surface group to delete |
◆ FindControlSurfaceGroup()
| std::string vsp::FindControlSurfaceGroup |
( |
int | group_index | ) |
|
|
extern |
Get the ID of a VSPAERO control surface group, so that its Parms can be reached the way any other container's are. A group carries an ActiveFlag and a DeflectionAngle, both in Parm group "ControlSurfaceGroup". Everything else about these groups is addressed by index; this is what lets a script set a deflection without knowing the index a group happens to hold.
string wid =
AddGeom(
"WING",
"" );
{
Print(
"ERROR: no control surface group was made" );
__failure++;
}
if ( group_id.length() == 0 )
{
Print(
"ERROR: FindControlSurfaceGroup found nothing" );
__failure++;
}
if ( abs(
GetParmVal( group_id,
"DeflectionAngle",
"ControlSurfaceGroup" ) - 7.0 ) > 1e-6 )
{
Print(
"ERROR: the group did not take the deflection it was given" );
__failure++;
}
std::string FindControlSurfaceGroup(int group_index)
double SetParmVal(const std::string &parm_id, double val)
- See also
- GetNumControlSurfaceGroups, AutoGroupVSPAEROControlSurfaces
- Parameters
-
| [in] | group_index | int Control surface group index |
- Returns
- string Control surface group ID
◆ GetActiveCSNameVec()
| std::vector< std::string > vsp::GetActiveCSNameVec |
( |
int | CSGroupIndex | ) |
|
|
extern |
Get the names of each active (used) control surface in the control surface group at the specified index
string wid =
AddGeom(
"WING",
"" );
if ( cs_name_vec.length() == 0 )
{
Print(
"ERROR: GetActiveCSNameVec returned nothing" );
__failure++;
}
Print(
"Active CS in Group Index #",
false );
for ( int i = 0; i < int( cs_name_vec.size() ); i++ )
{
}
- Parameters
-
| [in] | CSGroupIndex | int Index of the control surface group |
- Returns
- vector <string> Array of active control surface names
◆ GetAvailableCSNameVec()
| std::vector< std::string > vsp::GetAvailableCSNameVec |
( |
int | CSGroupIndex | ) |
|
|
extern |
Get the names of each available (not used) control surface in the control surface group at the specified index
string wid =
AddGeom(
"WING",
"" );
if ( cs_name_vec.length() == 0 )
{
Print(
"ERROR: GetAvailableCSNameVec returned nothing" );
__failure++;
}
array < int > cs_ind_vec(1);
cs_ind_vec[0] = 1;
if ( active_vec.size() != 1 || active_vec[0] != cs_name_vec[0] )
{
Print(
"ERROR: AddSelectedToCSGroup did not add the surface that was named" );
__failure++;
}
{
Print(
"ERROR: the added surface is still available" );
__failure++;
}
- Parameters
-
| [in] | CSGroupIndex | int Index of the control surface group |
- Returns
- vector <string> Array of active control surface names
◆ GetCompleteCSNameVec()
| std::vector< std::string > vsp::GetCompleteCSNameVec |
( |
| ) |
|
|
extern |
Get the names of all control surfaces. Some may be active (used) while others may be available.
string wid =
AddGeom(
"WING",
"" );
if ( cs_name_vec.length() == 0 )
{
Print(
"ERROR: GetCompleteCSNameVec returned nothing" );
__failure++;
}
Print(
"All Control Surfaces: ",
false );
for ( int i = 0; i < int( cs_name_vec.size() ); i++ )
{
}
std::vector< std::string > GetCompleteCSNameVec()
- Returns
- vector <string> Array of all control surface names
◆ GetCpSliceID()
| std::string vsp::GetCpSliceID |
( |
int | slice_index | ) |
|
|
extern |
Get the ID of the Cp slice at the specified index
{
Print(
"ERROR: GetCpSliceID did not report the slices in order" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print(
"ERROR: GetCpSliceID accepted an index past the end" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
- See also
- AddCpSlice, GetNumCpSlices
- Parameters
-
| [in] | slice_index | int Cp slice index |
- Returns
- string Cp slice ID
◆ GetNumControlSurfaceGroups()
| int vsp::GetNumControlSurfaceGroups |
( |
| ) |
|
|
extern |
Get the total number of control surface groups
string wid =
AddGeom(
"WING",
"" );
string horiz_id =
AddGeom(
"WING",
"" );
if ( num_group != 2 ) {
Print(
"Error: GetNumControlSurfaceGroups" ); __failure++; }
- Returns
- int Number of control surface groups
◆ GetNumCpSlices()
| int vsp::GetNumCpSlices |
( |
| ) |
|
|
extern |
Get the number of Cp slices in the VSPAERO Cp Slicer
{
Print(
"ERROR: GetNumCpSlices did not count both slices" );
__failure++;
}
{
{
Print(
"ERROR: slice " + i +
" cannot be found" );
__failure++;
}
}
- See also
- AddCpSlice, GetCpSliceID, DelCpSlice, DeleteAllCpSlices
- Returns
- int Number of Cp slices
◆ GetVSPAEROControlGroupName()
| std::string vsp::GetVSPAEROControlGroupName |
( |
int | CSGroupIndex | ) |
|
|
extern |
Get the name of the control surface group at the specified index
string wid =
AddGeom(
"WING",
"" );
Print(
"CS Group name: ",
false );
{
Print(
"ERROR: the control surface group name did not take" );
__failure++;
}
{
Print(
"ERROR: an index past the end named a group" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print(
"ERROR: an index past the end was accepted" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
- Parameters
-
| [in] | CSGroupIndex | int Index of the control surface group |
◆ RemoveAllFromVSPAEROControlSurfaceGroup()
| void vsp::RemoveAllFromVSPAEROControlSurfaceGroup |
( |
int | CSGroupIndex | ) |
|
|
extern |
Remove all used control surfaces from the control surface group at the specified index
string wid =
AddGeom(
"WING",
"" );
if ( num_active < 1 )
{
Print(
"ERROR: nothing was added to the group to remove" );
__failure++;
}
{
Print(
"ERROR: RemoveAllFromVSPAEROControlSurfaceGroup left surfaces in the group" );
__failure++;
}
{
Print(
"ERROR: the removed surfaces did not become available again" );
__failure++;
}
void RemoveAllFromVSPAEROControlSurfaceGroup(int CSGroupIndex)
- Parameters
-
| [in] | CSGroupIndex | int Index of the control surface group |
◆ RemoveSelectedFromCSGroup()
| void vsp::RemoveSelectedFromCSGroup |
( |
const std::vector< int > & | selected, |
|
|
int | CSGroupIndex ) |
|
extern |
Remove each control surfaces in the array of control surface indexes from the control surface group at the specified index.
- Warning
- The indexes in input "selected" must be matched with active control surfaces identified by GetActiveCSNameVec. The "selected" input uses one-based indexing to associate available control surfaces.
string wid =
AddGeom(
"WING",
"" );
array < int > cs_ind_vec( cs_name_vec.size() );
for ( int i = 0; i < int( cs_name_vec.size() ); i++ )
{
cs_ind_vec[i] = i + 1;
}
array < int > remove_cs_ind_vec( 1 );
remove_cs_ind_vec[0] = 1;
if ( num_active != int( cs_name_vec.size() ) )
{
Print(
"ERROR: not everything was added to the group" );
__failure++;
}
{
Print(
"ERROR: RemoveSelectedFromCSGroup did not remove a surface" );
__failure++;
}
{
Print(
"ERROR: the removed surface did not become available again" );
__failure++;
}
void RemoveSelectedFromCSGroup(const std::vector< int > &selected, int CSGroupIndex)
- See also
- GetActiveCSNameVec
- Parameters
-
| [in] | selected | vector <int> Array of control surface indexes to remove from the group. Note, the integer values are one based. |
| [in] | CSGroupIndex | int Index of the control surface group |
◆ SetVSPAEROControlGroupName()
| void vsp::SetVSPAEROControlGroupName |
( |
const std::string & | name, |
|
|
int | CSGroupIndex ) |
|
extern |
Set the name for the control surface group at the specified index
string wid =
AddGeom(
"WING",
"" );
{
Print(
"ERROR: SetVSPAEROControlGroupName did not take" );
__failure++;
}
Print(
"CS Group name: ",
false );
{
Print(
"ERROR: the control surface group name did not take" );
__failure++;
}
{
Print(
"ERROR: an index past the end named a group" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print(
"ERROR: an index past the end was accepted" );
__failure++;
}
while ( GetNumTotalErrors() > 0 )
{
}
- Parameters
-
| [in] | name | string Name to set for the control surface group |
| [in] | CSGroupIndex | int Index of the control surface group |