Exemple #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)
Exemple #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)
Exemple #3
0
def createFlap(name,
               parentUID,
               innerEtaLE,
               innerXsiLE,
               outerEtaLE,
               outerXsiLE,
               maxX,
               appendInnerCruiseRoller=False,
               type='flap',
               innerX=0.,
               outerX=0.):
    log.debug('VAMPzero FLAP: Creating Flap: %s' % (str(name)))
    log.debug('VAMPzero FLAP: innerEtaLE: %s' % str(innerEtaLE))
    log.debug('VAMPzero FLAP: outerEtaLE: %s' % str(outerEtaLE))
    log.debug('VAMPzero FLAP: innerXsiLE: %s' % str(innerXsiLE))
    log.debug('VAMPzero FLAP: outerXsiLE: %s' % str(outerXsiLE))

    myName = stringBaseType(None, None, None, name)
    myDescription = stringBaseType(None, None, None, 'innerFlap from VAMPzero')
    myParentUID = stringUIDBaseType(None, None, 'True', None, parentUID)

    myleadingEdgeShape = leadingEdgeShapeType(
        relHeightLE=doubleBaseType(valueOf_=str(0.2)),
        xsiUpperSkin=doubleBaseType(valueOf_=str(0.5)),
        xsiLowerSkin=doubleBaseType(valueOf_=str(0.95)))
    innerBorder = controlSurfaceBorderTrailingEdgeType(
        etaLE=doubleBaseType(valueOf_=str(innerEtaLE)),
        etaTE=doubleBaseType(valueOf_=str(innerEtaLE)),
        xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)),
        leadingEdgeShape=myleadingEdgeShape)
    outerBorder = controlSurfaceBorderTrailingEdgeType(
        etaLE=doubleBaseType(valueOf_=str(outerEtaLE)),
        etaTE=doubleBaseType(valueOf_=str(outerEtaLE)),
        xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)),
        leadingEdgeShape=myleadingEdgeShape)

    myOuterShape = controlSurfaceOuterShapeTrailingEdgeType(
        innerBorder=innerBorder, outerBorder=outerBorder)
    myStructure = wingComponentSegmentStructureType()
    myFlap = trailingEdgeDeviceType(uID=name + 'UID',
                                    name=myName,
                                    description=myDescription,
                                    parentUID=myParentUID,
                                    outerShape=myOuterShape,
                                    structure=myStructure)
    createFlapStructure(myFlap,
                        maxX,
                        innerXsiLE,
                        outerXsiLE,
                        appendInnerCruiseRoller,
                        type=type,
                        innerX=innerX,
                        outerX=outerX)
    return myFlap
Exemple #4
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)
Exemple #5
0
def createFlap(name, parentUID, innerEtaLE, innerXsiLE, outerEtaLE, outerXsiLE, maxX, appendInnerCruiseRoller=False, type='flap', innerX=0., outerX=0.):
    log.debug('VAMPzero FLAP: Creating Flap: %s' % (str(name)))
    log.debug('VAMPzero FLAP: innerEtaLE: %s' % str(innerEtaLE))
    log.debug('VAMPzero FLAP: outerEtaLE: %s' % str(outerEtaLE))
    log.debug('VAMPzero FLAP: innerXsiLE: %s' % str(innerXsiLE))
    log.debug('VAMPzero FLAP: outerXsiLE: %s' % str(outerXsiLE))
    
    myName = stringBaseType(None, None, None, name)
    myDescription = stringBaseType(None, None, None, 'innerFlap from VAMPzero')
    myParentUID = stringUIDBaseType(None, None, 'True', None, parentUID)

    myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.2)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.5)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.95)))
    innerBorder = controlSurfaceBorderTrailingEdgeType(etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), etaTE=doubleBaseType(valueOf_=str(innerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), leadingEdgeShape=myleadingEdgeShape)
    outerBorder = controlSurfaceBorderTrailingEdgeType(etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), etaTE=doubleBaseType(valueOf_=str(outerEtaLE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), leadingEdgeShape=myleadingEdgeShape)
    
    myOuterShape = controlSurfaceOuterShapeTrailingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder)
    myStructure = wingComponentSegmentStructureType()
    myFlap = trailingEdgeDeviceType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape, structure=myStructure)
    createFlapStructure(myFlap, maxX, innerXsiLE, outerXsiLE, appendInnerCruiseRoller, type=type, innerX=innerX, outerX=outerX)
    return myFlap
Exemple #6
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)
Exemple #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.
    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)
Exemple #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
    # 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)
Exemple #9
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)
Exemple #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
    #===========================================================================
    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)
Exemple #11
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)