Example #1
0
def createSpoiler(name, parentUID, innerEtaLE, innerEtaTE, innerXsiLE, innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE):
    #===========================================================================
    # Header
    #===========================================================================
    log.debug('VAMPzero SPOILER: Creating Spoiler: %s' % (str(name)))
    log.debug('VAMPzero SPOILER: innerEtaLE: %s' % str(innerEtaLE))
    log.debug('VAMPzero SPOILER: innerEtaTE: %s' % str(innerEtaTE))
    log.debug('VAMPzero SPOILER: innerXsiLE: %s' % str(innerXsiLE))
    log.debug('VAMPzero SPOILER: innerXsiTE: %s' % str(innerXsiTE))
    log.debug('VAMPzero SPOILER: outerEtaLE: %s' % str(outerEtaLE))
    log.debug('VAMPzero SPOILER: outerEtaTE: %s' % str(outerEtaTE))
    log.debug('VAMPzero SPOILER: outerXsiLE: %s' % str(outerXsiLE))
    log.debug('VAMPzero SPOILER: outerXsiTE: %s' % str(outerXsiTE))
    
    myName = stringBaseType(None, None, None, name)
    myDescription = stringBaseType(None, None, None, 'spoiler from VAMPzero')
    myParentUID = stringUIDBaseType(None, None, 'True', None, parentUID)

    myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(valueOf_=str(0.75)))
    innerBorder = controlSurfaceBorderSpoilerType(etaLE=doubleBaseType(valueOf_=str(innerEtaLE)), etaTE=doubleBaseType(valueOf_=str(innerEtaTE)), xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)), xsiTE=doubleBaseType(valueOf_=str(innerXsiTE)), leadingEdgeShape=myleadingEdgeShape)
    outerBorder = controlSurfaceBorderSpoilerType(etaLE=doubleBaseType(valueOf_=str(outerEtaLE)), etaTE=doubleBaseType(valueOf_=str(outerEtaTE)), xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)), xsiTE=doubleBaseType(valueOf_=str(outerXsiTE)), leadingEdgeShape=myleadingEdgeShape)
    
    myOuterShape = controlSurfaceOuterShapeSpoilerType(innerBorder=innerBorder, outerBorder=outerBorder)
    myStructure = wingComponentSegmentStructureType()
    mySpoiler = spoilerType(uID=name + 'UID', name=myName, description=myDescription, parentUID=myParentUID, outerShape=myOuterShape, structure=myStructure)
    createSpoilerStructure(mySpoiler)
    return mySpoiler
Example #2
0
def createPositioning(parent, uID, fromID, toID, length, sweep, dihedral,
                      name):
    '''
    Create a positioning for Fuselage Elements
    parent Element should be of PositioningsType 
    from ID must not be given, if None then element is placed relative to origin
    uID will be saved as "positioning"+uID
    @author: Jonas Jepsen
    '''
    #Convert Types
    mytoID = stringBaseType(None, None, None, toID)
    myName = stringBaseType(None, None, None, name)
    myLength = doubleBaseType(None, None, None, str(length))
    mySweep = doubleBaseType(None, None, None, str(sweep))
    myDihedral = doubleBaseType(None, None, None, str(dihedral))

    #Check if fromID is given
    #if it is given convert Type and create Positioning
    if fromID is not None:
        myfromID = stringBaseType(None, None, None, fromID)
        myPositioning = positioningType(None, None, None, uID, myName, None,
                                        myLength, mySweep, myDihedral,
                                        myfromID, mytoID)
    #if no from ID is given create Positioning with None
    else:
        myPositioning = positioningType(None, None, None, uID, myName, None,
                                        myLength, mySweep, myDihedral, None,
                                        mytoID)

    #Add to parent
    parent.add_positioning(myPositioning)
Example #3
0
def createRoller(uID='cruiseRoller1UID', eta=0.02, xsi=0.05, relHeight=0.3, positiv="False", negativ="True"):
    position = cruiseRollerPositionType(eta=doubleBaseType(valueOf_=str(eta)), xsi=doubleBaseType(valueOf_=str(xsi)), relHeight=doubleBaseType(valueOf_=str(relHeight)))
    parentAttachment = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    controlSurfaceAttachment = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    blockedDOF = blockedDOFType(positive=booleanBaseType(valueOf_=positiv), negative=booleanBaseType(valueOf_=negativ))
    
    return cruiseRollerType(uID=uID, position=position, parentAttachment=parentAttachment, controlSurfaceAttachment=controlSurfaceAttachment, blockedDOF=blockedDOF)
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.
    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 #5
0
def createTransformation(
    parent, refType="absGlobal", tx=0.0, ty=0.0, tz=0.0, sx=1.0, sy=1.0, sz=1.0, rx=0.0, ry=0.0, rz=0.0
):  # allgemein
    """
    This Method is used for creation in Transformation Element build up from pointTypes for Translation, Scaling and Rotation
    Note that in CPACS 1.0 Translation should be of Type pointAbsRelType Due to TIGL issues this feature is still unabled inside the cpacslib.py
    @author: Jonas Jepsen
    @param parent: should be any Type holding a TransformationType
    @param tx, ty, tz, sx, sy, sz, rx, ry, rz:Translation, Scaling and Rotation   
    """
    # Convert to CPACS Types

    myTranslation = pointAbsRelType(
        refType=refType,
        x=doubleBaseType(valueOf_=str(tx)),
        y=doubleBaseType(valueOf_=str(ty)),
        z=doubleBaseType(valueOf_=str(tz)),
    )
    myScaling = pointType(
        x=doubleBaseType(valueOf_=str(sx)), y=doubleBaseType(valueOf_=str(sy)), z=doubleBaseType(valueOf_=str(sz))
    )
    myRotation = pointType(
        x=doubleBaseType(valueOf_=str(rx)), y=doubleBaseType(valueOf_=str(ry)), z=doubleBaseType(valueOf_=str(rz))
    )

    # Create Element
    myTransformation = transformationType(scaling=myScaling, rotation=myRotation, translation=myTranslation)

    # Append to Parent
    parent.set_transformation(myTransformation)
Example #6
0
def createSparSegment(parent,
                      parentUID,
                      targetUID='FS',
                      material='aluminium7075',
                      numOfPoints=3,
                      typeOfSeg='other'):
    '''
    Used for generation of sparSegment within sparSegments
    @param parent: sparSegments, sparSegment will be added here

    @param id:  id of the spar either FS or RS
    @param material: uID of the material to be used
    @param numOfPoint: the number of SparPositions to position the spar
    '''
    myUID = parentUID + '' + targetUID
    myName = stringBaseType(None, None, None, myUID)
    myDescr = stringBaseType(None, None, None, myUID)

    #===========================================================================
    # Spar Position UIDS
    #===========================================================================
    mySparPositionUIDs = sparPositionUIDsType(None, None, None, None)
    for i in range(numOfPoints):
        sparPositionUID = stringUIDBaseType(None, None, None, None,
                                            myUID + '_P' + str(i))
        mySparPositionUIDs.add_sparPositionUID(sparPositionUID)

    #===========================================================================
    # Spar Cross Section
    #===========================================================================
    if typeOfSeg != 'strut':
        myMaterialUID = stringUIDBaseType(isLink='True', valueOf_=material)
        myThickness = doubleBaseType(valueOf_=str(0.003))
        myMaterial = materialDefinitionType(materialUID=myMaterialUID,
                                            thickness=myThickness)

    elif typeOfSeg == 'strut':
        myMaterial = materialDefinitionType(compositeUID = stringUIDBaseType(isLink='True',valueOf_='Comp_Shear'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\
                                         thicknessScaling=doubleBaseType(valueOf_='0.001'))

    myArea = doubleBaseType(None, None, None, str(0.0003))
    myCap = capType(None, None, None, myArea, myMaterial)

    myRelPos = doubleBaseType(None, None, None, str(0.5))
    myWeb = webType(None, None, None, myMaterial, myRelPos)

    myRotation = doubleBaseType(None, None, None, str(90.0))
    mySparCrossSection = sparCrossSectionType(None, None, None, myCap, myCap,
                                              myWeb, None, None, myRotation)

    #===========================================================================
    mySpar = sparSegmentType(None, None, None, myUID, myName, myDescr,
                             mySparPositionUIDs, mySparCrossSection)
    parent.add_sparSegment(mySpar)
Example #7
0
def createPointList(pointList):
    #new Point List object
    myPointList = pointListType(None, None, None, None)

    for [xvalue, yvalue] in pointList:
        #Convert Types and Create Point
        x = doubleBaseType(None, None, None, str(xvalue))
        y = doubleBaseType(None, None, None, str(yvalue))
        z = doubleBaseType(None, None, None, str(0.0))
        myPoint = pointType(None, None, None, None, x, y, z)
        #Add Point to PointList
        myPointList.add_point(myPoint)
    return myPointList
Example #8
0
def createPointList(pointList):
    # new Point List object
    myPointList = pointListType()

    for [xvalue, yvalue] in pointList:
        # Convert Types and Create Point
        x = doubleBaseType(valueOf_=str(xvalue))
        y = doubleBaseType(valueOf_=str(yvalue))
        z = doubleBaseType(valueOf_=str(0.0))
        myPoint = pointType(x=x, y=y, z=z)
        # Add Point to PointList
        myPointList.add_point(myPoint)
    return myPointList
Example #9
0
        def createPointList(nparray):
            '''
            create a point list for each cog location

            This method is currently without use, as long as there is no update to CPACS 2.2.1
            '''
            myPointList = pointListType()
            zero = doubleBaseType(valueOf_='0.')

            for item in nparray.tolist():
                newPoint = pointType(x=doubleBaseType(valueOf_=str(item)),y=zero, z=zero)
                myPointList.add_point(newPoint)

            return myPointList
Example #10
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
Example #11
0
        def createVectorPointList(nparray):
            '''
            create a point list for each cog location
            '''
            myPointList = pointListType()

            x = '; '.join(str(x) for x in nparray.tolist())

            zeros = np.zeros(nparray.shape)
            y = '; '.join(str(y) for y in zeros.tolist())

            newPoint = pointType(x=doubleBaseType(valueOf_=str(x)),y=doubleBaseType(valueOf_=y), z=doubleBaseType(valueOf_=y))
            myPointList.add_point(newPoint)

            return myPointList
Example #12
0
def createShell(parent, parentUID, typeOfSeg, thickness=0.003, pitch=0.14):
    '''
    Used for generation of wing upper and lower shell within a componentSegment
    @param parent: ComponentSegment object, upper and lower shell-object will be added here

    @param thickness:  thickness of the wing shell
    @param pitch: pitch of the stringers
    @param typeOfSeg: either advDoubleTrapezoid or trapezoid
    '''

    if typeOfSeg != 'strut':
        myAlu2024 = materialDefinitionType(materialUID=stringUIDBaseType(isLink='True', valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_=str(thickness)))
        myAlu7075 = materialDefinitionType(materialUID=stringUIDBaseType(isLink='True', valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness)))

        mySkin2024 = wingSkinType(material=myAlu2024)
        mySkin7075 = wingSkinType(material=myAlu7075)

        myStringerUp = wingStringerType(stringerStructureUID=stringUIDBaseType(valueOf_='Stringer_WING_up'), angle=doubleBaseType(valueOf_='0.0'), pitch=doubleBaseType(valueOf_=str(pitch)))
        myStringerLow = wingStringerType(stringerStructureUID=stringUIDBaseType(valueOf_='Stringer_WING_low'), angle=doubleBaseType(valueOf_='0.0'), pitch=doubleBaseType(valueOf_=str(pitch)))

        myShell2024 = wingShellType(uID='', skin=mySkin2024, stringer=myStringerLow)
        myShell7075 = wingShellType(uID='', skin=mySkin7075, stringer=myStringerUp)

        parent.get_structure().set_upperShell(myShell7075)
        parent.get_structure().set_lowerShell(myShell2024)

    elif typeOfSeg == 'strut':
        myComp_Long = materialDefinitionType(compositeUID = stringUIDBaseType(isLink='True',valueOf_='Comp_Long'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\
                                         thicknessScaling=doubleBaseType(valueOf_='0.001'))

        mySkinComp = wingSkinType(material=myComp_Long)
        myShellComp = wingShellType(uID='', skin=mySkinComp)

        parent.get_structure().set_upperShell(myShellComp)
        parent.get_structure().set_lowerShell(myShellComp)
Example #13
0
def createTrackAileron(uid, eta, trackType):
    eta = doubleBaseType(valueOf_=str(eta))
    trackType = stringBaseType(valueOf_=trackType)
    controlSurfaceAttachment = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    #parentAttachment = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    trackStructure = trackStructureType(controlSurfaceAttachment=controlSurfaceAttachment)
    return controlSurfaceTrackTypeType(uID=uid, eta=eta, trackType=trackType, trackStructure=trackStructure)
Example #14
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 #15
0
def createSparSegment(parent, parentUID, targetUID='FS', material='aluminium7075', numOfPoints=3, typeOfSeg='other'):
    '''
    Used for generation of sparSegment within sparSegments
    @param parent: sparSegments, sparSegment will be added here

    @param id:  id of the spar either FS or RS
    @param material: uID of the material to be used
    @param numOfPoint: the number of SparPositions to position the spar
    '''
    myUID = parentUID + '' + targetUID
    myName = stringBaseType(valueOf_=myUID)
    myDescr = stringBaseType(valueOf_= myUID)
    
    #===========================================================================
    # Spar Position UIDS
    #===========================================================================
    mySparPositionUIDs = sparPositionUIDsType()
    for i in range(numOfPoints):
        sparPositionUID = stringUIDBaseType(valueOf_=myUID + '_P' + str(i))
        mySparPositionUIDs.add_sparPositionUID(sparPositionUID)
    
    #===========================================================================
    # Spar Cross Section
    #===========================================================================
    if typeOfSeg != 'strut':
        myMaterialUID = stringUIDBaseType(isLink='True', valueOf_=material)
        myThickness = doubleBaseType(valueOf_=str(0.003))
        myMaterial = materialDefinitionType(materialUID=myMaterialUID, thickness=myThickness)

    elif typeOfSeg =='strut':
        #myMaterial = materialDefinitionType(compositeUID = stringUIDBaseType(isLink='True',valueOf_='Comp_Shear'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\
        #                                 thicknessScaling=doubleBaseType(valueOf_='0.001'))
        myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(isLink='True', valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(0.03)))
    myArea = doubleBaseType(valueOf_=str(0.0003))
    myCap = capType(area=myArea, material=myMaterial)
    
    myRelPos = doubleBaseType(valueOf_=str(0.5))
    myWeb = webType(material=myMaterial, relPos=myRelPos)
    
    myRotation = doubleBaseType(valueOf_= str(90.0))
    mySparCrossSection = sparCrossSectionType(upperCap=myCap, lowerCap=myCap, web1=myWeb, rotation=myRotation)
    
    #===========================================================================
    mySpar = sparSegmentType(uID=myUID, name=myName, description=myDescr, sparPositionUIDs=mySparPositionUIDs, sparCrossSection=mySparCrossSection)
    parent.add_sparSegment(mySpar)
