Ejemplo n.º 1
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        Will get the value for dfus from CPACS via TIGL functions
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle,
                                  self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle,
                        '/cpacs/vehicles/aircraft/model/fuselages/fuselage'):
            lastSegment = getFuselageSegmentCount(TIGLHandle)

            dmax = 0.

            for i in range(lastSegment):
                diameter = getFuselageDiameter(TIGLHandle, i + 1, 1.)
                if diameter > dmax:
                    dmax = diameter

            self.setValueFix(dmax)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 2
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        Will get the value for lfus from CPACS via TIGL functions
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle,
                                  self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle,
                        '/cpacs/vehicles/aircraft/model/fuselages/fuselage'):

            # get First Point from the Fuselage
            x1, y1, z1 = getFuselagePoint(TIGLHandle, 1, 0., 0.)

            lastSegment = getFuselageSegmentCount(TIGLHandle)
            x2, y2, z2 = getFuselagePoint(TIGLHandle, lastSegment, 1., 0.)

            self.setValueFix(x2 - x1)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 3
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        Will get the value for dfus from CPACS via TIGL functions
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/fuselages/fuselage'):
            lastSegment = getFuselageSegmentCount(TIGLHandle)

            dmax = 0.

            for i in range(lastSegment):
                diameter = getFuselageDiameter(TIGLHandle, i+1,1.)
                if diameter > dmax:
                    dmax = diameter

            self.setValueFix(dmax)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 4
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Imports the quarter chord sweep angle of the htp from TIGL. It takes the htp's first and last section and reads
        y and y coordinates and from these calculates the htp sweep. 
        '''
        wingIndex = 2

        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        lastSeg = getWingSegmentCount(TIGLHandle, wingIndex)

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing[2]'):
            x1, y1, z1 = getWingUpperPoint(TIGLHandle, wingIndex, 1, 0., 0.25)
            x2, y2, z2 = getWingUpperPoint(TIGLHandle, wingIndex, lastSeg, 1., 0.25)
            #Length of the hypothenuse so we do not need atan
            h = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

            self.setValueFix(asin((x2 - x1) / h) / rad)

        else:
            self.importError()
Ejemplo n.º 5
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        Will get the value for the htp span from CPACS via TIGL functions
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle,
                                  self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle,
                        '/cpacs/vehicles/aircraft/model/wings/wing[2]'):
            #get First Point from the WingRoot
            wingIndex = 2

            x1, y1, z1 = getWingUpperPoint(TIGLHandle, wingIndex, 1, 0, 0)

            lastSegment = getWingSegmentCount(TIGLHandle, wingIndex)
            x2, y2, z2 = getWingUpperPoint(TIGLHandle, wingIndex, lastSegment,
                                           1, 0)
            #todo: cpacsImport span: prototype version taking leading Edge Points

            self.setValueFix((y2 - y1) * 2.)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 6
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        Will get the value for wingSpan from CPACS via TIGL functions
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing'):

            #get First Point from the WingRoot
            wingIndex = 1

            x1, y1, z1 = getWingUpperPoint(TIGLHandle, wingIndex, 1, 0, 0)

            lastSegment = getWingSegmentCount(TIGLHandle, wingIndex)
            x2, y2, z2 = getWingUpperPoint(TIGLHandle, wingIndex, lastSegment, 1, 0)
            #todo: cpacsImport span: prototype version taking leading Edge Points

            self.setValueFix((y2 - y1) * 2.)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 7
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        Retrieves the xRoot coordinate from TIGL. It will go for the main fuselage. The first sections x coordinate is read at eta and zeta
        equal 0.
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle,
                                  self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle,
                        '/cpacs/vehicles/aircraft/model/fuselages/fuselage'):
            self.log.debug('Importing fuselage x position...')
            try:
                # fuselage index is implicitly set to 1 in TIGL/tigl.py
                x1, _, _ = getFuselagePoint(TIGLHandle, 1, 0, 0)
            except Exception as e:
                self.log.warning(str(e))
            self.log.debug('Importing fuselage x position... {}'.format(x1))
            self.setValueFix(x1)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 8
0
    def cpacsImport(self, path='.\\cpacs.xml'):
        '''
        Looks for parameter.CPACSPath in CPACSFilse defined by Path
        Transfers Value is possible
        Input Values will be set to 'fix' 
        '''
        self.log.info('')
        self.log.info(
            "##############################################################################"
        )
        self.log.info("VAMPzero CPACS Import from %s" % path)
        self.log.info("trying to import and fix parameters")
        self.log.info(
            "##############################################################################"
        )

        TIXIHandle = openTIXI(path)
        modelUID = getText(TIXIHandle,
                           '/cpacs/toolspecific/vampZero/aircraftModelUID')

        if modelUID is None:
            self.log.info(
                "VAMPzero IMPORT: No modelUID specified in the toolspecific Block"
            )
            try:
                modelUID = self.modelUID.getValue()
                self.log.info("VAMPzero IMPORT: loaded modelUID from VAMPzero")
            except AttributeError:
                modelUID = None
                self.log.info(
                    "VAMPzero IMPORT: could not load modelUID from VAMPzero")

        if modelUID is not None:
            TIGLHandle = openTIGL(TIXIHandle, modelUID)
            if TIGLHandle is not None:
                self.log.debug(
                    "VAMPzero IMPORT: Opened TIXI and TIGL in Component")
        else:
            TIGLHandle = None
            self.log.debug(
                "VAMPzero IMPORT: Opened only TIXI in Component as no modelUID was specified"
            )

        self.importer(path, TIXIHandle, TIGLHandle)
        self.log.info("VAMPzero IMPORT: done.")

        closeXML(TIXIHandle)
Ejemplo n.º 9
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        Will get the value for wingSpan from CPACS via TIGL functions
        '''

        def calcRootLength(tiglHandle, wingIndex):
            '''
            Calculates the length of the root section chord
            '''
            x1, y1, z1 = getWingUpperPoint(tiglHandle, wingIndex, 1, 0, 0)
            x2, y2, z2 = getWingUpperPoint(tiglHandle, wingIndex, 1, 0, 1)

            return pointDistance(x1, y1, z1, x2, y2, z2)

        def calcTipLength(tiglHandle, wingIndex):
            '''
            Calculates the length of the tip section chord
            '''
            lastSegment = getWingSegmentCount(tiglHandle, wingIndex)
            x1, y1, z1 = getWingUpperPoint(tiglHandle, wingIndex, lastSegment, 1, 0)
            x2, y2, z2 = getWingUpperPoint(tiglHandle, wingIndex, lastSegment, 1, 1)

            return pointDistance(x1, y1, z1, x2, y2, z2)

        #===============================================================================
        # main cpacsImport
        #===============================================================================s
        wingIndex = 1

        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing'):
            rootC = calcRootLength(TIGLHandle, wingIndex)
            tipC = calcTipLength(TIGLHandle, wingIndex)

            self.setValueFix(tipC / rootC)
            self.importSuccess()

        else:
            self.importError()
