Beispiel #1
0
 def createWingElement(parent,
                       tx,
                       ty,
                       tz,
                       sx,
                       sy,
                       sz,
                       rx,
                       ry,
                       rz,
                       AirfUID,
                       UID='WElem',
                       Name='WElem',
                       descr='Wing Element'):
     '''
     Used for the creation of a wing element from PrADO cross section
     @param parent: wingElementsType object, element will be added here
     @param crossSection: the cross section parameters from PrADO [list] (see myFQS in PrADOlib/Wings.py)
     @param AirfUID: the uID of the used Profile
     @param UID: the UID of this element
     @param Name: Name of this Element [string]
     @param descr: Description of this Element [string]
     '''
     myElement = wingElementType(uID=UID)
     myElement.set_name(stringBaseType(valueOf_=Name))
     myElement.set_description(stringBaseType(valueOf_=descr))
     myElement.set_airfoilUID(stringBaseType(valueOf_=AirfUID))
     # Translation
     createTransformation(myElement, 'absGlobal', tx, ty, tz, sx, sy, sz,
                          rx, ry, rz)
     parent.add_element(myElement)
Beispiel #2
0
def createWingSegments(parent, parentUID, numOfSeg):
    '''
    Used for generation of wing Segments.
    Connects two sections to one segment.
    This method assumes, that two sections with contiguous numbers must be connected.
    @param parent: wingType object, Sections-object will be added here
    @param parentUID:  UID of parent object [string]
    @param numOfSeg: number of Segments to create (must be one less than sections)
    '''
    # # ONLY ONE ELEMENT PER SECTION SUPPORTED
    mySegments = wingSegmentsType()
    for i in range(numOfSeg):
        myUID = parentUID + '_Seg' + str(i + 1)
        myName = stringBaseType(None, None, None,
                                parentUID + '_Seg' + str(i + 1))
        myDescr = stringBaseType(None, None, None,
                                 parentUID + '_Seg' + str(i + 1))
        myFromElem = stringBaseType(None, None, None,
                                    parentUID + '_Sec' + str(i + 1) + '_Elem1')
        myToElem = stringBaseType(None, None, None,
                                  parentUID + '_Sec' + str(i + 2) + '_Elem1')
        tmpSegment = wingSegmentType(None, None, None, myUID, myName, myDescr,
                                     myFromElem, myToElem)
        mySegments.add_segment(tmpSegment)
    parent.set_segments(mySegments)
Beispiel #3
0
def createFuselageProfile(CPACSObj, profile='Circle' ):
    '''
    @author: Jonas Jepsen
    '''
    # get airfoil holding object
    cpacsPath = '/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[%s]'% profile
    myProfile = getObjfromXpath(CPACSObj,cpacsPath)
    pointList = myProfile.get_pointList()
    if pointList is None:
        #print "Airfoil 'Circle' not found -> will be created."
        xVector, yVector, zVector = createCircleList()
        # create pointList
        pointList   = pointListXYZVectorType()

        x         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(xVector))
        y         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(yVector))
        z         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(zVector))
        
        pointList.set_x(x)
        pointList.set_y(y)
        pointList.set_z(z)
        
        myProfile.set_pointList(pointList)
        myProfile.set_name(stringBaseType(valueOf_="Circle Profile"))
        myProfile.set_description(stringBaseType(valueOf_="Profile generated automatically by VAMPzero cpacs-export" ))
Beispiel #4
0
def createComponentSegment(parent, parentUID, fromElement='_Sec1_Elem1'):
    '''
    Used for generation of componentSegments within a wing
    create numOfComponentSegs in a wing
    @param parent: wingType object, Sections-object will be added here
    @param parentUID:  UID of parent object [string]
    '''
    #===========================================================================
    # Create Component Segement
    #===========================================================================
    myUID = parentUID + '_Cseg'
    myName = stringBaseType(valueOf_= parentUID + '_CSeg')
    myDescr = stringBaseType(valueOf_= parentUID + '_CSeg')
    myFromElem = stringBaseType(valueOf_=parentUID + fromElement)
    index = str(len(parent.get_sections().get_section()))
    myToElem = stringBaseType(valueOf_=parentUID + '_Sec' + index + '_Elem1')
    myStructure = wingComponentSegmentStructureType()
    
    #===========================================================================
    # Back to CPACS
    #===========================================================================
    myComponentSegments = componentSegmentsType()
    myComponentSegment = componentSegmentType(uID=myUID, name=myName, description=myDescr, fromElementUID=myFromElem, toElementUID=myToElem, structure=myStructure)
    myComponentSegments.add_componentSegment(myComponentSegment)
    parent.set_componentSegments(myComponentSegments)
Beispiel #5
0
def createFuselageProfile(CPACSObj, profile='Circle'):
    '''
    @author: Jonas Jepsen
    '''
    # get airfoil holding object
    cpacsPath = '/cpacs/vehicles/profiles/fuselageProfiles/fuselageProfile[%s]' % profile
    myProfile = getObjfromXpath(CPACSObj, cpacsPath)
    pointList = myProfile.get_pointList()
    if pointList is None:
        #print "Airfoil 'Circle' not found -> will be created."
        xVector, yVector, zVector = createCircleList()
        # create pointList
        pointList = pointListXYZVectorType()

        x = stringVectorBaseType(None, None, None, 'vector', ';'.join(xVector))
        y = stringVectorBaseType(None, None, None, 'vector', ';'.join(yVector))
        z = stringVectorBaseType(None, None, None, 'vector', ';'.join(zVector))

        pointList.set_x(x)
        pointList.set_y(y)
        pointList.set_z(z)

        myProfile.set_pointList(pointList)
        myProfile.set_name(stringBaseType(None, None, None, "Circle Profile"))
        myProfile.set_description(
            stringBaseType(
                None, None, None,
                "Profile generated automatically by VAMPzero cpacs-export"))
Beispiel #6
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
Beispiel #7
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)
Beispiel #8
0
def createFuselageSection(parent,
                          dfus,
                          cs,
                          ProfUID,
                          UID='FLSec',
                          Name='FLSec',
                          descr='Fuselage Section'):
    '''
    Used for generation of a fuselage Section.
    Creates all the sections given through myRQSi.
    @author: Jonas Jepsen
    @param parent: fuselageSectionsType object, fuselageSectionType-objects will be added here
    @param crossSection: only one cross section from PrADO [x_rel,z-dist,height/2,width/2]
    @param ProfUID: the ProfileUID for this section
    @param UID:  UID of this section [string]
    @param Name: Name of this section [string]
    @param descr: Description of this section [string]
    '''
    ## ONLY ONE ELEMENT PER SECTION SUPPORTED
    mySection = fuselageSectionType(uID=UID)
    mySection.set_name(stringBaseType(None, None, None, Name))
    mySection.set_description(stringBaseType(None, None, None, descr))

    transZ = cs[1] * dfus
    scaleX = cs[3] * dfus
    scaleZ = cs[2] * dfus
    createTransformation(mySection, 'absGlobal', 0., 0., transZ, 1., 1., 1.,
                         0., 0., 0.)
    myElements = fuselageElementsType()

    def createFuselageElement(parent,
                              sx,
                              sz,
                              profUID,
                              UID='FLElem',
                              Name='FLElem',
                              descr='Fuselage Element'):
        '''
        Used for the creation of a fuselage element from PrADO cross section
        @author: Jonas Jepsen
        @param parent: fuselageElementsType object, element will be added here
        @param crossSection: the cross section parameters from PrADO [list] (see myRQS in PrADOlib/Fuselages.py)
        @param profUID: the uID of the used Profile
        @param UID: the UID of this element
        @param Name: Name of this Element [string]
        @param descr: Description of this Element [string]
        '''
        myElement = fuselageElementType(uID=UID)
        myElement.set_name(stringBaseType(None, None, None, Name))
        myElement.set_description(stringBaseType(None, None, None, descr))
        myElement.set_profileUID(stringBaseType(None, None, None, profUID))
        createTransformation(myElement, 'absGlobal', 0., 0., 0., 1., sx, sz,
                             0., 0., 0.)
        parent.add_element(myElement)

    createFuselageElement(myElements, scaleX, scaleZ, ProfUID,
                          UID + '_Elem' + str(1), Name + '_Elem' + str(1),
                          descr + '_Element' + str(1))
    mySection.set_elements(myElements)
    parent.add_section(mySection)
