Example #1
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')
Example #2
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)
Example #3
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)
Example #4
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)
Example #5
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)
Example #6
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)
Example #7
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')
Example #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(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)
Example #9
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)
Example #10
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)
Example #11
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)
Example #12
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)
Example #13
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)
Example #14
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)
Example #15
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)