Ejemplo n.º 10
0
    def cpacsImport(self, path=".\\cpacs.xml", TIXIHandle=None, TIGLHandle=None):
        """
        Overwrites the parameters cpacsImport method!
        Will get the value for taperRatio from CPACS via TIGL functions
        """

        def calcRootLength(tiglHandle, wingIndex):
            """
            Calculates the length of the root section chord
            """
            x1, y1, z1 = getWingUpperPoint(tiglHandle, wingIndex, 1, 0, 0)
            x2, y2, z2 = getWingUpperPoint(tiglHandle, wingIndex, 1, 0, 1)

            return pointDistance(x1, y1, z1, x2, y2, z2)

        def calcTipLength(tiglHandle, wingIndex):
            """
            Calculates the length of the tip section chord
            """
            lastSegment = getWingSegmentCount(tiglHandle, wingIndex)
            x1, y1, z1 = getWingUpperPoint(tiglHandle, wingIndex, lastSegment, 1, 0)
            x2, y2, z2 = getWingUpperPoint(tiglHandle, wingIndex, lastSegment, 1, 1)

            return pointDistance(x1, y1, z1, x2, y2, z2)

        # =======================================================================
        #
        # =======================================================================
        # @todo: cpacsImport taperRatio: Think about an import logic for the different wings
        wingIndex = 3
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, "/cpacs/vehicles/aircraft/model/wings/wing[3]"):
            rootC = calcRootLength(TIGLHandle, wingIndex)
            tipC = calcTipLength(TIGLHandle, wingIndex)

            self.setValueFix(tipC / rootC)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 11
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        '''
        #@todo: cpacsImport taperRatio: Think about an import logic for the different wings
        wingIndex = 2
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing[2]'):
            x1, y1, z1 = getWingUpperPoint(TIGLHandle, wingIndex, 1, 0, 0)

            self.setValueFix(z1)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 12
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        '''
        #@todo: cpacsImport taperRatio: Think about an import logic for the different wings
        wingIndex = 2
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing[2]'):
            x1, y1, z1 = getWingUpperPoint(TIGLHandle, wingIndex, 1, 0, 0)

            self.setValueFix(x1)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 13
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        Will get the value for refArea for HTP from CPACS via TIGL functions
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

            #@todo: cpacsImport refArea: it is assumed that the htp is number 2 wing
        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing[2]'):
            area = getWingSurfaceArea(TIGLHandle, 2)

            self.setValueFix(area)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 14
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Retrieves the xRoot coordinate from TIGL. It will go for the main wing. The first sections x coordinate is read at eta and chord
        equal 0.
        '''
        wingIndex = 1
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing'):
            x1, y1, z1 = getWingUpperPoint(TIGLHandle, wingIndex, 1, 0, 0)

            self.setValueFix(x1)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 15
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Retrieves the xRoot.py coordinate from TIGL. It will go for the vtp. The first sections x coordinate is read at eta and chord
        equal 0.
        '''
        wingIndex = 3
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing[3]'):
            x1, y1, z1 = getWingUpperPoint(TIGLHandle, wingIndex, 1, 0, 0)

            self.setValueFix(x1)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 16
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Retrieves the xRoot coordinate from TIGL. It will go for the main fuselage. The first sections x coordinate is read at eta and zeta
        equal 0.
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/fuselages/fuselage'):
            self.log.debug('Importing fuselage x position...')
            try:
                # fuselage index is implicitly set to 1 in TIGL/tigl.py
                x1, _, _ = getFuselagePoint(TIGLHandle, 1, 0, 0)
            except Exception as e:
                self.log.warning(str(e))
            self.log.debug('Importing fuselage x position... {}'.format(x1))
            self.setValueFix(x1)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 17
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!
        Will get the value for lfus from CPACS via TIGL functions
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if not TIGLHandle:
            TIGLHandle = openTIGL(TIXIHandle, self.parent.aircraft.modelUID.getValue())

        if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/fuselages/fuselage'):


            # get First Point from the Fuselage
            x1, y1, z1 = getFuselagePoint(TIGLHandle, 1, 0., 0.)

            lastSegment = getFuselageSegmentCount(TIGLHandle)
            x2, y2, z2 = getFuselagePoint(TIGLHandle, lastSegment, 1., 0.)

            self.setValueFix(x2 - x1)
            self.importSuccess()
        else:
            self.importError()