Example #16
0
    def cpacsExport(self, CPACSObj):
        '''
        Export routine for the engine
        '''
        cpacsPath = '/cpacs/vehicles/aircraft/model/engines/engine'
        myEngine = getObjfromXpath(CPACSObj, cpacsPath)
        myEngine.set_uID('engine')
        myEngine.set_symmetry('x-z-plane')
        myEngine.set_parentUID(stringUIDBaseType(valueOf_="enginePylon"))

        x = doubleBaseType(valueOf_=str(self.xEngine.getValue()))
        y = doubleBaseType(valueOf_=str(self.yEngine.getValue()))
        z = doubleBaseType(valueOf_=str(self.zEngine.getValue()))
        myTranslation = pointAbsRelType(refType="absGlobal", x=x, y=y, z=z)
        myTransformation = transformationType(translation=myTranslation)
        myEngine.set_transformation(myTransformation)

        # Mass Export Engine Pylon
        mass = doubleBaseType(valueOf_=str(self.mEngine.getValue()))
        massIX = doubleBaseType(valueOf_=str(self.massIX.getValue()))
        massIY = doubleBaseType(valueOf_=str(self.massIY.getValue()))
        massIZ = doubleBaseType(valueOf_=str(self.massIZ.getValue()))
        massInertia = massInertiaType(Jxx=massIX, Jyy=massIY, Jzz=massIZ)

        cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mPowerUnits'
        mEngines = getObjfromXpath(CPACSObj, cpacsPath)
        massDescription = genericMassType(uID='engine_mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="engine"),
                                          massInertia=massInertia)
        mEngines.set_massDescription(massDescription)

        #call overall export method
        super(engine, self).cpacsExport(CPACSObj)
Example #17
0
def createPoint(parent, x, y, z=None):
    '''
    Methods builds a Point from PointType and adds it to parent
    @author: Jonas Jepsen
    @param parent: parent element (i.e. pointListType)
    @param x: X-Coordinate
    @param y: Y-Coordinate  
    @param z: Z-Coordinate, default is NONE
    '''
    xP = doubleBaseType(None, None, None, str(x))
    yP = doubleBaseType(None, None, None, str(0.0))
    zP = doubleBaseType(None, None, None, str(y))
    if z is None:
        myPoint = pointType(None, None, None, None, xP, yP, None)
    else:
        zP = doubleBaseType(None, None, None, str(z))
        myPoint = pointType(None, None, None, None, xP, yP, zP)
    parent.add_point(myPoint)
Example #18
0
def createPoint(parent, x, y, z=None):
    """
    Methods builds a Point from PointType and adds it to parent
    @author: Jonas Jepsen
    @param parent: parent element (i.e. pointListType)
    @param x: X-Coordinate
    @param y: Y-Coordinate  
    @param z: Z-Coordinate, default is NONE
    """
    xP = doubleBaseType(valueOf_=str(x))
    yP = doubleBaseType(valueOf_=str(0.0))
    zP = doubleBaseType(valueOf_=str(y))
    if z is None:
        myPoint = pointType(x=xP, y=yP)
    else:
        zP = doubleBaseType(valueOf_=str(z))
        myPoint = pointType(x=xP, y=yP, z=zP)
    parent.add_point(myPoint)
Example #19
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 #20
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
Example #21
0
def createDoubleTrapezoidWing(myWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, twist, xMAC25, etakf, strUID):
    '''
    This method creates a double trapezoid wing geometry in the 'myWing' parameter.
    @author: Jonas Jepsen
    @param myWing: wings CPACS object
    @param id: the VAMPzero-id of the wing 
    @param cTip: length of chord at wing tip [m]
    @param cRoot: length of chord at wing root [m]
    @param span: span of the wing [m]
    @param Sref: reference area [m^2]
    @param phiLE: sweep angle at the leading edge [deg]
    @param dihedral: dihedralangle of the wing [deg]
    @param twist: twist of the outer wing section [deg]     
    @param etakf: dimensionless span coordinate [-]
    @param strUID: the CPACS-uID of the wing
    '''
    # sections and positionings will be created, all existing sections and positionings will be deleted
    mySections = wingSectionsType()
    myPositionings = positioningsType()
    # calc Lvl 1 parameters
    taperRatio = (cTip/cRoot)
    cRoot, cKink, cTip = calcWing(span, Sref, taperRatio, phiLE, etakf)
    createWingSection(mySections, 0.,0.,0., cRoot,1.,cRoot, 0.,0.,0., 'NACA653218', 1, strUID + '_Sec1', strUID + '_Sec1', strUID + '_Sec1')
    createWingSection(mySections, 0.,0.,0., cKink,1.,cKink, 0.,0.,0., 'NACA653218', 1, strUID + '_Sec2', strUID + '_Sec2', strUID + '_Sec2')
    createWingSection(mySections, 0.,0.,0., cTip,1.,cTip, 0.,twist,0., 'NACA653218', 1, strUID + '_Sec3', strUID + '_Sec3', strUID + '_Sec3')

    # calc length from span, sweep and dihedral
    sweep_rad = phiLE/180. * pi
    dihedral_rad = dihedral/180. * pi
    length1 = (etakf*span/2.)/cos(sweep_rad)/cos(dihedral_rad)
    length2 = span/2.*(1-etakf)/cos(sweep_rad)/cos(dihedral_rad)
    
    createPositioning(myPositionings,str(id) + '_Pos1',None, str(id) + '_Sec1',0.,0.,0.,id)
    createPositioning(myPositionings,str(id) + '_Pos2',str(id) + '_Sec1',str(id) + '_Sec2',length1,phiLE,dihedral,id)
    createPositioning(myPositionings,str(id) + '_Pos3',str(id) + '_Sec2',str(id) + '_Sec3',length2,phiLE,dihedral,id)
    
    myWing.set_sections(mySections)
    myWing.set_positionings(myPositionings)

    createWingSegments(myWing, strUID, 2)
    
    createComponentSegment(myWing, strUID)

    # calc wing position
    tauk = cTip/cKink
    myLambda = span**2/Sref
    sweep_rad = 35./180.*pi
    tanPhi25a = calcPhi25a(sweep_rad, taperRatio, tauk, etakf, span, cRoot)
    tanPhi25i = calcPhi25i(sweep_rad, taperRatio, tauk, etakf, span, cRoot)
    Xef = calcXef(cRoot, myLambda, tanPhi25i, tanPhi25a, etakf, taperRatio, tauk)
    xRoot = calcXRoot(xMAC25, Xef, cRoot)
    # set wing x - position
    myWing.get_transformation().get_translation().set_x(doubleBaseType(None, None, None,str(xRoot)))
Example #22
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 #23
0
def createSpoiler(name, parentUID, innerEtaLE, innerEtaTE, innerXsiLE,
                  innerXsiTE, outerEtaLE, outerEtaTE, outerXsiLE, outerXsiTE):
    #===========================================================================
    # Header
    #===========================================================================
    log.debug('VAMPzero SPOILER: Creating Spoiler: %s' % (str(name)))
    log.debug('VAMPzero SPOILER: innerEtaLE: %s' % str(innerEtaLE))
    log.debug('VAMPzero SPOILER: innerEtaTE: %s' % str(innerEtaTE))
    log.debug('VAMPzero SPOILER: innerXsiLE: %s' % str(innerXsiLE))
    log.debug('VAMPzero SPOILER: innerXsiTE: %s' % str(innerXsiTE))
    log.debug('VAMPzero SPOILER: outerEtaLE: %s' % str(outerEtaLE))
    log.debug('VAMPzero SPOILER: outerEtaTE: %s' % str(outerEtaTE))
    log.debug('VAMPzero SPOILER: outerXsiLE: %s' % str(outerXsiLE))
    log.debug('VAMPzero SPOILER: outerXsiTE: %s' % str(outerXsiTE))

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

    myleadingEdgeShape = leadingEdgeShapeType(relHeightLE=doubleBaseType(
        valueOf_=str(0.75)))
    innerBorder = controlSurfaceBorderSpoilerType(
        etaLE=doubleBaseType(valueOf_=str(innerEtaLE)),
        etaTE=doubleBaseType(valueOf_=str(innerEtaTE)),
        xsiLE=doubleBaseType(valueOf_=str(innerXsiLE)),
        xsiTE=doubleBaseType(valueOf_=str(innerXsiTE)),
        leadingEdgeShape=myleadingEdgeShape)
    outerBorder = controlSurfaceBorderSpoilerType(
        etaLE=doubleBaseType(valueOf_=str(outerEtaLE)),
        etaTE=doubleBaseType(valueOf_=str(outerEtaTE)),
        xsiLE=doubleBaseType(valueOf_=str(outerXsiLE)),
        xsiTE=doubleBaseType(valueOf_=str(outerXsiTE)),
        leadingEdgeShape=myleadingEdgeShape)

    myOuterShape = controlSurfaceOuterShapeSpoilerType(innerBorder=innerBorder,
                                                       outerBorder=outerBorder)
    myStructure = wingComponentSegmentStructureType()
    mySpoiler = spoilerType(uID=name + 'UID',
                            name=myName,
                            description=myDescription,
                            parentUID=myParentUID,
                            outerShape=myOuterShape,
                            structure=myStructure)
    createSpoilerStructure(mySpoiler)
    return mySpoiler
Example #24
0
def createActuator(uID='act', actuatorUID='Aileron_Act', etaControlSurface=0.3, parentXsi=0.7, parentHeight=0.1, controlSurfaceXsi=0.7, controlSurfaceHeight=0.1):
    #===============================================================================
    # Create the attachment 
    #===============================================================================
    etaControlSurface = doubleBaseType(valueOf_=str(etaControlSurface))
    material = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))

    parentXsi = doubleBaseType(valueOf_=str(parentXsi))
    parentHeight = doubleBaseType(valueOf_=str(parentHeight))
    parentAttachment = actuatorParentAttachmentType(parentXsi=parentXsi, parentHeight=parentHeight, material=material)

    parentXsi = doubleBaseType(valueOf_=str(controlSurfaceXsi))
    parentHeight = doubleBaseType(valueOf_=str(controlSurfaceHeight))
    controlSurfaceAttachment = actuatorControlSurfaceAttachmentType(parentXsi=parentXsi, parentHeight=parentHeight, material=material)
    
    attachment = actuatorAttachmentType(etaControlSurface=etaControlSurface, parentAttachment=parentAttachment, controlSurfaceAttachment=controlSurfaceAttachment)
    
    #===========================================================================
    # Create the actuator
    #===========================================================================
    
    return controlSurfaceActuatorType(uID=uID, actuatorUID=stringUIDBaseType(isLink='True', valueOf_=actuatorUID), attachment=attachment)