Beispiel #9
0
def createComponentSegment(parent, parentUID, fromElement='_Sec1_Elem1'):
    '''
    Used for generation of componentSegments within a wing
    create numOfComponentSegs in a wing
    @param parent: wingType object, Sections-object will be added here
    @param parentUID:  UID of parent object [string]
    '''
    #===========================================================================
    # Create Component Segement
    #===========================================================================
    myUID = parentUID + '_Cseg'
    myName = stringBaseType(None, None, None, parentUID + '_CSeg')
    myDescr = stringBaseType(None, None, None, parentUID + '_CSeg')
    myFromElem = stringBaseType(None, None, None, parentUID + fromElement)
    index = str(len(parent.get_sections().get_section()))
    myToElem = stringBaseType(None, None, None,
                              parentUID + '_Sec' + index + '_Elem1')
    myStructure = wingComponentSegmentStructureType()

    #===========================================================================
    # Back to CPACS
    #===========================================================================
    myComponentSegments = componentSegmentsType()
    myComponentSegment = componentSegmentType(None, None, None, myUID, myName,
                                              myDescr, myFromElem, myToElem,
                                              myStructure, None, None)
    myComponentSegments.add_componentSegment(myComponentSegment)
    parent.set_componentSegments(myComponentSegments)
Beispiel #10
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)
Beispiel #11
0
def createFuselageSegments(parent, parentUID, numOfSeg):
    '''
    Used for generation of fuselage Segments.
    Connects two sections to one segment.
    This method assumes, that two sections with contiguous numbers must be connected.
    @author: Jonas Jepsen
    @param parent: fuselageType object, Sections-object will be added here
    @param parentUID:  UID of parent object [string]
    @param numOfSeg: number of Segments to create (must be one less than sections)
    '''
    mySegments = fuselageSegmentsType()
    for i in range(numOfSeg):
        myUID = parentUID + '_Seg' + str(i + 1)
        myName = stringBaseType(None, None, None,
                                parentUID + '_Seg' + str(i + 1))
        myDescr = stringBaseType(None, None, None,
                                 parentUID + '_Seg' + str(i + 1))
        myFromElem = stringBaseType(None, None, None,
                                    parentUID + '_Sec' + str(i + 1) + '_Elem1')
        myToElem = stringBaseType(None, None, None,
                                  parentUID + '_Sec' + str(i + 2) + '_Elem1')
        tmpSegment = fuselageSegmentType(None, None, None, myUID, myName,
                                         myDescr, myFromElem, myToElem)
        mySegments.add_segment(tmpSegment)
    parent.set_segments(mySegments)
Beispiel #12
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)
Beispiel #13
0
def createWingAirfoil(CPACSObj):
    # get airfoil holding object
    cpacsPath = '/cpacs/vehicles/profiles/wingAirfoils/wingAirfoil[NACA0009]'
    myAirfoil = getObjfromXpath(CPACSObj, cpacsPath)
    pointList = myAirfoil.get_pointList()
    if pointList is None:
        # print "Airfoil 'NACA0009' not found -> will be created."
        # create pointList
        pointList = pointListXYZVectorType()
        xVector = [] 
        yVector = []
        zVector = []

        for x, y in NACA0009[::-1]:
            xVector.append(str(x))
            yVector.append(str(0.0))
            zVector.append(str(y))

        x         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(xVector))
        y         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(yVector))
        z         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(zVector))
        
        pointList.set_x(x)
        pointList.set_y(y)
        pointList.set_z(z)
    
        myAirfoil.set_pointList(pointList)
        myAirfoil.set_name(stringBaseType(valueOf_="NACA0009 Airfoil"))
        myAirfoil.set_description(stringBaseType(valueOf_="Profile generated automatically by VAMPzero cpacs-export"))

    # get airfoil holding object
    cpacsPath = '/cpacs/vehicles/profiles/wingAirfoils/wingAirfoil[NACA653218]'
    myAirfoil = getObjfromXpath(CPACSObj, cpacsPath)
    pointList = myAirfoil.get_pointList()

    if pointList is None:
        # print "Airfoil 'NACA0000' not found -> will be created."
        # create pointList
        pointList = pointListXYZVectorType()
        xVector = [] 
        yVector = []
        zVector = []

        for x, y in NACA653218[::-1]:
            xVector.append(str(x))
            yVector.append(str(0.0))
            zVector.append(str(y))

        x         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(xVector))
        y         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(yVector))
        z         = stringVectorBaseType(mapType='vector',valueOf_=';'.join(zVector))
        
        pointList.set_x(x)
        pointList.set_y(y)
        pointList.set_z(z)
        
        myAirfoil.set_pointList(pointList)
        myAirfoil.set_name(stringBaseType(valueOf_="NACA653218 Airfoil"))
        myAirfoil.set_description(stringBaseType(valueOf_="Profile generated automatically by VAMPzero cpacs-export"))