Ejemplo n.º 18
0
    def cpacsImport(self, path='.\\cpacs.xml'):
        '''
        Looks for parameter.CPACSPath in CPACSFilse defined by Path
        Transfers Value is possible
        Input Values will be set to 'fix' 
        '''
        self.log.info('')
        self.log.info("##############################################################################")
        self.log.info("VAMPzero CPACS Import from %s" % path)
        self.log.info("trying to import and fix parameters")
        self.log.info("##############################################################################")

        TIXIHandle = openTIXI(path)
        modelUID = getText(TIXIHandle, '/cpacs/toolspecific/vampZero/aircraftModelUID')

        if modelUID is None:
            self.log.info("VAMPzero IMPORT: No modelUID specified in the toolspecific Block")
            try:
                modelUID = self.modelUID.getValue()
                self.log.info("VAMPzero IMPORT: loaded modelUID from VAMPzero")
            except AttributeError:
                modelUID = None
                self.log.info("VAMPzero IMPORT: could not load modelUID from VAMPzero")

        if modelUID is not None:
            TIGLHandle = openTIGL(TIXIHandle, modelUID)
            if TIGLHandle is not None:
                self.log.debug("VAMPzero IMPORT: Opened TIXI and TIGL in Component")
        else:
            TIGLHandle = None
            self.log.debug("VAMPzero IMPORT: Opened only TIXI in Component as no modelUID was specified")

        self.importer(path, TIXIHandle, TIGLHandle)
        self.log.info("VAMPzero IMPORT: done.")

        closeXML(TIXIHandle)