def createFlapStructure(myFlap, maxX=0.4, innerHingeXsi=0.7, outerHingeXsi=0.7, appendInnerCruiseRoller=False, type='flap', innerX=0., outerX=0.): myUID = myFlap.get_uID() # Structure createShell(myFlap, myUID, type, thickness=0.001) createSpars(myFlap, myUID, type) createRibs(myFlap, myUID, type, thickness=0.001, nRibs=20) # Moveables createTracks(myFlap, type, myUID) createPath(myFlap, type, myUID, innerX, outerX, innerHingeXsi, outerHingeXsi) if appendInnerCruiseRoller: createCruiseRollers(myFlap, 'outerFlap', myUID + '_CR1')
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 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)