VSPAERO Control Surface Group Functions¶
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.
Creates the initial default grouping for the control surfaces. |
|
|
Add a new VSPAERO control surface group using the default naming convention. |
Get the number of Cp slices in the VSPAERO Cp Slicer |
|
|
Get the ID of the Cp slice at the specified index |
Get the IDs of the Cp slices, in the order of their indexes. |
|
|
Delete a single Cp slice from the VSPAERO Cp Slicer |
|
Delete a Cp slice, by slice ID. |
Delete all Cp slices from the VSPAERO Cp Slicer |
|
|
Delete one VSPAERO control surface group, by index. |
|
Delete a VSPAERO control surface group, by group ID. |
Add a VSPAERO control surface group. |
|
Add an empty VSPAERO control surface group and return its ID. |
|
|
Add all available control surfaces to the control surface group at the specified index |
|
Add every available control surface to a group, by group ID. |
Remove all used control surfaces from the control surface group at the specified index |
|
Remove every control surface from a group, by group ID. |
|
|
Get the names of each active (used) control surface in the control surface group at the specified index |
|
Get the names of the control surfaces in a group, by group ID. |
|
Get the subsurface IDs of the control surfaces in a group. |
|
Get the reflection indexes of the control surfaces in a group, in the order of GetActiveCSSubSurfIDVec. |
Get the names of all control surfaces. |
|
Get the subsurface IDs of every control surface, grouped or not, in the order of GetCompleteCSNameVec. |
|
Get the reflection indexes of every control surface, in the order of GetCompleteCSSubSurfIDVec. |
|
|
Get the names of each available (not used) control surface in the control surface group at the specified index |
|
Get the names of the control surfaces not in a group, by group ID. |
|
Get the subsurface IDs of the control surfaces not in a group, in the order of GetAvailableCSNameVec. |
|
Get the reflection indexes of the control surfaces not in a group, in the order of GetAvailableCSSubSurfIDVec. |
|
Set the name for the control surface group at the specified index |
|
Set the name of a control surface group, by group ID. |
|
Get the name of the control surface group at the specified index |
|
Get the name of a control surface group, by group ID. |
|
Add each control surfaces in the array of control surface indexes to the control surface group at the specified index. |
|
Remove each control surfaces in the array of control surface indexes from the control surface group at the specified index. |
|
Add a control surface to a group, by its subsurface ID and the index of its symmetric reflection. |
|
Remove a control surface from a group, by its subsurface ID and the index of its symmetric reflection. |
Get the total number of control surface groups |
|
|
Get the ID of a VSPAERO control surface group, so that its Parms can be reached the way any other container's are. |
Get the IDs of the VSPAERO control surface groups, in the order of their indexes. |
Details¶
- openvsp.AutoGroupVSPAEROControlSurfaces()[source]¶
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.
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface #==== Add Vertical tail and set some parameters =====// vert_id = AddGeom( "WING" ) SetGeomName( vert_id, "Vert" ) SetParmValUpdate( vert_id, "TotalArea", "WingGeom", 10.0 ) SetParmValUpdate( vert_id, "X_Rel_Location", "XForm", 8.5 ) SetParmValUpdate( vert_id, "X_Rel_Rotation", "XForm", 90 ) rudder_id = AddSubSurf( vert_id, SS_CONTROL ) # Add Control Surface Sub-Surface AutoGroupVSPAEROControlSurfaces() Update() print( "COMPLETE\n" ) control_group_settings_container_id = FindContainer( "VSPAEROSettings", 0 ) # auto grouping produces parm containers within VSPAEROSettings #==== Set Control Surface Group Deflection Angle ====// print( "\tSetting control surface group deflection angles..." ) # subsurfaces get added to groups with "CSGQualities_[geom_name]_[control_surf_name]" # subsurfaces gain parm name is "Surf[surfndx]_Gain" starting from 0 to NumSymmetricCopies-1 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" ) # deflect aileron deflection_angle_id = FindParm( control_group_settings_container_id, "DeflectionAngle", "ControlSurfaceGroup_0" ) # Auto grouping puts each control surface in a group of its own, so the two # that were added make two groups, and each holds one surface. assert GetNumControlSurfaceGroups() == 2, "AutoGroupVSPAEROControlSurfaces did not make a group per surface" for i in range( 2 ): # Each wing is symmetric, so its control surface arrives as two copies # and both land in the group. assert len( GetActiveCSNameVec( i ) ) == 2, "group " + str( i ) + " does not hold its control surface copies" assert len( GetVSPAEROControlGroupName( i ) ) > 0, "group " + str( i ) + " was not named" # The Parms the grouping created have to be findable. assert len( deflection_gain_id ) > 0, "the control surface group Parms were not created" assert len( deflection_angle_id ) > 0, "the control surface group Parms were not created"
See also: CreateVSPAEROControlSurfaceGroup
- openvsp.AddCpSlice(cut_type, location)[source]¶
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.
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group num_group = GetNumControlSurfaceGroups() if num_group != 1 : print( "Error: CreateVSPAEROControlSurfaceGroup" ) assert False, "Error: CreateVSPAEROControlSurfaceGroup"
See also: AddSelectedToCSGroup :rtype: string :return: 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.
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group SetVSPAEROControlGroupName( "Doomed_Group", group_index ) AddAllToVSPAEROControlSurfaceGroup( group_index ) num_active = len( GetActiveCSNameVec( group_index ) ) DeleteVSPAEROControlSurfaceGroup( group_index ) assert GetNumControlSurfaceGroups() == 0, "DeleteVSPAEROControlSurfaceGroup did not remove the group" # The surfaces it held are available again in a fresh group. new_index = CreateVSPAEROControlSurfaceGroup() assert len( GetAvailableCSNameVec( new_index ) ) == num_active, "the deleted group did not release its control surfaces" # An index past the end has to be rejected. The error queue is reached # through the error manager singleton in Python. err_mgr = ErrorMgrSingleton.getInstance() DeleteVSPAEROControlSurfaceGroup( GetNumControlSurfaceGroups() ) assert err_mgr.GetNumTotalErrors() > 0, "DeleteVSPAEROControlSurfaceGroup accepted an index past the end" # That error was raised deliberately, so take it back off the queue. while err_mgr.GetNumTotalErrors() > 0 : err = err_mgr.PopLastError()
See also: CreateVSPAEROControlSurfaceGroup, GetNumControlSurfaceGroups :param [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.
# A fresh model already carries a default slice, so count from there. num_before = GetNumCpSlices() slice_id = AddCpSlice( X_DIR, 0.5 ) assert len( slice_id ) > 0, "AddCpSlice did not add a slice" assert GetNumCpSlices() == num_before + 1, "AddCpSlice did not add a slice" # The slice is its own Parm Container, so its cut can be read back. assert abs( GetParmVal( FindParm( slice_id, "CutPosition", "CpSlice" ) ) - 0.5 ) < 1e-9, "AddCpSlice did not place the cut" assert GetCpSliceID( num_before ) == slice_id, "GetCpSliceID does not agree with AddCpSlice"
See also: GetNumCpSlices, GetCpSliceID, DelCpSlice, DeleteAllCpSlices :param [in]: cut_type int Slice direction enum (X_DIR, Y_DIR or Z_DIR) :param [in]: location double Location of the cut along that axis :rtype: string :return: string Cp slice ID
- openvsp.GetNumCpSlices()[source]¶
Get the number of Cp slices in the VSPAERO Cp Slicer
num_before = GetNumCpSlices() AddCpSlice( X_DIR, 0.5 ) AddCpSlice( Y_DIR, 0.25 ) assert GetNumCpSlices() == num_before + 2, "GetNumCpSlices did not count both slices" # Every slice the count claims has to be findable. for i in range( GetNumCpSlices() ): assert len( GetCpSliceID( i ) ) > 0, "slice " + str( i ) + " cannot be found"
See also: AddCpSlice, GetCpSliceID, DelCpSlice, DeleteAllCpSlices :rtype: int :return: int Number of Cp slices
- openvsp.GetCpSliceID(slice_index)[source]¶
Get the ID of the Cp slice at the specified index
num_before = GetNumCpSlices() first = AddCpSlice( X_DIR, 0.5 ) second = AddCpSlice( Y_DIR, 0.25 ) # Slices come back in the order they were added. assert GetCpSliceID( num_before ) == first, "GetCpSliceID did not report the slices in order" assert GetCpSliceID( num_before + 1 ) == second, "GetCpSliceID did not report the slices in order" # An index past the end has to be rejected. The error queue is reached # through the error manager singleton in Python. err_mgr = ErrorMgrSingleton.getInstance() GetCpSliceID( GetNumCpSlices() ) assert err_mgr.GetNumTotalErrors() > 0, "GetCpSliceID accepted an index past the end" # That error was raised deliberately, so take it back off the queue. while err_mgr.GetNumTotalErrors() > 0 : err = err_mgr.PopLastError()
See also: AddCpSlice, GetNumCpSlices :param [in]: slice_index int Cp slice index :rtype: string :return: string Cp slice ID
- openvsp.GetCpSliceIDVec()[source]¶
Get the IDs of the Cp slices, in the order of their indexes.
DeleteAllCpSlices() slice_id = AddCpSlice( X_DIR, 0.5 ) assert list( GetCpSliceIDVec() ) == [ slice_id ], "GetCpSliceIDVec did not return the slice"
See also: GetCpSliceID :rtype: std::vector< std::string,std::allocator< std::string > > :return: array<string> Array of Cp slice IDs
- openvsp.DelCpSlice(slice_index)[source]¶
Delete a single Cp slice from the VSPAERO Cp Slicer
DeleteAllCpSlices() first = AddCpSlice( X_DIR, 0.5 ) second = AddCpSlice( Y_DIR, 0.25 ) DelCpSlice( 0 ) # Only the indexed slice goes, and the rest slide down. assert GetNumCpSlices() == 1, "DelCpSlice removed the wrong slice" assert GetCpSliceID( 0 ) == second, "DelCpSlice removed the wrong slice" # An index past the end has to be rejected. The error queue is reached # through the error manager singleton in Python. err_mgr = ErrorMgrSingleton.getInstance() DelCpSlice( GetNumCpSlices() ) assert err_mgr.GetNumTotalErrors() > 0, "DelCpSlice accepted an index past the end" # That error was raised deliberately, so take it back off the queue. while err_mgr.GetNumTotalErrors() > 0 : err = err_mgr.PopLastError()
See also: AddCpSlice, DeleteAllCpSlices, DelCpSliceByID :param [in]: slice_index int Cp slice index
- openvsp.DelCpSliceByID(slice_id)[source]¶
Delete a Cp slice, by slice ID.
slice_id = AddCpSlice( X_DIR, 0.5 ) DelCpSliceByID( slice_id ) assert slice_id not in GetCpSliceIDVec(), "DelCpSliceByID did not delete the slice"
See also: AddCpSlice, DeleteAllCpSlices, DelCpSlice :param [in]: slice_id string Cp slice ID
- openvsp.DeleteAllCpSlices()[source]¶
Delete all Cp slices from the VSPAERO Cp Slicer
AddCpSlice( X_DIR, 0.5 ) AddCpSlice( Y_DIR, 0.25 ) DeleteAllCpSlices() assert GetNumCpSlices() == 0, "DeleteAllCpSlices left slices behind" # Clearing an empty slicer is not an error. err_mgr = ErrorMgrSingleton.getInstance() DeleteAllCpSlices() assert err_mgr.GetNumTotalErrors() == 0, "DeleteAllCpSlices complained about an empty slicer"
See also: AddCpSlice, DelCpSlice, GetNumCpSlices
- openvsp.DeleteVSPAEROControlSurfaceGroup(CSGroupIndex)[source]¶
Delete one VSPAERO control surface group, by index.
wid = AddGeom( "WING" ) Update() CreateVSPAEROControlSurfaceGroup() DeleteVSPAEROControlSurfaceGroup( 0 ) assert GetNumControlSurfaceGroups() == 0, "DeleteVSPAEROControlSurfaceGroup did not delete the group"
See also: CreateVSPAEROControlSurfaceGroup, DeleteVSPAEROControlSurfaceGroupByID :param [in]: CSGroupIndex int Index of the control surface group to delete
- openvsp.DeleteVSPAEROControlSurfaceGroupByID(group_id)[source]¶
Delete a VSPAERO control surface group, by group ID.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() DeleteVSPAEROControlSurfaceGroupByID( group_id ) assert group_id not in GetControlSurfaceGroupIDVec(), "DeleteVSPAEROControlSurfaceGroupByID did not delete the group"
See also: CreateVSPAEROControlSurfaceGroup, DeleteVSPAEROControlSurfaceGroup :param [in]: group_id string Control surface group ID
- openvsp.CreateVSPAEROControlSurfaceGroup()[source]¶
Add a VSPAERO control surface group.
wid = AddGeom( "WING" ) Update() group_index = CreateVSPAEROControlSurfaceGroup() assert GetNumControlSurfaceGroups() == 1, "CreateVSPAEROControlSurfaceGroup did not add the group"
See also: DeleteVSPAEROControlSurfaceGroup, GetNumControlSurfaceGroups, AddVSPAEROControlSurfaceGroup :rtype: int :return: int Index of the new control surface group
- openvsp.AddVSPAEROControlSurfaceGroup()[source]¶
Add an empty VSPAERO control surface group and return its ID.
group_id = AddVSPAEROControlSurfaceGroup() assert group_id in GetControlSurfaceGroupIDVec(), "AddVSPAEROControlSurfaceGroup did not add the group"
See also: CreateVSPAEROControlSurfaceGroup, DeleteVSPAEROControlSurfaceGroup :rtype: string :return: string Control surface group ID
- openvsp.AddAllToVSPAEROControlSurfaceGroup(CSGroupIndex)[source]¶
Add all available control surfaces to the control surface group at the specified index
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group # The group starts empty and the wing offers one control surface, mirrored # by the wing's own symmetry. assert GetNumControlSurfaceGroups() >= 1, "CreateVSPAEROControlSurfaceGroup did not add a group" num_avail = len( GetAvailableCSNameVec( group_index ) ) assert num_avail >= 1, "no control surfaces are available to add" assert len( GetActiveCSNameVec( group_index ) ) == 0, "a new control surface group is not empty" AddAllToVSPAEROControlSurfaceGroup( group_index ) # Everything that was available is now active, and nothing is left over. assert len( GetActiveCSNameVec( group_index ) ) == num_avail, "AddAllToVSPAEROControlSurfaceGroup did not add them all" assert len( GetAvailableCSNameVec( group_index ) ) == 0, "control surfaces are still available after adding them all"
See also: AddAllToVSPAEROControlSurfaceGroupByID :param [in]: CSGroupIndex int Index of the control surface group
- openvsp.AddAllToVSPAEROControlSurfaceGroupByID(group_id)[source]¶
Add every available control surface to a group, by group ID.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddAllToVSPAEROControlSurfaceGroupByID( group_id ) assert len( GetAvailableCSNameVecByID( group_id ) ) == 0, "AddAllToVSPAEROControlSurfaceGroupByID left control surfaces available"
See also: RemoveAllFromVSPAEROControlSurfaceGroup, AddAllToVSPAEROControlSurfaceGroup :param [in]: group_id string Control surface group ID
- openvsp.RemoveAllFromVSPAEROControlSurfaceGroup(CSGroupIndex)[source]¶
Remove all used control surfaces from the control surface group at the specified index
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group AddAllToVSPAEROControlSurfaceGroup( group_index ) num_active = len( GetActiveCSNameVec( group_index ) ) assert num_active >= 1, "nothing was added to the group to remove" RemoveAllFromVSPAEROControlSurfaceGroup( group_index ) # Empty control surface group # Everything that was active goes back to being available. assert len( GetActiveCSNameVec( group_index ) ) == 0, "RemoveAllFromVSPAEROControlSurfaceGroup left surfaces in the group" assert len( GetAvailableCSNameVec( group_index ) ) == num_active, "the removed surfaces did not become available again"
See also: RemoveAllFromVSPAEROControlSurfaceGroupByID :param [in]: CSGroupIndex int Index of the control surface group
- openvsp.RemoveAllFromVSPAEROControlSurfaceGroupByID(group_id)[source]¶
Remove every control surface from a group, by group ID.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddAllToVSPAEROControlSurfaceGroupByID( group_id ) RemoveAllFromVSPAEROControlSurfaceGroupByID( group_id ) assert len( GetActiveCSNameVecByID( group_id ) ) == 0, "RemoveAllFromVSPAEROControlSurfaceGroupByID left control surfaces in the group"
See also: AddAllToVSPAEROControlSurfaceGroup, RemoveAllFromVSPAEROControlSurfaceGroup :param [in]: group_id string Control surface group ID
- openvsp.GetActiveCSNameVec(CSGroupIndex)[source]¶
Get the names of each active (used) control surface in the control surface group at the specified index
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group AddAllToVSPAEROControlSurfaceGroup( group_index ) cs_name_vec = GetActiveCSNameVec( group_index ) assert len( cs_name_vec ) > 0, "GetActiveCSNameVec returned nothing" print( "Active CS in Group Index #", False ) print( group_index ) for i in range(int( len(cs_name_vec) )): print( cs_name_vec[i] )
See also: GetActiveCSNameVecByID :param [in]: CSGroupIndex int Index of the control surface group :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector <string> Array of active control surface names
- openvsp.GetActiveCSNameVecByID(group_id)[source]¶
Get the names of the control surfaces in a group, by group ID.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddSubSurfToCSGroup( group_id, ss_id, 0 ) assert len( GetActiveCSNameVecByID( group_id ) ) == 1, "GetActiveCSNameVecByID did not return the control surface"
See also: GetActiveCSSubSurfIDVec, GetActiveCSNameVec :param [in]: group_id string Control surface group ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: array<string> Array of control surface names
- openvsp.GetActiveCSSubSurfIDVec(group_id)[source]¶
Get the subsurface IDs of the control surfaces in a group. A control surface is a subsurface and the index of one of its symmetric reflections; GetActiveCSReflectVec gives the reflections.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddSubSurfToCSGroup( group_id, ss_id, 1 ) assert list( GetActiveCSSubSurfIDVec( group_id ) ) == [ ss_id ], "GetActiveCSSubSurfIDVec did not return the subsurface"
See also: GetActiveCSReflectVec, GetActiveCSNameVec :param [in]: group_id string Control surface group ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: array<string> Array of subsurface IDs
- openvsp.GetActiveCSReflectVec(group_id)[source]¶
Get the reflection indexes of the control surfaces in a group, in the order of GetActiveCSSubSurfIDVec.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddSubSurfToCSGroup( group_id, ss_id, 1 ) assert list( GetActiveCSReflectVec( group_id ) ) == [ 1 ], "GetActiveCSReflectVec did not return the reflection"
See also: GetActiveCSSubSurfIDVec :param [in]: group_id string Control surface group ID :rtype: std::vector< int,std::allocator< int > > :return: array<int> Array of reflection indexes
- openvsp.GetCompleteCSNameVec()[source]¶
Get the names of all control surfaces. Some may be active (used) while others may be available.
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group cs_name_vec = GetCompleteCSNameVec() assert len( cs_name_vec ) > 0, "GetCompleteCSNameVec returned nothing" print( "All Control Surfaces: ", False ) for i in range(int( len(cs_name_vec) )): print( cs_name_vec[i] )
- Return type:
std::vector< std::string,std::allocator< std::string > >
- Returns:
vector <string> Array of all control surface names
- openvsp.GetCompleteCSSubSurfIDVec()[source]¶
Get the subsurface IDs of every control surface, grouped or not, in the order of GetCompleteCSNameVec.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() # A symmetric wing holds the control surface twice, once on each side. assert list( GetCompleteCSSubSurfIDVec() ) == [ ss_id, ss_id ], "GetCompleteCSSubSurfIDVec did not return both reflections"
See also: GetCompleteCSReflectVec, GetCompleteCSNameVec :rtype: std::vector< std::string,std::allocator< std::string > > :return: array<string> Array of subsurface IDs
- openvsp.GetCompleteCSReflectVec()[source]¶
Get the reflection indexes of every control surface, in the order of GetCompleteCSSubSurfIDVec.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() assert list( GetCompleteCSReflectVec() ) == [ 0, 1 ], "GetCompleteCSReflectVec did not return both reflections"
See also: GetCompleteCSSubSurfIDVec :rtype: std::vector< int,std::allocator< int > > :return: array<int> Array of reflection indexes
- openvsp.GetAvailableCSNameVec(CSGroupIndex)[source]¶
Get the names of each available (not used) control surface in the control surface group at the specified index
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group cs_name_vec = GetAvailableCSNameVec( group_index ) assert len( cs_name_vec ) > 0, "GetAvailableCSNameVec returned nothing" cs_ind_vec = [1] AddSelectedToCSGroup( cs_ind_vec, group_index ) # Add the first available control surface to the group # One surface moved from available to active. active_vec = GetActiveCSNameVec( group_index ) assert len( active_vec ) == 1, "AddSelectedToCSGroup did not add the surface that was named" assert active_vec[0] == cs_name_vec[0], "AddSelectedToCSGroup added the wrong surface" assert len( GetAvailableCSNameVec( group_index ) ) == len( cs_name_vec ) - 1, "the added surface is still available"
See also: GetAvailableCSNameVecByID :param [in]: CSGroupIndex int Index of the control surface group :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector <string> Array of active control surface names
- openvsp.GetAvailableCSNameVecByID(group_id)[source]¶
Get the names of the control surfaces not in a group, by group ID.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddSubSurfToCSGroup( group_id, ss_id, 0 ) assert len( GetAvailableCSNameVecByID( group_id ) ) == 1, "GetAvailableCSNameVecByID did not return the other reflection"
See also: GetAvailableCSSubSurfIDVec, GetAvailableCSNameVec :param [in]: group_id string Control surface group ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: array<string> Array of control surface names
- openvsp.GetAvailableCSSubSurfIDVec(group_id)[source]¶
Get the subsurface IDs of the control surfaces not in a group, in the order of GetAvailableCSNameVec.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddSubSurfToCSGroup( group_id, ss_id, 0 ) assert list( GetAvailableCSSubSurfIDVec( group_id ) ) == [ ss_id ], "GetAvailableCSSubSurfIDVec did not return the other reflection"
See also: GetAvailableCSReflectVec :param [in]: group_id string Control surface group ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: array<string> Array of subsurface IDs
- openvsp.GetAvailableCSReflectVec(group_id)[source]¶
Get the reflection indexes of the control surfaces not in a group, in the order of GetAvailableCSSubSurfIDVec.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddSubSurfToCSGroup( group_id, ss_id, 0 ) assert list( GetAvailableCSReflectVec( group_id ) ) == [ 1 ], "GetAvailableCSReflectVec did not return the other reflection"
See also: GetAvailableCSSubSurfIDVec :param [in]: group_id string Control surface group ID :rtype: std::vector< int,std::allocator< int > > :return: array<int> Array of reflection indexes
- openvsp.SetVSPAEROControlGroupName(name, CSGroupIndex)[source]¶
Set the name for the control surface group at the specified index
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group SetVSPAEROControlGroupName( "Example_CS_Group", group_index ) assert GetVSPAEROControlGroupName( group_index ) == "Example_CS_Group", "SetVSPAEROControlGroupName did not take" print( "CS Group name: ", False ) print( GetVSPAEROControlGroupName( group_index ) )
See also: SetVSPAEROControlGroupNameByID :param [in]: name string Name to set for the control surface group :param [in]: CSGroupIndex int Index of the control surface group
- openvsp.SetVSPAEROControlGroupNameByID(name, group_id)[source]¶
Set the name of a control surface group, by group ID.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() SetVSPAEROControlGroupNameByID( "Ailerons", group_id ) assert GetVSPAEROControlGroupNameByID( group_id ) == "Ailerons", "SetVSPAEROControlGroupNameByID did not name the group"
See also: GetVSPAEROControlGroupName, SetVSPAEROControlGroupName :param [in]: name string New name for the group :param [in]: group_id string Control surface group ID
- openvsp.GetVSPAEROControlGroupName(CSGroupIndex)[source]¶
Get the name of the control surface group at the specified index
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group SetVSPAEROControlGroupName( "Example_CS_Group", group_index ) assert GetVSPAEROControlGroupName( group_index ) == "Example_CS_Group", "SetVSPAEROControlGroupName did not take" print( "CS Group name: ", False ) print( GetVSPAEROControlGroupName( group_index ) )
See also: GetVSPAEROControlGroupNameByID :param [in]: CSGroupIndex int Index of the control surface group
- openvsp.GetVSPAEROControlGroupNameByID(group_id)[source]¶
Get the name of a control surface group, by group ID.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() SetVSPAEROControlGroupName( "Ailerons", 0 ) assert GetVSPAEROControlGroupNameByID( group_id ) == "Ailerons", "GetVSPAEROControlGroupNameByID did not return the name set"
See also: SetVSPAEROControlGroupName, GetVSPAEROControlGroupName :param [in]: group_id string Control surface group ID :rtype: string :return: string Group name
- openvsp.AddSelectedToCSGroup(selected, CSGroupIndex)[source]¶
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.
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group cs_name_vec = GetAvailableCSNameVec( group_index ) cs_ind_vec = [0] * len(cs_name_vec) for i in range(int( len(cs_name_vec) )): cs_ind_vec[i] = i + 1 AddSelectedToCSGroup( cs_ind_vec, group_index ) # Add all available control surfaces to the group # Everything that was named moved from available to active. assert len( GetActiveCSNameVec( group_index ) ) == len( cs_name_vec ), "AddSelectedToCSGroup did not add them all" assert len( GetAvailableCSNameVec( group_index ) ) == 0, "control surfaces are still available after adding them all"
See also: GetAvailableCSNameVec :param [in]: selected vector <int> Array of control surface indexes to add to the group. Note, the integer values are one based. :param [in]: CSGroupIndex int Index of the control surface group
- openvsp.RemoveSelectedFromCSGroup(selected, CSGroupIndex)[source]¶
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.
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface group_index = CreateVSPAEROControlSurfaceGroup() # Empty control surface group cs_name_vec = GetAvailableCSNameVec( group_index ) cs_ind_vec = [0] * len(cs_name_vec) for i in range(int( len(cs_name_vec) )): cs_ind_vec[i] = i + 1 AddSelectedToCSGroup( cs_ind_vec, group_index ) # Add the available control surfaces to the group remove_cs_ind_vec = [1] num_active = len( GetActiveCSNameVec( group_index ) ) assert num_active == len( cs_name_vec ), "not everything was added to the group" RemoveSelectedFromCSGroup( remove_cs_ind_vec, group_index ) # Remove the first control surface # One surface moved back from active to available. assert len( GetActiveCSNameVec( group_index ) ) == num_active - 1, "RemoveSelectedFromCSGroup did not remove a surface" assert len( GetAvailableCSNameVec( group_index ) ) == 1, "the removed surface did not become available again"
See also: GetActiveCSNameVec :param [in]: selected vector <int> Array of control surface indexes to remove from the group. Note, the integer values are one based. :param [in]: CSGroupIndex int Index of the control surface group
- openvsp.AddSubSurfToCSGroup(group_id, ss_id, reflect_index)[source]¶
Add a control surface to a group, by its subsurface ID and the index of its symmetric reflection.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddSubSurfToCSGroup( group_id, ss_id, 0 ) assert list( GetActiveCSSubSurfIDVec( group_id ) ) == [ ss_id ], "AddSubSurfToCSGroup did not add the control surface"
See also: RemoveSubSurfFromCSGroup, GetAvailableCSSubSurfIDVec :param [in]: group_id string Control surface group ID :param [in]: ss_id string Control surface subsurface ID :param [in]: reflect_index int Index of the symmetric reflection of the subsurface
- openvsp.RemoveSubSurfFromCSGroup(group_id, ss_id, reflect_index)[source]¶
Remove a control surface from a group, by its subsurface ID and the index of its symmetric reflection.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() AddAllToVSPAEROControlSurfaceGroupByID( group_id ) RemoveSubSurfFromCSGroup( group_id, ss_id, 1 ) assert list( GetActiveCSReflectVec( group_id ) ) == [ 0 ], "RemoveSubSurfFromCSGroup did not remove the reflection"
See also: AddSubSurfToCSGroup, GetActiveCSSubSurfIDVec :param [in]: group_id string Control surface group ID :param [in]: ss_id string Control surface subsurface ID :param [in]: reflect_index int Index of the symmetric reflection of the subsurface
- openvsp.GetNumControlSurfaceGroups()[source]¶
Get the total number of control surface groups
wid = AddGeom( "WING", "" ) # Add Wing aileron_id = AddSubSurf( wid, SS_CONTROL ) # Add Control Surface Sub-Surface #==== Add Horizontal tail and set some parameters =====// horiz_id = AddGeom( "WING", "" ) SetGeomName( horiz_id, "Vert" ) SetParmValUpdate( horiz_id, "TotalArea", "WingGeom", 10.0 ) SetParmValUpdate( horiz_id, "X_Rel_Location", "XForm", 8.5 ) elevator_id = AddSubSurf( horiz_id, SS_CONTROL ) # Add Control Surface Sub-Surface AutoGroupVSPAEROControlSurfaces() num_group = GetNumControlSurfaceGroups() if num_group != 2 : print( "Error: GetNumControlSurfaceGroups" ) assert False, "Error: GetNumControlSurfaceGroups"
- Return type:
int
- Returns:
int Number of control surface groups
- openvsp.FindControlSurfaceGroup(group_index)[source]¶
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.
#==== A wing with a control surface on it ====# wid = AddGeom( "WING", "" ) subsurf_id = AddSubSurf( wid, SS_CONTROL, 0 ) Update() #==== Group it, the way the VSPAERO screen does ====# AutoGroupVSPAEROControlSurfaces() Update() assert GetNumControlSurfaceGroups() > 0, "no control surface group was made" group_id = FindControlSurfaceGroup( 0 ) assert len( group_id ) > 0, "FindControlSurfaceGroup found nothing" #==== And its deflection is a Parm like any other ====# SetParmVal( FindParm( group_id, "DeflectionAngle", "ControlSurfaceGroup" ), 7.0 ) Update() deflected = GetParmVal( group_id, "DeflectionAngle", "ControlSurfaceGroup" ) assert abs( deflected - 7.0 ) < 1e-6, "the group did not take the deflection it was given"
See also: GetNumControlSurfaceGroups, AutoGroupVSPAEROControlSurfaces :param [in]: group_index int Control surface group index :rtype: string :return: string Control surface group ID
- openvsp.GetControlSurfaceGroupIDVec()[source]¶
Get the IDs of the VSPAERO control surface groups, in the order of their indexes.
wid = AddGeom( "WING" ) ss_id = AddSubSurf( wid, SS_CONTROL ) Update() group_id = AddVSPAEROControlSurfaceGroup() ids = GetControlSurfaceGroupIDVec() assert len( ids ) == GetNumControlSurfaceGroups() and group_id in ids, "GetControlSurfaceGroupIDVec did not return the group"
See also: FindControlSurfaceGroup :rtype: std::vector< std::string,std::allocator< std::string > > :return: array<string> Array of control surface group IDs