コード例 #1
0
ファイル: htp.py プロジェクト: codingpoets/VAMPzero
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')
コード例 #2
0
ファイル: htp.py プロジェクト: p-chambers/VAMPzero
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')
コード例 #3
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)
コード例 #4
0
ファイル: wing.py プロジェクト: p-chambers/VAMPzero
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)
コード例 #5
0
ファイル: wing.py プロジェクト: techtronics/VAMPzero
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)