Example #25
0
def createShell(parent, parentUID, typeOfSeg, thickness=0.003, pitch=0.14):
    '''
    Used for generation of wing upper and lower shell within a componentSegment
    @param parent: ComponentSegment object, upper and lower shell-object will be added here

    @param thickness:  thickness of the wing shell
    @param pitch: pitch of the stringers
    @param typeOfSeg: either advDoubleTrapezoid or trapezoid
    '''

    if typeOfSeg != 'strut':
        myAlu2024 = materialDefinitionType(
            materialUID=stringUIDBaseType(isLink='True',
                                          valueOf_='aluminium2024'),
            thickness=doubleBaseType(valueOf_=str(thickness)))
        myAlu7075 = materialDefinitionType(
            materialUID=stringUIDBaseType(isLink='True',
                                          valueOf_='aluminium7075'),
            thickness=doubleBaseType(valueOf_=str(thickness)))

        mySkin2024 = wingSkinType(material=myAlu2024)
        mySkin7075 = wingSkinType(material=myAlu7075)

        myStringerUp = wingStringerType(
            stringerStructureUID=stringUIDBaseType(
                valueOf_='Stringer_WING_up'),
            angle=doubleBaseType(valueOf_='0.0'),
            pitch=doubleBaseType(valueOf_=str(pitch)))
        myStringerLow = wingStringerType(
            stringerStructureUID=stringUIDBaseType(
                valueOf_='Stringer_WING_low'),
            angle=doubleBaseType(valueOf_='0.0'),
            pitch=doubleBaseType(valueOf_=str(pitch)))

        myShell2024 = wingShellType(uID='',
                                    skin=mySkin2024,
                                    stringer=myStringerLow)
        myShell7075 = wingShellType(uID='',
                                    skin=mySkin7075,
                                    stringer=myStringerUp)

        parent.get_structure().set_upperShell(myShell7075)
        parent.get_structure().set_lowerShell(myShell2024)

    elif typeOfSeg == 'strut':
        myComp_Long = materialDefinitionType(compositeUID = stringUIDBaseType(isLink='True',valueOf_='Comp_Long'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\
                                         thicknessScaling=doubleBaseType(valueOf_='0.001'))

        mySkinComp = wingSkinType(material=myComp_Long)
        myShellComp = wingShellType(uID='', skin=mySkinComp)

        parent.get_structure().set_upperShell(myShellComp)
        parent.get_structure().set_lowerShell(myShellComp)
Example #26
0
def createStep(deflection, x1, y1, z1, x2, z2, rotation):
    relDeflection = doubleBaseType(valueOf_=str(deflection))
    innerHingeTranslation = pointType(x=doubleBaseType(valueOf_=str(x1)),
                                      y=doubleBaseType(valueOf_=str(y1)),
                                      z=doubleBaseType(valueOf_=str(z1)))
    outerHingeTranslation = pointXZType(x=doubleBaseType(valueOf_=str(x2)),
                                        z=doubleBaseType(valueOf_=str(z2)))
    hingeLineRotation = doubleBaseType(valueOf_=str(rotation))

    return controlSurfaceStepType(relDeflection=relDeflection,
                                  innerHingeTranslation=innerHingeTranslation,
                                  outerHingeTranslation=outerHingeTranslation,
                                  hingeLineRotation=hingeLineRotation)
Example #27
0
def createRoller(uID='cruiseRoller1UID',
                 eta=0.02,
                 xsi=0.05,
                 relHeight=0.3,
                 positiv="False",
                 negativ="True"):
    position = cruiseRollerPositionType(
        eta=doubleBaseType(valueOf_=str(eta)),
        xsi=doubleBaseType(valueOf_=str(xsi)),
        relHeight=doubleBaseType(valueOf_=str(relHeight)))
    parentAttachment = materialDefinitionType(
        materialUID=stringBaseType(valueOf_='aluminium2024'),
        thickness=doubleBaseType(valueOf_='0.001'))
    controlSurfaceAttachment = materialDefinitionType(
        materialUID=stringBaseType(valueOf_='aluminium2024'),
        thickness=doubleBaseType(valueOf_='0.001'))
    blockedDOF = blockedDOFType(positive=booleanBaseType(valueOf_=positiv),
                                negative=booleanBaseType(valueOf_=negativ))

    return cruiseRollerType(uID=uID,
                            position=position,
                            parentAttachment=parentAttachment,
                            controlSurfaceAttachment=controlSurfaceAttachment,
                            blockedDOF=blockedDOF)
Example #28
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 #29
0
    def cpacsExport(self, CPACSObj):
        '''
        Export routine for the main and nose landing gear
        '''

        # Main Gear Export
        cpacsPath = '/cpacs/vehicles/aircraft/model/landingGear/mainGears/mainGear'
        myMainGear = getObjfromXpath(CPACSObj, cpacsPath)
        myMainGear.set_parentUID(stringUIDBaseType(valueOf_="fuselage"))
        myMainGear.set_uID('mainGear')
        myMainGear.set_symmetry('x-z-plane')

        # Mass Export Main Landing Gear
        mass = doubleBaseType(valueOf_=str(self.mLandingGear.getValue()))
        cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mLandingGears'
        myLandingGears = getObjfromXpath(CPACSObj, cpacsPath)
        massDescription = genericMassType(uID='mainGear_Mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="mainGear"))
        myRightMainGear = mLandingGearType(massDescription=massDescription)
        myLandingGears.add_mLandingGear(myRightMainGear)

        # Nose Gear Export
        cpacsPath = '/cpacs/vehicles/aircraft/model/landingGear/noseGears/noseGear'
        myNoseGear = getObjfromXpath(CPACSObj, cpacsPath)
        myNoseGear.set_parentUID(stringUIDBaseType(valueOf_="fuselage"))
        myNoseGear.set_uID('noseGear')

        # Mass Export Nose Landing Gear
        mass = doubleBaseType(valueOf_=str(self.mNoseGear.getValue()))
        cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mLandingGears'
        myLandingGears = getObjfromXpath(CPACSObj, cpacsPath)
        massDescription = genericMassType(uID='noseGear_mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="noseGear"))
        myRightMainGear = mLandingGearType(massDescription=massDescription)
        myLandingGears.add_mLandingGear(myRightMainGear)

        #call overall export method
        super(landingGear, self).cpacsExport(CPACSObj)
Example #30
0
def createPositioning(parent, uID, fromID, toID, length, sweep, dihedral, name):
    """
    Create a positioning for Fuselage Elements
    parent Element should be of PositioningsType 
    from ID must not be given, if None then element is placed relative to origin
    uID will be saved as "positioning"+uID
    @author: Jonas Jepsen
    """
    # Convert Types
    mytoID = stringBaseType(valueOf_=toID)
    myName = stringBaseType(valueOf_=name)
    myLength = doubleBaseType(valueOf_=str(length))
    mySweep = doubleBaseType(valueOf_=str(sweep))
    myDihedral = doubleBaseType(valueOf_=str(dihedral))

    # Check if fromID is given
    # if it is given convert Type and create Positioning
    if fromID is not None:
        myfromID = stringBaseType(valueOf_=fromID)
        myPositioning = positioningType(
            uID=uID,
            name=myName,
            length=myLength,
            sweepAngle=mySweep,
            dihedralAngle=myDihedral,
            fromSectionUID=myfromID,
            toSectionUID=mytoID,
        )
    # if no from ID is given create Positioning with None
    else:
        myPositioning = positioningType(
            uID=uID, name=myName, length=myLength, sweepAngle=mySweep, dihedralAngle=myDihedral, toSectionUID=mytoID
        )

    # Add to parent
    parent.add_positioning(myPositioning)
Example #31
0
def createStep(deflection, x1, y1, z1, x2, z2, rotation):
    relDeflection = doubleBaseType(valueOf_=str(deflection))
    innerHingeTranslation = pointType(
        x=doubleBaseType(valueOf_=str(x1)), y=doubleBaseType(valueOf_=str(y1)), z=doubleBaseType(valueOf_=str(z1))
    )
    outerHingeTranslation = pointXZType(x=doubleBaseType(valueOf_=str(x2)), z=doubleBaseType(valueOf_=str(z2)))
    hingeLineRotation = doubleBaseType(valueOf_=str(rotation))

    return controlSurfaceStepType(
        relDeflection=relDeflection,
        innerHingeTranslation=innerHingeTranslation,
        outerHingeTranslation=outerHingeTranslation,
        hingeLineRotation=hingeLineRotation,
    )
Example #32
0
def createTransformation(parent,
                         refType='absGlobal',
                         tx=0.,
                         ty=0.,
                         tz=0.,
                         sx=1.,
                         sy=1.,
                         sz=1.,
                         rx=0.,
                         ry=0.,
                         rz=0.):  # allgemein
    '''
    This Method is used for creation in Transformation Element build up from pointTypes for Translation, Scaling and Rotation
    Note that in CPACS 1.0 Translation should be of Type pointAbsRelType Due to TIGL issues this feature is still unabled inside the cpacslib.py
    @author: Jonas Jepsen
    @param parent: should be any Type holding a TransformationType
    @param tx, ty, tz, sx, sy, sz, rx, ry, rz:Translation, Scaling and Rotation   
    '''
    # Convert to CPACS Types

    myTranslation = pointAbsRelType(refType=refType,
                                    x=doubleBaseType(valueOf_=str(tx)),
                                    y=doubleBaseType(valueOf_=str(ty)),
                                    z=doubleBaseType(valueOf_=str(tz)))
    myScaling = pointType(x=doubleBaseType(valueOf_=str(sx)),
                          y=doubleBaseType(valueOf_=str(sy)),
                          z=doubleBaseType(valueOf_=str(sz)))
    myRotation = pointType(x=doubleBaseType(valueOf_=str(rx)),
                           y=doubleBaseType(valueOf_=str(ry)),
                           z=doubleBaseType(valueOf_=str(rz)))

    #Create Element
    myTransformation = transformationType(scaling=myScaling,
                                          rotation=myRotation,
                                          translation=myTranslation)

    #Append to Parent
    parent.set_transformation(myTransformation)
Example #33
0
def createStrut(myWing, id, tcRoot, tcTip, cTip, cRoot, span, phiLE, dihedral, twist, xRoot, yRoot, etaStrut, strUID):
    '''
    This method creates a trapezoid wing geometry in the 'myWing' parameter.
    @author: Jonas Jepsen
    @param myWing: wings CPACS object
    @param id: the VAMPzero-id of the wing 
    @param cTip: length of chord at wing tip [m]
    @param cRoot: length of chord at wing root [m]
    @param span: span of the wing [m]
    @param phiLE: sweep angle at the leading edge [deg]
    @param dihedral: dihedralangle of the wing [deg]
    @param twist: twist of the outer wing section [deg]
    @param strUID: the CPACS-uID of the wing
    '''
    # sections and positionings will be created, all existing sections and positionings will be deleted
    mySections = wingSectionsType()
    myPositionings = positioningsType()

    incidence_angle = 2.

    createWingSection(mySections, tcRoot / 0.09, 0., 0., 0., cRoot, 1., cRoot, 0., incidence_angle, 0., 'NACA0009', 1, strUID + '_Sec1', strUID + '_Sec1', strUID + '_Sec1')
    createWingSection(mySections, tcRoot / 0.09, 0., 0., 0., cRoot, 1., cRoot, dihedral, incidence_angle, 0., 'NACA0009', 1, strUID + '_Sec2', strUID + '_Sec2', strUID + '_Sec2')
    createWingSection(mySections, tcTip / 0.09, 0., 0., 0., cTip, 1., cTip, dihedral, incidence_angle, 0., 'NACA0009', 1, strUID + '_Sec3', strUID + '_Sec3', strUID + '_Sec3')

    createPositioning(myPositionings, str(id) + '_Pos1', None, str(id) + '_Sec1', 0., 0., 0., id)
    createPositioning(myPositionings, str(id) + '_Pos2', str(id) + '_Sec1', str(id) + '_Sec2', yRoot, 0., 0., id)
    createPositioning(myPositionings, str(id) + '_Pos3', str(id) + '_Sec2', str(id) + '_Sec3', span, phiLE, dihedral, id)

    myWing.set_sections(mySections)
    myWing.set_positionings(myPositionings)
    
    createWingSegments(myWing, strUID, 2)

    createComponentSegment(myWing, strUID, fromElement='_Sec2_Elem1')
    createRibs(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strut', etaStrut=etaStrut)
    createSpars(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strut')
    createShell(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strut')

    createWingFuselageAttachment(myWing.get_componentSegments().get_componentSegment()[0], strUID, typeOfSeg='strut')
    createWingWingAttachment(myWing.get_componentSegments().get_componentSegment()[0], strUID, typeOfSeg='strut')

    # set wing x - position and twist
    myWing.get_transformation().get_translation().set_x(doubleBaseType(None, None, None, str(xRoot)))
    #myWing.get_transformation().get_translation().set_y(doubleBaseType(None, None, None, str(yRoot)))
Example #34
0
    def cpacsExport(self, CPACSObj):
        '''
        Export routine for the pylon
        '''

        # pylon
        cpacsPath = '/cpacs/vehicles/aircraft/model/enginePylons/enginePylon'
        myPylon = getObjfromXpath(CPACSObj, cpacsPath)
        myPylon.set_uID('enginePylon')
        if self.aircraft.engine.location.getValue():
            myPylon.set_parentUID(stringUIDBaseType(valueOf_="wing"))
        else:
            myPylon.set_parentUID(stringUIDBaseType(valueOf_="fuselage"))

        # Mass Export Engine Pylon
        mass = doubleBaseType(valueOf_=str(self.mPylon.getValue()))
        cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mPylons'
        mPylons = getObjfromXpath(CPACSObj, cpacsPath)
        massDescription = genericMassType(uID='pylon_mass', mass=mass, parentUID=stringUIDBaseType(valueOf_="enginePylon"))
        mPylons.set_massDescription(massDescription)

        #call overall export method
        super(pylon, self).cpacsExport(CPACSObj)
Example #35
0
def createTrackFlap(uID, eta, trackType, trackSubType=None, actuatorcounter=1):
    eta = doubleBaseType(valueOf_=str(eta))
    trackType = stringBaseType(valueOf_=trackType)
    if trackSubType is not None:
        trackSubType = stringBaseType(valueOf_=trackSubType)
    
    global nFlapActuators
    trackActuator = trackActuatorType(uID=uID + '_actuatorUID', actuatorUID=stringUIDBaseType(isLink='true', valueOf_='Act_FT'+str(nFlapActuators)), material=materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001')))
    nFlapActuators += 1
    controlSurfaceAttachment = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    #parentAttachment = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    sidePanels = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    upperPanel = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    lowerPanel = materialDefinitionType(materialUID=stringBaseType(valueOf_='titan'), thickness=doubleBaseType(valueOf_='0.001'))
    rollerTrack = materialDefinitionType(materialUID=stringBaseType(valueOf_='titan'), thickness=doubleBaseType(valueOf_='0.001'))
    ribs = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    car = materialDefinitionType(materialUID=stringBaseType(valueOf_='aluminium2024'), thickness=doubleBaseType(valueOf_='0.001'))
    
    trackStructure = trackStructureType(controlSurfaceAttachment=controlSurfaceAttachment, sidePanels=sidePanels, upperPanel=upperPanel, lowerPanel=lowerPanel, rollerTrack=rollerTrack, ribs=ribs, car=car)
    
    if trackSubType is None:
        return controlSurfaceTrackTypeType(uID=uID, eta=eta, trackType=trackType, trackStructure=trackStructure, actuator=trackActuator)
    else:
        return controlSurfaceTrackTypeType(uID=uID, eta=eta, trackType=trackType, trackSubType=trackSubType, trackStructure=trackStructure, actuator=trackActuator)
Example #36
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 #37
0
def createStrutBracedWing(myWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, twist, xMAC25, etaFus, etaStrut, tcRoot, tcTip, xRoot, strUID):
    '''
    This method creates a double trapezoid wing geometry in the 'myWing' parameter.
    @author: Jonas Jepsen
    @param myWing: wings CPACS object
    @param id: the VAMPzero-id of the wing 
    @param cTip: length of chord at wing tip [m]
    @param cRoot: length of chord at wing root [m]
    @param span: span of the wing [m]
    @param Sref: reference area [m^2]
    @param phiLE: sweep angle at the leading edge [deg]
    @param dihedral: dihedralangle of the wing [deg]
    @param twist: twist of the outer wing section [deg]     
    @param etakf: dimensionless span coordinate [-]
    @param strUID: the CPACS-uID of the wing
    '''
    mySections = wingSectionsType()
    myPositionings = positioningsType()
    # calc Lvl 1 parameters
    taperRatio = (cTip/cRoot)
    #cRoot, cFuselage, cTip = calcWing(span, Sref, taperRatio, phiLE, etaFus)

    cStrut = cRoot+(cTip-cRoot)*(etaStrut-etaFus)/(1-etaFus)

    # calc length from span, sweep and dihedral
    sweep_rad = phiLE/180. * pi
    dihedral_rad = dihedral/180. * pi
    length1 = (etaFus*span/2.)
    length2 = (etaStrut-etaFus)*span/2/cos(sweep_rad)/cos(dihedral_rad)
    length3 = span/2.*(1-etaStrut)/cos(sweep_rad)/cos(dihedral_rad)

    # Increase (or reduce the twist by 4deg as that is the overall angle of incidence of the wing)
    incidenceAngle = 4.
    twist = twist + incidenceAngle
    twistgrad = twist / (span / 2.)
    twist2 = twistgrad * length2
    twist3 = twist

    createWingSection(mySections, tcRoot/0.09, 0.,0.,0., cRoot,1.,cRoot, 0.,incidenceAngle,0., 'NACA0009', 1, strUID + '_Sec1', strUID + '_Sec1', strUID + '_Sec1')
    createWingSection(mySections, tcRoot / 0.18, 0.,0.,0., cRoot,1.,cRoot, 0.,incidenceAngle,0., 'NACA653218', 1, strUID + '_Sec2', strUID + '_Sec2', strUID + '_Sec2')
    createWingSection(mySections, tcRoot / 0.18, 0.,0.,0., cStrut,1.,cStrut, 0.,twist2,0., 'NACA653218', 1, strUID + '_Sec3', strUID + '_Sec3', strUID + '_Sec3')
    createWingSection(mySections, tcTip / 0.18, 0.,0.,0., cTip,1.,cTip, 0.,twist3,0., 'NACA653218', 1, strUID + '_Sec4', strUID + '_Sec4', strUID + '_Sec4')

    createPositioning(myPositionings,str(id) + '_Pos1',None, str(id) + '_Sec1',0.,0.,0.,id)
    createPositioning(myPositionings,str(id) + '_Pos2',str(id) + '_Sec1',str(id) + '_Sec2',length1,0.,0.,id)
    createPositioning(myPositionings,str(id) + '_Pos3',str(id) + '_Sec2',str(id) + '_Sec3',length2,phiLE,dihedral,id)
    createPositioning(myPositionings,str(id) + '_Pos4',str(id) + '_Sec3',str(id) + '_Sec4',length3,phiLE,dihedral,id)
    
    myWing.set_sections(mySections)
    myWing.set_positionings(myPositionings)

    createWingSegments(myWing, strUID, 3)
    createComponentSegment(myWing, strUID)

    # Ribs outboard of the Fuselage section are placed at 0.8 m distance
    nouterRibs = int(ceil((0.95 - etaFus - 0.05) * span / 2. / 0.8))
    createRibs(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strutBracedWing', etaFus=etaFus, nRibs=nouterRibs, etaStrut=etaStrut, span=span / 2., phi25 = phiLE)
    createSpars(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strutBracedWing', etaFus=etaFus, cTip=cTip, cRoot=cRoot)
    createShell(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strutBracedWing')

    iRib = int(span * (0.9 - etaStrut) / (2 * 0.8)) - 1
    if iRib == 1:
        iRib = 2
    createTanks(myWing.get_componentSegments().get_componentSegment()[0], strUID, typeOfSeg='strutBracedWing', nRib=iRib)

    createWingFuselageAttachment(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'advDoubletrapezoid')

    # set wing x - position and twist
    myWing.get_transformation().get_translation().set_x(doubleBaseType(None, None, None, str(xRoot)))
Example #38
0
def createStrut(myWing, id, tcRoot, tcTip, cTip, cRoot, span, phiLE, dihedral,
                twist, xRoot, yRoot, etaStrut, strUID):
    '''
    This method creates a trapezoid wing geometry in the 'myWing' parameter.
    @author: Jonas Jepsen
    @param myWing: wings CPACS object
    @param id: the VAMPzero-id of the wing 
    @param cTip: length of chord at wing tip [m]
    @param cRoot: length of chord at wing root [m]
    @param span: span of the wing [m]
    @param phiLE: sweep angle at the leading edge [deg]
    @param dihedral: dihedralangle of the wing [deg]
    @param twist: twist of the outer wing section [deg]
    @param strUID: the CPACS-uID of the wing
    '''
    # sections and positionings will be created, all existing sections and positionings will be deleted
    mySections = wingSectionsType()
    myPositionings = positioningsType()

    incidence_angle = 2.

    createWingSection(mySections, tcRoot / 0.09, 0., 0., 0., cRoot, 1., cRoot,
                      0., incidence_angle, 0., 'NACA0009', 1, strUID + '_Sec1',
                      strUID + '_Sec1', strUID + '_Sec1')
    createWingSection(mySections, tcRoot / 0.09, 0., 0., 0., cRoot, 1., cRoot,
                      dihedral, incidence_angle, 0., 'NACA0009', 1,
                      strUID + '_Sec2', strUID + '_Sec2', strUID + '_Sec2')
    createWingSection(mySections, tcTip / 0.09, 0., 0., 0., cTip, 1., cTip,
                      dihedral, incidence_angle, 0., 'NACA0009', 1,
                      strUID + '_Sec3', strUID + '_Sec3', strUID + '_Sec3')

    createPositioning(myPositionings,
                      str(id) + '_Pos1', None,
                      str(id) + '_Sec1', 0., 0., 0., id)
    createPositioning(myPositionings,
                      str(id) + '_Pos2',
                      str(id) + '_Sec1',
                      str(id) + '_Sec2', yRoot, 0., 0., id)
    createPositioning(myPositionings,
                      str(id) + '_Pos3',
                      str(id) + '_Sec2',
                      str(id) + '_Sec3', span, phiLE, dihedral, id)

    myWing.set_sections(mySections)
    myWing.set_positionings(myPositionings)

    createWingSegments(myWing, strUID, 2)

    createComponentSegment(myWing, strUID, fromElement='_Sec2_Elem1')
    createRibs(myWing.get_componentSegments().get_componentSegment()[0],
               strUID,
               'strut',
               etaStrut=etaStrut)
    createSpars(myWing.get_componentSegments().get_componentSegment()[0],
                strUID, 'strut')
    createShell(myWing.get_componentSegments().get_componentSegment()[0],
                strUID, 'strut')

    createWingFuselageAttachment(
        myWing.get_componentSegments().get_componentSegment()[0],
        strUID,
        typeOfSeg='strut')
    createWingWingAttachment(
        myWing.get_componentSegments().get_componentSegment()[0],
        strUID,
        typeOfSeg='strut')

    # set wing x - position and twist
    myWing.get_transformation().get_translation().set_x(
        doubleBaseType(None, None, None, str(xRoot)))
Example #39
0
def createRibs(parent, parentUID, typeOfSeg, thickness=0.03, pitch=.8, nRibs=None, etaFus=0.2, etaEng=.3, span=17., fanDiameter=1.9, etaStrut=0.0, phi25 = 0.0):
    '''
    Used for generation of a ribs definition in the wing 

    @param parent: ComponentSegment object, ribsDefinition will be added here
    @param thickness:  thickness of the ribs
    @param pitch: pitch of the ribs
    @param typeOfSeg: either advDoubleTrapezoid or trapezoid
    '''
    myUID = parentUID + '_ribs'
    ribsList = []

    #===============================================================================
    # Advanced Double Trapezoid 
    #===============================================================================
    if typeOfSeg.lower() == 'advdoubletrapezoid':
        myName = stringBaseType(valueOf_='wing_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness)))
        myCrossSection = wingRibCrossSectionType(material=myMaterial)
        ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS')
        ribStart = stringBaseType(valueOf_=parentUID + '_Spar_FS')
        ribEnd = stringBaseType(valueOf_=parentUID + '_Spar_RS')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.')))
        ribCrossing = ribCrossingBehaviourType(valueOf_='cross')

        #=======================================================================
        # First set of 4 ribs inside the fuselage
        #=======================================================================
        etaStart = doubleBaseType(valueOf_='0.0')
        etaEnd = doubleBaseType(valueOf_=str(etaFus))
        innerRibs = doubleBaseType(valueOf_= 4)
        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=innerRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)
        
        myUID = parentUID + '_ribs_inner'
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

        #===============================================================
        # Second set outside of the fuselage up to the engine
        #===============================================================
        etaPylon = 1. / 10. * fanDiameter / span
        etaStart = doubleBaseType(valueOf_=str(etaFus + pitch / span))
        etaEnd = doubleBaseType(valueOf_=str(etaEng - etaPylon))
        middleRibs = int(ceil((etaEng - etaPylon - etaFus) * span / pitch)) - 1
        if middleRibs < 1:
            middleRibs = 1
        middleRibs = doubleBaseType(valueOf_=middleRibs)
        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=middleRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)
        
        myUID = parentUID + '_ribs_engine1'
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

        #===============================================================
        # Third set one ribs outside of the pylon
        #===============================================================
        etaEnd = doubleBaseType(valueOf_= str(etaEng + etaPylon))
        pylonRibs = doubleBaseType(valueOf_= str(1))
        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=pylonRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)
        
        myUID = parentUID + '_ribs_engine2'
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

        #===============================================================
        # Fourth set outside of the engine
        #===============================================================
        etaStart = doubleBaseType(valueOf_= str(etaEng + etaPylon + pitch / span))
        etaEnd = doubleBaseType(valueOf_= '0.95')
        
        ribCrossing = ribCrossingBehaviourType(valueOf_='end')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='wing_Spar_FS'), \
                                           z=doubleBaseType(valueOf_='90.'))

        outerRibs = int(ceil((0.95 - etaEng + etaPylon) * span / pitch)) - 1
        outerRibs = doubleBaseType(valueOf_= outerRibs)

        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=outerRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)
        myUID = parentUID + '_ribs_outer'
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

    #===============================================================================
    # Strut Braced Wing
    #===============================================================================
    if typeOfSeg.lower() == 'strutbracedwing':
        myName = stringBaseType(valueOf_='wing_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness)))
        myCrossSection = wingRibCrossSectionType(material=myMaterial)
        ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS')
        ribStart = stringBaseType(valueOf_=parentUID + '_Spar_FS')
        ribEnd = stringBaseType(valueOf_=parentUID + '_Spar_RS')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.')))
        ribCrossing = ribCrossingBehaviourType(valueOf_='cross')

        #=======================================================================
        # First set of 4 ribs inside the fuselage
        #=======================================================================
        etaStart = doubleBaseType(valueOf_='0.0')
        etaEnd = doubleBaseType(valueOf_=str(etaFus))
        innerRibs = doubleBaseType(valueOf_=4)
        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=innerRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)

        myUID = parentUID + '_ribs_inner'
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

        #===============================================================
        # Second set outside of the fuselage up to the strut
        #===============================================================
        etaStart = doubleBaseType(valueOf_=str(etaFus + pitch / span + phi25 * 0.0002))
        etaEnd = doubleBaseType(valueOf_=str(etaStrut))
        middleRibs = int(ceil((etaStrut - etaFus) * span / pitch)) - 1
        middleRibs = doubleBaseType(valueOf_=middleRibs)
        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=middleRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)

        myUID = parentUID + '_ribs_strut'
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

        #===============================================================
        # Third set outside of the spar
        #===============================================================
        etaStart = doubleBaseType(valueOf_=str(etaStrut + pitch / span))
        etaEnd = doubleBaseType(valueOf_='0.95')

        ribCrossing = ribCrossingBehaviourType(valueOf_='end')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='wing_Spar_FS'), z=doubleBaseType(valueOf_=str('90.')))

        outerRibs = int(ceil((0.95 - etaStrut) * span / pitch)) - 1
        outerRibs = doubleBaseType(valueOf_=outerRibs)

        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=outerRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)

        myUID = parentUID + '_ribs_outer'
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

    #===============================================================================
    # Strut (And only the strut not the wing that goes along with it)
    #===============================================================================
    if typeOfSeg.lower() == 'strut':
        myName = stringBaseType(valueOf_='strut_ribs')

        # Rib Cross Section
        #=======================================================================
        #myMaterial = materialDefinitionType(compositeUID=stringUIDBaseType(isLink='True',valueOf_='Comp_Shear'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\
        #                                  thicknessScaling=doubleBaseType(valueOf_='0.001'))
        myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness)))
        myCrossSection = wingRibCrossSectionType(material=myMaterial)
        ribReference = stringBaseType(valueOf_='leadingEdge')
        ribStart = stringBaseType(valueOf_='leadingEdge')
        ribEnd = stringBaseType(valueOf_='trailingEdge')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.')))
        ribCrossing = ribCrossingBehaviourType(valueOf_='cross')

        etaStart = doubleBaseType(valueOf_=str(0.))
        etaEnd = doubleBaseType(valueOf_=str(1.))
        middleRibs = doubleBaseType(valueOf_=5.)
        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=middleRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)

        myUID = parentUID + '_ribs'
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

    #===============================================================================
    # Aileron 
    #===============================================================================
    if typeOfSeg.lower() == 'aileron':
        myName = stringBaseType(valueOf_='aileron_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness)))
        myCrossSection = wingRibCrossSectionType(material= myMaterial)
        
        # Rib Positioning
        #=======================================================================
        etaStart = doubleBaseType(valueOf_='0.')
        etaEnd = doubleBaseType(valueOf_='1.')
        ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS')
        ribStart = stringBaseType(valueOf_='leadingEdge')
        ribEnd = stringBaseType(valueOf_='trailingEdge')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.')))
        ribCrossing = ribCrossingBehaviourType(valueOf_='cross')

        if nRibs is None:
            ribSpacing = doubleBaseType(valueOf_=pitch)
            ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                          spacing=ribSpacing, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)
        else: 
            nRibs = doubleBaseType(valueOf_=nRibs)
            ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                          numberOfRibs=nRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)
        
        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

    if typeOfSeg.lower() == 'trapezoid':
        myName = stringBaseType(valueOf_='trapezoid_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness)))
        myCrossSection = wingRibCrossSectionType(material= myMaterial)

        # Rib Positioning
        #=======================================================================
        etaStart = doubleBaseType(valueOf_='0.')
        etaEnd = doubleBaseType(valueOf_='1.')
        ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS')
        ribStart = stringBaseType(valueOf_='leadingEdge')
        ribEnd = stringBaseType(valueOf_='trailingEdge')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.')))
        ribCrossing = ribCrossingBehaviourType(valueOf_='cross')

        middleRibs = doubleBaseType(valueOf_=5.)
        ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                      numberOfRibs=middleRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)

        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))

    #===============================================================================
    # Flap
    #===============================================================================
    if typeOfSeg.lower() == 'flap' or typeOfSeg.lower() == 'innerflap':
        myName = stringBaseType(valueOf_='flap_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness)))
        myCrossSection = wingRibCrossSectionType(material= myMaterial)
        
        # Rib Positioning
        #=======================================================================
        etaStart = doubleBaseType(valueOf_='0.')
        etaEnd = doubleBaseType(valueOf_='1.')
        ribReference = stringBaseType(valueOf_=parentUID + '_Spar_FS')
        ribStart = stringBaseType(valueOf_='leadingEdge')
        ribEnd = stringBaseType(valueOf_='trailingEdge')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.')))
        ribCrossing = ribCrossingBehaviourType(valueOf_='cross')

        if nRibs is None:
            ribSpacing = doubleBaseType(valueOf_=pitch)
            ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                          spacing=ribSpacing, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)
        else:
            nRibs = doubleBaseType(valueOf_=nRibs)
            ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                          numberOfRibs=nRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)

        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))
    #===============================================================================
    # Spoiler
    #===============================================================================
    if typeOfSeg.lower() == 'spoiler':
        myName = stringBaseType(valueOf_='spoiler_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(materialUID=stringUIDBaseType(valueOf_='aluminium7075'), thickness=doubleBaseType(valueOf_=str(thickness)))
        myCrossSection = wingRibCrossSectionType(material= myMaterial)
        
        # Rib Positioning
        #=======================================================================
        etaStart = doubleBaseType(valueOf_='0.')
        etaEnd = doubleBaseType(valueOf_='1.')
        ribReference = stringBaseType(valueOf_='leadingEdge')
        ribStart = stringBaseType(valueOf_='leadingEdge')
        ribEnd = stringBaseType(valueOf_='trailingEdge')
        ribRotation = ribRotationType(ribRotationReference=stringBaseType(valueOf_='globalY'), z=doubleBaseType(valueOf_=str('90.')))
        ribCrossing = ribCrossingBehaviourType(valueOf_='cross')

        if nRibs is None:
            ribSpacing = doubleBaseType(valueOf_=pitch)
            ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                          spacing=ribSpacing, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)
        else:
            nRibs = doubleBaseType(valueOf_=nRibs)
            ribsPositioning = wingRibsPositioningType(ribReference=ribReference, etaStart=etaStart, etaEnd=etaEnd, ribStart=ribStart, ribEnd=ribEnd, \
                                          numberOfRibs=nRibs, ribCrossingBehaviour=ribCrossing, ribRotation=ribRotation)

        ribsList.append(wingRibsDefinitionType(uID=myUID, name=myName, ribsPositioning=ribsPositioning, ribCrossSection=myCrossSection))
        
    #=======================================================================
    # RibsDefinition
    #=======================================================================
    
    myRibsDefinitions = wingRibsDefinitionsType(None, None, None, ribsList)
    
    parent.get_structure().set_ribsDefinitions(myRibsDefinitions)
