def createShell(parent, parentUID, typeOfSeg, thickness=0.003, pitch=0.14): ''' Used for generation of wing upper and lower shell within a componentSegment @param parent: ComponentSegment object, upper and lower shell-object will be added here @param thickness: thickness of the wing shell @param pitch: pitch of the stringers @param typeOfSeg: either advDoubleTrapezoid or trapezoid ''' if typeOfSeg != 'strut': myAlu2024 = materialDefinitionType(materialUID=stringUIDBaseType(isLink='True', valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_=str(thickness))) myAlu7075 = materialDefinitionType(materialUID=stringUIDBaseType(isLink='True', valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) mySkin2024 = wingSkinType(material=myAlu2024) mySkin7075 = wingSkinType(material=myAlu7075) myStringerUp = wingStringerType(stringerStructureUID=stringUIDBaseType(valueOf_='Stringer_WING_up'), angle=doubleBaseType(valueOf_='0.0'), pitch=doubleBaseType(valueOf_=str(pitch))) myStringerLow = wingStringerType(stringerStructureUID=stringUIDBaseType(valueOf_='Stringer_WING_low'), angle=doubleBaseType(valueOf_='0.0'), pitch=doubleBaseType(valueOf_=str(pitch))) myShell2024 = wingShellType(uID='', skin=mySkin2024, stringer=myStringerLow) myShell7075 = wingShellType(uID='', skin=mySkin7075, stringer=myStringerUp) parent.get_structure().set_upperShell(myShell7075) parent.get_structure().set_lowerShell(myShell2024) elif typeOfSeg == 'strut': myComp_Long = materialDefinitionType(compositeUID = stringUIDBaseType(isLink='True',valueOf_='Comp_Long'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\ thicknessScaling=doubleBaseType(valueOf_='0.001')) mySkinComp = wingSkinType(material=myComp_Long) myShellComp = wingShellType(uID='', skin=mySkinComp) parent.get_structure().set_upperShell(myShellComp) parent.get_structure().set_lowerShell(myShellComp)
def createHTP(CPACSObj, id, xRoot, zRoot, tcRoot, tcTip, cRoot, cTip, span, phiLE, dihedral, LoD=0, location=True): if LoD == WING_LOD.NONE: return # just for now cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']' # the next line is the one to use later on # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']' # get the wing object from given cpacs path myWing = getObjfromXpath(CPACSObj, cpacsPath) myWing.set_name(stringBaseType(valueOf_='htp')) strUID = createHeader(myWing, id) myWing.set_symmetry('x-z-plane') if location: myWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='fuselage')) createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot) else: myWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='vtp')) createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot) # call corresponding wing creation method if LoD == WING_LOD.SINGLE: createTrapezoidWing(myWing, id, tcTip, tcRoot, cTip, cRoot, span, phiLE, dihedral, 0., strUID) if not location: createWingWingAttachment(myWing.get_componentSegments().get_componentSegment()[0], strUID, targetUID='vtp_Cseg', typeOfSeg='ttail')
def cpacsExport(self, CPACSObj): ''' Export routine for the engine ''' cpacsPath = '/cpacs/vehicles/aircraft/model/engines/engine' myEngine = getObjfromXpath(CPACSObj, cpacsPath) myEngine.set_uID('engine') myEngine.set_symmetry('x-z-plane') myEngine.set_parentUID(stringUIDBaseType(valueOf_="enginePylon")) x = doubleBaseType(valueOf_=str(self.xEngine.getValue())) y = doubleBaseType(valueOf_=str(self.yEngine.getValue())) z = doubleBaseType(valueOf_=str(self.zEngine.getValue())) myTranslation = pointAbsRelType(refType="absGlobal", x=x, y=y, z=z) myTransformation = transformationType(translation=myTranslation) myEngine.set_transformation(myTransformation) # Mass Export Engine Pylon mass = doubleBaseType(valueOf_=str(self.mEngine.getValue())) massIX = doubleBaseType(valueOf_=str(self.massIX.getValue())) massIY = doubleBaseType(valueOf_=str(self.massIY.getValue())) massIZ = doubleBaseType(valueOf_=str(self.massIZ.getValue())) massInertia = massInertiaType(Jxx=massIX, Jyy=massIY, Jzz=massIZ) cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mPowerUnits' mEngines = getObjfromXpath(CPACSObj, cpacsPath) massDescription = genericMassType(uID='engine_mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="engine"), massInertia=massInertia) mEngines.set_massDescription(massDescription) #call overall export method super(engine, self).cpacsExport(CPACSObj)
def createSparSegment(parent, parentUID, targetUID='FS', material='aluminium7075', numOfPoints=3, typeOfSeg='other'): ''' Used for generation of sparSegment within sparSegments @param parent: sparSegments, sparSegment will be added here @param id: id of the spar either FS or RS @param material: uID of the material to be used @param numOfPoint: the number of SparPositions to position the spar ''' myUID = parentUID + '' + targetUID myName = stringBaseType(None, None, None, myUID) myDescr = stringBaseType(None, None, None, myUID) #=========================================================================== # Spar Position UIDS #=========================================================================== mySparPositionUIDs = sparPositionUIDsType(None, None, None, None) for i in range(numOfPoints): sparPositionUID = stringUIDBaseType(None, None, None, None, myUID + '_P' + str(i)) mySparPositionUIDs.add_sparPositionUID(sparPositionUID) #=========================================================================== # Spar Cross Section #=========================================================================== if typeOfSeg != 'strut': myMaterialUID = stringUIDBaseType(isLink='True', valueOf_=material) myThickness = doubleBaseType(valueOf_=str(0.003)) myMaterial = materialDefinitionType(materialUID=myMaterialUID, thickness=myThickness) elif typeOfSeg == 'strut': myMaterial = materialDefinitionType(compositeUID = stringUIDBaseType(isLink='True',valueOf_='Comp_Shear'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\ thicknessScaling=doubleBaseType(valueOf_='0.001')) myArea = doubleBaseType(None, None, None, str(0.0003)) myCap = capType(None, None, None, myArea, myMaterial) myRelPos = doubleBaseType(None, None, None, str(0.5)) myWeb = webType(None, None, None, myMaterial, myRelPos) myRotation = doubleBaseType(None, None, None, str(90.0)) mySparCrossSection = sparCrossSectionType(None, None, None, myCap, myCap, myWeb, None, None, myRotation) #=========================================================================== mySpar = sparSegmentType(None, None, None, myUID, myName, myDescr, mySparPositionUIDs, mySparCrossSection) parent.add_sparSegment(mySpar)
def createShell(parent, parentUID, typeOfSeg, thickness=0.003, pitch=0.14): ''' Used for generation of wing upper and lower shell within a componentSegment @param parent: ComponentSegment object, upper and lower shell-object will be added here @param thickness: thickness of the wing shell @param pitch: pitch of the stringers @param typeOfSeg: either advDoubleTrapezoid or trapezoid ''' if typeOfSeg != 'strut': myAlu2024 = materialDefinitionType( materialUID=stringUIDBaseType(isLink='True', valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_=str(thickness))) myAlu7075 = materialDefinitionType( materialUID=stringUIDBaseType(isLink='True', valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) mySkin2024 = wingSkinType(material=myAlu2024) mySkin7075 = wingSkinType(material=myAlu7075) myStringerUp = wingStringerType( stringerStructureUID=stringUIDBaseType( valueOf_='Stringer_WING_up'), angle=doubleBaseType(valueOf_='0.0'), pitch=doubleBaseType(valueOf_=str(pitch))) myStringerLow = wingStringerType( stringerStructureUID=stringUIDBaseType( valueOf_='Stringer_WING_low'), angle=doubleBaseType(valueOf_='0.0'), pitch=doubleBaseType(valueOf_=str(pitch))) myShell2024 = wingShellType(uID='', skin=mySkin2024, stringer=myStringerLow) myShell7075 = wingShellType(uID='', skin=mySkin7075, stringer=myStringerUp) parent.get_structure().set_upperShell(myShell7075) parent.get_structure().set_lowerShell(myShell2024) elif typeOfSeg == 'strut': myComp_Long = materialDefinitionType(compositeUID = stringUIDBaseType(isLink='True',valueOf_='Comp_Long'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\ thicknessScaling=doubleBaseType(valueOf_='0.001')) mySkinComp = wingSkinType(material=myComp_Long) myShellComp = wingShellType(uID='', skin=mySkinComp) parent.get_structure().set_upperShell(myShellComp) parent.get_structure().set_lowerShell(myShellComp)
def createWingFuselageAttachment(parent, parentUID, targetUID='fuselage', typeOfSeg='advDoubletrapezoid'): if typeOfSeg == 'advDoubletrapezoid': toFuselageUID = stringUIDBaseType(valueOf_=targetUID) rib1 = ribIdentificationType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'), ribNumber=integerBaseType(valueOf_=str(4))) wingFuselageAttachment = wingFuselageAttachmentType(rib1=rib1) if typeOfSeg =='strut': toFuselageUID = stringUIDBaseType(valueOf_=targetUID) rib1 = ribIdentificationType(ribDefinitionUID=stringUIDBaseType(valueOf_='strut_ribs'), ribNumber=integerBaseType(valueOf_=str(1))) wingFuselageAttachment = wingFuselageAttachmentType(rib1=rib1) wingFuselageAttachments = wingFuselageAttachmentsType(wingFuselageAttachment=[wingFuselageAttachment]) parent.set_wingFuselageAttachments(wingFuselageAttachments)
def createSpoiler(name, parentUID, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE): #=========================================================================== # Header #=========================================================================== log.debug('VAMPzero SPOILER: Creating Spoiler: %s' % (str(name))) log.debug('VAMPzero SPOILER: innerEtaLE: %s' % str(innerEtaLE)) log.debug('VAMPzero SPOILER: innerEtaTE: %s' % str(innerEtaTE)) log.debug('VAMPzero SPOILER: innerXsiLE: %s' % str(innerXsiLE)) log.debug('VAMPzero SPOILER: innerXsiTE: %s' % str(innerXsiTE)) log.debug('VAMPzero SPOILER: outerEtaLE: %s' % str(outerEtaLE)) log.debug('VAMPzero SPOILER: outerEtaTE: %s' % str(outerEtaTE)) log.debug('VAMPzero SPOILER: outerXsiLE: %s' % str(outerXsiLE)) log.debug('VAMPzero SPOILER: outerXsiTE: %s' % str(outerXsiTE)) myName = stringBaseType(None, None, None, name) myDescription = stringBaseType(None, None, None, 'spoiler from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, parentUID) myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.75))) innerBorder = controlSurfaceBorderSpoilerType(etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), etaTE=doubleBaseType(valueOf_=str(innerEtaTE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), xsiTE=doubleBaseType(valueOf_=str(innerXsiTE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderSpoilerType(etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), etaTE=doubleBaseType(valueOf_=str(outerEtaTE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), xsiTE=doubleBaseType(valueOf_=str(outerXsiTE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeSpoilerType(innerBorder=innerBorder, outerBorder=outerBorder) myStructure = wingComponentSegmentStructureType() mySpoiler = spoilerType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape, structure=myStructure) createSpoilerStructure(mySpoiler) return mySpoiler
def createRudder(parentVtpCPACS, parentVtpVAMPzero, myRudder): """ This is the main export method for the wings aileron """ cpacsPath = "/cpacs/vehicles/aircraft/model/wings/wing[" + parentVtpVAMPzero.id + "]" cpacsVtp = getObjfromXpath(parentVtpCPACS, cpacsPath) cpacsComponentSegment = cpacsVtp.get_componentSegments().get_componentSegment()[0] # =========================================================================== # Header # =========================================================================== myName = stringBaseType(None, None, None, "rudder") myDescription = stringBaseType(None, None, None, "rudder from VAMPzero") myParentUID = stringUIDBaseType(None, None, "True", None, "vtp_Cseg") # =========================================================================== # Outer Shape # With the rudder this is pretty simple as it is supposed to cover # the same span as the VTP # =========================================================================== # the inner border eta is determined from the rooYLocation of the Rudder and the vtp span vtpSpan = parentVtpVAMPzero.span.getValue() / 2.0 innerEtaLE = 0.0 outerEtaLE = 1.0 innerXsiLE = myRudder.cRoot.getValue() / parentVtpVAMPzero.cRoot.getValue() outerXsiLE = myRudder.cTip.getValue() / parentVtpVAMPzero.cTip.getValue() # start writing back myleadingEdgeShape = leadingEdgeShapeType( relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85)), ) innerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape, ) outerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape, ) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder) cpacsRudder = trailingEdgeDeviceType( uID="rudderUID", name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape ) createPath(cpacsRudder, "rudder") if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices(trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices().add_trailingEdgeDevice(cpacsRudder)
def createSparSegment(parent, parentUID, targetUID='FS', material='aluminium7075', numOfPoints=3, typeOfSeg='other'): ''' Used for generation of sparSegment within sparSegments @param parent: sparSegments, sparSegment will be added here @param id: id of the spar either FS or RS @param material: uID of the material to be used @param numOfPoint: the number of SparPositions to position the spar ''' myUID = parentUID + '' + targetUID myName = stringBaseType(valueOf_=myUID) myDescr = stringBaseType(valueOf_= myUID) #=========================================================================== # Spar Position UIDS #=========================================================================== mySparPositionUIDs = sparPositionUIDsType() for i in range(numOfPoints): sparPositionUID = stringUIDBaseType(valueOf_=myUID + '_P' + str(i)) mySparPositionUIDs.add_sparPositionUID(sparPositionUID) #=========================================================================== # Spar Cross Section #=========================================================================== if typeOfSeg != 'strut': myMaterialUID = stringUIDBaseType(isLink='True', valueOf_=material) myThickness = doubleBaseType(valueOf_=str(0.003)) myMaterial = materialDefinitionType(materialUID=myMaterialUID, thickness=myThickness) elif typeOfSeg =='strut': #myMaterial = materialDefinitionType(compositeUID = stringUIDBaseType(isLink='True',valueOf_='Comp_Shear'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\ # thicknessScaling=doubleBaseType(valueOf_='0.001')) myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(isLink='True', valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(0.03))) myArea = doubleBaseType(valueOf_=str(0.0003)) myCap = capType(area=myArea, material=myMaterial) myRelPos = doubleBaseType(valueOf_=str(0.5)) myWeb = webType(material=myMaterial, relPos=myRelPos) myRotation = doubleBaseType(valueOf_= str(90.0)) mySparCrossSection = sparCrossSectionType(upperCap=myCap, lowerCap=myCap, web1=myWeb, rotation=myRotation) #=========================================================================== mySpar = sparSegmentType(uID=myUID, name=myName, description=myDescr, sparPositionUIDs=mySparPositionUIDs, sparCrossSection=mySparCrossSection) parent.add_sparSegment(mySpar)
def createHTP(CPACSObj, id, xRoot, zRoot, tcRoot, tcTip, cRoot, cTip, span, phiLE, dihedral, LoD=0, location=True): if LoD == WING_LOD.NONE: return # just for now cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']' # the next line is the one to use later on # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']' # get the wing object from given cpacs path myWing = getObjfromXpath(CPACSObj, cpacsPath) myWing.set_name(stringBaseType(valueOf_='htp')) strUID = createHeader(myWing, id) myWing.set_symmetry('x-z-plane') if location: myWing.set_parentUID( stringUIDBaseType(isLink=True, valueOf_='fuselage')) createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot) else: myWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='vtp')) createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot) # call corresponding wing creation method if LoD == WING_LOD.SINGLE: createTrapezoidWing(myWing, id, tcTip, tcRoot, cTip, cRoot, span, phiLE, dihedral, 0., strUID) if not location: createWingWingAttachment( myWing.get_componentSegments().get_componentSegment()[0], strUID, targetUID='vtp_Cseg', typeOfSeg='ttail')
def createStabilizer(parentHtpCPACS, parentHtpVAMPzero, myElevator): ''' This is the main export method for the stabilizer, i.e. the whole htp as control surface ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentHtpVAMPzero.id + ']' cpacsHtp = getObjfromXpath(parentHtpCPACS, cpacsPath) cpacsComponentSegment = cpacsHtp.get_componentSegments( ).get_componentSegment()[0] #=========================================================================== # Header #=========================================================================== myName = stringBaseType(None, None, None, 'stabilizer') myDescription = stringBaseType(None, None, None, 'stabilizer exported from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, parentHtpVAMPzero.id) #=========================================================================== # Outer Shape #=========================================================================== innerEtaLE = 0. innerXsiLE = 0. outerEtaLE = 1. outerXsiLE = 0. # start writing back #myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE))) outerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE))) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType( innerBorder=innerBorder, outerBorder=outerBorder) cpacsStabilizer = trailingEdgeDeviceType(uID='stabilizerUID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape) createPath(cpacsStabilizer, 'stabilizer') if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces(). get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices( trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices( ).add_trailingEdgeDevice(cpacsStabilizer)
def createFlap(name, parentUID, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=False, type='flap', innerX=0., outerX=0.): log.debug('VAMPzero FLAP: Creating Flap: %s' % (str(name))) log.debug('VAMPzero FLAP: innerEtaLE: %s' % str(innerEtaLE)) log.debug('VAMPzero FLAP: outerEtaLE: %s' % str(outerEtaLE)) log.debug('VAMPzero FLAP: innerXsiLE: %s' % str(innerXsiLE)) log.debug('VAMPzero FLAP: outerXsiLE: %s' % str(outerXsiLE)) myName = stringBaseType(None, None, None, name) myDescription = stringBaseType(None, None, None, 'innerFlap from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, parentUID) myleadingEdgeShape = leadingEdgeShapeType( relHeightLE=doubleBaseType(valueOf_=str(0.2)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.5)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.95))) innerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), etaTE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), etaTE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType( innerBorder=innerBorder, outerBorder=outerBorder) myStructure = wingComponentSegmentStructureType() myFlap = trailingEdgeDeviceType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape, structure=myStructure) createFlapStructure(myFlap, maxX, innerXsiLE, outerXsiLE, appendInnerCruiseRoller, type=type, innerX=innerX, outerX=outerX) return myFlap
def createWingFuselageAttachment(parent, parentUID, targetUID='fuselage', typeOfSeg='advDoubletrapezoid'): if typeOfSeg == 'advDoubletrapezoid': toFuselageUID = stringUIDBaseType(valueOf_=targetUID) rib1 = ribIdentificationType( ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'), ribNumber=integerBaseType(valueOf_=str(4))) wingFuselageAttachment = wingFuselageAttachmentType(rib1=rib1) if typeOfSeg == 'strut': toFuselageUID = stringUIDBaseType(valueOf_=targetUID) rib1 = ribIdentificationType( ribDefinitionUID=stringUIDBaseType(valueOf_='strut_ribs'), ribNumber=integerBaseType(valueOf_=str(1))) wingFuselageAttachment = wingFuselageAttachmentType(rib1=rib1) wingFuselageAttachments = wingFuselageAttachmentsType( wingFuselageAttachment=[wingFuselageAttachment]) parent.set_wingFuselageAttachments(wingFuselageAttachments)
def cpacsExport(self, CPACSObj): ''' Export routine for the pylon ''' # pylon cpacsPath = '/cpacs/vehicles/aircraft/model/enginePylons/enginePylon' myPylon = getObjfromXpath(CPACSObj, cpacsPath) myPylon.set_uID('enginePylon') if self.aircraft.engine.location.getValue(): myPylon.set_parentUID(stringUIDBaseType(valueOf_="wing")) else: myPylon.set_parentUID(stringUIDBaseType(valueOf_="fuselage")) # Mass Export Engine Pylon mass = doubleBaseType(valueOf_=str(self.mPylon.getValue())) cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mPylons' mPylons = getObjfromXpath(CPACSObj, cpacsPath) massDescription = genericMassType(uID='pylon_mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="enginePylon")) mPylons.set_massDescription(massDescription) #call overall export method super(pylon, self).cpacsExport(CPACSObj)
def cpacsExport(self, CPACSObj): ''' Export routine for the main and nose landing gear ''' # Main Gear Export cpacsPath = '/cpacs/vehicles/aircraft/model/landingGear/mainGears/mainGear' myMainGear = getObjfromXpath(CPACSObj, cpacsPath) myMainGear.set_parentUID(stringUIDBaseType(valueOf_="fuselage")) myMainGear.set_uID('mainGear') myMainGear.set_symmetry('x-z-plane') # Mass Export Main Landing Gear mass = doubleBaseType(valueOf_=str(self.mLandingGear.getValue())) cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mLandingGears' myLandingGears = getObjfromXpath(CPACSObj, cpacsPath) massDescription = genericMassType(uID='mainGear_Mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="mainGear")) myRightMainGear = mLandingGearType(massDescription=massDescription) myLandingGears.add_mLandingGear(myRightMainGear) # Nose Gear Export cpacsPath = '/cpacs/vehicles/aircraft/model/landingGear/noseGears/noseGear' myNoseGear = getObjfromXpath(CPACSObj, cpacsPath) myNoseGear.set_parentUID(stringUIDBaseType(valueOf_="fuselage")) myNoseGear.set_uID('noseGear') # Mass Export Nose Landing Gear mass = doubleBaseType(valueOf_=str(self.mNoseGear.getValue())) cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mLandingGears' myLandingGears = getObjfromXpath(CPACSObj, cpacsPath) massDescription = genericMassType(uID='noseGear_mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="noseGear")) myRightMainGear = mLandingGearType(massDescription=massDescription) myLandingGears.add_mLandingGear(myRightMainGear) #call overall export method super(landingGear, self).cpacsExport(CPACSObj)
def createStabilizer(parentHtpCPACS, parentHtpVAMPzero, myElevator): """ This is the main export method for the stabilizer, i.e. the whole htp as control surface """ cpacsPath = "/cpacs/vehicles/aircraft/model/wings/wing[" + parentHtpVAMPzero.id + "]" cpacsHtp = getObjfromXpath(parentHtpCPACS, cpacsPath) cpacsComponentSegment = cpacsHtp.get_componentSegments().get_componentSegment()[0] # =========================================================================== # Header # =========================================================================== myName = stringBaseType(None, None, None, "stabilizer") myDescription = stringBaseType(None, None, None, "stabilizer exported from VAMPzero") myParentUID = stringUIDBaseType(None, None, "True", None, parentHtpVAMPzero.id) # =========================================================================== # Outer Shape # =========================================================================== innerEtaLE = 0.0 innerXsiLE = 0.0 outerEtaLE = 1.0 outerXsiLE = 0.0 # start writing back # myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)) ) outerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)) ) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder) cpacsStabilizer = trailingEdgeDeviceType( uID="stabilizerUID", name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape ) createPath(cpacsStabilizer, "stabilizer") if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices(trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices().add_trailingEdgeDevice(cpacsStabilizer)
def createSpoiler(name, parentUID, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE): #=========================================================================== # Header #=========================================================================== log.debug('VAMPzero SPOILER: Creating Spoiler: %s' % (str(name))) log.debug('VAMPzero SPOILER: innerEtaLE: %s' % str(innerEtaLE)) log.debug('VAMPzero SPOILER: innerEtaTE: %s' % str(innerEtaTE)) log.debug('VAMPzero SPOILER: innerXsiLE: %s' % str(innerXsiLE)) log.debug('VAMPzero SPOILER: innerXsiTE: %s' % str(innerXsiTE)) log.debug('VAMPzero SPOILER: outerEtaLE: %s' % str(outerEtaLE)) log.debug('VAMPzero SPOILER: outerEtaTE: %s' % str(outerEtaTE)) log.debug('VAMPzero SPOILER: outerXsiLE: %s' % str(outerXsiLE)) log.debug('VAMPzero SPOILER: outerXsiTE: %s' % str(outerXsiTE)) myName = stringBaseType(None, None, None, name) myDescription = stringBaseType(None, None, None, 'spoiler from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, parentUID) myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType( valueOf_=str(0.75))) innerBorder = controlSurfaceBorderSpoilerType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), etaTE=doubleBaseType(valueOf_=str(innerEtaTE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), xsiTE=doubleBaseType(valueOf_=str(innerXsiTE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderSpoilerType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), etaTE=doubleBaseType(valueOf_=str(outerEtaTE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), xsiTE=doubleBaseType(valueOf_=str(outerXsiTE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeSpoilerType(innerBorder=innerBorder, outerBorder=outerBorder) myStructure = wingComponentSegmentStructureType() mySpoiler = spoilerType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape, structure=myStructure) createSpoilerStructure(mySpoiler) return mySpoiler
def createVTP(CPACSObj, id, xRoot, zRoot, tcRoot, tcTip, cRoot, cTip, span, phiLE, LoD=0): if LoD == WING_LOD.NONE: return # just for now cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']' # the next line is the one to use later on # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']' # get the wing object from given cpacs path myWing = getObjfromXpath(CPACSObj, cpacsPath) myWing.set_name(stringBaseType(valueOf_='vtp')) myWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='fuselage')) strUID = createHeader(myWing, id) # rotate vertical tail to correct orientation createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot, 1., 1., 1., 90., 0., 0.) # As the vtp is not symmetrical span values must be dubbled for conversion span = span * 2 # call corresponding wing creation method if LoD == WING_LOD.SINGLE: createTrapezoidWing(myWing, id, tcRoot, tcTip, cTip, cRoot, span, phiLE, dihedral=0, twist=0., strUID=strUID)
def createFlap(name, parentUID, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=False, type='flap', innerX=0., outerX=0.): log.debug('VAMPzero FLAP: Creating Flap: %s' % (str(name))) log.debug('VAMPzero FLAP: innerEtaLE: %s' % str(innerEtaLE)) log.debug('VAMPzero FLAP: outerEtaLE: %s' % str(outerEtaLE)) log.debug('VAMPzero FLAP: innerXsiLE: %s' % str(innerXsiLE)) log.debug('VAMPzero FLAP: outerXsiLE: %s' % str(outerXsiLE)) myName = stringBaseType(None, None, None, name) myDescription = stringBaseType(None, None, None, 'innerFlap from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, parentUID) myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.2)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.5)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.95))) innerBorder = controlSurfaceBorderTrailingEdgeType(etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), etaTE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderTrailingEdgeType(etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), etaTE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder) myStructure = wingComponentSegmentStructureType() myFlap = trailingEdgeDeviceType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape, structure=myStructure) createFlapStructure(myFlap, maxX, innerXsiLE, outerXsiLE, appendInnerCruiseRoller, type=type, innerX=innerX, outerX=outerX) return myFlap
def setUIDs(self): ################################################################################################### ##Set UIDS ################################################################################################### CPACSObj = cpacsLib.parse(self.cpacsOut) #UID for aircraft model cpacsPath = '/cpacs/vehicles/aircraft/model' myCPACSAircraft = exportLib.getObjfromXpath(CPACSObj,cpacsPath) myCPACSAircraft.set_uID(self.aircraft.modelUID.getValue()) #UID for engine cpacsPath = '/cpacs/vehicles/aircraft/model/engines/engine' myCPACSEngine = exportLib.getObjfromXpath(CPACSObj,cpacsPath) myCPACSEngine.set_uID('model_engine') myCPACSEngine.set_engineUID(cpacsLib.stringUIDBaseType(valueOf_='engine')) myCPACSEngine.set_symmetry('x-z-plane') #save and close outfile = open(self.cpacsOut,'w') CPACSObj.export(outfile,0) outfile.close()
def createSlat(name, parentUID, innerEtaTE, innerXsiTE, outerEtaTE, outerXsiTE, innerX, outerX): # Header log.debug('VAMPzero SLAT: Creating Slat: %s' % (str(name))) log.debug('VAMPzero SLAT: innerEtaTE: %s' % str(innerEtaTE)) log.debug('VAMPzero SLAT: outerEtaTE: %s' % str(outerEtaTE)) log.debug('VAMPzero SLAT: innerXsiTE: %s' % str(innerXsiTE)) log.debug('VAMPzero SLAT: outerXsiTE: %s' % str(outerXsiTE)) myName = stringBaseType(valueOf_=name) myDescription = stringBaseType(valueOf_='slat from VAMPzero') myParentUID = stringUIDBaseType(isLink='True', valueOf_=parentUID) myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderLeadingEdgeType(etaLE=doubleBaseType(valueOf_=str(innerEtaTE)), xsiTEUpper=doubleBaseType(valueOf_=str(innerXsiTE)), xsiTELower=doubleBaseType(valueOf_=str(0.02)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderLeadingEdgeType(etaLE=doubleBaseType(valueOf_=str(outerEtaTE)), xsiTEUpper=doubleBaseType(valueOf_=str(outerXsiTE)), xsiTELower=doubleBaseType(valueOf_=str(0.02)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeLeadingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder) mySlat = leadingEdgeDeviceType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape) createPath(mySlat, typeOfSeg = "slat", uID=name + 'UID', innerX=innerX, outerX=outerX, innerHingeXsi = 0.5, outerHingeXsi = 0.5) return mySlat
def createActuator(uID='act', actuatorUID='Aileron_Act', etaControlSurface=0.3, parentXsi=0.7, parentHeight=0.1, controlSurfaceXsi=0.7, controlSurfaceHeight=0.1): #=============================================================================== # Create the attachment #=============================================================================== etaControlSurface = doubleBaseType(valueOf_=str(etaControlSurface)) material = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001')) parentXsi = doubleBaseType(valueOf_=str(parentXsi)) parentHeight = doubleBaseType(valueOf_=str(parentHeight)) parentAttachment = actuatorParentAttachmentType(parentXsi=parentXsi, parentHeight=parentHeight, material=material) parentXsi = doubleBaseType(valueOf_=str(controlSurfaceXsi)) parentHeight = doubleBaseType(valueOf_=str(controlSurfaceHeight)) controlSurfaceAttachment = actuatorControlSurfaceAttachmentType(parentXsi=parentXsi, parentHeight=parentHeight, material=material) attachment = actuatorAttachmentType(etaControlSurface=etaControlSurface, parentAttachment=parentAttachment, controlSurfaceAttachment=controlSurfaceAttachment) #=========================================================================== # Create the actuator #=========================================================================== return controlSurfaceActuatorType(uID=uID, actuatorUID=stringUIDBaseType(isLink='True', valueOf_=actuatorUID), attachment=attachment)
def createTrackFlap(uID, eta, trackType, trackSubType=None, actuatorcounter=1): eta = doubleBaseType(valueOf_=str(eta)) trackType = stringBaseType(valueOf_=trackType) if trackSubType is not None: trackSubType = stringBaseType(valueOf_=trackSubType) global nFlapActuators trackActuator = trackActuatorType(uID=uID + '_actuatorUID', actuatorUID=stringUIDBaseType(isLink='true', valueOf_='Act_FT'+str(nFlapActuators)), material=materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))) nFlapActuators += 1 controlSurfaceAttachment = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001')) #parentAttachment = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001')) sidePanels = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001')) upperPanel = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001')) lowerPanel = materialDefinitionType(materialUID=stringBaseType(valueOf_='titan'), thickness=doubleBaseType(valueOf_='0.001')) rollerTrack = materialDefinitionType(materialUID=stringBaseType(valueOf_='titan'), thickness=doubleBaseType(valueOf_='0.001')) ribs = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001')) car = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001')) trackStructure = trackStructureType(controlSurfaceAttachment=controlSurfaceAttachment, sidePanels=sidePanels, upperPanel=upperPanel, lowerPanel=lowerPanel, rollerTrack=rollerTrack, ribs=ribs, car=car) if trackSubType is None: return controlSurfaceTrackTypeType(uID=uID, eta=eta, trackType=trackType, trackStructure=trackStructure, actuator=trackActuator) else: return controlSurfaceTrackTypeType(uID=uID, eta=eta, trackType=trackType, trackSubType=trackSubType, trackStructure=trackStructure, actuator=trackActuator)
def createSlat(name, parentUID, innerEtaTE, innerXsiTE, outerEtaTE, outerXsiTE, innerX, outerX): #=========================================================================== # Header #=========================================================================== log.debug('VAMPzero SLAT: Creating Slat: %s' % (str(name))) log.debug('VAMPzero SLAT: innerEtaTE: %s' % str(innerEtaTE)) log.debug('VAMPzero SLAT: outerEtaTE: %s' % str(outerEtaTE)) log.debug('VAMPzero SLAT: innerXsiTE: %s' % str(innerXsiTE)) log.debug('VAMPzero SLAT: outerXsiTE: %s' % str(outerXsiTE)) myName = stringBaseType(None, None, None, name) myDescription = stringBaseType(None, None, None, 'slat from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, parentUID) myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderLeadingEdgeType(etaLE=doubleBaseType(valueOf_=str(innerEtaTE)), xsiTEUpper=doubleBaseType(valueOf_=str(innerXsiTE)), xsiTELower=doubleBaseType(valueOf_=str(0.02)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderLeadingEdgeType(etaLE=doubleBaseType(valueOf_=str(outerEtaTE)), xsiTEUpper=doubleBaseType(valueOf_=str(outerXsiTE)), xsiTELower=doubleBaseType(valueOf_=str(0.02)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeLeadingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder) mySlat = leadingEdgeDeviceType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape) createPath(mySlat, typeOfSeg = "slat", uID=name + 'UID', innerX=innerX, outerX=outerX, innerHingeXsi = 0.5, outerHingeXsi = 0.5) return mySlat
def createTanks(parent, parentUID, targetUID='tank1', typeOfSeg='advDoubletrapezoid', nRib='2'): ''' Used for generation of a wing tank @param parent: ComponentSegment object, wing fuel tank will be added here. @param typeOfSeg: either advDoubleTrapezoid or trapezoid @param iRib: index of Rib in wing_ribs ribDefinition ''' tanks = [] #=========================================================================== # Tanks #=========================================================================== if typeOfSeg == 'advDoubletrapezoid': # Innermost myUID = parentUID + '_tank_inner' myName = stringBaseType(None, None, None, myUID) front = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_FS')) outer = wingFuelTankBorderType( ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'), ribNumber=integerBaseType(valueOf_=str(4))) rear = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(None, None, None, [front, outer, rear]) tanks.append( wingFuelTankType(None, None, None, myUID, myName, None, myGeometry, None)) # root to tw myUID = parentUID + '_tank_middle' myName = stringBaseType(None, None, None, myUID) inner = outer front = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_FS')) outer = wingFuelTankBorderType( ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_engine2'), ribNumber=integerBaseType(valueOf_=str(1))) rear = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(None, None, None, [inner, front, outer, rear]) tanks.append( wingFuelTankType(None, None, None, myUID, myName, None, myGeometry, None)) # tw to outer myUID = parentUID + '_tank_outer' myName = stringBaseType(None, None, None, myUID) inner = outer front = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_FS')) outer = wingFuelTankBorderType( ribDefinitionUID=stringUIDBaseType(valueOf_=parentUID + '_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(nRib))) rear = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(None, None, None, [inner, front, outer, rear]) tanks.append( wingFuelTankType(None, None, None, myUID, myName, None, myGeometry, None)) if typeOfSeg == "strutBracedWing": # Innermost myUID = parentUID + '_tank_inner' myName = stringBaseType(None, None, None, myUID) front = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_FS')) outer = wingFuelTankBorderType( ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'), ribNumber=integerBaseType(valueOf_=str(4))) rear = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(None, None, None, [front, outer, rear]) tanks.append( wingFuelTankType(None, None, None, myUID, myName, None, myGeometry, None)) # root to strut myUID = parentUID + '_tank_middle' myName = stringBaseType(None, None, None, myUID) inner = outer front = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_FS')) outer = wingFuelTankBorderType( ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(1))) rear = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(None, None, None, [inner, front, outer, rear]) tanks.append( wingFuelTankType(None, None, None, myUID, myName, None, myGeometry, None)) # strut to outer myUID = parentUID + '_tank_outer' myName = stringBaseType(None, None, None, myUID) inner = outer front = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_FS')) outer = wingFuelTankBorderType( ribDefinitionUID=stringUIDBaseType(valueOf_=parentUID + '_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(nRib))) rear = wingFuelTankBorderType( None, None, None, stringUIDBaseType(None, None, 'True', None, parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(None, None, None, [inner, front, outer, rear]) tanks.append( wingFuelTankType(None, None, None, myUID, myName, None, myGeometry, None)) myTanks = wingFuelTanksType(None, None, None, tanks) parent.set_wingFuelTanks(myTanks)
def createRudder(parentVtpCPACS, parentVtpVAMPzero, myRudder): ''' This is the main export method for the wings aileron ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentVtpVAMPzero.id + ']' cpacsVtp = getObjfromXpath(parentVtpCPACS, cpacsPath) cpacsComponentSegment = cpacsVtp.get_componentSegments( ).get_componentSegment()[0] #=========================================================================== # Header #=========================================================================== myName = stringBaseType(None, None, None, 'rudder') myDescription = stringBaseType(None, None, None, 'rudder from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, 'vtp_Cseg') #=========================================================================== # Outer Shape # With the rudder this is pretty simple as it is supposed to cover # the same span as the VTP #=========================================================================== # the inner border eta is determined from the rooYLocation of the Rudder and the vtp span vtpSpan = parentVtpVAMPzero.span.getValue() / 2. innerEtaLE = 0. outerEtaLE = 1. innerXsiLE = myRudder.cRoot.getValue() / parentVtpVAMPzero.cRoot.getValue() outerXsiLE = myRudder.cTip.getValue() / parentVtpVAMPzero.cTip.getValue() # start writing back myleadingEdgeShape = leadingEdgeShapeType( relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType( innerBorder=innerBorder, outerBorder=outerBorder) cpacsRudder = trailingEdgeDeviceType(uID='rudderUID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape) createPath(cpacsRudder, 'rudder') if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces(). get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices( trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices( ).add_trailingEdgeDevice(cpacsRudder)
def createAileron(parentWingCPACS, parentWingVAMPzero, myAileron): ''' This is the main export method for the wings aileron ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentWingVAMPzero.id + ']' cpacsWing = getObjfromXpath(parentWingCPACS, cpacsPath) cpacsComponentSegment = cpacsWing.get_componentSegments().get_componentSegment()[0] # Header myName = stringBaseType(None, None, None, 'aileron') myDescription = stringBaseType(None, None, None, 'aileron from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, 'wing_Cseg') # Initialization, i.e. fetching values throughout the code xsis = [] etas = [] for i in range(3,7): try: xsis.append(eval(cpacsComponentSegment.get_structure().get_spars().get_sparPositions().get_sparPosition()[i].get_xsi().valueOf_)) etas.append(eval(cpacsComponentSegment.get_structure().get_spars().get_sparPositions().get_sparPosition()[i].get_eta().valueOf_)) except IndexError: pass xsiSpar_interp = scipy.interpolate.interp1d(etas, xsis) sparOffset = 0.1 wingSpan = parentWingVAMPzero.span.getValue() / 2. # Outer Shape # The outer border eta station is set to 96 percent outerEtaLE = 0.96 # The outer chord station is determined from the wing's chord at eta = 0.96 # and the rear spar location + the spar offset outerXsiLE = xsiSpar_interp(0.96) + sparOffset outerWingChord = calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) cTip = (1 - outerXsiLE) * outerWingChord # now we need to determine the necessary span for the aileron by gently increasing the span # this is an iterative process as the chord of the aileron is a function of the inbound span aileronArea = parentWingVAMPzero.aileron.refArea.getValue() delta = 0.01 calcArea = 0. while abs(calcArea - aileronArea) > 0.1: if delta > outerEtaLE: parentWingVAMPzero.log.warning('VAMPzero EXPORT: Cannot determine the span of the aileron') parentWingVAMPzero.log.warning('VAMPzero EXPORT: aileronArea= '+str(aileronArea)) parentWingVAMPzero.log.warning('VAMPzero EXPORT: Decreasing Spar Offset') sparOffset = sparOffset - 0.02 delta = 0.01 innerEtaLE = outerEtaLE - delta innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset innerWingChord = calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) cRoot = (1 - innerXsiLE) * innerWingChord calcArea = (cTip + cRoot) / 2 * (outerEtaLE - innerEtaLE) * wingSpan delta += 0.005 # start outer shape myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderTrailingEdgeType(etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), etaTE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderTrailingEdgeType(etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), etaTE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder) # structure myStructure = wingComponentSegmentStructureType() cpacsAileron = trailingEdgeDeviceType(uID='aileronUID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape, structure=myStructure) createAileronStructure(cpacsAileron) # Forward information about innerEtaLE to the flap parentWingVAMPzero.flap.maxEta = parameter(value=innerEtaLE, doc='This it the inner position of the aileron, the flap may not exceed it') # moveables deltaEta = outerEtaLE - innerEtaLE innerParentXsi = xsiSpar_interp(innerEtaLE + 0.3 * deltaEta) + 0.02 outerParentXsi = xsiSpar_interp(innerEtaLE + 0.7 * deltaEta) + 0.02 createPath(cpacsAileron, 'aileron') createTracks(cpacsAileron, 'aileron') createActuators(cpacsAileron, 'aileron', [innerParentXsi, outerParentXsi]) if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices(trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices().add_trailingEdgeDevice(cpacsAileron)
def createWing(CPACSObj=None, zeroWing=None, id="1", LoD=0.): """ This function triggers the different export modes of the wing depending on the desired level of detail. Options include a single trapezoid, double trapezoid, advanced double trapezoid (that includes a rectangular center fuselage section) and a strut-braced wing. Please note, these are the internal guts of VAMPzero's CPACS export. A lot of the code here is experimental and furthermore highly chaotic. In case of emergency contact Daniel or Jonas. :param CPACSObj: The overall CPACS object of the export :param zeroWing: The instance of the wing. :param id: The id of the wing, mostly sth. like wing :param LoD: The level of detail of the desired input. :return: CPACSObj including a new wing """ if LoD == WING_LOD.NONE: return # just for now cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']' # the next line is the one to use later on # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']' # get the wing object from given cpacs path cpacsWing = getObjfromXpath(CPACSObj, cpacsPath) strUID = createHeader(cpacsWing, id) cpacsWing.set_symmetry('x-z-plane') cpacsWing.set_name(stringBaseType(valueOf_='wing')) cpacsWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='fuselage')) xRoot = zeroWing.xRoot.getValue() zRoot = zeroWing.zRoot.getValue() cRoot = zeroWing.cRoot.getValue() cTip = zeroWing.cTip.getValue() span = zeroWing.span.getValue() dfus = zeroWing.aircraft.fuselage.dfus.getValue() phiLE = zeroWing.phiLE.getValue() dihedral = zeroWing.dihedral.getValue() twist = zeroWing.twist.getValue() Sref = zeroWing.refArea.getValue() xMAC25 = zeroWing.xMAC25.getValue() tcRoot = zeroWing.airfoilr.tc.getValue() tcTip = zeroWing.airfoilt.tc.getValue() try: etakf = zeroWing.etaKink.getValue() yFus = zeroWing.yFuselage.getValue() etaEng = zeroWing.etaEngine.getValue() etaFus = yFus / span * 2. except AttributeError: pass #As not all components that call this method have a kink try: yRoot = zeroWing.yRoot.getValue() except AttributeError: pass #As not all components that call this method have a kink createTransformation(cpacsWing, 'absGlobal', xRoot, 0., zRoot) # call corresponding wing creation method if LoD == WING_LOD.SINGLE: createTrapezoidWing(cpacsWing, id, tcRoot, tcTip, cTip, cRoot, span, phiLE, dihedral, twist, strUID) elif LoD == WING_LOD.DOUBLE: createDoubleTrapezoidWing(cpacsWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, twist, xMAC25, etakf, strUID) elif LoD == WING_LOD.ADVDOUBLE: createAdvDoubleTrapezoidWing(cpacsWing, id, cTip, cRoot, span, Sref, dfus, phiLE, dihedral, twist, xMAC25, etakf, strUID, yFus, xRoot, etaEng, tcRoot, tcTip) elif LoD == WING_LOD.UCAV: createUCAVWing(cpacsWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, etakf, strUID) elif LoD == WING_LOD.SBW: print "dihedral", dihedral etaStrut = zeroWing.aircraft.strut.etaStrut.getValue() createStrutBracedWing(cpacsWing, id=id, cTip=cTip, cRoot=cRoot, span=span, Sref=Sref, phiLE=phiLE, dihedral=dihedral, twist=twist, xMAC25=xMAC25, etaFus=etaFus, etaStrut=etaStrut, tcRoot=tcRoot, tcTip=tcTip, xRoot=xRoot, strUID=strUID) elif LoD == WING_LOD.STRUT: etaStrut = zeroWing.aircraft.strut.etaStrut.getValue() createStrut(cpacsWing, id=id, cTip=cTip, cRoot=cRoot, span=span, phiLE=phiLE, dihedral=dihedral, tcRoot=tcRoot, tcTip=tcTip, xRoot=xRoot, yRoot=yRoot, twist=twist, etaStrut=etaStrut, strUID=strUID)
def createWingWingAttachment(parent, parentUID, targetUID='wing_Cseg', typeOfSeg='strut'): if typeOfSeg =='strut': toComponentSegmentUID = stringUIDBaseType(valueOf_=targetUID) fromElementUID = stringUIDBaseType(valueOf_='strut_Sec3_Elem1') toElementUID = stringUIDBaseType(valueOf_='wing_Sec3_Elem1') elements = wingWingAttachmentElementsType(fromElementUID=fromElementUID, toElementUID=toElementUID) fromSparUID = stringUIDBaseType(valueOf_='strut_Spar_FS') toSparUID = stringUIDBaseType(valueOf_='wing_Spar_FS') sparAttachment = wingWingAttachmentSparsType(fromSparUID=fromSparUID, toSparUID=toSparUID) sparAttachments = wingWingAttachmentsSparsType(sparAttachment=[sparAttachment]) upperShellAttachment= stringUIDBaseType(valueOf_='upperShell') lowerShellAttachment= stringUIDBaseType(valueOf_='lowerShell') wingWingAttachment = wingWingAttachmentType(toComponentSegmentUID=toComponentSegmentUID, elements=elements, sparAttachments=sparAttachments, upperShellAttachment=upperShellAttachment, lowerShellAttachment=lowerShellAttachment) elif typeOfSeg == 'ttail': toComponentSegmentUID = stringUIDBaseType(valueOf_=targetUID) fromElementUID = stringUIDBaseType(valueOf_='htp_Sec1_Elem1') toElementUID = stringUIDBaseType(valueOf_='vtp_Sec2_Elem1') elements = wingWingAttachmentElementsType(fromElementUID=fromElementUID, toElementUID=toElementUID) fromSparUID = stringUIDBaseType(valueOf_='htp_Spar_FS') toSparUID = stringUIDBaseType(valueOf_='vtp_Spar_FS') FS_sparAttachment = wingWingAttachmentSparsType(fromSparUID=fromSparUID, toSparUID=toSparUID) fromSparUID = stringUIDBaseType(valueOf_='htp_Spar_RS') toSparUID = stringUIDBaseType(valueOf_='vtp_Spar_RS') RS_sparAttachment = wingWingAttachmentSparsType(fromSparUID=fromSparUID, toSparUID=toSparUID) sparAttachments = wingWingAttachmentsSparsType(sparAttachment=[FS_sparAttachment, RS_sparAttachment]) upperShellAttachment= stringUIDBaseType(valueOf_='upperShell') lowerShellAttachment= stringUIDBaseType(valueOf_='lowerShell') wingWingAttachment = wingWingAttachmentType(toComponentSegmentUID=toComponentSegmentUID, elements=elements, sparAttachments=sparAttachments, upperShellAttachment=upperShellAttachment, lowerShellAttachment=lowerShellAttachment) wingWingAttachments = wingWingAttachmentsType(wingWingAttachment=[wingWingAttachment]) parent.set_wingWingAttachments(wingWingAttachments)
def createRibs(parent, parentUID, typeOfSeg, thickness=0.03, pitch=.8, nRibs=None, etaFus=0.2, etaEng=.3, span=17., fanDiameter=1.9, etaStrut=0.0, phi25 = 0.0): ''' Used for generation of a ribs definition in the wing @param parent: ComponentSegment object, ribsDefinition will be added here @param thickness: thickness of the ribs @param pitch: pitch of the ribs @param typeOfSeg: either advDoubleTrapezoid or trapezoid ''' myUID = parentUID + '_ribs' ribsList = [] #=============================================================================== # Advanced Double Trapezoid #=============================================================================== if typeOfSeg.lower() == 'advdoubletrapezoid': myName = stringBaseType(valueOf_='wing_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) myCrossSection = wingRibCrossSectionType(material=myMaterial) ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS') ribStart = stringBaseType(valueOf_=parentUID + '_Spar_FS') ribEnd = stringBaseType(valueOf_=parentUID + '_Spar_RS') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.'))) ribCrossing = ribCrossingBehaviourType(valueOf_='cross') #======================================================================= # First set of 4 ribs inside the fuselage #======================================================================= etaStart = doubleBaseType(valueOf_='0.0') etaEnd = doubleBaseType(valueOf_=str(etaFus)) innerRibs = doubleBaseType(valueOf_= 4) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=innerRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) myUID = parentUID + '_ribs_inner' ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================== # Second set outside of the fuselage up to the engine #=============================================================== etaPylon = 1. / 10. * fanDiameter / span etaStart = doubleBaseType(valueOf_=str(etaFus + pitch / span)) etaEnd = doubleBaseType(valueOf_=str(etaEng - etaPylon)) middleRibs = int(ceil((etaEng - etaPylon - etaFus) * span / pitch)) - 1 if middleRibs < 1: middleRibs = 1 middleRibs = doubleBaseType(valueOf_=middleRibs) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=middleRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) myUID = parentUID + '_ribs_engine1' ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================== # Third set one ribs outside of the pylon #=============================================================== etaEnd = doubleBaseType(valueOf_= str(etaEng + etaPylon)) pylonRibs = doubleBaseType(valueOf_= str(1)) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=pylonRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) myUID = parentUID + '_ribs_engine2' ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================== # Fourth set outside of the engine #=============================================================== etaStart = doubleBaseType(valueOf_= str(etaEng + etaPylon + pitch / span)) etaEnd = doubleBaseType(valueOf_= '0.95') ribCrossing = ribCrossingBehaviourType(valueOf_='end') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='wing_Spar_FS'), \ z=doubleBaseType(valueOf_='90.')) outerRibs = int(ceil((0.95 - etaEng + etaPylon) * span / pitch)) - 1 outerRibs = doubleBaseType(valueOf_= outerRibs) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=outerRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) myUID = parentUID + '_ribs_outer' ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================================== # Strut Braced Wing #=============================================================================== if typeOfSeg.lower() == 'strutbracedwing': myName = stringBaseType(valueOf_='wing_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) myCrossSection = wingRibCrossSectionType(material=myMaterial) ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS') ribStart = stringBaseType(valueOf_=parentUID + '_Spar_FS') ribEnd = stringBaseType(valueOf_=parentUID + '_Spar_RS') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.'))) ribCrossing = ribCrossingBehaviourType(valueOf_='cross') #======================================================================= # First set of 4 ribs inside the fuselage #======================================================================= etaStart = doubleBaseType(valueOf_='0.0') etaEnd = doubleBaseType(valueOf_=str(etaFus)) innerRibs = doubleBaseType(valueOf_=4) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=innerRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) myUID = parentUID + '_ribs_inner' ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================== # Second set outside of the fuselage up to the strut #=============================================================== etaStart = doubleBaseType(valueOf_=str(etaFus + pitch / span + phi25 * 0.0002)) etaEnd = doubleBaseType(valueOf_=str(etaStrut)) middleRibs = int(ceil((etaStrut - etaFus) * span / pitch)) - 1 middleRibs = doubleBaseType(valueOf_=middleRibs) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=middleRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) myUID = parentUID + '_ribs_strut' ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================== # Third set outside of the spar #=============================================================== etaStart = doubleBaseType(valueOf_=str(etaStrut + pitch / span)) etaEnd = doubleBaseType(valueOf_='0.95') ribCrossing = ribCrossingBehaviourType(valueOf_='end') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='wing_Spar_FS'), z=doubleBaseType(valueOf_=str('90.'))) outerRibs = int(ceil((0.95 - etaStrut) * span / pitch)) - 1 outerRibs = doubleBaseType(valueOf_=outerRibs) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=outerRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) myUID = parentUID + '_ribs_outer' ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================================== # Strut (And only the strut not the wing that goes along with it) #=============================================================================== if typeOfSeg.lower() == 'strut': myName = stringBaseType(valueOf_='strut_ribs') # Rib Cross Section #======================================================================= #myMaterial = materialDefinitionType(compositeUID=stringUIDBaseType(isLink='True',valueOf_='Comp_Shear'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\ # thicknessScaling=doubleBaseType(valueOf_='0.001')) myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) myCrossSection = wingRibCrossSectionType(material=myMaterial) ribReference = stringBaseType(valueOf_='leadingEdge') ribStart = stringBaseType(valueOf_='leadingEdge') ribEnd = stringBaseType(valueOf_='trailingEdge') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.'))) ribCrossing = ribCrossingBehaviourType(valueOf_='cross') etaStart = doubleBaseType(valueOf_=str(0.)) etaEnd = doubleBaseType(valueOf_=str(1.)) middleRibs = doubleBaseType(valueOf_=5.) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=middleRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) myUID = parentUID + '_ribs' ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================================== # Aileron #=============================================================================== if typeOfSeg.lower() == 'aileron': myName = stringBaseType(valueOf_='aileron_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) myCrossSection = wingRibCrossSectionType(material= myMaterial) # Rib Positioning #======================================================================= etaStart = doubleBaseType(valueOf_='0.') etaEnd = doubleBaseType(valueOf_='1.') ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS') ribStart = stringBaseType(valueOf_='leadingEdge') ribEnd = stringBaseType(valueOf_='trailingEdge') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.'))) ribCrossing = ribCrossingBehaviourType(valueOf_='cross') if nRibs is None: ribSpacing = doubleBaseType(valueOf_=pitch) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ spacing=ribSpacing, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) else: nRibs = doubleBaseType(valueOf_=nRibs) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=nRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) if typeOfSeg.lower() == 'trapezoid': myName = stringBaseType(valueOf_='trapezoid_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) myCrossSection = wingRibCrossSectionType(material= myMaterial) # Rib Positioning #======================================================================= etaStart = doubleBaseType(valueOf_='0.') etaEnd = doubleBaseType(valueOf_='1.') ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS') ribStart = stringBaseType(valueOf_='leadingEdge') ribEnd = stringBaseType(valueOf_='trailingEdge') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.'))) ribCrossing = ribCrossingBehaviourType(valueOf_='cross') middleRibs = doubleBaseType(valueOf_=5.) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=middleRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================================== # Flap #=============================================================================== if typeOfSeg.lower() == 'flap' or typeOfSeg.lower() == 'innerflap': myName = stringBaseType(valueOf_='flap_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) myCrossSection = wingRibCrossSectionType(material= myMaterial) # Rib Positioning #======================================================================= etaStart = doubleBaseType(valueOf_='0.') etaEnd = doubleBaseType(valueOf_='1.') ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS') ribStart = stringBaseType(valueOf_='leadingEdge') ribEnd = stringBaseType(valueOf_='trailingEdge') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.'))) ribCrossing = ribCrossingBehaviourType(valueOf_='cross') if nRibs is None: ribSpacing = doubleBaseType(valueOf_=pitch) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ spacing=ribSpacing, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) else: nRibs = doubleBaseType(valueOf_=nRibs) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=nRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #=============================================================================== # Spoiler #=============================================================================== if typeOfSeg.lower() == 'spoiler': myName = stringBaseType(valueOf_='spoiler_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness))) myCrossSection = wingRibCrossSectionType(material= myMaterial) # Rib Positioning #======================================================================= etaStart = doubleBaseType(valueOf_='0.') etaEnd = doubleBaseType(valueOf_='1.') ribReference = stringBaseType(valueOf_='leadingEdge') ribStart = stringBaseType(valueOf_='leadingEdge') ribEnd = stringBaseType(valueOf_='trailingEdge') ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.'))) ribCrossing = ribCrossingBehaviourType(valueOf_='cross') if nRibs is None: ribSpacing = doubleBaseType(valueOf_=pitch) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ spacing=ribSpacing, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) else: nRibs = doubleBaseType(valueOf_=nRibs) ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \ numberOfRibs=nRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation) ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection)) #======================================================================= # RibsDefinition #======================================================================= myRibsDefinitions = wingRibsDefinitionsType(None, None, None, ribsList) parent.get_structure().set_ribsDefinitions(myRibsDefinitions)
def createTanks(parent, parentUID, targetUID='tank1', typeOfSeg='advDoubletrapezoid', nRib='2'): ''' Used for generation of a wing tank @param parent: ComponentSegment object, wing fuel tank will be added here. @param typeOfSeg: either advDoubleTrapezoid or trapezoid @param iRib: index of Rib in wing_ribs ribDefinition ''' tanks = [] #=========================================================================== # Tanks #=========================================================================== if typeOfSeg == 'advDoubletrapezoid': # Innermost myUID = parentUID + '_tank_inner' myName = stringBaseType(valueOf_=myUID) front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS')) outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'), ribNumber=integerBaseType(valueOf_=str(4))) rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(border=[front, outer, rear]) tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry)) # root to tw myUID = parentUID + '_tank_middle' myName = stringBaseType(valueOf_=myUID) inner = outer front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS')) outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_engine2'), ribNumber=integerBaseType(valueOf_=str(1))) rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(border=[inner, front, outer, rear]) tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry)) # tw to outer myUID = parentUID + '_tank_outer' myName = stringBaseType(valueOf_=myUID) inner = outer front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS')) outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_=parentUID + '_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(nRib))) rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(border=[inner, front, outer, rear]) tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry)) if typeOfSeg == "strutBracedWing": # Innermost myUID = parentUID + '_tank_inner' myName = stringBaseType(valueOf_=myUID) front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS')) outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'), ribNumber=integerBaseType(valueOf_=str(4))) rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(border=[front, outer, rear]) tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry)) # root to strut myUID = parentUID + '_tank_middle' myName = stringBaseType(valueOf_=myUID) inner = outer front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS')) outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(1))) rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(border=[inner, front, outer, rear]) tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry)) # strut to outer myUID = parentUID + '_tank_outer' myName = stringBaseType(valueOf_=myUID) inner = outer front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS')) outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_=parentUID + '_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(nRib))) rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS')) myGeometry = wingFuelTankGeometryType(border=[inner, front, outer, rear]) tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry)) myTanks = wingFuelTanksType(wingFuelTank=tanks) parent.set_wingFuelTanks(myTanks)
def createElevator(parentHtpCPACS, parentHtpVAMPzero, myElevator): ''' This is the main export method for the htp elevator ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentHtpVAMPzero.id + ']' cpacsHtp = getObjfromXpath(parentHtpCPACS, cpacsPath) cpacsComponentSegment = cpacsHtp.get_componentSegments().get_componentSegment()[0] #=========================================================================== # Header #=========================================================================== myName = stringBaseType(None, None, None, 'elevator') myDescription = stringBaseType(None, None, None, 'elevator from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, parentHtpVAMPzero.id) #=========================================================================== # Outer Shape #=========================================================================== # the inner border eta is determined from the rooYLocation of the Elevator and the htp span htpSpan = parentHtpVAMPzero.span.getValue() / 2. innerEtaLE = myElevator.rootYLocation.getValue() / htpSpan # the inner border xsi is determined from the Root Chord and the Chord of the Htp at the location # the inner border xsi is determined from the Root Chord and the Chord of the Htp at the location cTipHtp = parentHtpVAMPzero.cTip.getValue() cRootHtp = parentHtpVAMPzero.cRoot.getValue() cInnerWing = cRootHtp - (cRootHtp - cTipHtp)*innerEtaLE innerXsiLE = 1 - (myElevator.cRoot.getValue() / cInnerWing) if innerXsiLE < 0.2: parentHtpVAMPzero.log.warning('VAMPzero EXPORT: The Elevator tap inner border is larger than the available chord') parentHtpVAMPzero.log.warning('VAMPzero EXPORT: The Elevator tap inner border is now set to 0.1') innerXsiLE = 0.2 # The outer border eta station is set to the inner eta plus the span of the elevator outerEtaLE = innerEtaLE + myElevator.span.getValue() / htpSpan # The outer border xsi is determined in the same way as the inner border xsi cOuterWing = cRootHtp - (cRootHtp - cTipHtp)*outerEtaLE outerXsiLE = 1 - (myElevator.cTip.getValue() / cOuterWing) if outerXsiLE < 0.2: parentHtpVAMPzero.log.warning('VAMPzero EXPORT: The Elevator tap outer border is larger than the available chord') parentHtpVAMPzero.log.warning('VAMPzero EXPORT: The Elevator tap outer border is now set to 0.1') outerXsiLE = 0.2 # start writing back myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderTrailingEdgeType(etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderTrailingEdgeType(etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder) cpacsElevator = trailingEdgeDeviceType(uID='elevatorUID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape) createPath(cpacsElevator, 'elevator') if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices(trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices().add_trailingEdgeDevice(cpacsElevator)
def createElevator(parentHtpCPACS, parentHtpVAMPzero, myElevator): """ This is the main export method for the htp elevator """ cpacsPath = "/cpacs/vehicles/aircraft/model/wings/wing[" + parentHtpVAMPzero.id + "]" cpacsHtp = getObjfromXpath(parentHtpCPACS, cpacsPath) cpacsComponentSegment = cpacsHtp.get_componentSegments().get_componentSegment()[0] # =========================================================================== # Header # =========================================================================== myName = stringBaseType(None, None, None, "elevator") myDescription = stringBaseType(None, None, None, "elevator from VAMPzero") myParentUID = stringUIDBaseType(None, None, "True", None, parentHtpVAMPzero.id) # =========================================================================== # Outer Shape # =========================================================================== # the inner border eta is determined from the rooYLocation of the Elevator and the htp span htpSpan = parentHtpVAMPzero.span.getValue() / 2.0 innerEtaLE = myElevator.rootYLocation.getValue() / htpSpan # the inner border xsi is determined from the Root Chord and the Chord of the Htp at the location phiLE = parentHtpVAMPzero.phiLE.getValue() phiTE = parentHtpVAMPzero.phiTE.getValue() x1 = tan(phiLE * rad) * htpSpan * innerEtaLE x2 = tan(phiTE * rad) * htpSpan * innerEtaLE cInnerWing = (x2 + parentHtpVAMPzero.cRoot.getValue()) - x1 innerXsiLE = 1 - (myElevator.cRoot.getValue() / cInnerWing) # The outer border eta station is set to the inner eta plus the span of the elevator outerEtaLE = innerEtaLE + myElevator.span.getValue() / htpSpan # The outer border xsi is determined in the same way as the inner border xsi x1 = tan(phiLE * rad) * htpSpan * outerEtaLE x2 = tan(phiTE * rad) * htpSpan * outerEtaLE cOuterWing = (x2 + parentHtpVAMPzero.cRoot.getValue()) - x1 outerXsiLE = 1 - (myElevator.cTip.getValue() / cOuterWing) # start writing back myleadingEdgeShape = leadingEdgeShapeType( relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85)), ) innerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape, ) outerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape, ) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder) cpacsElevator = trailingEdgeDeviceType( uID="elevatorUID", name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape ) createPath(cpacsElevator, "elevator") if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices(trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices().add_trailingEdgeDevice(cpacsElevator)
def createAileron(parentWingCPACS, parentWingVAMPzero, myAileron): ''' This is the main export method for the wings aileron ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentWingVAMPzero.id + ']' cpacsWing = getObjfromXpath(parentWingCPACS, cpacsPath) cpacsComponentSegment = cpacsWing.get_componentSegments( ).get_componentSegment()[0] #=========================================================================== # Header #=========================================================================== myName = stringBaseType(None, None, None, 'aileron') myDescription = stringBaseType(None, None, None, 'aileron from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, 'wing_Cseg') #=========================================================================== # Initialization, i.e. fetching values throughout the code #=========================================================================== xsiSparRoot = eval(cpacsComponentSegment.get_structure().get_spars( ).get_sparPositions().get_sparPosition()[3].get_xsi().valueOf_) xsiSparFuselage = eval(cpacsComponentSegment.get_structure().get_spars( ).get_sparPositions().get_sparPosition()[4].get_xsi().valueOf_) xsiSparKink = eval(cpacsComponentSegment.get_structure().get_spars( ).get_sparPositions().get_sparPosition()[5].get_xsi().valueOf_) xsiSparTip = eval(cpacsComponentSegment.get_structure().get_spars( ).get_sparPositions().get_sparPosition()[6].get_xsi().valueOf_) etaSparRoot = eval(cpacsComponentSegment.get_structure().get_spars( ).get_sparPositions().get_sparPosition()[3].get_eta().valueOf_) etaSparFuselage = eval(cpacsComponentSegment.get_structure().get_spars( ).get_sparPositions().get_sparPosition()[4].get_eta().valueOf_) etaSparKink = eval(cpacsComponentSegment.get_structure().get_spars( ).get_sparPositions().get_sparPosition()[5].get_eta().valueOf_) etaSparTip = eval(cpacsComponentSegment.get_structure().get_spars( ).get_sparPositions().get_sparPosition()[6].get_eta().valueOf_) xsiSpar_interp = scipy.interpolate.interp1d( [etaSparRoot, etaSparFuselage, etaSparKink, etaSparTip], [xsiSparRoot, xsiSparFuselage, xsiSparKink, xsiSparTip]) sparOffset = 0.1 wingSpan = parentWingVAMPzero.span.getValue() / 2. #=========================================================================== # Outer Shape #=========================================================================== # The outer border eta station is set to 96 percent outerEtaLE = 0.96 # The outer chord station is determined from the wing's chord at eta = 0.96 # and the rear spar location + the spar offset outerXsiLE = xsiSpar_interp(0.96) + sparOffset outerWingChord = calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) cTip = (1 - outerXsiLE) * outerWingChord # now we need to determine the necessary span for the aileron by gently increasing the span # this is an iterative process as the chord of the aileron is a function of the inbound span aileronArea = parentWingVAMPzero.aileron.refArea.getValue() delta = 0.01 calcArea = 0. while abs(calcArea - aileronArea) > 0.1: if delta > outerEtaLE: parentWingVAMPzero.log.warning( 'VAMPzero EXPORT: Cannot determine the span of the aileron') parentWingVAMPzero.log.warning('VAMPzero EXPORT: aileronArea= ' + str(aileronArea)) parentWingVAMPzero.log.warning( 'VAMPzero EXPORT: Decreasing Spar Offset') sparOffset = sparOffset - 0.02 delta = 0.01 innerEtaLE = outerEtaLE - delta innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset innerWingChord = calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) cRoot = (1 - innerXsiLE) * innerWingChord calcArea = (cTip + cRoot) / 2 * (outerEtaLE - innerEtaLE) * wingSpan delta += 0.005 # start outer shape myleadingEdgeShape = leadingEdgeShapeType( relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), etaTE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), etaTE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType( innerBorder=innerBorder, outerBorder=outerBorder) # structure myStructure = wingComponentSegmentStructureType() cpacsAileron = trailingEdgeDeviceType(uID='aileronUID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape, structure=myStructure) createAileronStructure(cpacsAileron) # Forward information about innerEtaLE to the flap parentWingVAMPzero.flap.maxEta = parameter( value=innerEtaLE, doc= 'This it the inner position of the aileron, the flap may not exceed it' ) # moveables deltaEta = outerEtaLE - innerEtaLE innerParentXsi = xsiSpar_interp(innerEtaLE + 0.3 * deltaEta) + 0.02 outerParentXsi = xsiSpar_interp(innerEtaLE + 0.7 * deltaEta) + 0.02 createPath(cpacsAileron, 'aileron') createTracks(cpacsAileron, 'aileron') createActuators(cpacsAileron, 'aileron', [innerParentXsi, outerParentXsi]) if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces(). get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices( trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices( ).add_trailingEdgeDevice(cpacsAileron)
def createWingWingAttachment(parent, parentUID, targetUID='wing_Cseg', typeOfSeg='strut'): if typeOfSeg == 'strut': toComponentSegmentUID = stringUIDBaseType(valueOf_=targetUID) fromElementUID = stringUIDBaseType(valueOf_='strut_Sec3_Elem1') toElementUID = stringUIDBaseType(valueOf_='wing_Sec3_Elem1') elements = wingWingAttachmentElementsType( fromElementUID=fromElementUID, toElementUID=toElementUID) fromSparUID = stringUIDBaseType(valueOf_='strut_Spar_FS') toSparUID = stringUIDBaseType(valueOf_='wing_Spar_FS') sparAttachment = wingWingAttachmentSparsType(fromSparUID=fromSparUID, toSparUID=toSparUID) sparAttachments = wingWingAttachmentsSparsType( sparAttachment=[sparAttachment]) upperShellAttachment = stringUIDBaseType(valueOf_='upperShell') lowerShellAttachment = stringUIDBaseType(valueOf_='lowerShell') wingWingAttachment = wingWingAttachmentType( toComponentSegmentUID=toComponentSegmentUID, elements=elements, sparAttachments=sparAttachments, upperShellAttachment=upperShellAttachment, lowerShellAttachment=lowerShellAttachment) elif typeOfSeg == 'ttail': toComponentSegmentUID = stringUIDBaseType(valueOf_=targetUID) fromElementUID = stringUIDBaseType(valueOf_='htp_Sec1_Elem1') toElementUID = stringUIDBaseType(valueOf_='vtp_Sec2_Elem1') elements = wingWingAttachmentElementsType( fromElementUID=fromElementUID, toElementUID=toElementUID) fromSparUID = stringUIDBaseType(valueOf_='htp_Spar_FS') toSparUID = stringUIDBaseType(valueOf_='vtp_Spar_FS') FS_sparAttachment = wingWingAttachmentSparsType( fromSparUID=fromSparUID, toSparUID=toSparUID) fromSparUID = stringUIDBaseType(valueOf_='htp_Spar_RS') toSparUID = stringUIDBaseType(valueOf_='vtp_Spar_RS') RS_sparAttachment = wingWingAttachmentSparsType( fromSparUID=fromSparUID, toSparUID=toSparUID) sparAttachments = wingWingAttachmentsSparsType( sparAttachment=[FS_sparAttachment, RS_sparAttachment]) upperShellAttachment = stringUIDBaseType(valueOf_='upperShell') lowerShellAttachment = stringUIDBaseType(valueOf_='lowerShell') wingWingAttachment = wingWingAttachmentType( toComponentSegmentUID=toComponentSegmentUID, elements=elements, sparAttachments=sparAttachments, upperShellAttachment=upperShellAttachment, lowerShellAttachment=lowerShellAttachment) wingWingAttachments = wingWingAttachmentsType( wingWingAttachment=[wingWingAttachment]) parent.set_wingWingAttachments(wingWingAttachments)
def createElevator(parentHtpCPACS, parentHtpVAMPzero, myElevator): ''' This is the main export method for the htp elevator ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentHtpVAMPzero.id + ']' cpacsHtp = getObjfromXpath(parentHtpCPACS, cpacsPath) cpacsComponentSegment = cpacsHtp.get_componentSegments( ).get_componentSegment()[0] #=========================================================================== # Header #=========================================================================== myName = stringBaseType(None, None, None, 'elevator') myDescription = stringBaseType(None, None, None, 'elevator from VAMPzero') myParentUID = stringUIDBaseType(None, None, 'True', None, parentHtpVAMPzero.id) #=========================================================================== # Outer Shape #=========================================================================== # the inner border eta is determined from the rooYLocation of the Elevator and the htp span htpSpan = parentHtpVAMPzero.span.getValue() / 2. innerEtaLE = myElevator.rootYLocation.getValue() / htpSpan # the inner border xsi is determined from the Root Chord and the Chord of the Htp at the location phiLE = parentHtpVAMPzero.phiLE.getValue() phiTE = parentHtpVAMPzero.phiTE.getValue() x1 = tan(phiLE * rad) * htpSpan * innerEtaLE x2 = tan(phiTE * rad) * htpSpan * innerEtaLE cInnerWing = (x2 + parentHtpVAMPzero.cRoot.getValue()) - x1 innerXsiLE = 1 - (myElevator.cRoot.getValue() / cInnerWing) # The outer border eta station is set to the inner eta plus the span of the elevator outerEtaLE = innerEtaLE + myElevator.span.getValue() / htpSpan # The outer border xsi is determined in the same way as the inner border xsi x1 = tan(phiLE * rad) * htpSpan * outerEtaLE x2 = tan(phiTE * rad) * htpSpan * outerEtaLE cOuterWing = (x2 + parentHtpVAMPzero.cRoot.getValue()) - x1 outerXsiLE = 1 - (myElevator.cTip.getValue() / cOuterWing) # start writing back myleadingEdgeShape = leadingEdgeShapeType( relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85))) innerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape) outerBorder = controlSurfaceBorderTrailingEdgeType( etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape) myOuterShape = controlSurfaceOuterShapeTrailingEdgeType( innerBorder=innerBorder, outerBorder=outerBorder) cpacsElevator = trailingEdgeDeviceType(uID='elevatorUID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape) createPath(cpacsElevator, 'elevator') if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces(). get_trailingEdgeDevices()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices( trailingEdgeDevicesType()) cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices( ).add_trailingEdgeDevice(cpacsElevator)
def createWing(CPACSObj = None, zeroWing = None, id="1", LoD = 0.): """ This function triggers the different export modes of the wing depending on the desired level of detail. Options include a single trapezoid, double trapezoid, advanced double trapezoid (that includes a rectangular center fuselage section) and a strut-braced wing. Please note, these are the internal guts of VAMPzero's CPACS export. A lot of the code here is experimental and furthermore highly chaotic. In case of emergency contact Daniel or Jonas. :param CPACSObj: The overall CPACS object of the export :param zeroWing: The instance of the wing. :param id: The id of the wing, mostly sth. like wing :param LoD: The level of detail of the desired input. :return: CPACSObj including a new wing """ if LoD == WING_LOD.NONE: return # just for now cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']' # the next line is the one to use later on # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']' # get the wing object from given cpacs path cpacsWing = getObjfromXpath(CPACSObj, cpacsPath) strUID = createHeader(cpacsWing, id) cpacsWing.set_symmetry('x-z-plane') cpacsWing.set_name(stringBaseType(valueOf_='wing')) cpacsWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='fuselage')) xRoot = zeroWing.xRoot.getValue() zRoot = zeroWing.zRoot.getValue() cRoot = zeroWing.cRoot.getValue() cTip = zeroWing.cTip.getValue() span = zeroWing.span.getValue() dfus = zeroWing.aircraft.fuselage.dfus.getValue() phiLE = zeroWing.phiLE.getValue() dihedral = zeroWing.dihedral.getValue() twist = zeroWing.twist.getValue() Sref = zeroWing.refArea.getValue() xMAC25 = zeroWing.xMAC25.getValue() tcRoot = zeroWing.airfoilr.tc.getValue() tcTip = zeroWing.airfoilt.tc.getValue() try: etakf = zeroWing.etaKink.getValue() yFus = zeroWing.yFuselage.getValue() etaEng = zeroWing.etaEngine.getValue() etaFus = yFus/span*2. except AttributeError: pass #As not all components that call this method have a kink try: yRoot = zeroWing.yRoot.getValue() except AttributeError: pass #As not all components that call this method have a kink createTransformation(cpacsWing, 'absGlobal', xRoot, 0., zRoot) # call corresponding wing creation method if LoD == WING_LOD.SINGLE: createTrapezoidWing(cpacsWing, id, tcRoot, tcTip, cTip, cRoot, span, phiLE, dihedral, twist, strUID) elif LoD == WING_LOD.DOUBLE: createDoubleTrapezoidWing(cpacsWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, twist, xMAC25, etakf, strUID) elif LoD == WING_LOD.ADVDOUBLE: createAdvDoubleTrapezoidWing(cpacsWing, id, cTip, cRoot, span, Sref, dfus, phiLE, dihedral, twist, xMAC25, etakf, strUID, yFus, xRoot, etaEng, tcRoot, tcTip) elif LoD == WING_LOD.UCAV: createUCAVWing(cpacsWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, etakf, strUID) elif LoD == WING_LOD.SBW: etaStrut = zeroWing.aircraft.strut.etaStrut.getValue() createStrutBracedWing(cpacsWing, id=id, cTip=cTip, cRoot=cRoot, span=span, Sref=Sref, phiLE=phiLE, dihedral=dihedral, twist=twist, xMAC25=xMAC25, etaFus=etaFus, etaStrut=etaStrut, tcRoot=tcRoot, tcTip=tcTip, xRoot=xRoot, strUID=strUID) elif LoD == WING_LOD.SBWStraight: etaStrut = zeroWing.aircraft.strut.etaStrut.getValue() createStraightStrutBracedWing(cpacsWing, id=id, cTip=cTip, cRoot=cRoot, span=span, Sref=Sref, phiLE=phiLE, dihedral=dihedral, twist=twist, xMAC25=xMAC25, etaFus=etaFus, etaStrut=etaStrut, tcRoot=tcRoot, tcTip=tcTip, xRoot=xRoot, strUID=strUID) elif LoD == WING_LOD.STRUT: etaStrut = zeroWing.aircraft.strut.etaStrut.getValue() createStrut(cpacsWing, id=id, cTip=cTip, cRoot=cRoot, span=span, phiLE=phiLE, dihedral=dihedral, tcRoot=tcRoot, tcTip=tcTip, xRoot=xRoot, yRoot=yRoot, twist=twist, etaStrut=etaStrut, strUID=strUID)
def createRibs(parent, parentUID, typeOfSeg, thickness=0.03, pitch=.8, nRibs=None, etaFus=0.2, etaEng=.3, span=17., fanDiameter=1.9, etaStrut=0.0, phi25=0.0): ''' Used for generation of a ribs definition in the wing @param parent: ComponentSegment object, ribsDefinition will be added here @param thickness: thickness of the ribs @param pitch: pitch of the ribs @param typeOfSeg: either advDoubleTrapezoid or trapezoid ''' myUID = parentUID + '_ribs' ribsList = [] #=============================================================================== # Advanced Double Trapezoid #=============================================================================== if typeOfSeg.lower() == 'advdoubletrapezoid': myName = stringBaseType(None, None, None, 'wing_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium7075'), \ doubleBaseType(None, None, None, str(thickness))) myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial, None) ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS') ribStart = stringBaseType(None, None, None, parentUID + '_Spar_FS') ribEnd = stringBaseType(None, None, None, parentUID + '_Spar_RS') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \ doubleBaseType(None, None, None, '90.')) ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross') #======================================================================= # First set of 4 ribs inside the fuselage #======================================================================= etaStart = doubleBaseType(None, None, None, '0.0') etaEnd = doubleBaseType(None, None, None, str(etaFus)) innerRibs = doubleBaseType(None, None, None, 4) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, innerRibs, ribCrossing, ribRotation) myUID = parentUID + '_ribs_inner' ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================== # Second set outside of the fuselage up to the engine #=============================================================== etaPylon = 1. / 10. * fanDiameter / span etaStart = doubleBaseType(None, None, None, str(etaFus + pitch / span)) etaEnd = doubleBaseType(None, None, None, str(etaEng - etaPylon)) middleRibs = int(ceil((etaEng - etaPylon - etaFus) * span / pitch)) - 1 if middleRibs < 1: middleRibs = 1 middleRibs = doubleBaseType(None, None, None, middleRibs) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, middleRibs, ribCrossing, ribRotation) myUID = parentUID + '_ribs_engine1' ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================== # Third set one ribs outside of the pylon #=============================================================== etaEnd = doubleBaseType(None, None, None, str(etaEng + etaPylon)) pylonRibs = doubleBaseType(None, None, None, str(1)) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaEnd, etaEnd, ribStart, ribEnd, \ None, pylonRibs, ribCrossing, ribRotation) myUID = parentUID + '_ribs_engine2' ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================== # Fourth set outside of the engine #=============================================================== etaStart = doubleBaseType(None, None, None, str(etaEng + etaPylon + pitch / span)) etaEnd = doubleBaseType(None, None, None, '0.95') ribCrossing = ribCrossingBehaviourType(None, None, None, 'end') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'wing_Spar_FS'), \ doubleBaseType(None, None, None, '90.')) outerRibs = int(ceil((0.95 - etaEng + etaPylon) * span / pitch)) - 1 outerRibs = doubleBaseType(None, None, None, outerRibs) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, outerRibs, ribCrossing, ribRotation) myUID = parentUID + '_ribs_outer' ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================================== # Strut Braced Wing #=============================================================================== if typeOfSeg.lower() == 'strutbracedwing': myName = stringBaseType(None, None, None, 'wing_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium7075'), \ doubleBaseType(None, None, None, str(thickness))) myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial, None) ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS') ribStart = stringBaseType(None, None, None, parentUID + '_Spar_FS') ribEnd = stringBaseType(None, None, None, parentUID + '_Spar_RS') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \ doubleBaseType(None, None, None, '90.')) ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross') #======================================================================= # First set of 4 ribs inside the fuselage #======================================================================= etaStart = doubleBaseType(None, None, None, '0.0') etaEnd = doubleBaseType(None, None, None, str(etaFus)) innerRibs = doubleBaseType(None, None, None, 4) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, innerRibs, ribCrossing, ribRotation) myUID = parentUID + '_ribs_inner' ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================== # Second set outside of the fuselage up to the strut #=============================================================== etaStart = doubleBaseType(None, None, None, str(etaFus + pitch / span + phi25 * 0.0002)) etaEnd = doubleBaseType(None, None, None, str(etaStrut)) middleRibs = int(ceil((etaStrut - etaFus) * span / pitch)) - 1 middleRibs = doubleBaseType(None, None, None, middleRibs) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, middleRibs, ribCrossing, ribRotation) myUID = parentUID + '_ribs_strut' ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================== # Third set outside of the spar #=============================================================== etaStart = doubleBaseType(None, None, None, str(etaStrut + pitch / span)) etaEnd = doubleBaseType(None, None, None, '0.95') ribCrossing = ribCrossingBehaviourType(None, None, None, 'end') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'wing_Spar_FS'), \ doubleBaseType(None, None, None, '90.')) outerRibs = int(ceil((0.95 - etaStrut) * span / pitch)) - 1 outerRibs = doubleBaseType(None, None, None, outerRibs) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, outerRibs, ribCrossing, ribRotation) myUID = parentUID + '_ribs_outer' ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================================== # Strut (And only the strut not the wing that goes along with it) #=============================================================================== if typeOfSeg.lower() == 'strut': myName = stringBaseType(None, None, None, 'strut_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(compositeUID=stringUIDBaseType(isLink='True',valueOf_='Comp_Shear'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\ thicknessScaling=doubleBaseType(valueOf_='0.001')) myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial, None) ribReference = stringBaseType(None, None, None, 'leadingEdge') ribStart = stringBaseType(None, None, None, 'leadingEdge') ribEnd = stringBaseType(None, None, None, 'trailingEdge') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \ doubleBaseType(None, None, None, '90.')) ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross') etaStart = doubleBaseType(None, None, None, str(0.001)) etaEnd = doubleBaseType(None, None, None, str(0.999)) #middleRibs = int(ceil(span / 0.70)) - 1 middleRibs = doubleBaseType(None, None, None, 5.) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, middleRibs, ribCrossing, ribRotation) myUID = parentUID + '_ribs' ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================================== # Aileron #=============================================================================== if typeOfSeg.lower() == 'aileron': myName = stringBaseType(None, None, None, 'aileron_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium2024'), \ doubleBaseType(None, None, None, str(thickness))) myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial, None) # Rib Positioning #======================================================================= etaStart = doubleBaseType(None, None, None, '0.') etaEnd = doubleBaseType(None, None, None, '1.') ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS') ribStart = stringBaseType(None, None, None, 'leadingEdge') ribEnd = stringBaseType(None, None, None, 'trailingEdge') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \ doubleBaseType(None, None, None, '90.')) ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross') if nRibs is None: ribSpacing = doubleBaseType(None, None, None, pitch) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ ribSpacing, None, ribCrossing, ribRotation) else: nRibs = doubleBaseType(None, None, None, nRibs) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, nRibs, ribCrossing, ribRotation) ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) if typeOfSeg.lower() == 'trapezoid': myName = stringBaseType(None, None, None, 'trapezoid_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium2024'), \ doubleBaseType(None, None, None, str(thickness))) myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial, None) # Rib Positioning #======================================================================= etaStart = doubleBaseType(None, None, None, '0.') etaEnd = doubleBaseType(None, None, None, '1.') ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS') ribStart = stringBaseType(None, None, None, 'leadingEdge') ribEnd = stringBaseType(None, None, None, 'trailingEdge') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \ doubleBaseType(None, None, None, '90.')) ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross') etaStart = doubleBaseType(None, None, None, str(0.0)) etaEnd = doubleBaseType(None, None, None, str(0.95)) middleRibs = doubleBaseType(None, None, None, 5.) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, middleRibs, ribCrossing, ribRotation) ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================================== # Flap #=============================================================================== if typeOfSeg.lower() == 'flap' or typeOfSeg.lower() == 'innerflap': myName = stringBaseType(None, None, None, 'flap_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium2024'), \ doubleBaseType(None, None, None, str(thickness))) myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial, None) # Rib Positioning #======================================================================= etaStart = doubleBaseType(None, None, None, '0.') etaEnd = doubleBaseType(None, None, None, '1.') ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS') ribStart = stringBaseType(None, None, None, 'leadingEdge') ribEnd = stringBaseType(None, None, None, 'trailingEdge') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \ doubleBaseType(None, None, None, '90.')) ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross') if nRibs is None: ribSpacing = doubleBaseType(None, None, None, pitch) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ ribSpacing, None, ribCrossing, ribRotation) else: nRibs = doubleBaseType(None, None, None, nRibs) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, nRibs, ribCrossing, ribRotation) ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #=============================================================================== # Spoiler #=============================================================================== if typeOfSeg.lower() == 'spoiler': myName = stringBaseType(None, None, None, 'spoiler_ribs') # Rib Cross Section #======================================================================= myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium2024'), \ doubleBaseType(None, None, None, str(thickness))) myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial, None) # Rib Positioning #======================================================================= etaStart = doubleBaseType(None, None, None, '0.') etaEnd = doubleBaseType(None, None, None, '1.') ribReference = stringBaseType(None, None, None, 'leadingEdge') ribStart = stringBaseType(None, None, None, 'leadingEdge') ribEnd = stringBaseType(None, None, None, 'trailingEdge') ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'leadingEdge'), \ doubleBaseType(None, None, None, '90.')) ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross') if nRibs is None: ribSpacing = doubleBaseType(None, None, None, pitch) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ ribSpacing, None, ribCrossing, ribRotation) else: nRibs = doubleBaseType(None, None, None, nRibs) ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \ None, nRibs, ribCrossing, ribRotation) ribsList.append( wingRibsDefinitionType(None, None, None, myUID, myName, None, ribsPositioning, myCrossSection)) #======================================================================= # RibsDefinition #======================================================================= myRibsDefinitions = wingRibsDefinitionsType(None, None, None, ribsList) parent.get_structure().set_ribsDefinitions(myRibsDefinitions)