Beispiel #14
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)
Beispiel #15
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)
Beispiel #16
0
def createFuselage(CPACSObj, id, dfus, lnose, lcabin, ltail, LoD=0):
    # just for now
    if LoD==FUSE_LOD.NONE:
        return

    cpacsPath = '/cpacs/vehicles/aircraft/model/fuselages/fuselage[' + id + ']'
    # the next line is the one to use later on
    #cpacsPath = '/cpacs/vehicles/aircraft/model[model]/fuselages/fuselage[' + self.id + ']'
    # gets a list of all wing elements
    myFuse = getObjfromXpath(CPACSObj,cpacsPath)
    
    strUID       = myFuse.get_uID()
    myUID        = strUID
    myName       = stringBaseType(valueOf_=id)
    myDescr      = stringBaseType(valueOf_=strUID)
    myFuse.set_uID(myUID)
    myFuse.set_name(myName)
    myFuse.set_description(myDescr)
    
    createTransformation(myFuse, 'absGlobal',0.,0.,0.)
    
    if LoD==FUSE_LOD.A320:
        nose = list(NOSE)
        cabin = list(CABIN)
        tail = list(TAIL)
        # remove double values
        cabin.pop(0)
        tail.pop(0)
        # sections will be created, all existing sections will be deleted
        createFuselageSections(myFuse, nose,cabin,tail, dfus, strUID, strUID, strUID)
        createFuselagePositionings(myFuse, nose,cabin,tail, lnose,lcabin,ltail, strUID, strUID)
        
        createFuselageSegments(myFuse, strUID, len(nose)+len(cabin)+len(tail)-1)
    
    elif LoD==FUSE_LOD.ZYL:
        # sections will be created, all existing sections will be deleted
        mySections = fuselageSectionsType()
        #calc fuselage radius
        #rfus = dfus/2.
        # make fuselage configuration data [x_rel,z-dist,height/2,width/2]]
        fuseConf = [0.,0.,0.5,0.5]
        createFuselageSection(mySections, dfus, fuseConf, 'Circle', strUID+'_Sec1', strUID+'_Sec1', strUID+'_Sec1')
        createFuselageSection(mySections, dfus, fuseConf, 'Circle', strUID+'_Sec2', strUID+'_Sec2', strUID+'_Sec2')
        createFuselageSection(mySections, dfus, fuseConf, 'Circle', strUID+'_Sec3', strUID+'_Sec3', strUID+'_Sec3')
        createFuselageSection(mySections, dfus, fuseConf, 'Circle', strUID+'_Sec4', strUID+'_Sec4', strUID+'_Sec4')
        myFuse.set_sections(mySections)
                
        myPositionings = positioningsType()
        createPositioning(myPositionings,str(id) + '_Pos1',None, str(id) + '_Sec1',0.,90.,0.,id + '_Pos1')
        createPositioning(myPositionings,str(id) + '_Pos2',str(id) + '_Sec1',str(id) + '_Sec2',lnose,90.,0,id + '_Pos2')
        createPositioning(myPositionings,str(id) + '_Pos3',str(id) + '_Sec2',str(id) + '_Sec3',lcabin,90.,0,id + '_Pos3')
        createPositioning(myPositionings,str(id) + '_Pos4',str(id) + '_Sec3',str(id) + '_Sec4',ltail,90.,0,id + '_Pos4')
        myFuse.set_positionings(myPositionings)
        
        createFuselageSegments(myFuse, strUID, 3)
Beispiel #17
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
Beispiel #18
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)
Beispiel #19
0
def createProfilefromList(myAirfoils, pointList, uID):
    """
    Used for generation of Wing Profile from a simple 2D List
    @param myAirfoils: wingAirfoils object, Profile will be added here
    @param pointList: the pointlist of the profile
    @param uID: the uID for the profile
    @todo: allow overwriting existing airfoil with same uID
    @note: for now this function always creates a new airfoil
    """
    # new Point List object
    myPointList = createPointList(pointList)

    name = stringBaseType(valueOf_="Name" + uID)
    descripton = stringBaseType(valueOf_="Profile generated automatically by cpacs-export")
    myAirfoils.add_wingAirfoil(profileGeometryType(uID=uID, name=name, description=descripton, pointList=myPointList))
Beispiel #20
0
def createHeader(myWing, id):
    '''
    this function creates the header information in myWing
    @author: Jonas Jepsen
    @param myWing: CPACS wing object
    @param id: the wings id
    @return: strUID, the uID (in string form) of the wing
    '''
    strUID = myWing.get_uID()
    myUID = strUID
    myName = stringBaseType(None, None, None, id)
    myDescr = stringBaseType(None, None, None, strUID)
    myWing.set_uID(myUID)
    myWing.set_name(myName)
    myWing.set_description(myDescr)
    return strUID
Beispiel #21
0
def createHeader(myWing, id):
    """
    this function creates the header information in myWing
    @author: Jonas Jepsen
    @param myWing: CPACS wing object
    @param id: the wings id
    @return: strUID, the uID (in string form) of the wing
    """
    strUID = myWing.get_uID()
    myUID = strUID
    myName = stringBaseType(valueOf_=id)
    myDescr = stringBaseType(valueOf_=strUID)
    myWing.set_uID(myUID)
    myWing.set_name(myName)
    myWing.set_description(myDescr)
    return strUID
Beispiel #22
0
def createHTP(CPACSObj, id, xRoot, zRoot, tcRoot, tcTip, cRoot, cTip, span, phiLE, dihedral, LoD=0, location=True):
    if LoD == WING_LOD.NONE:
        return 
    # just for now
    cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']'
    # the next line is the one to use later on
    # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']'
    # get the wing object from given cpacs path
    myWing = getObjfromXpath(CPACSObj, cpacsPath)
    myWing.set_name(stringBaseType(valueOf_='htp'))
    strUID = createHeader(myWing, id)
    myWing.set_symmetry('x-z-plane')


    if location:
        myWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='fuselage'))
        createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot)
    else:
        myWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='vtp'))
        createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot)

    # call corresponding wing creation method
    if LoD == WING_LOD.SINGLE:
        createTrapezoidWing(myWing, id, tcTip, tcRoot, cTip, cRoot, span, phiLE, dihedral, 0., strUID)

    if not location:
        createWingWingAttachment(myWing.get_componentSegments().get_componentSegment()[0], strUID, targetUID='vtp_Cseg', typeOfSeg='ttail')
Beispiel #23
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)
Beispiel #24
0
 def createFuselageElement(parent, sx,sz, profUID, UID='FLElem', Name='FLElem', descr='Fuselage Element'):
     '''
     Used for the creation of a fuselage element from PrADO cross section
     @author: Jonas Jepsen
     @param parent: fuselageElementsType object, element will be added here
     @param crossSection: the cross section parameters from PrADO [list] (see myRQS in PrADOlib/Fuselages.py)
     @param profUID: the uID of the used Profile
     @param UID: the UID of this element
     @param Name: Name of this Element [string]
     @param descr: Description of this Element [string]
     '''
     myElement = fuselageElementType(uID = UID)
     myElement.set_name(stringBaseType(valueOf_=Name))
     myElement.set_description(stringBaseType(valueOf_=descr))
     myElement.set_profileUID(stringBaseType(valueOf_=profUID))
     createTransformation(myElement,'absGlobal', 0.,0.,0., 1.,sx,sz, 0.,0.,0.)
     parent.add_element(myElement)
Beispiel #25
0
 def createWingElement(parent, tx, ty, tz, sx, sy, sz, rx, ry, rz, AirfUID, UID='WElem', Name='WElem', descr='Wing Element'):
     '''
     Used for the creation of a wing element from PrADO cross section
     @param parent: wingElementsType object, element will be added here
     @param crossSection: the cross section parameters from PrADO [list] (see myFQS in PrADOlib/Wings.py)
     @param AirfUID: the uID of the used Profile
     @param UID: the UID of this element
     @param Name: Name of this Element [string]
     @param descr: Description of this Element [string]
     '''
     myElement = wingElementType(uID=UID)
     myElement.set_name(stringBaseType(valueOf_=Name))
     myElement.set_description(stringBaseType(valueOf_=descr))
     myElement.set_airfoilUID(stringBaseType(valueOf_=AirfUID))
     # Translation
     createTransformation(myElement, 'absGlobal', tx, ty, tz, sx, sy, sz, rx, ry, rz)
     parent.add_element(myElement)