Example #40
0
def createPath(
    parent,
    typeOfSeg="aileron",
    uID="controlSurface",
    innerX="0.",
    outerX="0.",
    innerHingeXsi="0.8",
    outerHingeXsi="0.8",
):

    if typeOfSeg == "aileron":
        innerHingeXsi = 0.75
        innerRelHeight = 0.2

        outerHingeXsi = 0.75
        outerRelHeight = 0.2
        steps = createStepsAileron()

    if typeOfSeg == "elevator":
        innerHingeXsi = 0.75
        innerRelHeight = 0.2

        outerHingeXsi = 0.75
        outerRelHeight = 0.2
        steps = createStepsAileron()

    if typeOfSeg == "stabilizer":
        innerHingeXsi = 0.25
        innerRelHeight = 0.5

        outerHingeXsi = 0.25
        outerRelHeight = 0.5
        steps = createStepsAileron()

    if typeOfSeg == "rudder":
        innerHingeXsi = 0.75
        innerRelHeight = 0.2

        outerHingeXsi = 0.75
        outerRelHeight = 0.2
        steps = createStepsAileron()

    if typeOfSeg == "flap" or typeOfSeg == "innerFlap":
        innerHingeXsi = innerHingeXsi
        innerRelHeight = 0.5

        outerHingeXsi = outerHingeXsi
        outerRelHeight = 0.5
        steps = createStepsFlaps(innerX, outerX)

    if typeOfSeg == "slat":
        innerHingeXsi = innerHingeXsi
        innerRelHeight = 0.5

        outerHingeXsi = outerHingeXsi
        outerRelHeight = 0.5
        steps = createStepsSlats(innerX, outerX)

    innerHinge = controlSurfaceHingePointType(
        hingeXsi=doubleBaseType(valueOf_=str(innerHingeXsi)),
        hingeRelHeight=doubleBaseType(valueOf_=str(innerRelHeight)),
    )
    outerHinge = controlSurfaceHingePointType(
        hingeXsi=doubleBaseType(valueOf_=str(outerHingeXsi)),
        hingeRelHeight=doubleBaseType(valueOf_=str(outerRelHeight)),
    )

    myPath = controlSurfacePathType(innerHingePoint=innerHinge, outerHingePoint=outerHinge, steps=steps)
    parent.set_path(myPath)
