def createSpoilers(parentWingCPACS, parentWingVAMPzero, mySpoiler): ''' This is the main export method for the wing's spoilers * It assumes a constant absolut chord for all spoilers * Spoiler start outboard and move inboard close behind the rearspar * They are rectangular ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentWingVAMPzero.id + ']' cpacsWing = getObjfromXpath(parentWingCPACS, cpacsPath) cpacsComponentSegment = cpacsWing.get_componentSegments( ).get_componentSegment()[0] mySpoilers = [] #=========================================================================== # Initialization, i.e. fetching values throughout the code #=========================================================================== span = parentWingVAMPzero.span.getValue() / 2. etaKink = parentWingVAMPzero.etaKink.getValue() yFus = parentWingVAMPzero.yFuselage.getValue() etaFus = yFus / span spoilerArea = mySpoiler.refArea.getValue() spoilerChord = mySpoiler.chord.getValue() spoilerOuterEta = mySpoiler.outerEta.getValue() sparOffset = 0.02 #=========================================================================== # Rear spar locations #=========================================================================== 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]) #=========================================================================== # Outer Spoilers #=========================================================================== outerSpan = (spoilerOuterEta - etaKink) * span outerArea = spoilerChord * outerSpan nOuterSpoiler = outerSpan**2 / (outerArea * 2.) log.debug( 'VAMPzero SPOILER: Exporting %s Spoiler outside of the kink for an area of %s m2.' % (str(nOuterSpoiler), str(outerArea))) #=========================================================================== # 1 Spoiler #=========================================================================== if nOuterSpoiler <= 1.: # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaKink: innerEtaTE = etaKink innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('OuterSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=========================================================================== # 2 Spoiler #=========================================================================== elif nOuterSpoiler > 1. and nOuterSpoiler <= 2.: # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = spoilerOuterEta - outerSpan / span / 2. # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('OuterSpoiler2', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaKink: innerEtaTE = etaKink innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('OuterSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=========================================================================== # n Spoiler #=========================================================================== elif nOuterSpoiler > 2.: n = int(ceil(nOuterSpoiler)) # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = outerEtaLE - outerSpan / span / n # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('OuterSpoiler' + str(n), parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) for i in range(2, n): # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = outerEtaLE - outerSpan / span / n # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('OuterSpoiler' + str(n - i + 1), parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaKink: innerEtaTE = etaKink innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('OuterSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=============================================================================== # Inner Spoilers #=============================================================================== deltaArea = spoilerArea - outerArea noExport = False if deltaArea <= 0.: log.warning( 'VAMPzero SPOILER: Outboard Spoiler area already exceeds the required spoiler area by: %s' % str(deltaArea)) noExport = True calcArea = 0. maxInnerArea = (etaKink - etaFus) * span * spoilerChord if maxInnerArea >= deltaArea and noExport == False: innerSpan = 0. while True: innerSpan += .01 oldArea = calcArea calcArea = innerSpan * spoilerChord # This is the break condition that should be hit normally if abs(deltaArea - calcArea) < 0.1: break if innerSpan > (etaKink - etaFus) * span: log.warning( 'VAMPzero SPOILER: The spoiler span of the inner spoiler exceeds the available span betweent fuselage and kink, continuing with calcArea = %s' % str(calcArea)) break if oldArea > calcArea: log.warning( 'VAMPzero SPOILER: Inner spoiler area apparently reached a maximum, continuing with calcArea = %s' % str(calcArea)) break elif noExport == False: log.warning( 'VAMPzero SPOILER: There is not sufficient space for the inner spoiler(s) between the kink and the fuselage!' ) spoilerChord = deltaArea / ((etaKink - etaFus) * span) innerSpan = (etaKink - etaFus) * span calcArea = deltaArea log.warning( 'VAMPzero SPOILER: The spoilerchord will be enlarged to %s!' % str(spoilerChord)) if noExport == True: nInnerSpoiler = 0 log.debug( 'VAMPzero SPOILER: Exporting %s Spoiler inside of the kink.' % (str(nInnerSpoiler))) else: nInnerSpoiler = innerSpan**2 / (calcArea * 3.) log.debug( 'VAMPzero SPOILER: Exporting %s Spoiler inside of the kink for an area of %s m2.' % (str(nInnerSpoiler), str(calcArea))) #=========================================================================== # 1 Spoiler #=========================================================================== if nInnerSpoiler == 0: pass elif nInnerSpoiler <= 1: # The outer eta of the leading Edge to the eta of the kink outerEtaLE = etaKink # The inner eta of the leading edge is the outer eta minus the span of the inner spoiler innerEtaLE = outerEtaLE - innerSpan / span # The outer Xsi at the leading Edge is defined by the sparLocation of the Kink outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset # The innner Xsi remains an absolute chord of the spoiler chordInnerSpoiler = (1 - outerXsiLE) * calcChordLengthAtEta( outerEtaLE, parentWingVAMPzero, cpacsWing) innerXsiLE = 1 - chordInnerSpoiler / calcChordLengthAtEta( innerEtaLE, parentWingVAMPzero, cpacsWing) # Eta Coordinates stay constant # Xsi Coordinates are shifted by spoilerChord outerEtaTE = outerEtaLE outerXsiTE = outerXsiLE + spoilerChord / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('InnerSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=========================================================================== # 2 Spoiler #=========================================================================== elif nInnerSpoiler > 1. and nInnerSpoiler <= 2.: # First inner spoiler # The outer eta of the leading Edge to the eta of the kink outerEtaLE = etaKink # The inner eta of the leading edge is the outer eta minus the span of the inner spoiler innerEtaLE = outerEtaLE - innerSpan / span / 2. # The outer Xsi at the leading Edge is defined by the sparLocation of the Kink outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset # The innner Xsi remains an absolute chord of the spoiler chordInnerSpoiler = (1 - outerXsiLE) * calcChordLengthAtEta( outerEtaLE, parentWingVAMPzero, cpacsWing) innerXsiLE = 1 - chordInnerSpoiler / calcChordLengthAtEta( innerEtaLE, parentWingVAMPzero, cpacsWing) # Eta Coordinates stay constant # Xsi Coordinates are shifted by spoilerChord outerEtaTE = outerEtaLE outerXsiTE = outerXsiLE + spoilerChord / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('InnerSpoiler2', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # Second inner spoiler # old inner becomes new outer outerEtaLE = innerEtaLE # The inner eta of the leading edge is the outer eta minus the span of the inner spoiler innerEtaLE = outerEtaLE - innerSpan / span / 2. # The outer Xsi at the leading Edge is defined by the sparLocation of the Kink outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset # The innner Xsi remains an absolute chord of the spoiler chordInnerSpoiler = (1 - outerXsiLE) * calcChordLengthAtEta( outerEtaLE, parentWingVAMPzero, cpacsWing) innerXsiLE = 1 - chordInnerSpoiler / calcChordLengthAtEta( innerEtaLE, parentWingVAMPzero, cpacsWing) # Eta Coordinates stay constant # Xsi Coordinates are shifted by spoilerChord outerEtaTE = outerEtaLE outerXsiTE = outerXsiLE + spoilerChord / calcChordLengthAtEta( outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta( innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append( createSpoiler('InnerSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=========================================================================== # Output to CPACS #=========================================================================== if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces().get_spoilers() ) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_spoilers( spoilersType()) log.debug('VAMPzero Spoiler: Exporting %s Spoilers to CPACS.' % (str(len(mySpoilers)))) for spoiler in mySpoilers: cpacsComponentSegment.get_controlSurfaces().get_spoilers().add_spoiler( spoiler)
def createSpoilers(parentWingCPACS, parentWingVAMPzero, mySpoiler): ''' This is the main export method for the wing's spoilers * It assumes a constant absolut chord for all spoilers * Spoiler start outboard and move inboard close behind the rearspar * They are rectangular ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentWingVAMPzero.id + ']' cpacsWing = getObjfromXpath(parentWingCPACS, cpacsPath) cpacsComponentSegment = cpacsWing.get_componentSegments().get_componentSegment()[0] mySpoilers = [] #=========================================================================== # Initialization, i.e. fetching values throughout the code #=========================================================================== span = parentWingVAMPzero.span.getValue() / 2. etaKink = parentWingVAMPzero.etaKink.getValue() yFus = parentWingVAMPzero.yFuselage.getValue() etaFus = yFus / span spoilerArea = mySpoiler.refArea.getValue() spoilerChord = mySpoiler.chord.getValue() spoilerOuterEta = mySpoiler.outerEta.getValue() sparOffset = 0.02 #=========================================================================== # Rear spar locations #=========================================================================== 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]) #=========================================================================== # Outer Spoilers #=========================================================================== outerSpan = (spoilerOuterEta - etaKink) * span outerArea = spoilerChord * outerSpan nOuterSpoiler = outerSpan ** 2 / (outerArea * 2.) log.debug('VAMPzero SPOILER: Exporting %s Spoiler outside of the kink for an area of %s m2.' % (str(nOuterSpoiler), str(outerArea))) #=========================================================================== # 1 Spoiler #=========================================================================== if nOuterSpoiler <= 1.: # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaKink: innerEtaTE = etaKink innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('OuterSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=========================================================================== # 2 Spoiler #=========================================================================== elif nOuterSpoiler > 1. and nOuterSpoiler <= 2.: # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = spoilerOuterEta - outerSpan / span / 2. # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('OuterSpoiler2', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaKink: innerEtaTE = etaKink innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('OuterSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=========================================================================== # n Spoiler #=========================================================================== elif nOuterSpoiler > 2.: n = int(ceil(nOuterSpoiler)) # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = outerEtaLE - outerSpan / span / n # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('OuterSpoiler' + str(n), parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) for i in range(2, n): # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = outerEtaLE - outerSpan / span / n # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('OuterSpoiler' + str(n - i + 1), parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaKink: innerEtaTE = etaKink innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('OuterSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=============================================================================== # Inner Spoilers #=============================================================================== deltaArea = spoilerArea - outerArea noExport = False if deltaArea <= 0.: log.warning('VAMPzero SPOILER: Outboard Spoiler area already exceeds the required spoiler area by: %s' % str(deltaArea)) noExport = True calcArea = 0. maxInnerArea = (etaKink - etaFus) * span * spoilerChord if maxInnerArea >= deltaArea and noExport == False: innerSpan = 0. while True: innerSpan += .01 oldArea = calcArea calcArea = innerSpan * spoilerChord # This is the break condition that should be hit normally if abs(deltaArea - calcArea) < 0.1: break if innerSpan > (etaKink - etaFus) * span: log.warning('VAMPzero SPOILER: The spoiler span of the inner spoiler exceeds the available span betweent fuselage and kink, continuing with calcArea = %s' % str(calcArea)) break if oldArea > calcArea: log.warning('VAMPzero SPOILER: Inner spoiler area apparently reached a maximum, continuing with calcArea = %s' % str(calcArea)) break elif noExport == False: log.warning('VAMPzero SPOILER: There is not sufficient space for the inner spoiler(s) between the kink and the fuselage!') spoilerChord = deltaArea / ((etaKink - etaFus) * span) innerSpan = (etaKink - etaFus) * span calcArea = deltaArea log.warning('VAMPzero SPOILER: The spoilerchord will be enlarged to %s!' % str(spoilerChord)) if noExport == True: nInnerSpoiler = 0 log.debug('VAMPzero SPOILER: Exporting %s Spoiler inside of the kink.' % (str(nInnerSpoiler))) else: nInnerSpoiler = innerSpan ** 2 / (calcArea * 3.) log.debug('VAMPzero SPOILER: Exporting %s Spoiler inside of the kink for an area of %s m2.' % (str(nInnerSpoiler), str(calcArea))) #=========================================================================== # 1 Spoiler #=========================================================================== if nInnerSpoiler == 0: pass elif nInnerSpoiler <= 1: # The outer eta of the leading Edge to the eta of the kink outerEtaLE = etaKink # The inner eta of the leading edge is the outer eta minus the span of the inner spoiler innerEtaLE = outerEtaLE - innerSpan / span # The outer Xsi at the leading Edge is defined by the sparLocation of the Kink outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset # The innner Xsi remains an absolute chord of the spoiler chordInnerSpoiler = (1-outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) innerXsiLE = 1 - chordInnerSpoiler / calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) # Eta Coordinates stay constant # Xsi Coordinates are shifted by spoilerChord outerEtaTE = outerEtaLE outerXsiTE = outerXsiLE + spoilerChord / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('InnerSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=========================================================================== # 2 Spoiler #=========================================================================== elif nInnerSpoiler > 1. and nInnerSpoiler <= 2.: # First inner spoiler # The outer eta of the leading Edge to the eta of the kink outerEtaLE = etaKink # The inner eta of the leading edge is the outer eta minus the span of the inner spoiler innerEtaLE = outerEtaLE - innerSpan / span / 2. # The outer Xsi at the leading Edge is defined by the sparLocation of the Kink outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset # The innner Xsi remains an absolute chord of the spoiler chordInnerSpoiler = (1-outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) innerXsiLE = 1 - chordInnerSpoiler / calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) # Eta Coordinates stay constant # Xsi Coordinates are shifted by spoilerChord outerEtaTE = outerEtaLE outerXsiTE = outerXsiLE + spoilerChord / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('InnerSpoiler2', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # Second inner spoiler # old inner becomes new outer outerEtaLE = innerEtaLE # The inner eta of the leading edge is the outer eta minus the span of the inner spoiler innerEtaLE = outerEtaLE - innerSpan / span / 2. # The outer Xsi at the leading Edge is defined by the sparLocation of the Kink outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset # The innner Xsi remains an absolute chord of the spoiler chordInnerSpoiler = (1-outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) innerXsiLE = 1 - chordInnerSpoiler / calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) # Eta Coordinates stay constant # Xsi Coordinates are shifted by spoilerChord outerEtaTE = outerEtaLE outerXsiTE = outerXsiLE + spoilerChord / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('InnerSpoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) #=========================================================================== # Output to CPACS #=========================================================================== if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces().get_spoilers()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_spoilers(spoilersType()) log.debug('VAMPzero Spoiler: Exporting %s Spoilers to CPACS.' % (str(len(mySpoilers)))) for spoiler in mySpoilers: cpacsComponentSegment.get_controlSurfaces().get_spoilers().add_spoiler(spoiler)
def createSpoilersSBW(parentWingCPACS, parentWingVAMPzero, mySpoiler): ''' This is the main export method for the wing's spoilers * It assumes a constant absolut chord for all spoilers * Spoiler start outboard and move inboard close behind the rearspar * They are rectangular ''' cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentWingVAMPzero.id + ']' cpacsWing = getObjfromXpath(parentWingCPACS, cpacsPath) cpacsComponentSegment = cpacsWing.get_componentSegments().get_componentSegment()[0] mySpoilers = [] # Initialization, i.e. fetching values throughout the code span = parentWingVAMPzero.span.getValue() / 2. yFus = parentWingVAMPzero.yFuselage.getValue() etaFus = yFus / span spoilerArea = mySpoiler.refArea.getValue() spoilerChord = mySpoiler.chord.getValue() spoilerOuterEta = mySpoiler.outerEta.getValue() sparOffset = 0.02 # Rear spar locations 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) # Outer Spoilers outerSpan = (spoilerOuterEta - etaFus) * span #outerArea = spoilerChord * outerSpan #nOuterSpoiler = outerSpan ** 2 / (outerArea * 2.) #log.debug('VAMPzero SPOILER: Exporting %s Spoiler outside of the kink for an area of %s m2.' % (str(nOuterSpoiler), str(outerArea))) calcArea = 0. maxInnerArea = (spoilerOuterEta - etaFus) * span * spoilerChord innerSpan = 0. while True: innerSpan += .01 oldArea = calcArea calcArea = innerSpan * spoilerChord # This is the break condition that should be hit normally if abs(spoilerArea - calcArea) < 0.1: break if innerSpan > (spoilerOuterEta - etaFus) * span: log.warning('VAMPzero SPOILER: The spoiler span of the spoiler exceeds the available span between fuselage and kink, continuing with calcArea = %s' % str(calcArea)) break if oldArea > calcArea: log.warning('VAMPzero SPOILER: Spoiler area apparently reached a maximum, continuing with calcArea = %s' % str(calcArea)) break nSpoiler = innerSpan ** 2 / (calcArea * 3.) log.debug('VAMPzero SPOILER: Exporting %s Spoiler inside of the kink for an area of %s m2.' % (str(nSpoiler), str(calcArea))) # 1 Spoiler if nSpoiler <= 1.: # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaFus: innerEtaTE = etaFus innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('Spoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # 2 Spoiler elif nSpoiler > 1. and nSpoiler <= 2.: # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = spoilerOuterEta - outerSpan / span / 2. # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('Spoiler2', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaFus: innerEtaTE = etaFus innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('Spoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # n Spoiler elif nSpoiler > 2.: n = int(ceil(nSpoiler)) # The outer eta of the leading Edge is correspondent to the outerEta of the spoiler outerEtaLE = spoilerOuterEta # The inner eta of the leading edge is the outer eta minus the span of the outer spoiler innerEtaLE = outerEtaLE - outerSpan / span / n # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('Spoiler' + str(n), parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) for i in range(2, n): # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = outerEtaLE - outerSpan / span / n # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('Spoiler' + str(n - i + 1), parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # old outer is new inner outerEtaLE = innerEtaLE # new inner is min next to kink innerEtaLE = spoilerOuterEta - outerSpan / span # The inner and outer Xsi coordinate of the leading edge are defined by the rear spar location and the sparOffset outerXsiLE = xsiSpar_interp(outerEtaLE) + sparOffset innerXsiLE = xsiSpar_interp(innerEtaLE) + sparOffset spoilerPhi = calcPhiLESpoiler(outerEtaLE, innerEtaLE, outerXsiLE, innerXsiLE, parentWingVAMPzero, cpacsWing) deltaEta = sin(spoilerPhi) * spoilerChord deltaXsi = cos(spoilerPhi) * spoilerChord outerEtaTE = outerEtaLE - deltaEta / span outerXsiTE = outerXsiLE + deltaXsi / calcChordLengthAtEta(outerEtaTE, parentWingVAMPzero, cpacsWing) innerEtaTE = innerEtaLE - deltaEta / span innerXsiTE = innerXsiLE + deltaXsi / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) # We do not want the spoiler to overlap the kink as the inner Spoilers will start here if innerEtaTE < etaFus: innerEtaTE = etaFus innerXsiTE = innerXsiLE + spoilerChord / calcChordLengthAtEta(innerEtaTE, parentWingVAMPzero, cpacsWing) mySpoilers.append(createSpoiler('Spoiler1', parentWingVAMPzero.id, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE)) # Output to CPACS if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType: cpacsComponentSegment.set_controlSurfaces(controlSurfacesType()) if type(cpacsComponentSegment.get_controlSurfaces().get_spoilers()) == NoneType: cpacsComponentSegment.get_controlSurfaces().set_spoilers(spoilersType()) log.debug('VAMPzero Spoiler: Exporting %s Spoilers to CPACS.' % (str(len(mySpoilers)))) for spoiler in mySpoilers: cpacsComponentSegment.get_controlSurfaces().get_spoilers().add_spoiler(spoiler)