Beispiel #26
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)
Beispiel #27
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
Beispiel #28
0
def createProfilefromList(myAirfoils, pointList, uID):
    '''
    Used for generation of Wing Profile from a simple 2D List
    @param myAirfoils: wingAirfoils object, Profile will be added here
    @param pointList: the pointlist of the profile
    @param uID: the uID for the profile
    @todo: allow overwriting existing airfoil with same uID
    @note: for now this function always creates a new airfoil
    '''
    #new Point List object
    myPointList = createPointList(pointList)

    name = stringBaseType(None, None, None, "Name" + uID)
    descripton = stringBaseType(
        None, None, None, "Profile generated automatically by cpacs-export")
    myAirfoils.add_wingAirfoil(
        profileGeometryType(None, None, None, uID, name, descripton,
                            myPointList))
Beispiel #29
0
def createFuselageSection(parent, dfus, cs, ProfUID, UID='FLSec', Name='FLSec', descr='Fuselage Section'):
    '''
    Used for generation of a fuselage Section.
    Creates all the sections given through myRQSi.
    @author: Jonas Jepsen
    @param parent: fuselageSectionsType object, fuselageSectionType-objects will be added here
    @param crossSection: only one cross section from PrADO [x_rel,z-dist,height/2,width/2]
    @param ProfUID: the ProfileUID for this section
    @param UID:  UID of this section [string]
    @param Name: Name of this section [string]
    @param descr: Description of this section [string]
    '''
    ## ONLY ONE ELEMENT PER SECTION SUPPORTED
    mySection = fuselageSectionType(uID=UID)
    mySection.set_name(stringBaseType(valueOf_=Name))
    mySection.set_description(stringBaseType(valueOf_=descr))
    
    transZ = cs[1]*dfus
    scaleX = cs[3]*dfus
    scaleZ = cs[2]*dfus
    createTransformation(mySection,'absGlobal',0.,0.,transZ, 1.,1.,1., 0.,0.,0.)
    myElements = fuselageElementsType()
    def createFuselageElement(parent, sx,sz, profUID, UID='FLElem', Name='FLElem', descr='Fuselage Element'):
        '''
        Used for the creation of a fuselage element from PrADO cross section
        @author: Jonas Jepsen
        @param parent: fuselageElementsType object, element will be added here
        @param crossSection: the cross section parameters from PrADO [list] (see myRQS in PrADOlib/Fuselages.py)
        @param profUID: the uID of the used Profile
        @param UID: the UID of this element
        @param Name: Name of this Element [string]
        @param descr: Description of this Element [string]
        '''
        myElement = fuselageElementType(uID = UID)
        myElement.set_name(stringBaseType(valueOf_=Name))
        myElement.set_description(stringBaseType(valueOf_=descr))
        myElement.set_profileUID(stringBaseType(valueOf_=profUID))
        createTransformation(myElement,'absGlobal', 0.,0.,0., 1.,sx,sz, 0.,0.,0.)
        parent.add_element(myElement)
    
    createFuselageElement(myElements, scaleX,scaleZ, ProfUID, UID+'_Elem'+str(1), Name+'_Elem'+str(1), descr+'_Element'+str(1))
    mySection.set_elements(myElements)
    parent.add_section(mySection)
Beispiel #30
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
Beispiel #31
0
def createWingSegments(parent, parentUID, numOfSeg):
    '''
    Used for generation of wing Segments.
    Connects two sections to one segment.
    This method assumes, that two sections with contiguous numbers must be connected.
    @param parent: wingType object, Sections-object will be added here
    @param parentUID:  UID of parent object [string]
    @param numOfSeg: number of Segments to create (must be one less than sections)
    '''
    # # ONLY ONE ELEMENT PER SECTION SUPPORTED
    mySegments = wingSegmentsType()
    for i in range(numOfSeg):
        myUID = parentUID + '_Seg' + str(i + 1)
        myName = stringBaseType(None, None, None, parentUID + '_Seg' + str(i + 1))
        myDescr = stringBaseType(None, None, None, parentUID + '_Seg' + str(i + 1))
        myFromElem = stringBaseType(None, None, None, parentUID + '_Sec' + str(i + 1) + '_Elem1')
        myToElem = stringBaseType(None, None, None, parentUID + '_Sec' + str(i + 2) + '_Elem1')
        tmpSegment = wingSegmentType(None, None, None, myUID, myName, myDescr, myFromElem, myToElem)
        mySegments.add_segment(tmpSegment)
    parent.set_segments(mySegments)
Beispiel #32
0
def createFuselageSegments(parent, parentUID, numOfSeg):
    '''
    Used for generation of fuselage Segments.
    Connects two sections to one segment.
    This method assumes, that two sections with contiguous numbers must be connected.
    @author: Jonas Jepsen
    @param parent: fuselageType object, Sections-object will be added here
    @param parentUID:  UID of parent object [string]
    @param numOfSeg: number of Segments to create (must be one less than sections)
    '''
    mySegments = fuselageSegmentsType()
    for i in range(numOfSeg):
        myUID       = parentUID+'_Seg'+str(i+1)
        myName      = stringBaseType(valueOf_=parentUID+'_Seg'+str(i+1))
        myDescr     = stringBaseType(valueOf_=parentUID+'_Seg'+str(i+1))
        myFromElem  = stringBaseType(valueOf_=parentUID+'_Sec'+str(i+1)+'_Elem1')
        myToElem    = stringBaseType(valueOf_=parentUID+'_Sec'+str(i+2)+'_Elem1')
        tmpSegment = fuselageSegmentType(uID=myUID, name=myName, description=myDescr, fromElementUID=myFromElem, toElementUID=myToElem)
        mySegments.add_segment(tmpSegment)
    parent.set_segments(mySegments)
Beispiel #33
0
def createWingSection(parent, thickness, tx, ty, tz, sx, sy, sz, rx, ry, rz, AirfUID, maxT, UID='WSec', Name='WSec', descr='Wing Section'):
    '''
    Used for generation of a wing Section.
    Creates all the sections given through myQSi.
    @param parent: wingSectionsType object, wingSectionType-objects will be added here
    @param crossSection: only one cross section from PrADOs R1GEO**i (with ** as F,HL,SL,WL and i as wingindex)
    @param AirfUID: the AirfoilUID for this section
    @param maxT: the max profile thickness of this section
    @param UID:  UID of this section [string]
    @param Name: Name of this section [string]
    @param descr: Description of this section [string]
    '''
    # # ONLY ONE ELEMENT PER SECTION SUPPORTED
    mySection = wingSectionType(uID=UID)
    mySection.set_name(stringBaseType(None, None, None, Name))
    mySection.set_description(stringBaseType(None, None, None, descr))
    
    # Position of the Element
    createTransformation(mySection, 'absGlobal', tx, ty, tz, sx, sy, sz, rx, ry, rz,)
    myElements = wingElementsType()
    def createWingElement(parent, tx, ty, tz, sx, sy, sz, rx, ry, rz, AirfUID, UID='WElem', Name='WElem', descr='Wing Element'):
        '''
        Used for the creation of a wing element from PrADO cross section
        @param parent: wingElementsType object, element will be added here
        @param crossSection: the cross section parameters from PrADO [list] (see myFQS in PrADOlib/Wings.py)
        @param AirfUID: the uID of the used Profile
        @param UID: the UID of this element
        @param Name: Name of this Element [string]
        @param descr: Description of this Element [string]
        '''
        myElement = wingElementType(uID=UID)
        myElement.set_name(stringBaseType(valueOf_=Name))
        myElement.set_description(stringBaseType(valueOf_=descr))
        myElement.set_airfoilUID(stringBaseType(valueOf_=AirfUID))
        # Translation
        createTransformation(myElement, 'absGlobal', tx, ty, tz, sx, sy, sz, rx, ry, rz)
        parent.add_element(myElement)
    
    createWingElement(myElements, 0., 0., 0., 1., 1., thickness, 0., 0., 0., AirfUID, UID + '_Elem' + str(1), Name + '_Elem' + str(1), descr + '_Element' + str(1))
    mySection.set_elements(myElements)
    parent.add_section(mySection)