Example #41
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 #42
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 #43
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)
Example #44
0
def createSpars(parent,
                parentUID,
                typeOfSeg,
                etaFus=0.1,
                etaKink=0.3,
                cTip=1.0,
                cRoot=6.0):
    '''
    Used for generation of spars within a componentSegment
    @param parent: ComponentSegment object, spars-object will be added here

    @param etaFus:  eta Position at the Fuselage intersection
    @param etaKink: eta Position at the Kink
    @param typeOfSeg: either advDoubleTrapezoid or trapezoid or aileron
    
    .. todo:
    
       Maybe it would be a good idea to catch errors for high values of sweep
       and high kink ratios. For this case the spar maybe out of bounds of the inner wing! 
    '''
    mySparPositions = sparPositionsType(None, None, None, None)
    myUID = parentUID + '_Spar'

    #===========================================================================
    # Spar Postions
    #===========================================================================
    if typeOfSeg == 'advDoubletrapezoid':
        # The front spar should have a constant distance to the leading edge
        distance = cRoot * .1
        xsiRoot = distance / cRoot
        xsiTip_front = distance / cTip
        xsiTip_rear = 0.59
        if xsiTip_front >= xsiTip_rear:
            xsiTip_rear = xsiTip_front + 0.1
        if xsiTip_rear > 1.0:
            print "VAMPzero Warning: Rear spar location at the tip is larger than 1. Increase Taper Ratio!!!"
        frontSparLocactions = [[0.0, xsiRoot], [etaFus, xsiRoot],
                               [1.0, xsiTip_front]]
        rearSparLocactions = [[0.0, 0.56], [etaFus, 0.56], [etaKink, 0.6],
                              [1.0, xsiTip_rear]]

    if typeOfSeg == 'strutBracedWing':
        # The calculation of the strut braced wing is similar to that of the
        # double trapezoid wing. nevertheless, we exclude the kink spar position
        #
        # The front spar should have a constant distance to the leading edge
        distance = cRoot * .1
        xsiRoot = distance / cRoot
        xsiTip_front = distance / cTip
        xsiTip_rear = 0.59
        if xsiTip_front >= xsiTip_rear:
            xsiTip_rear = xsiTip_front + 0.1
        if xsiTip_rear > 1.0:
            print "VAMPzero Warning: Rear spar location at the tip is larger than 1. Increase Taper Ratio!!!"
        frontSparLocactions = [[0.0, xsiRoot], [etaFus, xsiRoot],
                               [1.0, xsiTip_front]]
        rearSparLocactions = [[0.0, 0.56], [0.05, 0.56], [etaFus, 0.56],
                              [1.0, xsiTip_rear]]

    if typeOfSeg == 'trapezoid':
        frontSparLocactions = [[0.0, 0.22], [1.0, 0.22]]
        rearSparLocactions = [[0.0, 0.55], [1.0, 0.55]]

    if typeOfSeg == 'strut':
        frontSparLocactions = [[0.0, 0.3], [1.0, 0.3]]
        rearSparLocactions = []

    if typeOfSeg == 'aileron':
        frontSparLocactions = [[0.0, 0.2], [1.0, 0.2]]
        rearSparLocactions = [[0.0, 0.7], [1.0, 0.7]]

    if typeOfSeg == 'flap' or typeOfSeg == 'innerFlap':
        frontSparLocactions = [[0.0, 0.2], [1.0, 0.2]]
        rearSparLocactions = [[0.0, 0.7], [1.0, 0.7]]

    if typeOfSeg == 'spoiler':
        frontSparLocactions = [[0.0, 0.2], [1.0, 0.2]]
        rearSparLocactions = []

    #===========================================================================
    # Assign Spar Locations
    #===========================================================================
    for item in frontSparLocactions:
        x = doubleBaseType(valueOf_=str(item[0]))
        y = doubleBaseType(valueOf_=str(item[1]))
        mySparPostion = sparPositionType(None,
                                         None,
                                         None,
                                         myUID + '_FS_P' +
                                         str(frontSparLocactions.index(item)),
                                         eta=x,
                                         xsi=y)
        mySparPositions.add_sparPosition(mySparPostion)

    if len(rearSparLocactions) != 0:
        for item in rearSparLocactions:
            x = doubleBaseType(valueOf_=str(item[0]))
            y = doubleBaseType(valueOf_=str(item[1]))
            mySparPostion = sparPositionType(
                None,
                None,
                None,
                myUID + '_RS_P' + str(rearSparLocactions.index(item)),
                eta=x,
                xsi=y)
            mySparPositions.add_sparPosition(mySparPostion)

    #===========================================================================
    # Create Segments
    #===========================================================================
    mySparSegments = sparSegmentsType(None, None, None, None)
    createSparSegment(mySparSegments,
                      myUID,
                      '_FS',
                      numOfPoints=len(frontSparLocactions),
                      typeOfSeg=typeOfSeg)
    if len(rearSparLocactions) != 0:
        createSparSegment(mySparSegments,
                          myUID,
                          '_RS',
                          numOfPoints=len(rearSparLocactions))

    #===========================================================================
    # Back to CPACS
    #===========================================================================
    mySpars = wingSparType(None, None, None, mySparPositions, mySparSegments)
    parent.get_structure().set_spars(mySpars)
