Example #1
0
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)
Example #2
0
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)
Example #3
0
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)
Example #4
0
def createFlapsSBW(parentWingCPACS, parentWingVAMPzero, myFlap):
    '''
    This is the main export method for the wings flaps

    @todo: it is possible that the inner flap overlaps the kink area
    '''
    cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentWingVAMPzero.id + ']'
    cpacsWing = getObjfromXpath(parentWingCPACS, cpacsPath)
    cpacsComponentSegment = cpacsWing.get_componentSegments(
    ).get_componentSegment()[0]
    myFlaps = []

    #===========================================================================
    # 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])

    yFus = parentWingVAMPzero.yFuselage.getValue()
    span = parentWingVAMPzero.span.getValue() / 2.
    etaFus = yFus / span
    etaKink = parentWingVAMPzero.etaKink.getValue()
    cRoot = parentWingVAMPzero.cRoot.getValue()
    cKink = calcChordLengthAtEta(etaKink, parentWingVAMPzero, cpacsWing)
    phiLE = parentWingVAMPzero.phiLE.getValue()

    innerFlapArea = myFlap.refAreaInnerFlap.getValue()
    outerFlapArea = myFlap.refAreaOuterFlap.getValue()

    #===========================================================================
    # OuterFlap
    #===========================================================================
    sparOffset = 0.08

    # maxX is the maximum extension of the flap
    maxX = cRoot * (1. - (xsiSparRoot + sparOffset)) / 2.
    newOuterFlapArea = innerFlapArea + outerFlapArea
    cRootOuterFlap = cRoot * (1. - (xsiSparRoot + sparOffset))

    #===========================================================================
    # Determine the total flap span by iteration
    #===========================================================================
    calcArea = 0.
    spanOuterFlap = 0.
    absSparOffset = sparOffset * cKink

    # Obtain the maxEtaValue. This is forwarded from the ailerons export routine.
    maxEta = myFlap.maxEta.getValue() - 0.02

    # the tip root length is a function of the span (as the xsi location of the spar changes)
    while abs(calcArea - newOuterFlapArea) > 0.1:
        spanOuterFlap += .01
        cTipOuterFlap = calcChordLengthAtEta(
            etaFus + spanOuterFlap / span, parentWingVAMPzero, cpacsWing
        ) * (1 - xsiSpar_interp(etaFus + spanOuterFlap / span)) - absSparOffset
        oldcalcArea = calcArea
        calcArea = spanOuterFlap * (cRootOuterFlap + cTipOuterFlap) / 2.

        if calcArea < oldcalcArea:
            log.warning(
                'VAMPzero FLAP: Outer Flap Area can not be established decreasing spar offset by 2% chord!'
            )
            sparOffset = sparOffset - 0.02
            calcArea = 0.
            spanOuterFlap = 0.
            absSparOffset = sparOffset * cKink
            break

        if spanOuterFlap / span + etaFus > maxEta:
            log.warning(
                'VAMPzero FLAP: Outer Flap overlaps with the aileron decreasing spar offset by 2% chord!'
            )
            sparOffset = sparOffset - 0.02
            calcArea = 0.
            spanOuterFlap = 0.
            absSparOffset = sparOffset * cRoot
            break

    while abs(calcArea - newOuterFlapArea) > 0.1:
        spanOuterFlap += .01
        cTipOuterFlap = calcChordLengthAtEta(
            etaKink + spanOuterFlap / span, parentWingVAMPzero, cpacsWing) * (
                1 -
                xsiSpar_interp(etaKink + spanOuterFlap / span)) - absSparOffset
        oldcalcArea = calcArea
        calcArea = spanOuterFlap * (cRootOuterFlap + cTipOuterFlap) / 2.

        if calcArea < oldcalcArea:
            log.warning(
                'VAMPzero FLAP: Outer Flap Area can not be established! Continuing with outerArea = %s'
                % str(calcArea))
            newOuterFlapArea = calcArea
            break

        if spanOuterFlap / span + etaFus > maxEta:
            log.warning(
                'VAMPzero FLAP: Outer Flap overlaps with the aileron! Continuing with outerArea = %s'
                % str(calcArea))
            newOuterFlapArea = calcArea
            break

    #===========================================================================
    # Determine the number of flaps
    # The aspect ratio of a flap should not be higher than 6.
    #===========================================================================
    nOuterFlaps = spanOuterFlap**2. / (newOuterFlapArea * 6.)
    log.debug(
        'VAMPzero FLAP: Exporting %s Flaps outboard of the engine for an area of %s m2.'
        % (str(nOuterFlaps), str(newOuterFlapArea)))

    #===========================================================================
    # 1 Flap
    #===========================================================================
    if nOuterFlaps <= 1.:
        # the inner border eta is located at the kink
        innerEtaLE = etaFus + 0.05
        innerXsiLE = xsiSparRoot + sparOffset
        # the outer border eta is determined from the span of the outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(
            outerEtaLE, parentWingVAMPzero, cpacsWing))

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(
            innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(
            outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(
            createFlap('outerFlap1',
                       parentWingVAMPzero.id,
                       innerEtaLE,
                       innerXsiLE,
                       outerEtaLE,
                       outerXsiLE,
                       maxX,
                       appendInnerCruiseRoller=True,
                       type='flap',
                       innerX=innerX,
                       outerX=outerX))

    #===========================================================================
    # 2 Flaps
    #===========================================================================
    elif nOuterFlaps > 1. and nOuterFlaps <= 2.:
        # the inner border eta is located at the kink
        innerEtaLE = etaFus + 0.05
        innerXsiLE = xsiSparKink + sparOffset
        # the outer border eta is determined from the half span of the total outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / (2 * span)
        outerXsiLE = xsiSpar_interp(
            outerEtaLE) + absSparOffset / calcChordLengthAtEta(
                outerEtaLE, parentWingVAMPzero, cpacsWing)
        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(
            innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(
            outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(
            createFlap('outerFlap1',
                       parentWingVAMPzero.id,
                       innerEtaLE,
                       innerXsiLE,
                       outerEtaLE,
                       outerXsiLE,
                       maxX,
                       type='flap',
                       innerX=innerX,
                       outerX=outerX))

        # new inner is the old outer
        innerEtaLE = outerEtaLE
        innerXsiLE = outerXsiLE
        # the outer border eta is determined from the full span of the total outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(
            outerEtaLE, parentWingVAMPzero, cpacsWing))

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(
            innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(
            outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(
            createFlap('outerFlap2',
                       parentWingVAMPzero.id,
                       innerEtaLE,
                       innerXsiLE,
                       outerEtaLE,
                       outerXsiLE,
                       maxX,
                       appendInnerCruiseRoller=True,
                       type='flap',
                       innerX=innerX,
                       outerX=outerX))

    #===========================================================================
    # n Flaps
    #===========================================================================
    elif nOuterFlaps > 2.:
        n = int(ceil(nOuterFlaps))
        # First Flap
        # the inner border eta is located at the kink
        innerEtaLE = etaFus + 0.05
        innerXsiLE = xsiSparKink + sparOffset
        # the outer border eta is determined from the half span of the total outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / (n * span)
        outerXsiLE = xsiSpar_interp(
            outerEtaLE) + absSparOffset / calcChordLengthAtEta(
                outerEtaLE, parentWingVAMPzero, cpacsWing)

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(
            innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(
            outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(
            createFlap('outerFlap1',
                       parentWingVAMPzero.id,
                       innerEtaLE,
                       innerXsiLE,
                       outerEtaLE,
                       outerXsiLE,
                       maxX,
                       type='flap',
                       innerX=innerX,
                       outerX=outerX))

        for i in range(2, n):
            # nth Flap
            # new inner is the old outer
            innerEtaLE = outerEtaLE
            innerXsiLE = outerXsiLE
            # the outer border eta is determined from the full span of the total outer flap
            outerEtaLE = innerEtaLE + spanOuterFlap / n / span
            outerXsiLE = xsiSpar_interp(
                outerEtaLE) + absSparOffset / calcChordLengthAtEta(
                    outerEtaLE, parentWingVAMPzero, cpacsWing)

            #Fowler Motion is restricted to 75% of the flap depth
            innerX = (1. - innerXsiLE) * calcChordLengthAtEta(
                innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
            outerX = (1. - outerXsiLE) * calcChordLengthAtEta(
                outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
            myFlaps.append(
                createFlap('outerFlap' + str(i),
                           parentWingVAMPzero.id,
                           innerEtaLE,
                           innerXsiLE,
                           outerEtaLE,
                           outerXsiLE,
                           maxX,
                           appendInnerCruiseRoller=True,
                           type='flap',
                           innerX=innerX,
                           outerX=outerX))

        # Last Flap
        # new inner is the old outer
        innerEtaLE = outerEtaLE
        innerXsiLE = outerXsiLE
        # the outer border eta is determined from the full span of the total outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(
            outerEtaLE, parentWingVAMPzero, cpacsWing))

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(
            innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(
            outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(
            createFlap('outerFlap' + str(n),
                       parentWingVAMPzero.id,
                       innerEtaLE,
                       innerXsiLE,
                       outerEtaLE,
                       outerXsiLE,
                       maxX,
                       appendInnerCruiseRoller=True,
                       type='flap',
                       innerX=innerX,
                       outerX=outerX))

    #===============================================================================
    # Output to Spoiler
    # as the spoiler is relying on data of the flaps some basic information is written
    # back to the the VAMPzero components
    #===============================================================================
    parentWingVAMPzero.spoiler.outerEta = parameter(
        parent=parentWingVAMPzero.spoiler,
        value=outerEtaLE,
        unit='',
        status='calc',
        doc=
        'The outermost eta coordinate of all flaps. This overlaps with the outer eta coordinate of the spoiler'
    )
    spoilerChord = maxX
    parentWingVAMPzero.spoiler.chord = parameter(
        spoilerChord,
        'm',
        'calc',
        'The absolute chord of the spoiler: 5% of the kink chord length + 50% of the innerFlap Chord length',
        parent=parentWingVAMPzero.spoiler)

    #===========================================================================
    # Output to CPACS
    #===========================================================================
    if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType:
        cpacsComponentSegment.set_controlSurfaces(controlSurfacesType())
    if type(cpacsComponentSegment.get_controlSurfaces().
            get_trailingEdgeDevices()) == NoneType:
        cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices(
            trailingEdgeDevicesType())

    log.debug('VAMPzero SLAT: Exporting %s Flaps to CPACS.' %
              (str(len(myFlaps))))
    for flap in myFlaps:
        cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices(
        ).add_trailingEdgeDevice(flap)
Example #5
0
def createFlapsSBW(parentWingCPACS, parentWingVAMPzero, myFlap):
    '''
    This is the main export method for the wings flaps for the strut braced wing.

    The SBW does not feature any inner flaps as no kink exists

    @todo: it is possible that the inner flap overlaps the kink area
    '''
    cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentWingVAMPzero.id + ']'
    cpacsWing = getObjfromXpath(parentWingCPACS, cpacsPath)
    cpacsComponentSegment = cpacsWing.get_componentSegments().get_componentSegment()[0]
    myFlaps = []

    # 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)

    yFus = parentWingVAMPzero.yFuselage.getValue()
    span = parentWingVAMPzero.span.getValue() / 2.
    etaFus = yFus / span
    etaKink = parentWingVAMPzero.etaKink.getValue()
    cRoot = parentWingVAMPzero.cRoot.getValue()
    cKink = calcChordLengthAtEta(etaKink, parentWingVAMPzero, cpacsWing)

    innerFlapArea = myFlap.refAreaInnerFlap.getValue()
    outerFlapArea = myFlap.refAreaOuterFlap.getValue()

    # OuterFlap
    sparOffset = 0.08

    # maxX is the maximum extension of the flap
    maxX = cRoot * (1. - (xsis[0] + sparOffset)) /2.
    newOuterFlapArea = innerFlapArea + outerFlapArea
    cRootOuterFlap = cRoot * (1. - (xsis[0] + sparOffset))

    # Determine the total flap span by iteration
    calcArea = 0.
    spanOuterFlap = 0.
    absSparOffset = sparOffset * cKink

    # Obtain the maxEtaValue. This is forwarded from the ailerons export routine.
    maxEta = myFlap.maxEta.getValue() - 0.02

    # the tip root length is a function of the span (as the xsi location of the spar changes)
    while abs(calcArea - newOuterFlapArea) > 0.1:
        spanOuterFlap += .01
        cTipOuterFlap = calcChordLengthAtEta(etaFus + spanOuterFlap / span, parentWingVAMPzero, cpacsWing) * (1 - xsiSpar_interp(etaFus + spanOuterFlap / span)) - absSparOffset
        oldcalcArea = calcArea
        calcArea = spanOuterFlap * (cRootOuterFlap + cTipOuterFlap) / 2.

        if calcArea < oldcalcArea:
            log.warning('VAMPzero FLAP: Outer Flap Area can not be established decreasing spar offset by 2% chord!')
            sparOffset = sparOffset - 0.02
            calcArea = 0.
            spanOuterFlap = 0.
            absSparOffset = sparOffset * cKink
            break

        if spanOuterFlap / span + etaFus > maxEta:
            log.warning('VAMPzero FLAP: Outer Flap overlaps with the aileron decreasing spar offset by 2% chord!')
            sparOffset = sparOffset - 0.02
            calcArea = 0.
            spanOuterFlap = 0.
            absSparOffset = sparOffset * cRoot
            break

    while abs(calcArea - newOuterFlapArea) > 0.1:
        spanOuterFlap += .01
        cTipOuterFlap = calcChordLengthAtEta(etaFus + spanOuterFlap / span, parentWingVAMPzero, cpacsWing) * (1 - xsiSpar_interp(etaFus + spanOuterFlap / span)) - absSparOffset
        oldcalcArea = calcArea
        calcArea = spanOuterFlap * (cRootOuterFlap + cTipOuterFlap) / 2.

        if calcArea < oldcalcArea:
            log.warning('VAMPzero FLAP: Outer Flap Area can not be established! Continuing with outerArea = %s' % str(calcArea))
            newOuterFlapArea = calcArea
            break

        if spanOuterFlap / span + etaFus + 0.06 > maxEta:
            log.warning('VAMPzero FLAP: Outer Flap overlaps with the aileron! Continuing with outerArea = %s' % str(calcArea))
            newOuterFlapArea = calcArea
            break

    # Determine the number of flaps
    # The aspect ratio of a flap should not be higher than 6.
    nOuterFlaps = spanOuterFlap ** 2. / (newOuterFlapArea * 6.)
    log.debug('VAMPzero FLAP: Exporting %s Flaps outboard of the engine for an area of %s m2.' % (str(nOuterFlaps), str(newOuterFlapArea)))

    # 1 Flap
    if nOuterFlaps <= 1.:
        # the inner border eta is located at the kink
        innerEtaLE = etaFus + 0.05
        innerXsiLE = xsis[0] + sparOffset
        # the outer border eta is determined from the span of the outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing))

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap1', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=True, type='flap', innerX=innerX, outerX=outerX))

    # 2 Flaps
    elif nOuterFlaps > 1. and nOuterFlaps <= 2.:
        # the inner border eta is located at the kink
        innerEtaLE = etaFus + 0.05
        innerXsiLE = xsis[2] + sparOffset
        # the outer border eta is determined from the half span of the total outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / (2*span)
        outerXsiLE = xsiSpar_interp(outerEtaLE) + absSparOffset / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing)
        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap1', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, type='flap', innerX=innerX, outerX=outerX))

        # new inner is the old outer
        innerEtaLE = outerEtaLE
        innerXsiLE = outerXsiLE
        # the outer border eta is determined from the full span of the total outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing))

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap2', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=True, type='flap', innerX=innerX, outerX=outerX))

    # n Flaps
    elif nOuterFlaps > 2. :
        n = int(ceil(nOuterFlaps))
        # First Flap
        # the inner border eta is located at the kink
        innerEtaLE = etaFus + 0.05
        innerXsiLE = xsis[2] + sparOffset
        # the outer border eta is determined from the half span of the total outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / (n*span)
        outerXsiLE = xsiSpar_interp(outerEtaLE) + absSparOffset / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing)

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap1', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, type='flap', innerX=innerX, outerX=outerX))

        for i in range(2, n):
            # nth Flap
            # new inner is the old outer
            innerEtaLE = outerEtaLE
            innerXsiLE = outerXsiLE
            # the outer border eta is determined from the full span of the total outer flap
            outerEtaLE = innerEtaLE + spanOuterFlap / n / span
            outerXsiLE = xsiSpar_interp(outerEtaLE) + absSparOffset / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing)

            #Fowler Motion is restricted to 75% of the flap depth
            innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
            outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
            myFlaps.append(createFlap('outerFlap' + str(i), parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=True, type='flap', innerX=innerX, outerX=outerX))

        # Last Flap
        # new inner is the old outer
        innerEtaLE = outerEtaLE
        innerXsiLE = outerXsiLE
        # the outer border eta is determined from the full span of the total outer flap
        outerEtaLE = etaFus + 0.05 + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing))

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap' + str(n), parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=True, type='flap', innerX=innerX, outerX=outerX))

    # Output to Spoiler
    # as the spoiler is relying on data of the flaps some basic information is written
    # back to the the VAMPzero components
    parentWingVAMPzero.spoiler.outerEta = parameter(parent=parentWingVAMPzero.spoiler, value=outerEtaLE, unit='', status='calc', doc='The outermost eta coordinate of all flaps. This overlaps with the outer eta coordinate of the spoiler')
    spoilerChord = maxX
    parentWingVAMPzero.spoiler.chord = parameter(spoilerChord, 'm', 'calc', 'The absolute chord of the spoiler: 5% of the kink chord length + 50% of the innerFlap Chord length', parent=parentWingVAMPzero.spoiler)

    # Output to CPACS
    if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType:
        cpacsComponentSegment.set_controlSurfaces(controlSurfacesType())
    if type(cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices()) == NoneType:
        cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices(trailingEdgeDevicesType())

    log.debug('VAMPzero SLAT: Exporting %s Flaps to CPACS.' % (str(len(myFlaps))))
    for flap in myFlaps:
        cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices().add_trailingEdgeDevice(flap)
Example #6
0
def createFlapsAdvDoubleTrapezoid(parentWingCPACS, parentWingVAMPzero, myFlap):
    '''
    This is the main export method for the wings flaps
    
    @todo: it is possible that the inner flap overlaps the kink area
    '''
    cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + parentWingVAMPzero.id + ']'
    cpacsWing = getObjfromXpath(parentWingCPACS, cpacsPath)
    cpacsComponentSegment = cpacsWing.get_componentSegments().get_componentSegment()[0]
    myFlaps = []
    
    # 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])
    
    yFus = parentWingVAMPzero.yFuselage.getValue()
    span = parentWingVAMPzero.span.getValue() / 2.
    etaFus = yFus / span
    etaKink = parentWingVAMPzero.etaKink.getValue()
    cRoot = parentWingVAMPzero.cRoot.getValue()
    cKink = calcChordLengthAtEta(etaKink, parentWingVAMPzero, cpacsWing)
    phiLE = parentWingVAMPzero.phiLE.getValue()
    
    innerFlapArea = myFlap.refAreaInnerFlap.getValue()
    outerFlapArea = myFlap.refAreaOuterFlap.getValue()

    # InnerFlap
    # Determine the number of flaps
    # The aspect ratio of a flap should not be higher than 9.
    sparOffset = 0.08
    if phiLE > 0.:
        # if the wing is backward swept the chord of the inner flap equals the chord at kink behind the rear spar + sparOffset
        cInnerFlap = cKink * (1. - (xsiSparKink + sparOffset))
    elif phiLE < 0.:
        # if the wing is forward swept the chord of the inner flap is similar to the chord of the root section behind the spar + 20%
        cInnerFlap = cRoot * (1. - (xsiSparFuselage + 0.2))
    
    # maxX is the maximum extension of the flap
    maxX = cInnerFlap / 2.
    
    # The area of the innerFlap is determined by the chord and span 
    # The difference in the area will be substituted by the outerFlap Area
    spanInnerFlap = (etaKink - etaFus) * span
    newInnerFlapArea = cInnerFlap * spanInnerFlap
    deltaArea = innerFlapArea - newInnerFlapArea
    nInnerFlaps = spanInnerFlap ** 2. / (newInnerFlapArea * 9.)
    log.debug('VAMPzero FLAP: Exporting %s Flaps inside of the engine for an area of %s m2.' % (str(nInnerFlaps), str(innerFlapArea)))
        
    if nInnerFlaps < 1.:
        # the inner border eta is located at the intersection with the fuselage 
        innerEtaLE = etaFus
        # the inner border xsi is determined from the wing chord at the fuselage station (which equals CRoot)
        innerXsiLE = 1. - (cInnerFlap / cRoot)
        # the outer border eta is determined from the span of the inner flap
        outerEtaLE = etaKink
        # the outer xsi location is found from the avg chord and the chord length at that station
        outerXsiLE = 1. - (cInnerFlap / cKink)

        myFlaps.append(createFlap('innerFlap', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, type='innerFlap', innerX=maxX, outerX=maxX))
    
    elif nInnerFlaps > 1. and nInnerFlaps <= 2.:
        # First Flap
        # the inner border eta is located at the intersection with the fuselage
        innerEtaLE = etaFus
        # the inner border xsi is determined from the wing chord at the fuselage station (which equals CRoot)
        innerXsiLE = 1. - (cInnerFlap / cRoot)
        # the outer border eta is determined from the span of the inner flap
        outerEtaLE = etaFus + (etaKink - etaFus) / 2.
        # the outer xsi location is found from the avg chord and the chord length at that station
        outerXsiLE = 1. - (cInnerFlap / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing))

        myFlaps.append(createFlap('innerFlap1', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, type='innerFlap', innerX=maxX, outerX=maxX))
        
        # Second Flap
        # new inner is old outer
        innerEtaLE = outerEtaLE
        # new outer is kink
        outerEtaLE = etaKink
        # new inner is old outer
        innerXsiLE = outerXsiLE
        # new outer is kink
        outerXsiLE = 1. - (cInnerFlap / cKink)

        myFlaps.append(createFlap('innerFlap2', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, type='flap', innerX=maxX, outerX=maxX))

    # OuterFlap
    newOuterFlapArea = outerFlapArea + deltaArea
    cRootOuterFlap = cKink * (1. - (xsiSparKink + sparOffset))
    
    # Determine the total flap span by iteration
    calcArea = 0.
    spanOuterFlap = 0.
    absSparOffset = sparOffset * cKink
    
    # Obtain the maxEtaValue. This is forwarded from the ailerons export routine.
    maxEta = myFlap.maxEta.getValue() - 0.02
    
    # the tip root length is a function of the span (as the xsi location of the spar changes)
    while abs(calcArea - newOuterFlapArea) > 0.1:
        spanOuterFlap += .01
        cTipOuterFlap = calcChordLengthAtEta(etaKink + spanOuterFlap / span, parentWingVAMPzero, cpacsWing) * (1 - xsiSpar_interp(etaKink + spanOuterFlap / span)) - absSparOffset
        oldcalcArea = calcArea
        calcArea = spanOuterFlap * (cRootOuterFlap + cTipOuterFlap) / 2.
        
        if calcArea < oldcalcArea:
            log.warning('VAMPzero FLAP: Outer Flap Area can not be established decreasing spar offset by 2% chord!')
            sparOffset = sparOffset - 0.02
            calcArea = 0.
            spanOuterFlap = 0.
            absSparOffset = sparOffset * cKink
            break
        
        if spanOuterFlap / span + etaKink > maxEta:
            log.warning('VAMPzero FLAP: Outer Flap overlaps with the aileron decreasing spar offset by 2% chord!')
            sparOffset = sparOffset - 0.02
            calcArea = 0.
            spanOuterFlap = 0.
            absSparOffset = sparOffset * cKink
            break
            
    while abs(calcArea - newOuterFlapArea) > 0.1:
        spanOuterFlap += .01
        cTipOuterFlap = calcChordLengthAtEta(etaKink + spanOuterFlap / span, parentWingVAMPzero, cpacsWing) * (1 - xsiSpar_interp(etaKink + spanOuterFlap / span)) - absSparOffset
        oldcalcArea = calcArea
        calcArea = spanOuterFlap * (cRootOuterFlap + cTipOuterFlap) / 2.
        
        if calcArea < oldcalcArea:
            log.warning('VAMPzero FLAP: Outer Flap Area can not be established! Continuing with outerArea = %s' % str(calcArea))
            newOuterFlapArea = calcArea
            break

        if spanOuterFlap / span + etaKink > maxEta:
            log.warning('VAMPzero FLAP: Outer Flap overlaps with the aileron! Continuing with outerArea = %s' % str(calcArea))
            newOuterFlapArea = calcArea
            break
        
    # Determine the number of flaps
    # The aspect ratio of a flap should not be higher than 9. 
    nOuterFlaps = spanOuterFlap ** 2. / (newOuterFlapArea * 9.)
    log.debug('VAMPzero FLAP: Exporting %s Flaps outboard of the engine for an area of %s m2.' % (str(nOuterFlaps), str(newOuterFlapArea)))
    
    # 1 Flap
    if nOuterFlaps <= 1.:
        # the inner border eta is located at the kink 
        innerEtaLE = etaKink
        innerXsiLE = xsiSparKink + sparOffset
        # the outer border eta is determined from the span of the outer flap
        outerEtaLE = etaKink + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing))
        
        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap1', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=True, type='flap', innerX=innerX, outerX=outerX))
    
    # 2 Flaps
    elif nOuterFlaps > 1. and nOuterFlaps <= 2.:
        # the inner border eta is located at the kink 
        innerEtaLE = etaKink
        innerXsiLE = xsiSparKink + sparOffset
        # the outer border eta is determined from the half span of the total outer flap
        outerEtaLE = etaKink + spanOuterFlap / (2. * span)
        outerXsiLE = xsiSpar_interp(outerEtaLE) + absSparOffset / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing)
        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap1', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, type='flap', innerX=innerX, outerX=outerX))
        
        # new inner is the old outer 
        innerEtaLE = outerEtaLE
        innerXsiLE = outerXsiLE
        # the outer border eta is determined from the full span of the total outer flap
        outerEtaLE = etaKink + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing))

        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap2', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=True, type='flap', innerX=innerX, outerX=outerX))
    
    # n Flaps
    elif nOuterFlaps > 2. :
        n = int(ceil(nOuterFlaps))
        # First Flap
        # the inner border eta is located at the kink 
        innerEtaLE = etaKink
        innerXsiLE = xsiSparKink + sparOffset
        # the outer border eta is determined from the half span of the total outer flap
        outerEtaLE = etaKink + spanOuterFlap / n / span
        outerXsiLE = xsiSpar_interp(outerEtaLE) + absSparOffset / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing)
        
        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap1', parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, type='flap', innerX=innerX, outerX=outerX))
        
        for i in range(2, n):
            # nth Flap
            # new inner is the old outer 
            innerEtaLE = outerEtaLE
            innerXsiLE = outerXsiLE
            # the outer border eta is determined from the full span of the total outer flap
            outerEtaLE = innerEtaLE + spanOuterFlap / n / span
            outerXsiLE = xsiSpar_interp(outerEtaLE) + absSparOffset / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing)
            
            #Fowler Motion is restricted to 75% of the flap depth
            innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
            outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
            myFlaps.append(createFlap('outerFlap' + str(i), parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=True, type='flap', innerX=innerX, outerX=outerX))

        # Last Flap
        # new inner is the old outer 
        innerEtaLE = outerEtaLE
        innerXsiLE = outerXsiLE
        # the outer border eta is determined from the full span of the total outer flap
        outerEtaLE = etaKink + spanOuterFlap / span
        outerXsiLE = 1 - (cTipOuterFlap / calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing))
        
        #Fowler Motion is restricted to 75% of the flap depth
        innerX = (1. - innerXsiLE) * calcChordLengthAtEta(innerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        outerX = (1. - outerXsiLE) * calcChordLengthAtEta(outerEtaLE, parentWingVAMPzero, cpacsWing) * 0.5
        myFlaps.append(createFlap('outerFlap' + str(n), parentWingVAMPzero.id, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=True, type='flap', innerX=innerX, outerX=outerX))

    # Output to Spoiler
    # as the spoiler is relying on data of the flaps some basic information is written 
    # back to the the VAMPzero components  
    parentWingVAMPzero.spoiler.outerEta = parameter(outerEtaLE, '', 'calc', 'The outermost eta coordinate of all flaps. This overlaps with the outer eta coordinate of the spoiler', parent=parentWingVAMPzero.spoiler)
    spoilerChord = 0.05 * cKink + 0.5 * cInnerFlap
    parentWingVAMPzero.spoiler.chord = parameter(spoilerChord, 'm', 'calc', 'The absolute chord of the spoiler: 5% of the kink chord length + 50% of the innerFlap Chord length', parent=parentWingVAMPzero.spoiler)
    
    # Output to CPACS
    if type(cpacsComponentSegment.get_controlSurfaces()) == NoneType:
        cpacsComponentSegment.set_controlSurfaces(controlSurfacesType())
    if type(cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices()) == NoneType:
        cpacsComponentSegment.get_controlSurfaces().set_trailingEdgeDevices(trailingEdgeDevicesType())
    
    log.debug('VAMPzero SLAT: Exporting %s Flaps to CPACS.' % (str(len(myFlaps))))
    for flap in myFlaps:
        cpacsComponentSegment.get_controlSurfaces().get_trailingEdgeDevices().add_trailingEdgeDevice(flap)
Example #7
0
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)
Example #8
0
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)
Example #9
0
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)
Example #10
0
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)
Example #11
0
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)
Example #12
0
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)