Beispiel #34
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
Beispiel #35
0
 def createFuselageElement(parent,
                           sx,
                           sz,
                           profUID,
                           UID='FLElem',
                           Name='FLElem',
                           descr='Fuselage Element'):
     '''
     Used for the creation of a fuselage element from PrADO cross section
     @author: Jonas Jepsen
     @param parent: fuselageElementsType object, element will be added here
     @param crossSection: the cross section parameters from PrADO [list] (see myRQS in PrADOlib/Fuselages.py)
     @param profUID: the uID of the used Profile
     @param UID: the UID of this element
     @param Name: Name of this Element [string]
     @param descr: Description of this Element [string]
     '''
     myElement = fuselageElementType(uID=UID)
     myElement.set_name(stringBaseType(None, None, None, Name))
     myElement.set_description(stringBaseType(None, None, None, descr))
     myElement.set_profileUID(stringBaseType(None, None, None, profUID))
     createTransformation(myElement, 'absGlobal', 0., 0., 0., 1., sx, sz,
                          0., 0., 0.)
     parent.add_element(myElement)
Beispiel #36
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
Beispiel #37
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)
Beispiel #38
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)
Beispiel #39
0
def createHTP(CPACSObj,
              id,
              xRoot,
              zRoot,
              tcRoot,
              tcTip,
              cRoot,
              cTip,
              span,
              phiLE,
              dihedral,
              LoD=0,
              location=True):
    if LoD == WING_LOD.NONE:
        return
    # just for now
    cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']'
    # the next line is the one to use later on
    # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']'
    # get the wing object from given cpacs path
    myWing = getObjfromXpath(CPACSObj, cpacsPath)
    myWing.set_name(stringBaseType(valueOf_='htp'))
    strUID = createHeader(myWing, id)
    myWing.set_symmetry('x-z-plane')

    if location:
        myWing.set_parentUID(
            stringUIDBaseType(isLink=True, valueOf_='fuselage'))
        createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot)
    else:
        myWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='vtp'))
        createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot)

    # call corresponding wing creation method
    if LoD == WING_LOD.SINGLE:
        createTrapezoidWing(myWing, id, tcTip, tcRoot, cTip, cRoot, span,
                            phiLE, dihedral, 0., strUID)

    if not location:
        createWingWingAttachment(
            myWing.get_componentSegments().get_componentSegment()[0],
            strUID,
            targetUID='vtp_Cseg',
            typeOfSeg='ttail')
Beispiel #40
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)
Beispiel #41
0
def createVTP(CPACSObj,
              id,
              xRoot,
              zRoot,
              tcRoot,
              tcTip,
              cRoot,
              cTip,
              span,
              phiLE,
              LoD=0):
    if LoD == WING_LOD.NONE:
        return
    # just for now
    cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']'
    # the next line is the one to use later on
    # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']'
    # get the wing object from given cpacs path
    myWing = getObjfromXpath(CPACSObj, cpacsPath)
    myWing.set_name(stringBaseType(valueOf_='vtp'))
    myWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='fuselage'))

    strUID = createHeader(myWing, id)

    # rotate vertical tail to correct orientation
    createTransformation(myWing, 'absGlobal', xRoot, 0., zRoot, 1., 1., 1.,
                         90., 0., 0.)
    # As the vtp is not symmetrical span values must be dubbled for conversion
    span = span * 2

    # call corresponding wing creation method
    if LoD == WING_LOD.SINGLE:
        createTrapezoidWing(myWing,
                            id,
                            tcRoot,
                            tcTip,
                            cTip,
                            cRoot,
                            span,
                            phiLE,
                            dihedral=0,
                            twist=0.,
                            strUID=strUID)
Beispiel #42
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)
Beispiel #43
0
def createWingAirfoil(CPACSObj):
    # get airfoil holding object
    cpacsPath = '/cpacs/vehicles/profiles/wingAirfoils/wingAirfoil[NACA0009]'
    myAirfoil = getObjfromXpath(CPACSObj, cpacsPath)
    pointList = myAirfoil.get_pointList()
    if pointList is None:
        # print "Airfoil 'NACA0009' not found -> will be created."
        # create pointList
        pointList = pointListXYZVectorType()
        xVector = []
        yVector = []
        zVector = []

        for x, y in NACA0009:
            xVector.append(str(x))
            yVector.append(str(0.0))
            zVector.append(str(y))

        x = stringVectorBaseType(None, None, None, 'vector', ';'.join(xVector))
        y = stringVectorBaseType(None, None, None, 'vector', ';'.join(yVector))
        z = stringVectorBaseType(None, None, None, 'vector', ';'.join(zVector))

        pointList.set_x(x)
        pointList.set_y(y)
        pointList.set_z(z)

        myAirfoil.set_pointList(pointList)
        myAirfoil.set_name(stringBaseType(None, None, None,
                                          "NACA0009 Airfoil"))
        myAirfoil.set_description(
            stringBaseType(
                None, None, None,
                "Profile generated automatically by VAMPzero cpacs-export"))

    # get airfoil holding object
    cpacsPath = '/cpacs/vehicles/profiles/wingAirfoils/wingAirfoil[NACA653218]'
    myAirfoil = getObjfromXpath(CPACSObj, cpacsPath)
    pointList = myAirfoil.get_pointList()

    if pointList is None:
        # print "Airfoil 'NACA0000' not found -> will be created."
        # create pointList
        pointList = pointListXYZVectorType()
        xVector = []
        yVector = []
        zVector = []

        for x, y in NACA653218:
            xVector.append(str(x))
            yVector.append(str(0.0))
            zVector.append(str(y))

        x = stringVectorBaseType(None, None, None, 'vector', ';'.join(xVector))
        y = stringVectorBaseType(None, None, None, 'vector', ';'.join(yVector))
        z = stringVectorBaseType(None, None, None, 'vector', ';'.join(zVector))

        pointList.set_x(x)
        pointList.set_y(y)
        pointList.set_z(z)

        myAirfoil.set_pointList(pointList)
        myAirfoil.set_name(
            stringBaseType(None, None, None, "NACA653218 Airfoil"))
        myAirfoil.set_description(
            stringBaseType(
                None, None, None,
                "Profile generated automatically by VAMPzero cpacs-export"))