Example #45
0
def createRibs(parent,
               parentUID,
               typeOfSeg,
               thickness=0.03,
               pitch=.8,
               nRibs=None,
               etaFus=0.2,
               etaEng=.3,
               span=17.,
               fanDiameter=1.9,
               etaStrut=0.0,
               phi25=0.0):
    '''
    Used for generation of a ribs definition in the wing 

    @param parent: ComponentSegment object, ribsDefinition will be added here
    @param thickness:  thickness of the ribs
    @param pitch: pitch of the ribs
    @param typeOfSeg: either advDoubleTrapezoid or trapezoid
    '''
    myUID = parentUID + '_ribs'
    ribsList = []

    #===============================================================================
    # Advanced Double Trapezoid
    #===============================================================================
    if typeOfSeg.lower() == 'advdoubletrapezoid':
        myName = stringBaseType(None, None, None, 'wing_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium7075'), \
                                              doubleBaseType(None, None, None, str(thickness)))
        myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial,
                                                 None)
        ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS')
        ribStart = stringBaseType(None, None, None, parentUID + '_Spar_FS')
        ribEnd = stringBaseType(None, None, None, parentUID + '_Spar_RS')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \
                                           doubleBaseType(None, None, None, '90.'))
        ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross')

        #=======================================================================
        # First set of 4 ribs inside the fuselage
        #=======================================================================
        etaStart = doubleBaseType(None, None, None, '0.0')
        etaEnd = doubleBaseType(None, None, None, str(etaFus))
        innerRibs = doubleBaseType(None, None, None, 4)
        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                      None, innerRibs, ribCrossing, ribRotation)

        myUID = parentUID + '_ribs_inner'
        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

        #===============================================================
        # Second set outside of the fuselage up to the engine
        #===============================================================
        etaPylon = 1. / 10. * fanDiameter / span
        etaStart = doubleBaseType(None, None, None, str(etaFus + pitch / span))
        etaEnd = doubleBaseType(None, None, None, str(etaEng - etaPylon))
        middleRibs = int(ceil((etaEng - etaPylon - etaFus) * span / pitch)) - 1
        if middleRibs < 1:
            middleRibs = 1
        middleRibs = doubleBaseType(None, None, None, middleRibs)
        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                      None, middleRibs, ribCrossing, ribRotation)

        myUID = parentUID + '_ribs_engine1'
        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

        #===============================================================
        # Third set one ribs outside of the pylon
        #===============================================================
        etaEnd = doubleBaseType(None, None, None, str(etaEng + etaPylon))
        pylonRibs = doubleBaseType(None, None, None, str(1))
        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaEnd, etaEnd, ribStart, ribEnd, \
                                      None, pylonRibs, ribCrossing, ribRotation)

        myUID = parentUID + '_ribs_engine2'
        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

        #===============================================================
        # Fourth set outside of the engine
        #===============================================================
        etaStart = doubleBaseType(None, None, None,
                                  str(etaEng + etaPylon + pitch / span))
        etaEnd = doubleBaseType(None, None, None, '0.95')

        ribCrossing = ribCrossingBehaviourType(None, None, None, 'end')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'wing_Spar_FS'), \
                                           doubleBaseType(None, None, None, '90.'))

        outerRibs = int(ceil((0.95 - etaEng + etaPylon) * span / pitch)) - 1
        outerRibs = doubleBaseType(None, None, None, outerRibs)

        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                      None, outerRibs, ribCrossing, ribRotation)
        myUID = parentUID + '_ribs_outer'
        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

    #===============================================================================
    # Strut Braced Wing
    #===============================================================================
    if typeOfSeg.lower() == 'strutbracedwing':
        myName = stringBaseType(None, None, None, 'wing_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium7075'), \
                                              doubleBaseType(None, None, None, str(thickness)))
        myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial,
                                                 None)
        ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS')
        ribStart = stringBaseType(None, None, None, parentUID + '_Spar_FS')
        ribEnd = stringBaseType(None, None, None, parentUID + '_Spar_RS')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \
                                           doubleBaseType(None, None, None, '90.'))
        ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross')

        #=======================================================================
        # First set of 4 ribs inside the fuselage
        #=======================================================================
        etaStart = doubleBaseType(None, None, None, '0.0')
        etaEnd = doubleBaseType(None, None, None, str(etaFus))
        innerRibs = doubleBaseType(None, None, None, 4)
        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                      None, innerRibs, ribCrossing, ribRotation)

        myUID = parentUID + '_ribs_inner'
        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

        #===============================================================
        # Second set outside of the fuselage up to the strut
        #===============================================================
        etaStart = doubleBaseType(None, None, None,
                                  str(etaFus + pitch / span + phi25 * 0.0002))
        etaEnd = doubleBaseType(None, None, None, str(etaStrut))
        middleRibs = int(ceil((etaStrut - etaFus) * span / pitch)) - 1
        middleRibs = doubleBaseType(None, None, None, middleRibs)
        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                      None, middleRibs, ribCrossing, ribRotation)

        myUID = parentUID + '_ribs_strut'
        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

        #===============================================================
        # Third set outside of the spar
        #===============================================================
        etaStart = doubleBaseType(None, None, None,
                                  str(etaStrut + pitch / span))
        etaEnd = doubleBaseType(None, None, None, '0.95')

        ribCrossing = ribCrossingBehaviourType(None, None, None, 'end')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'wing_Spar_FS'), \
                                           doubleBaseType(None, None, None, '90.'))

        outerRibs = int(ceil((0.95 - etaStrut) * span / pitch)) - 1
        outerRibs = doubleBaseType(None, None, None, outerRibs)

        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                      None, outerRibs, ribCrossing, ribRotation)
        myUID = parentUID + '_ribs_outer'
        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

    #===============================================================================
    # Strut (And only the strut not the wing that goes along with it)
    #===============================================================================
    if typeOfSeg.lower() == 'strut':
        myName = stringBaseType(None, None, None, 'strut_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(compositeUID=stringUIDBaseType(isLink='True',valueOf_='Comp_Shear'), orthotropyDirection=doubleBaseType(valueOf_='0.'),\
                                          thicknessScaling=doubleBaseType(valueOf_='0.001'))
        myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial,
                                                 None)
        ribReference = stringBaseType(None, None, None, 'leadingEdge')
        ribStart = stringBaseType(None, None, None, 'leadingEdge')
        ribEnd = stringBaseType(None, None, None, 'trailingEdge')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \
                                           doubleBaseType(None, None, None, '90.'))
        ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross')

        etaStart = doubleBaseType(None, None, None, str(0.001))
        etaEnd = doubleBaseType(None, None, None, str(0.999))
        #middleRibs = int(ceil(span / 0.70)) - 1
        middleRibs = doubleBaseType(None, None, None, 5.)
        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                      None, middleRibs, ribCrossing, ribRotation)

        myUID = parentUID + '_ribs'
        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

    #===============================================================================
    # Aileron
    #===============================================================================
    if typeOfSeg.lower() == 'aileron':
        myName = stringBaseType(None, None, None, 'aileron_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium2024'), \
                                              doubleBaseType(None, None, None, str(thickness)))
        myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial,
                                                 None)

        # Rib Positioning
        #=======================================================================
        etaStart = doubleBaseType(None, None, None, '0.')
        etaEnd = doubleBaseType(None, None, None, '1.')
        ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS')
        ribStart = stringBaseType(None, None, None, 'leadingEdge')
        ribEnd = stringBaseType(None, None, None, 'trailingEdge')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \
                                           doubleBaseType(None, None, None, '90.'))
        ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross')
        if nRibs is None:
            ribSpacing = doubleBaseType(None, None, None, pitch)
            ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                          ribSpacing, None, ribCrossing, ribRotation)
        else:
            nRibs = doubleBaseType(None, None, None, nRibs)
            ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                          None, nRibs, ribCrossing, ribRotation)

        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

    if typeOfSeg.lower() == 'trapezoid':
        myName = stringBaseType(None, None, None, 'trapezoid_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium2024'), \
                                              doubleBaseType(None, None, None, str(thickness)))
        myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial,
                                                 None)

        # Rib Positioning
        #=======================================================================
        etaStart = doubleBaseType(None, None, None, '0.')
        etaEnd = doubleBaseType(None, None, None, '1.')
        ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS')
        ribStart = stringBaseType(None, None, None, 'leadingEdge')
        ribEnd = stringBaseType(None, None, None, 'trailingEdge')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \
                                           doubleBaseType(None, None, None, '90.'))
        ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross')

        etaStart = doubleBaseType(None, None, None, str(0.0))
        etaEnd = doubleBaseType(None, None, None, str(0.95))
        middleRibs = doubleBaseType(None, None, None, 5.)
        ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                      None, middleRibs, ribCrossing, ribRotation)

        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

    #===============================================================================
    # Flap
    #===============================================================================
    if typeOfSeg.lower() == 'flap' or typeOfSeg.lower() == 'innerflap':
        myName = stringBaseType(None, None, None, 'flap_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium2024'), \
                                              doubleBaseType(None, None, None, str(thickness)))
        myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial,
                                                 None)

        # Rib Positioning
        #=======================================================================
        etaStart = doubleBaseType(None, None, None, '0.')
        etaEnd = doubleBaseType(None, None, None, '1.')
        ribReference = stringBaseType(None, None, None, parentUID + '_Spar_FS')
        ribStart = stringBaseType(None, None, None, 'leadingEdge')
        ribEnd = stringBaseType(None, None, None, 'trailingEdge')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'globalY'), \
                                           doubleBaseType(None, None, None, '90.'))
        ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross')
        if nRibs is None:
            ribSpacing = doubleBaseType(None, None, None, pitch)
            ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                          ribSpacing, None, ribCrossing, ribRotation)
        else:
            nRibs = doubleBaseType(None, None, None, nRibs)
            ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                          None, nRibs, ribCrossing, ribRotation)

        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))
    #===============================================================================
    # Spoiler
    #===============================================================================
    if typeOfSeg.lower() == 'spoiler':
        myName = stringBaseType(None, None, None, 'spoiler_ribs')

        # Rib Cross Section
        #=======================================================================
        myMaterial = materialDefinitionType(None, None, None, None, None, None, stringUIDBaseType(None, None, 'True', None, 'aluminium2024'), \
                                              doubleBaseType(None, None, None, str(thickness)))
        myCrossSection = wingRibCrossSectionType(None, None, None, myMaterial,
                                                 None)

        # Rib Positioning
        #=======================================================================
        etaStart = doubleBaseType(None, None, None, '0.')
        etaEnd = doubleBaseType(None, None, None, '1.')
        ribReference = stringBaseType(None, None, None, 'leadingEdge')
        ribStart = stringBaseType(None, None, None, 'leadingEdge')
        ribEnd = stringBaseType(None, None, None, 'trailingEdge')
        ribRotation = ribRotationType(None, None, None, stringBaseType(None, None, None, 'leadingEdge'), \
                                           doubleBaseType(None, None, None, '90.'))
        ribCrossing = ribCrossingBehaviourType(None, None, None, 'cross')
        if nRibs is None:
            ribSpacing = doubleBaseType(None, None, None, pitch)
            ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                          ribSpacing, None, ribCrossing, ribRotation)
        else:
            nRibs = doubleBaseType(None, None, None, nRibs)
            ribsPositioning = wingRibsPositioningType(None, None, None, ribReference, etaStart, etaEnd, ribStart, ribEnd, \
                                          None, nRibs, ribCrossing, ribRotation)

        ribsList.append(
            wingRibsDefinitionType(None, None, None, myUID, myName, None,
                                   ribsPositioning, myCrossSection))

    #=======================================================================
    # RibsDefinition
    #=======================================================================

    myRibsDefinitions = wingRibsDefinitionsType(None, None, None, ribsList)

    parent.get_structure().set_ribsDefinitions(myRibsDefinitions)
