Ejemplo n.º 1
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" ))
Ejemplo n.º 2
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"))
Ejemplo n.º 3
0
    def cpacsExport(self, CPACSObj):
        '''
        This method overwrites the cpacsExport method of parameter.

        This method will create the certification cases for CPACS
        '''
        def createPointList(nparray):
            '''
            create a point list for each cog location

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

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

            return myPointList

        def createVectorPointList(nparray):
            '''
            create a point list for each cog location
            '''
            myPointList = pointListType()

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

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

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

            return myPointList

        cpacsPath = '/cpacs/vehicles/aircraft/model/analyses/weightAndBalance/certificationCases'
        myCertificationCases = getObjfromXpath(CPACSObj, cpacsPath)

        # create mass Vector
        massVector = stringVectorBaseType(valueOf_='; '.join(str(mass) for mass in self.m_TOW_fuel_pay.tolist()))

        # create forward case, create backward case
        forwardPoints = createVectorPointList(self.posCoGMIN_fuel_pay0)
        rearwardPoints = createVectorPointList(self.posCoGMAX_fuel_pay0)

        forwardCertificationCase = weightAndBalanceCaseType(uID="cc_forwardLocations", coG=forwardPoints, mass=massVector)
        rearwardCertificationCase = weightAndBalanceCaseType(uID="cc_rearwardLocations", coG=rearwardPoints, mass=massVector)

        myCertificationCases.add_certificationCase(forwardCertificationCase)
        myCertificationCases.add_certificationCase(rearwardCertificationCase)
Ejemplo n.º 4
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"))
Ejemplo n.º 5
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"))