Beispiel #44
0
def createWingSection(parent,
                      thickness,
                      tx,
                      ty,
                      tz,
                      sx,
                      sy,
                      sz,
                      rx,
                      ry,
                      rz,
                      AirfUID,
                      maxT,
                      UID='WSec',
                      Name='WSec',
                      descr='Wing Section'):
    '''
    Used for generation of a wing Section.
    Creates all the sections given through myQSi.
    @param parent: wingSectionsType object, wingSectionType-objects will be added here
    @param crossSection: only one cross section from PrADOs R1GEO**i (with ** as F,HL,SL,WL and i as wingindex)
    @param AirfUID: the AirfoilUID for this section
    @param maxT: the max profile thickness of this section
    @param UID:  UID of this section [string]
    @param Name: Name of this section [string]
    @param descr: Description of this section [string]
    '''
    # # ONLY ONE ELEMENT PER SECTION SUPPORTED
    mySection = wingSectionType(uID=UID)
    mySection.set_name(stringBaseType(None, None, None, Name))
    mySection.set_description(stringBaseType(None, None, None, descr))

    # Position of the Element
    createTransformation(
        mySection,
        'absGlobal',
        tx,
        ty,
        tz,
        sx,
        sy,
        sz,
        rx,
        ry,
        rz,
    )
    myElements = wingElementsType()

    def createWingElement(parent,
                          tx,
                          ty,
                          tz,
                          sx,
                          sy,
                          sz,
                          rx,
                          ry,
                          rz,
                          AirfUID,
                          UID='WElem',
                          Name='WElem',
                          descr='Wing Element'):
        '''
        Used for the creation of a wing element from PrADO cross section
        @param parent: wingElementsType object, element will be added here
        @param crossSection: the cross section parameters from PrADO [list] (see myFQS in PrADOlib/Wings.py)
        @param AirfUID: the uID of the used Profile
        @param UID: the UID of this element
        @param Name: Name of this Element [string]
        @param descr: Description of this Element [string]
        '''
        myElement = wingElementType(uID=UID)
        myElement.set_name(stringBaseType(valueOf_=Name))
        myElement.set_description(stringBaseType(valueOf_=descr))
        myElement.set_airfoilUID(stringBaseType(valueOf_=AirfUID))
        # Translation
        createTransformation(myElement, 'absGlobal', tx, ty, tz, sx, sy, sz,
                             rx, ry, rz)
        parent.add_element(myElement)

    createWingElement(myElements, 0., 0., 0., 1., 1., thickness, 0., 0., 0.,
                      AirfUID, UID + '_Elem' + str(1), Name + '_Elem' + str(1),
                      descr + '_Element' + str(1))
    mySection.set_elements(myElements)
    parent.add_section(mySection)