Example #46
0
def createSpars(parent, parentUID, typeOfSeg, etaFus=0.1, etaKink=0.3, cTip=1.0, cRoot=6.0):
    '''
    Used for generation of spars within a componentSegment
    @param parent: ComponentSegment object, spars-object will be added here

    @param etaFus:  eta Position at the Fuselage intersection
    @param etaKink: eta Position at the Kink
    @param typeOfSeg: either advDoubleTrapezoid or trapezoid or aileron
    
    .. todo:
    
       Maybe it would be a good idea to catch errors for high values of sweep
       and high kink ratios. For this case the spar maybe out of bounds of the inner wing! 
    '''
    mySparPositions = sparPositionsType(None, None, None, None)
    myUID = parentUID + '_Spar'
    
    #===========================================================================
    # Spar Postions
    #===========================================================================
    if typeOfSeg == 'advDoubletrapezoid':
        # The front spar should have a constant distance to the leading edge
        distance = cRoot * .1
        xsiRoot = distance / cRoot  
        xsiTip_front = distance / cTip
        xsiTip_rear = 0.59
        if xsiTip_front >= xsiTip_rear:
            xsiTip_rear = xsiTip_front + 0.1
        if xsiTip_rear > 1.0:
            print "VAMPzero Warning: Rear spar location at the tip is larger than 1. Increase Taper Ratio!!!"
        frontSparLocactions = [[0.0, xsiRoot], [etaFus, xsiRoot], [1.0, xsiTip_front]]
        rearSparLocactions = [[0.0, 0.56],  [etaFus, 0.56], [etaKink, 0.6], [1.0, xsiTip_rear]]

    if typeOfSeg == 'strutBracedWing':
        # The calculation of the strut braced wing is similar to that of the
        # double trapezoid wing. nevertheless, we exclude the kink spar position
        #
        # The front spar should have a constant distance to the leading edge
        distance = cRoot * .1
        xsiRoot = distance / cRoot
        xsiTip_front = distance / cTip
        xsiTip_rear = 0.59
        if xsiTip_front >= xsiTip_rear:
            xsiTip_rear = xsiTip_front + 0.1
        if xsiTip_rear > 1.0:
            print "VAMPzero Warning: Rear spar location at the tip is larger than 1. Increase Taper Ratio!!!"
        frontSparLocactions = [[0.0, xsiRoot], [etaFus, xsiRoot], [1.0, xsiTip_front]]
        rearSparLocactions = [[0.0, 0.56], [etaFus, 0.56], [1.0, xsiTip_rear]]

    if typeOfSeg == 'trapezoid':
        frontSparLocactions = [[0.0, 0.22], [1.0, 0.22]]
        rearSparLocactions = [[0.0, 0.55], [1.0, 0.55]]

    if typeOfSeg == 'strut':
        frontSparLocactions = [[0.0, 0.3], [1.0, 0.3]]
        rearSparLocactions = []

    if typeOfSeg == 'aileron':
        frontSparLocactions = [[0.0, 0.2], [1.0, 0.2]]
        rearSparLocactions = [[0.0, 0.7], [1.0, 0.7]]

    if typeOfSeg == 'flap' or typeOfSeg == 'innerFlap':
        frontSparLocactions = [[0.0, 0.2], [1.0, 0.2]]
        rearSparLocactions = [[0.0, 0.7], [1.0, 0.7]]

    if typeOfSeg == 'spoiler':
        frontSparLocactions = [[0.0, 0.2], [1.0, 0.2]]
        rearSparLocactions = []
        
    #===========================================================================
    # Assign Spar Locations 
    #===========================================================================
    for item in frontSparLocactions:
        x = doubleBaseType(valueOf_=str(item[0]))
        y = doubleBaseType(valueOf_=str(item[1]))
        mySparPostion = sparPositionType(uID= myUID + '_FS_P' + str(frontSparLocactions.index(item)), eta=x, xsi=y)
        mySparPositions.add_sparPosition(mySparPostion)

    if len(rearSparLocactions) != 0:
        for item in rearSparLocactions:
            x = doubleBaseType(valueOf_=str(item[0]))
            y = doubleBaseType(valueOf_=str(item[1]))
            mySparPostion = sparPositionType(uID=myUID + '_RS_P' + str(rearSparLocactions.index(item)), eta=x, xsi=y)
            mySparPositions.add_sparPosition(mySparPostion)
        
    #===========================================================================
    # Create Segments
    #===========================================================================
    mySparSegments = sparSegmentsType()
    createSparSegment(mySparSegments, myUID, '_FS', numOfPoints=len(frontSparLocactions), typeOfSeg=typeOfSeg)
    if len(rearSparLocactions) != 0:
        createSparSegment(mySparSegments, myUID, '_RS', numOfPoints=len(rearSparLocactions))
    
    #===========================================================================
    # Back to CPACS
    #===========================================================================
    mySpars = wingSparType(None, None, None, mySparPositions, mySparSegments)
    parent.get_structure().set_spars(mySpars)
Example #47
0
def createAdvDoubleTrapezoidWing(myWing, id, cTip, cRoot, span, Sref, dfus,
                                 phiLE, dihedral, twist, xMAC25, etakf, strUID,
                                 yfus, xRoot, etaEng, tcRoot, tcTip):
    '''
    This method creates a double trapezoid wing geometry in the 'myWing' parameter.
    
    ** Introduced a linear twist distribution from *0* at root to *twist* at tip 
    
    
    @author: Jonas Jepsen
    @param myWing: wings CPACS object
    @param id: the VAMPzero-id of the wing 
    @param cTip: length of chord at wing tip [m]
    @param cRoot: length of chord at wing root [m]
    @param span: span of the wing [m]
    @param Sref: reference area [m^2]
    @param dfus: fuselage diameter [m]
    @param phiLE: sweep angle at the leading edge [deg]
    @param dihedral: dihedralangle of the wing [deg]
    @param twist: twist of the outer wing section [deg]     
    @param etakf: dimensionless span coordinate [-]
    @param strUID: the CPACS-uID of the wing
    '''
    # sections and positionings will be created, all existing sections and positionings will be deleted
    mySections = wingSectionsType()
    myPositionings = positioningsType()
    # calc Lvl 1 parameters
    taperRatio = (cTip / cRoot)
    cRoot, cKink, cTip = calcWing(span, Sref, taperRatio, phiLE, etakf, dfus)

    # calc length from span, sweep and dihedral
    sweep_rad = phiLE / 180. * pi
    dihedral_rad = dihedral / 180. * pi
    # trying to correct the commented statement that uses dfus. will try to use yfus
    # length1 = dfus / 2.
    length1 = yfus
    length2 = (etakf * span / 2. -
               length1) / cos(sweep_rad) / cos(dihedral_rad)
    length3 = span / 2. * (1 - etakf) / cos(sweep_rad) / cos(dihedral_rad)

    # Increase (or reduce the twist by 4deg as that is the overall angle of incidence of the wing)
    twist = twist - 4.
    twistgrad = twist / (span / 2.)
    twist1 = twistgrad * length1
    twist2 = twistgrad * etakf * (span / 2.)
    twist3 = twist

    createWingSection(mySections, tcRoot / 0.09, 0., 0., 0., cRoot, 1., cRoot,
                      0., 0., 0., 'NACA0009', 1, strUID + '_Sec1',
                      strUID + '_Sec1', strUID + '_Sec1')
    createWingSection(mySections, tcRoot / 0.18, 0., 0., 0., cRoot, 1., cRoot,
                      0., 0., 0., 'NACA653218', 1, strUID + '_Sec2',
                      strUID + '_Sec2', strUID + '_Sec2')
    createWingSection(mySections, tcTip / 0.18, 0., 0., 0., cKink, 1., cKink,
                      0., twist2, 0., 'NACA653218', 1, strUID + '_Sec3',
                      strUID + '_Sec3', strUID + '_Sec3')
    createWingSection(mySections, tcTip / 0.18, 0., 0., 0., cTip, 1., cTip, 0.,
                      twist3, 0., 'NACA653218', 1, strUID + '_Sec4',
                      strUID + '_Sec4', strUID + '_Sec4')

    createPositioning(myPositionings,
                      str(id) + '_Pos1', None,
                      str(id) + '_Sec1', 0., 0., 0., id)
    createPositioning(myPositionings,
                      str(id) + '_Pos2',
                      str(id) + '_Sec1',
                      str(id) + '_Sec2', length1, 0., 0., id)
    createPositioning(myPositionings,
                      str(id) + '_Pos3',
                      str(id) + '_Sec2',
                      str(id) + '_Sec3', length2, phiLE, dihedral, id)
    createPositioning(myPositionings,
                      str(id) + '_Pos4',
                      str(id) + '_Sec3',
                      str(id) + '_Sec4', length3, phiLE, dihedral, id)

    myWing.set_sections(mySections)
    myWing.set_positionings(myPositionings)

    createWingSegments(myWing, strUID, 3)

    createComponentSegment(myWing, strUID)
    etafus = yfus / (span / 2.)
    # Ribs outboard of the Fuselage section are placed at 0.8 m distance
    nouterRibs = int(ceil((0.95 - etafus - 0.05) * span / 2. / 0.8))
    createRibs(myWing.get_componentSegments().get_componentSegment()[0],
               strUID,
               'advDoubletrapezoid',
               etaFus=etafus,
               nRibs=nouterRibs,
               etaEng=etaEng,
               span=span / 2.)
    createSpars(myWing.get_componentSegments().get_componentSegment()[0],
                strUID,
                'advDoubletrapezoid',
                length1 / (span / 2.),
                etakf / cos(dihedral_rad),
                cTip=cTip,
                cRoot=cRoot)
    createShell(myWing.get_componentSegments().get_componentSegment()[0],
                strUID, 'advDoubletrapezoid')
    createWingFuselageAttachment(
        myWing.get_componentSegments().get_componentSegment()[0], strUID,
        'advDoubletrapezoid')

    # Estimate ribNum of outer Rib
    iRib = int(span * (0.85 - etaEng) / (2 * 0.8)) - 1
    createTanks(myWing.get_componentSegments().get_componentSegment()[0],
                strUID,
                'advDoubletrapezoid',
                nRib=iRib)

    # calc wing position
    tauK = cTip / cKink
    etar = dfus / span
    # XN25F = calcXN25F(cRoot, span, phiLE, etar, etakf, tauK, taperRatio)
    # xRoot.py = calcXRoot(xMAC25, XN25F)

    # set wing x - position and twist
    myWing.get_transformation().get_translation().set_x(
        doubleBaseType(None, None, None, str(xRoot)))
    myWing.get_transformation().get_rotation().set_y(
        doubleBaseType(None, None, None, str(4.)))
