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 createFlapStructure(myFlap, maxX=0.4, innerHingeXsi=0.7, outerHingeXsi=0.7, appendInnerCruiseRoller=False, type='flap', innerX=0., outerX=0.):
    myUID = myFlap.get_uID()

    # Structure    
    createShell(myFlap, myUID, type, thickness=0.001)
    createSpars(myFlap, myUID, type)
    createRibs(myFlap, myUID, type, thickness=0.001, nRibs=20)

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

    # Structure
    createShell(myFlap, myUID, type, thickness=0.001)
    createSpars(myFlap, myUID, type)
    createRibs(myFlap, myUID, type, thickness=0.001, nRibs=20)

    # Moveables
    createTracks(myFlap, type, myUID)
    createPath(myFlap, type, myUID, innerX, outerX, innerHingeXsi,
               outerHingeXsi)
    if appendInnerCruiseRoller:
        createCruiseRollers(myFlap, 'outerFlap', myUID + '_CR1')
Example #6
0
def createSlat(name, parentUID, innerEtaTE, innerXsiTE, outerEtaTE, outerXsiTE, innerX, outerX):
    # Header
    log.debug('VAMPzero SLAT: Creating Slat: %s' % (str(name)))
    log.debug('VAMPzero SLAT: innerEtaTE: %s' % str(innerEtaTE))
    log.debug('VAMPzero SLAT: outerEtaTE: %s' % str(outerEtaTE))
    log.debug('VAMPzero SLAT: innerXsiTE: %s' % str(innerXsiTE))
    log.debug('VAMPzero SLAT: outerXsiTE: %s' % str(outerXsiTE))

    myName = stringBaseType(valueOf_=name)
    myDescription = stringBaseType(valueOf_='slat from VAMPzero')
    myParentUID = stringUIDBaseType(isLink='True', valueOf_=parentUID)

    myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85)))
    innerBorder = controlSurfaceBorderLeadingEdgeType(etaLE=doubleBaseType(valueOf_=str(innerEtaTE)), xsiTEUpper=doubleBaseType(valueOf_=str(innerXsiTE)), xsiTELower=doubleBaseType(valueOf_=str(0.02)), leadingEdgeShape=myleadingEdgeShape)
    outerBorder = controlSurfaceBorderLeadingEdgeType(etaLE=doubleBaseType(valueOf_=str(outerEtaTE)), xsiTEUpper=doubleBaseType(valueOf_=str(outerXsiTE)), xsiTELower=doubleBaseType(valueOf_=str(0.02)), leadingEdgeShape=myleadingEdgeShape)
    
    myOuterShape = controlSurfaceOuterShapeLeadingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder)
    
    mySlat = leadingEdgeDeviceType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape)
    createPath(mySlat, typeOfSeg = "slat", uID=name + 'UID', innerX=innerX, outerX=outerX, innerHingeXsi = 0.5, outerHingeXsi = 0.5)
    return mySlat
Example #7
0
def createSlat(name, parentUID, innerEtaTE, innerXsiTE, outerEtaTE, outerXsiTE, innerX, outerX):
    #===========================================================================
    # Header
    #===========================================================================
    log.debug('VAMPzero SLAT: Creating Slat: %s' % (str(name)))
    log.debug('VAMPzero SLAT: innerEtaTE: %s' % str(innerEtaTE))
    log.debug('VAMPzero SLAT: outerEtaTE: %s' % str(outerEtaTE))
    log.debug('VAMPzero SLAT: innerXsiTE: %s' % str(innerXsiTE))
    log.debug('VAMPzero SLAT: outerXsiTE: %s' % str(outerXsiTE))

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

    myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.5)), xsiUpperSkin=doubleBaseType(valueOf_=str(0.85)), xsiLowerSkin=doubleBaseType(valueOf_=str(0.85)))
    innerBorder = controlSurfaceBorderLeadingEdgeType(etaLE=doubleBaseType(valueOf_=str(innerEtaTE)), xsiTEUpper=doubleBaseType(valueOf_=str(innerXsiTE)), xsiTELower=doubleBaseType(valueOf_=str(0.02)), leadingEdgeShape=myleadingEdgeShape)
    outerBorder = controlSurfaceBorderLeadingEdgeType(etaLE=doubleBaseType(valueOf_=str(outerEtaTE)), xsiTEUpper=doubleBaseType(valueOf_=str(outerXsiTE)), xsiTELower=doubleBaseType(valueOf_=str(0.02)), leadingEdgeShape=myleadingEdgeShape)
    
    myOuterShape = controlSurfaceOuterShapeLeadingEdgeType(innerBorder=innerBorder, outerBorder=outerBorder)
    
    mySlat = leadingEdgeDeviceType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape)
    createPath(mySlat, typeOfSeg = "slat", uID=name + 'UID', innerX=innerX, outerX=outerX, innerHingeXsi = 0.5, outerHingeXsi = 0.5)
    return mySlat
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.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 #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
    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 #10
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 #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
    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 #12
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 #13
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)