Beispiel #45
0
def createTanks(parent,
                parentUID,
                targetUID='tank1',
                typeOfSeg='advDoubletrapezoid',
                nRib='2'):
    '''
    Used for generation of a wing tank

    @param parent: ComponentSegment object, wing fuel tank will be added here. 
    @param typeOfSeg: either advDoubleTrapezoid or trapezoid
    @param iRib: index of Rib in wing_ribs ribDefinition
    '''
    tanks = []

    #===========================================================================
    # Tanks
    #===========================================================================

    if typeOfSeg == 'advDoubletrapezoid':
        # Innermost
        myUID = parentUID + '_tank_inner'
        myName = stringBaseType(None, None, None, myUID)
        front = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(
            ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'),
            ribNumber=integerBaseType(valueOf_=str(4)))
        rear = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(None, None, None,
                                              [front, outer, rear])
        tanks.append(
            wingFuelTankType(None, None, None, myUID, myName, None, myGeometry,
                             None))

        # root to tw
        myUID = parentUID + '_tank_middle'
        myName = stringBaseType(None, None, None, myUID)
        inner = outer
        front = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(
            ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_engine2'),
            ribNumber=integerBaseType(valueOf_=str(1)))
        rear = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(None, None, None,
                                              [inner, front, outer, rear])
        tanks.append(
            wingFuelTankType(None, None, None, myUID, myName, None, myGeometry,
                             None))

        # tw to outer
        myUID = parentUID + '_tank_outer'
        myName = stringBaseType(None, None, None, myUID)
        inner = outer
        front = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(
            ribDefinitionUID=stringUIDBaseType(valueOf_=parentUID +
                                               '_ribs_outer'),
            ribNumber=integerBaseType(valueOf_=str(nRib)))
        rear = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(None, None, None,
                                              [inner, front, outer, rear])
        tanks.append(
            wingFuelTankType(None, None, None, myUID, myName, None, myGeometry,
                             None))

    if typeOfSeg == "strutBracedWing":
        # Innermost
        myUID = parentUID + '_tank_inner'
        myName = stringBaseType(None, None, None, myUID)
        front = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(
            ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'),
            ribNumber=integerBaseType(valueOf_=str(4)))
        rear = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(None, None, None,
                                              [front, outer, rear])
        tanks.append(
            wingFuelTankType(None, None, None, myUID, myName, None, myGeometry,
                             None))

        # root to strut
        myUID = parentUID + '_tank_middle'
        myName = stringBaseType(None, None, None, myUID)
        inner = outer
        front = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(
            ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_outer'),
            ribNumber=integerBaseType(valueOf_=str(1)))
        rear = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(None, None, None,
                                              [inner, front, outer, rear])
        tanks.append(
            wingFuelTankType(None, None, None, myUID, myName, None, myGeometry,
                             None))

        # strut to outer
        myUID = parentUID + '_tank_outer'
        myName = stringBaseType(None, None, None, myUID)
        inner = outer
        front = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(
            ribDefinitionUID=stringUIDBaseType(valueOf_=parentUID +
                                               '_ribs_outer'),
            ribNumber=integerBaseType(valueOf_=str(nRib)))
        rear = wingFuelTankBorderType(
            None, None, None,
            stringUIDBaseType(None, None, 'True', None,
                              parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(None, None, None,
                                              [inner, front, outer, rear])
        tanks.append(
            wingFuelTankType(None, None, None, myUID, myName, None, myGeometry,
                             None))

    myTanks = wingFuelTanksType(None, None, None, tanks)
    parent.set_wingFuelTanks(myTanks)
Beispiel #46
0
def createFuselage(CPACSObj, id, dfus, lnose, lcabin, ltail, LoD=0):
    # just for now
    if LoD == FUSE_LOD.NONE:
        return

    cpacsPath = '/cpacs/vehicles/aircraft/model/fuselages/fuselage[' + id + ']'
    # the next line is the one to use later on
    #cpacsPath = '/cpacs/vehicles/aircraft/model[model]/fuselages/fuselage[' + self.id + ']'
    # gets a list of all wing elements
    myFuse = getObjfromXpath(CPACSObj, cpacsPath)

    strUID = myFuse.get_uID()
    myUID = strUID
    myName = stringBaseType(None, None, None, id)
    myDescr = stringBaseType(None, None, None, strUID)
    myFuse.set_uID(myUID)
    myFuse.set_name(myName)
    myFuse.set_description(myDescr)

    createTransformation(myFuse, 'absGlobal', 0., 0., 0.)

    if LoD == FUSE_LOD.A320:
        nose = list(NOSE)
        cabin = list(CABIN)
        tail = list(TAIL)
        # remove double values
        cabin.pop(0)
        tail.pop(0)
        # sections will be created, all existing sections will be deleted
        createFuselageSections(myFuse, nose, cabin, tail, dfus, strUID, strUID,
                               strUID)
        createFuselagePositionings(myFuse, nose, cabin, tail, lnose, lcabin,
                                   ltail, strUID, strUID)

        createFuselageSegments(myFuse, strUID,
                               len(nose) + len(cabin) + len(tail) - 1)

    elif LoD == FUSE_LOD.ZYL:
        # sections will be created, all existing sections will be deleted
        mySections = fuselageSectionsType()
        #calc fuselage radius
        #rfus = dfus/2.
        # make fuselage configuration data [x_rel,z-dist,height/2,width/2]]
        fuseConf = [0., 0., 0.5, 0.5]
        createFuselageSection(mySections, dfus, fuseConf, 'Circle',
                              strUID + '_Sec1', strUID + '_Sec1',
                              strUID + '_Sec1')
        createFuselageSection(mySections, dfus, fuseConf, 'Circle',
                              strUID + '_Sec2', strUID + '_Sec2',
                              strUID + '_Sec2')
        createFuselageSection(mySections, dfus, fuseConf, 'Circle',
                              strUID + '_Sec3', strUID + '_Sec3',
                              strUID + '_Sec3')
        createFuselageSection(mySections, dfus, fuseConf, 'Circle',
                              strUID + '_Sec4', strUID + '_Sec4',
                              strUID + '_Sec4')
        myFuse.set_sections(mySections)

        myPositionings = positioningsType()
        createPositioning(myPositionings,
                          str(id) + '_Pos1', None,
                          str(id) + '_Sec1', 0., 90., 0., id + '_Pos1')
        createPositioning(myPositionings,
                          str(id) + '_Pos2',
                          str(id) + '_Sec1',
                          str(id) + '_Sec2', lnose, 90., 0, id + '_Pos2')
        createPositioning(myPositionings,
                          str(id) + '_Pos3',
                          str(id) + '_Sec2',
                          str(id) + '_Sec3', lcabin, 90., 0, id + '_Pos3')
        createPositioning(myPositionings,
                          str(id) + '_Pos4',
                          str(id) + '_Sec3',
                          str(id) + '_Sec4', ltail, 90., 0, id + '_Pos4')
        myFuse.set_positionings(myPositionings)

        createFuselageSegments(myFuse, strUID, 3)
Beispiel #47
0
def createWing(CPACSObj=None, zeroWing=None, id="1", LoD=0.):
    """
    This function triggers the different export modes of the wing depending on the desired
    level of detail.

    Options include a single trapezoid, double trapezoid, advanced double trapezoid (that includes
    a rectangular center fuselage section) and a strut-braced wing.

    Please note, these are the internal guts of VAMPzero's CPACS export. A lot of the code
    here is experimental and furthermore highly chaotic. In case of emergency contact Daniel or Jonas.

    :param CPACSObj: The overall CPACS object of the export
    :param zeroWing: The instance of the wing.
    :param id: The id of the wing, mostly sth. like wing
    :param LoD: The level of detail of the desired input.
    :return: CPACSObj including a new wing
    """
    if LoD == WING_LOD.NONE:
        return
    # just for now
    cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']'
    # the next line is the one to use later on
    # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']'
    # get the wing object from given cpacs path
    cpacsWing = getObjfromXpath(CPACSObj, cpacsPath)
    strUID = createHeader(cpacsWing, id)

    cpacsWing.set_symmetry('x-z-plane')
    cpacsWing.set_name(stringBaseType(valueOf_='wing'))
    cpacsWing.set_parentUID(stringUIDBaseType(isLink=True,
                                              valueOf_='fuselage'))

    xRoot = zeroWing.xRoot.getValue()
    zRoot = zeroWing.zRoot.getValue()
    cRoot = zeroWing.cRoot.getValue()
    cTip = zeroWing.cTip.getValue()
    span = zeroWing.span.getValue()
    dfus = zeroWing.aircraft.fuselage.dfus.getValue()
    phiLE = zeroWing.phiLE.getValue()
    dihedral = zeroWing.dihedral.getValue()
    twist = zeroWing.twist.getValue()
    Sref = zeroWing.refArea.getValue()
    xMAC25 = zeroWing.xMAC25.getValue()
    tcRoot = zeroWing.airfoilr.tc.getValue()
    tcTip = zeroWing.airfoilt.tc.getValue()

    try:
        etakf = zeroWing.etaKink.getValue()
        yFus = zeroWing.yFuselage.getValue()
        etaEng = zeroWing.etaEngine.getValue()
        etaFus = yFus / span * 2.
    except AttributeError:
        pass  #As not all components that call this method have a kink

    try:
        yRoot = zeroWing.yRoot.getValue()
    except AttributeError:
        pass  #As not all components that call this method have a kink

    createTransformation(cpacsWing, 'absGlobal', xRoot, 0., zRoot)
    # call corresponding wing creation method
    if LoD == WING_LOD.SINGLE:
        createTrapezoidWing(cpacsWing, id, tcRoot, tcTip, cTip, cRoot, span,
                            phiLE, dihedral, twist, strUID)
    elif LoD == WING_LOD.DOUBLE:
        createDoubleTrapezoidWing(cpacsWing, id, cTip, cRoot, span, Sref,
                                  phiLE, dihedral, twist, xMAC25, etakf,
                                  strUID)
    elif LoD == WING_LOD.ADVDOUBLE:
        createAdvDoubleTrapezoidWing(cpacsWing, id, cTip, cRoot, span, Sref,
                                     dfus, phiLE, dihedral, twist, xMAC25,
                                     etakf, strUID, yFus, xRoot, etaEng,
                                     tcRoot, tcTip)
    elif LoD == WING_LOD.UCAV:
        createUCAVWing(cpacsWing, id, cTip, cRoot, span, Sref, phiLE, dihedral,
                       etakf, strUID)
    elif LoD == WING_LOD.SBW:
        print "dihedral", dihedral
        etaStrut = zeroWing.aircraft.strut.etaStrut.getValue()
        createStrutBracedWing(cpacsWing,
                              id=id,
                              cTip=cTip,
                              cRoot=cRoot,
                              span=span,
                              Sref=Sref,
                              phiLE=phiLE,
                              dihedral=dihedral,
                              twist=twist,
                              xMAC25=xMAC25,
                              etaFus=etaFus,
                              etaStrut=etaStrut,
                              tcRoot=tcRoot,
                              tcTip=tcTip,
                              xRoot=xRoot,
                              strUID=strUID)
    elif LoD == WING_LOD.STRUT:
        etaStrut = zeroWing.aircraft.strut.etaStrut.getValue()
        createStrut(cpacsWing,
                    id=id,
                    cTip=cTip,
                    cRoot=cRoot,
                    span=span,
                    phiLE=phiLE,
                    dihedral=dihedral,
                    tcRoot=tcRoot,
                    tcTip=tcTip,
                    xRoot=xRoot,
                    yRoot=yRoot,
                    twist=twist,
                    etaStrut=etaStrut,
                    strUID=strUID)
Beispiel #48
0
def createTanks(parent, parentUID, targetUID='tank1', typeOfSeg='advDoubletrapezoid', nRib='2'):
    '''
    Used for generation of a wing tank

    @param parent: ComponentSegment object, wing fuel tank will be added here. 
    @param typeOfSeg: either advDoubleTrapezoid or trapezoid
    @param iRib: index of Rib in wing_ribs ribDefinition
    '''
    tanks = []

    #===========================================================================
    # Tanks
    #===========================================================================

    if typeOfSeg == 'advDoubletrapezoid':
        # Innermost
        myUID = parentUID + '_tank_inner'
        myName = stringBaseType(valueOf_=myUID)
        front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'), ribNumber=integerBaseType(valueOf_=str(4)))
        rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(border=[front, outer, rear])
        tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry))

        # root to tw
        myUID = parentUID + '_tank_middle'
        myName = stringBaseType(valueOf_=myUID)
        inner = outer
        front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_engine2'), ribNumber=integerBaseType(valueOf_=str(1)))
        rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(border=[inner, front, outer, rear])
        tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry))

        # tw to outer
        myUID = parentUID + '_tank_outer'
        myName = stringBaseType(valueOf_=myUID)
        inner = outer
        front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_=parentUID + '_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(nRib)))
        rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(border=[inner, front, outer, rear])
        tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry))

    if typeOfSeg == "strutBracedWing":
        # Innermost
        myUID = parentUID + '_tank_inner'
        myName = stringBaseType(valueOf_=myUID)
        front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_inner'), ribNumber=integerBaseType(valueOf_=str(4)))
        rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(border=[front, outer, rear])
        tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry))

        # root to strut
        myUID = parentUID + '_tank_middle'
        myName = stringBaseType(valueOf_=myUID)
        inner = outer
        front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_='wing_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(1)))
        rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(border=[inner, front, outer, rear])
        tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry))

        # strut to outer
        myUID = parentUID + '_tank_outer'
        myName = stringBaseType(valueOf_=myUID)
        inner = outer
        front = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_FS'))
        outer = wingFuelTankBorderType(ribDefinitionUID=stringUIDBaseType(valueOf_=parentUID + '_ribs_outer'), ribNumber=integerBaseType(valueOf_=str(nRib)))
        rear = wingFuelTankBorderType(sparUID=stringUIDBaseType(valueOf_=parentUID + '_Spar_RS'))
        myGeometry = wingFuelTankGeometryType(border=[inner, front, outer, rear])
        tanks.append(wingFuelTankType(uID=myUID, name=myName, geometry=myGeometry))

    myTanks = wingFuelTanksType(wingFuelTank=tanks)
    parent.set_wingFuelTanks(myTanks)