Example #48
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 #49
0
def createPath(parent,
               typeOfSeg='aileron',
               uID='controlSurface',
               innerX='0.',
               outerX='0.',
               innerHingeXsi='0.8',
               outerHingeXsi='0.8'):

    if typeOfSeg == 'aileron':
        innerHingeXsi = 0.75
        innerRelHeight = 0.2

        outerHingeXsi = 0.75
        outerRelHeight = 0.2
        steps = createStepsAileron()

    if typeOfSeg == 'elevator':
        innerHingeXsi = 0.75
        innerRelHeight = 0.2

        outerHingeXsi = 0.75
        outerRelHeight = 0.2
        steps = createStepsAileron()

    if typeOfSeg == 'stabilizer':
        innerHingeXsi = 0.25
        innerRelHeight = 0.5

        outerHingeXsi = 0.25
        outerRelHeight = 0.5
        steps = createStepsAileron()

    if typeOfSeg == 'rudder':
        innerHingeXsi = 0.75
        innerRelHeight = 0.2

        outerHingeXsi = 0.75
        outerRelHeight = 0.2
        steps = createStepsAileron()

    if typeOfSeg == 'flap' or typeOfSeg == 'innerFlap':
        innerHingeXsi = innerHingeXsi
        innerRelHeight = 0.5

        outerHingeXsi = outerHingeXsi
        outerRelHeight = 0.5
        steps = createStepsFlaps(innerX, outerX)

    if typeOfSeg == 'slat':
        innerHingeXsi = innerHingeXsi
        innerRelHeight = 0.5

        outerHingeXsi = outerHingeXsi
        outerRelHeight = 0.5
        steps = createStepsSlats(innerX, outerX)

    innerHinge = controlSurfaceHingePointType(
        hingeXsi=doubleBaseType(valueOf_=str(innerHingeXsi)),
        hingeRelHeight=doubleBaseType(valueOf_=str(innerRelHeight)))
    outerHinge = controlSurfaceHingePointType(
        hingeXsi=doubleBaseType(valueOf_=str(outerHingeXsi)),
        hingeRelHeight=doubleBaseType(valueOf_=str(outerRelHeight)))

    myPath = controlSurfacePathType(innerHingePoint=innerHinge,
                                    outerHingePoint=outerHinge,
                                    steps=steps)
    parent.set_path(myPath)
Example #50
0
def createStrutBracedWing(myWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, twist, xMAC25, etaFus, etaStrut, tcRoot, tcTip, xRoot, strUID):
    '''
    This method creates a double trapezoid wing geometry in the 'myWing' parameter.
    @author: Jonas Jepsen
    @param myWing: wings CPACS object
    @param id: the VAMPzero-id of the wing 
    @param cTip: length of chord at wing tip [m]
    @param cRoot: length of chord at wing root [m]
    @param span: span of the wing [m]
    @param Sref: reference area [m^2]
    @param phiLE: sweep angle at the leading edge [deg]
    @param dihedral: dihedralangle of the wing [deg]
    @param twist: twist of the outer wing section [deg]     
    @param etakf: dimensionless span coordinate [-]
    @param strUID: the CPACS-uID of the wing
    '''
    mySections = wingSectionsType()
    myPositionings = positioningsType()
    # calc Lvl 1 parameters
    taperRatio = (cTip/cRoot)
    cRoot = calcWing(b=span, S=Sref, tau=taperRatio, eF=etaFus)
    cStrut = cRoot+(cTip-cRoot)*(etaStrut-etaFus)/(1-etaFus)
    cTip = taperRatio * cRoot # cRoot was updated in the last step

    # calc length from span, sweep and dihedral
    sweep_rad = phiLE/180. * pi
    dihedral_rad = dihedral/180. * pi
    length1 = (etaFus*span/2.)
    length2 = (etaStrut-etaFus)*span/2/cos(sweep_rad)/cos(dihedral_rad)
    length3 = span/2.*(1-etaStrut)/cos(sweep_rad)/cos(dihedral_rad)

    # Increase (or reduce the twist by 4deg as that is the overall angle of incidence of the wing)
    incidenceAngle = 4.
    twist = twist + incidenceAngle
    twistgrad = twist / (span / 2.)
    twist2 = twistgrad * length2
    twist3 = twist

    createWingSection(mySections, tcRoot/0.09, 0.,0.,0., cRoot,1.,cRoot, 0.,incidenceAngle,0., 'NACA0009', 1, strUID + '_Sec1', strUID + '_Sec1', strUID + '_Sec1')
    createWingSection(mySections, tcRoot / 0.18, 0.,0.,0., cRoot,1.,cRoot, 0.,incidenceAngle,0., 'NACA653218', 1, strUID + '_Sec2', strUID + '_Sec2', strUID + '_Sec2')
    createWingSection(mySections, tcRoot / 0.18, 0.,0.,0., cStrut,1.,cStrut, 0.,twist2,0., 'NACA653218', 1, strUID + '_Sec3', strUID + '_Sec3', strUID + '_Sec3')
    createWingSection(mySections, tcTip / 0.18, 0.,0.,0., cTip,1.,cTip, 0.,twist3,0., 'NACA653218', 1, strUID + '_Sec4', strUID + '_Sec4', strUID + '_Sec4')

    createPositioning(myPositionings,str(id) + '_Pos1',None, str(id) + '_Sec1',0.,0.,0.,id)
    createPositioning(myPositionings,str(id) + '_Pos2',str(id) + '_Sec1',str(id) + '_Sec2',length1,0.,0.,id)
    createPositioning(myPositionings,str(id) + '_Pos3',str(id) + '_Sec2',str(id) + '_Sec3',length2,phiLE,dihedral,id)
    createPositioning(myPositionings,str(id) + '_Pos4',str(id) + '_Sec3',str(id) + '_Sec4',length3,phiLE,dihedral,id)
    
    myWing.set_sections(mySections)
    myWing.set_positionings(myPositionings)

    createWingSegments(myWing, strUID, 3)
    createComponentSegment(myWing, strUID)

    # Ribs outboard of the Fuselage section are placed at 0.8 m distance
    nouterRibs = int(ceil((0.95 - etaFus - 0.05) * span / 2. / 0.8))
    createRibs(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strutBracedWing', etaFus=etaFus, nRibs=nouterRibs, etaStrut=etaStrut, span=span / 2., phi25 = phiLE)
    createSpars(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strutBracedWing', etaFus=etaFus, cTip=cTip, cRoot=cRoot)
    createShell(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'strutBracedWing')

    iRib = int(span * (0.9 - etaStrut) / (2 * 0.8)) - 1
    if iRib == 1:
        iRib = 2
    createTanks(myWing.get_componentSegments().get_componentSegment()[0], strUID, typeOfSeg='strutBracedWing', nRib=iRib)

    createWingFuselageAttachment(myWing.get_componentSegments().get_componentSegment()[0], strUID, 'advDoubletrapezoid')

    # set wing x - position and twist
    myWing.get_transformation().get_translation().set_x(doubleBaseType(valueOf_=str(xRoot)))
Example #51
0
def createDoubleTrapezoidWing(myWing, id, cTip, cRoot, span, Sref, phiLE,
                              dihedral, twist, xMAC25, etakf, strUID):
    '''
    This method creates a double trapezoid wing geometry in the 'myWing' parameter.
    @author: Jonas Jepsen
    @param myWing: wings CPACS object
    @param id: the VAMPzero-id of the wing 
    @param cTip: length of chord at wing tip [m]
    @param cRoot: length of chord at wing root [m]
    @param span: span of the wing [m]
    @param Sref: reference area [m^2]
    @param phiLE: sweep angle at the leading edge [deg]
    @param dihedral: dihedralangle of the wing [deg]
    @param twist: twist of the outer wing section [deg]     
    @param etakf: dimensionless span coordinate [-]
    @param strUID: the CPACS-uID of the wing
    '''
    # sections and positionings will be created, all existing sections and positionings will be deleted
    mySections = wingSectionsType()
    myPositionings = positioningsType()
    # calc Lvl 1 parameters
    taperRatio = (cTip / cRoot)
    cRoot, cKink, cTip = calcWing(span, Sref, taperRatio, phiLE, etakf)
    createWingSection(mySections, 0., 0., 0., cRoot, 1., cRoot, 0., 0., 0.,
                      'NACA653218', 1, strUID + '_Sec1', strUID + '_Sec1',
                      strUID + '_Sec1')
    createWingSection(mySections, 0., 0., 0., cKink, 1., cKink, 0., 0., 0.,
                      'NACA653218', 1, strUID + '_Sec2', strUID + '_Sec2',
                      strUID + '_Sec2')
    createWingSection(mySections, 0., 0., 0., cTip, 1., cTip, 0., twist, 0.,
                      'NACA653218', 1, strUID + '_Sec3', strUID + '_Sec3',
                      strUID + '_Sec3')

    # calc length from span, sweep and dihedral
    sweep_rad = phiLE / 180. * pi
    dihedral_rad = dihedral / 180. * pi
    length1 = (etakf * span / 2.) / cos(sweep_rad) / cos(dihedral_rad)
    length2 = span / 2. * (1 - etakf) / cos(sweep_rad) / cos(dihedral_rad)

    createPositioning(myPositionings,
                      str(id) + '_Pos1', None,
                      str(id) + '_Sec1', 0., 0., 0., id)
    createPositioning(myPositionings,
                      str(id) + '_Pos2',
                      str(id) + '_Sec1',
                      str(id) + '_Sec2', length1, phiLE, dihedral, id)
    createPositioning(myPositionings,
                      str(id) + '_Pos3',
                      str(id) + '_Sec2',
                      str(id) + '_Sec3', length2, phiLE, dihedral, id)

    myWing.set_sections(mySections)
    myWing.set_positionings(myPositionings)

    createWingSegments(myWing, strUID, 2)

    createComponentSegment(myWing, strUID)

    # calc wing position
    tauk = cTip / cKink
    myLambda = span**2 / Sref
    sweep_rad = 35. / 180. * pi
    tanPhi25a = calcPhi25a(sweep_rad, taperRatio, tauk, etakf, span, cRoot)
    tanPhi25i = calcPhi25i(sweep_rad, taperRatio, tauk, etakf, span, cRoot)
    Xef = calcXef(cRoot, myLambda, tanPhi25i, tanPhi25a, etakf, taperRatio,
                  tauk)
    xRoot = calcXRoot(xMAC25, Xef, cRoot)
    # set wing x - position
    myWing.get_transformation().get_translation().set_x(
        doubleBaseType(None, None, None, str(xRoot)))
Example #52
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)