Beispiel #49
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)
Beispiel #50
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)
Beispiel #51
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)
Beispiel #52
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)
Beispiel #53
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)
Beispiel #54
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)
Beispiel #55
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)
Beispiel #56
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)
Beispiel #57
0
def createWing(CPACSObj = None, zeroWing = None, id="1", LoD = 0.):
    """
    This function triggers the different export modes of the wing depending on the desired
    level of detail.

    Options include a single trapezoid, double trapezoid, advanced double trapezoid (that includes
    a rectangular center fuselage section) and a strut-braced wing.

    Please note, these are the internal guts of VAMPzero's CPACS export. A lot of the code
    here is experimental and furthermore highly chaotic. In case of emergency contact Daniel or Jonas.

    :param CPACSObj: The overall CPACS object of the export
    :param zeroWing: The instance of the wing.
    :param id: The id of the wing, mostly sth. like wing
    :param LoD: The level of detail of the desired input.
    :return: CPACSObj including a new wing
    """
    if LoD == WING_LOD.NONE:
        return 
    # just for now
    cpacsPath = '/cpacs/vehicles/aircraft/model/wings/wing[' + id + ']'
    # the next line is the one to use later on
    # cpacsPath = '/cpacs/vehicles/aircraft/model[model]/wings/wing[' + self.id + ']'
    # get the wing object from given cpacs path
    cpacsWing = getObjfromXpath(CPACSObj, cpacsPath)
    strUID = createHeader(cpacsWing, id)
    
    cpacsWing.set_symmetry('x-z-plane')
    cpacsWing.set_name(stringBaseType(valueOf_='wing'))
    cpacsWing.set_parentUID(stringUIDBaseType(isLink=True, valueOf_='fuselage'))

    xRoot = zeroWing.xRoot.getValue()
    zRoot = zeroWing.zRoot.getValue()
    cRoot = zeroWing.cRoot.getValue()
    cTip = zeroWing.cTip.getValue()
    span = zeroWing.span.getValue()
    dfus = zeroWing.aircraft.fuselage.dfus.getValue()
    phiLE = zeroWing.phiLE.getValue()
    dihedral = zeroWing.dihedral.getValue()
    twist = zeroWing.twist.getValue()
    Sref = zeroWing.refArea.getValue()
    xMAC25 = zeroWing.xMAC25.getValue()
    tcRoot = zeroWing.airfoilr.tc.getValue()
    tcTip = zeroWing.airfoilt.tc.getValue()

    try:
        etakf = zeroWing.etaKink.getValue()
        yFus = zeroWing.yFuselage.getValue()
        etaEng = zeroWing.etaEngine.getValue()
        etaFus = yFus/span*2.
    except AttributeError:
        pass #As not all components that call this method have a kink

    try:
        yRoot = zeroWing.yRoot.getValue()
    except AttributeError:
        pass #As not all components that call this method have a kink

    createTransformation(cpacsWing, 'absGlobal', xRoot, 0., zRoot)
    # call corresponding wing creation method
    if LoD == WING_LOD.SINGLE:
        createTrapezoidWing(cpacsWing, id, tcRoot, tcTip, cTip, cRoot, span, phiLE, dihedral, twist, strUID)
    elif LoD == WING_LOD.DOUBLE:
        createDoubleTrapezoidWing(cpacsWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, twist, xMAC25, etakf, strUID)
    elif LoD == WING_LOD.ADVDOUBLE:
        createAdvDoubleTrapezoidWing(cpacsWing, id, cTip, cRoot, span, Sref, dfus, phiLE, dihedral, twist, xMAC25, etakf, strUID, yFus, xRoot, etaEng, tcRoot, tcTip)
    elif LoD == WING_LOD.UCAV:
        createUCAVWing(cpacsWing, id, cTip, cRoot, span, Sref, phiLE, dihedral, etakf, strUID)
    elif LoD == WING_LOD.SBW:
        etaStrut = zeroWing.aircraft.strut.etaStrut.getValue()
        createStrutBracedWing(cpacsWing, id=id, cTip=cTip, cRoot=cRoot, span=span, Sref=Sref, phiLE=phiLE, dihedral=dihedral, twist=twist, xMAC25=xMAC25, etaFus=etaFus, etaStrut=etaStrut, tcRoot=tcRoot, tcTip=tcTip, xRoot=xRoot, strUID=strUID)
    elif LoD == WING_LOD.SBWStraight:
        etaStrut = zeroWing.aircraft.strut.etaStrut.getValue()
        createStraightStrutBracedWing(cpacsWing, id=id, cTip=cTip, cRoot=cRoot, span=span, Sref=Sref, phiLE=phiLE, dihedral=dihedral, twist=twist, xMAC25=xMAC25, etaFus=etaFus, etaStrut=etaStrut, tcRoot=tcRoot, tcTip=tcTip, xRoot=xRoot, strUID=strUID)
    elif LoD == WING_LOD.STRUT:
        etaStrut = zeroWing.aircraft.strut.etaStrut.getValue()
        createStrut(cpacsWing, id=id, cTip=cTip, cRoot=cRoot, span=span, phiLE=phiLE, dihedral=dihedral, tcRoot=tcRoot, tcTip=tcTip, xRoot=xRoot, yRoot=yRoot, twist=twist, etaStrut=etaStrut,  strUID=strUID)