Пример #1
0
 def readConfig(self):
     '''
     Read VAMPzeros configuration parameters. Command line arguments overwrite the configurations in the toolspecific part. 
     '''
     TIXIHandle      = tixiLib.openTIXI(self.cpacsIn)
     if self.args.d != None:
         self.config['deviationAmplitude'] = float(self.args.d)
     else:
         devFactor = 0.0
         devFactorStr = tixiLib.getText(TIXIHandle,'/cpacs/toolspecific/vampZero/toolSettings/deviationAmplitude')
         if devFactorStr != None:
             devFactor = float(devFactorStr)
         self.config['deviationAmplitude'] = devFactor
     # read configuration for extended output
     self.config['extendedOutput'] = True
     extendedOutput = tixiLib.getText(TIXIHandle,'/cpacs/toolspecific/vampZero/toolSettings/extendedOutput')
     if extendedOutput in ('False', 'false', '0.0', '0.', '0'):
         self.config['extendedOutput'] = False
     # read sensitivity configuration
     self.config['calcSensitivities'] = False
     calcSensitivities = tixiLib.getText(TIXIHandle,'/cpacs/toolspecific/vampZero/toolSettings/calcSensitivities')
     if calcSensitivities in ('True', 'true', '1.0', '1.', '1'):
         self.config['calcSensitivities'] = True
     # read not converging behavior
     self.config['notConvergingAction'] = 'exit'
     not_converging_action = tixiLib.getText(TIXIHandle,'/cpacs/toolspecific/vampZero/toolSettings/notConvergingAction')
     if not_converging_action in ('exit', 'copyInput', 'errorXML'):
         self.config['notConvergingAction'] = not_converging_action
     tixiLib.closeXML(TIXIHandle)
Пример #2
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        imports the value for thrust00 for the current engine out of TWDat
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if checkElement(TIXIHandle,
                        '/cpacs/vehicles/engines/engine/analysis/thrust00'):
            self.thrust00 = eval(
                getText(TIXIHandle,
                        '/cpacs/vehicles/engines/engine/analysis/thrust00'))
            self.importSuccess()
        else:
            self.importError()

        if checkElement(TIXIHandle, '/cpacs/vehicles/engines/engine/name'):
            name = getText(TIXIHandle, '/cpacs/vehicles/engines/engine/name')
            if name.find('scaled') != -1:
                self.originalScaling = eval(name.split()[-1])
                self.log.info(
                    "VAMPzero TIXI: imported previous scaling factor from TWDat: %s"
                    % self.originalScaling)
            else:
                self.originalScaling = 1.
        else:
            self.importError()
Пример #3
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        imports the values for summed up Nose and Main Landing Gear and set value to fix

        .. todo:: 
           
           cpacsImport mLandingGear this is out dated since LGDesign does not apply to CPACS 1.4
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        error = 0

        if checkElement(TIXIHandle,
                        '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/landingGear/mainGears/mainGear/totalMass/mass'):
            self.mMainGear = eval(getText(TIXIHandle,
                                          '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/landingGear/mainGears/mainGear/totalMass/mass'))
        else:
            error = 1

        if checkElement(TIXIHandle,
                        '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/landingGear/noseGears/noseGear/totalMass/mass'):
            self.mNoseGear = eval(getText(TIXIHandle,
                                          '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/landingGear/noseGears/noseGear/totalMass/mass'))
        else:
            error = 1

        if not error:
            self.setValueFix(2 * self.mMainGear + self.mNoseGear)
            self.importSuccess()
        else:
            self.importError()
Пример #4
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameter's cpacsImport method! Will get
        the value for cDMINoffset from a CPACS aeroPerformanceMap.
        Does a monkey patch as it replaces cDMINoffset.calc with cDMINoffset.calcLiLi

        .. todo::

            cpacsImport cDMINoffset catch error if cfy is unequal zero
        '''

        try:
            if not TIXIHandle:
                TIXIHandle = openTIXI(path)

            self.refArea = eval(getText(TIXIHandle, '/cpacs/vehicles/aircraft/model/reference/area'))
            self.CfxList = getList(TIXIHandle, '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/cfx')
            self.CfzList = getList(TIXIHandle, '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/cfz')
            self.CfyList = getList(TIXIHandle, '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/cfy')
            self.AOAList = getList(TIXIHandle,
                                   '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/angleOfAttack')
            self.AOYList = getList(TIXIHandle, '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/angleOfYaw')
            self.machList = getList(TIXIHandle, '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/machNumber')
            self.reList = getList(TIXIHandle,
                                  '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/reynoldsNumber')

            if self.CfxList:
                self.calc = self.calcLiLi
                self.monkeyPatch('LiftingLine')

        except:
            self.importError()
Пример #5
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        Imports the values for the primary wing structure and applies formula to calculate mWing
        Value is set to FIX, but a correction factor is applied to get secondary wing mass from
        the imported primary wing structure mass.
        
        :Source: Analytical Fuselage and Wing Weight Estimation of Transport Aircraft, M. D. Ardema, M. C. Chambers, A. P. Patron, A. S. Hahn, H. Miura, M. D. Moore, NASA Technical Memorandum 110392, 1996, p. 22 eq. 109
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        error = 0

        if checkElement(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mWingsStructure/mWingStructure[1]/massDescription/mass'
        ):
            self.mWingPrimary = eval(
                getText(
                    TIXIHandle,
                    '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mWingsStructure/mWingStructure[1]/massDescription/mass'
                ))
        else:
            error = 1

        if error == 0 and self.mWingPrimary is not None:
            self.setValueFix(2. * self.mWingPrimary)
            self.importSuccess()
        else:
            self.importError()
Пример #6
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        TIXI and TIGL Handle should be given, to save some valueable time
        Imports self.cpacsPath from path
        Input Values will be set to 'fix' 
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if self.getCpacsPath() != '':
            retVal = getText(TIXIHandle, self.getCpacsPath())
            if retVal is not None and retVal is not '':
                try:
                    self.setValueFix(eval(retVal))
                    self.importSuccess()
                # This may occur if UID or other strings will be imported
                except NameError:
                    self.setValueFix(retVal)
                    self.importSuccess()
                except SyntaxError:
                    self.setValueFix(retVal)
                    self.importSuccess()

            else:
                self.importError()
Пример #7
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        error = 0

        if checkElement(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mWingsStructure/mWingStructure[3]/massDescription/mass'
        ):
            self.mWingPrimary = eval(
                getText(
                    TIXIHandle,
                    '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mWingsStructure/mWingStructure[3]/massDescription/mass'
                ))
        else:
            error = 1

        if error == 0 and self.mWingPrimary is not None:
            self.setValueFix(self.mWingPrimary * 2.)
            self.importSuccess()
        else:
            self.importError()
Пример #8
0
    def cpacsImport(self, path=".\\cpacs.xml", TIXIHandle=None, TIGLHandle=None):
        """
        Imports the values for the primary wing structure and applies formula to calculate mWing
        Value is set to FIX, but a correction factor is applied to get secondary wing mass from
        the imported primary wing structure mass.
        
        :Source: Analytical Fuselage and Wing Weight Estimation of Transport Aircraft, M. D. Ardema, M. C. Chambers, A. P. Patron, A. S. Hahn, H. Miura, M. D. Moore, NASA Technical Memorandum 110392, 1996, p. 22 eq. 109
        """
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        error = 0

        if checkElement(
            TIXIHandle,
            "/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mWingsStructure/mWingStructure[1]/massDescription/mass",
        ):
            self.mWingPrimary = eval(
                getText(
                    TIXIHandle,
                    "/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mWingsStructure/mWingStructure[1]/massDescription/mass",
                )
            )
        else:
            error = 1

        if error == 0 and self.mWingPrimary is not None:
            self.setValueFix(self.mWingPrimary)
            self.importSuccess()
        else:
            self.importError()
Пример #9
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        TIXI and TIGL Handle should be given, to save some valueable time
        Imports self.cpacsPath from path
        Input Values will be set to 'fix' 
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if self.getCpacsPath() != '':
            retVal = getText(TIXIHandle, self.getCpacsPath())
            if retVal is not None and retVal is not '':
                try:
                    self.setValueFix(eval(retVal))
                    self.importSuccess()
                # This may occur if UID or other strings will be imported
                except NameError:
                    self.setValueFix(retVal)
                    self.importSuccess()
                except SyntaxError:
                    self.setValueFix(retVal)
                    self.importSuccess()

            else:
                self.importError()
Пример #10
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        imports the values for summed up Nose and Main Landing Gear and set value to fix

        .. todo:: 
           
           cpacsImport mLandingGear this is out dated since LGDesign does not apply to CPACS 1.4
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        error = 0

        if checkElement(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/landingGear/mainGears/mainGear/totalMass/mass'
        ):
            self.mMainGear = eval(
                getText(
                    TIXIHandle,
                    '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/landingGear/mainGears/mainGear/totalMass/mass'
                ))
        else:
            error = 1

        if checkElement(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/landingGear/noseGears/noseGear/totalMass/mass'
        ):
            self.mNoseGear = eval(
                getText(
                    TIXIHandle,
                    '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/landingGear/noseGears/noseGear/totalMass/mass'
                ))
        else:
            error = 1

        if not error:
            self.setValueFix(2 * self.mMainGear + self.mNoseGear)
            self.importSuccess()
        else:
            self.importError()
Пример #11
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        Overwrites the parameter's cpacsImport method!
        Will get the value for the Oswald Factor from CPACS
        It will be assumed that the aeroperformanceMap holds LiLi values
        Does a monkey patch as it replaces oswald.calc with oswald.calcLiLi

        .. todo:: 

            cpacsImport oswald catch error if cfy is unequal zero
        '''

        try:
            if not TIXIHandle:
                TIXIHandle = openTIXI(path)

            self.refArea = eval(
                getText(TIXIHandle,
                        '/cpacs/vehicles/aircraft/model/reference/area'))
            self.CfxList = getList(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/cfx'
            )
            self.CfzList = getList(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/cfz'
            )
            self.CfyList = getList(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/cfy'
            )
            self.AOAList = getList(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/angleOfAttack'
            )
            self.AOYList = getList(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/angleOfYaw'
            )
            self.machList = getList(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/machNumber'
            )
            self.reList = getList(
                TIXIHandle,
                '/cpacs/vehicles/aircraft/model/analyses/aeroPerformanceMap/reynoldsNumber'
            )

            if self.CfxList:
                self.calc = self.calcLiLi
                self.monkeyPatch('LiftingLine')

        except:
            self.importError()
Пример #12
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        imports the value for thrust00 for the current engine out of TWDat
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if checkElement(TIXIHandle, '/cpacs/vehicles/engines/engine/analysis/thrust00'):
            self.thrust00 = eval(getText(TIXIHandle, '/cpacs/vehicles/engines/engine/analysis/thrust00'))
            self.importSuccess()
        else:
            self.importError()

        if checkElement(TIXIHandle, '/cpacs/vehicles/engines/engine/name'):
            name = getText(TIXIHandle, '/cpacs/vehicles/engines/engine/name')
            if name.find('scaled') != -1:
                self.originalScaling = eval(name.split()[-1])
                self.log.info("VAMPzero TIXI: imported previous scaling factor from TWDat: %s" % self.originalScaling)
            else:
                self.originalScaling = 1.
        else:
            self.importError()
Пример #13
0
 def readConfig(self):
     '''
     Read VAMPzeros configuration parameters. Command line arguments overwrite the configurations in the toolspecific part. 
     '''
     TIXIHandle = tixiLib.openTIXI(self.cpacsIn)
     if self.args.d != None:
         self.config['deviationAmplitude'] = float(self.args.d)
     else:
         devFactor = 0.0
         devFactorStr = tixiLib.getText(
             TIXIHandle,
             '/cpacs/toolspecific/vampZero/toolSettings/deviationAmplitude')
         if devFactorStr != None:
             devFactor = float(devFactorStr)
         self.config['deviationAmplitude'] = devFactor
     # read configuration for extended output
     self.config['extendedOutput'] = True
     extendedOutput = tixiLib.getText(
         TIXIHandle,
         '/cpacs/toolspecific/vampZero/toolSettings/extendedOutput')
     if extendedOutput in ('False', 'false', '0.0', '0.', '0'):
         self.config['extendedOutput'] = False
     # read sensitivity configuration
     self.config['calcSensitivities'] = False
     calcSensitivities = tixiLib.getText(
         TIXIHandle,
         '/cpacs/toolspecific/vampZero/toolSettings/calcSensitivities')
     if calcSensitivities in ('True', 'true', '1.0', '1.', '1'):
         self.config['calcSensitivities'] = True
     # read not converging behavior
     self.config['notConvergingAction'] = 'exit'
     not_converging_action = tixiLib.getText(
         TIXIHandle,
         '/cpacs/toolspecific/vampZero/toolSettings/notConvergingAction')
     if not_converging_action in ('exit', 'copyInput', 'errorXML'):
         self.config['notConvergingAction'] = not_converging_action
     tixiLib.closeXML(TIXIHandle)
Пример #14
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)
Пример #15
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        error = 0

        if checkElement(TIXIHandle,
                        '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mWingsStructure/mWingStructure[3]/massDescription/mass'):
            self.mWingPrimary = eval(getText(TIXIHandle,
                                             '/cpacs/vehicles/aircraft/model/analyses/massBreakdown/mOEM/mEM/mStructure/mWingsStructure/mWingStructure[3]/massDescription/mass'))
        else:
            error = 1

        if error == 0 and self.mWingPrimary is not None:
            self.setValueFix(self.mWingPrimary * 2.)
            self.importSuccess()
        else:
            self.importError()
Пример #16
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)
Пример #17
0
    def cpacsImport(self,
                    path='.\\cpacs.xml',
                    TIXIHandle=None,
                    TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!

        Imports the enginePerformanceMap

        This method replaces the initial calc method by calcCPACS

        sfcCR will not be set fix because ongoing interpolation is necessary to find
        the correct values
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if checkElement(
                TIXIHandle,
                '/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap'
        ):

            # Get performanceMap from CPACS
            Tmap = getText(
                TIXIHandle,
                "/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap/thrust"
            ).split(';')
            Mamap = getText(
                TIXIHandle,
                "/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap/machNumber"
            ).split(';')
            FLmap = getText(
                TIXIHandle,
                "/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap/flightLevel"
            ).split(';')
            mDotmap = getText(
                TIXIHandle,
                "/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap/mDotFuel"
            ).split(';')

            #Pop Last entries because of garbage
            FLmap.pop()
            mDotmap.pop()
            Tmap.pop()
            Mamap.pop()

            #Conversion
            FLmap = [float(val) for val in FLmap]
            Mamap = [float(val) for val in Mamap]
            Tmap = [float(val) for val in Tmap]
            mDotmap = [float(val) for val in mDotmap]

            #Dummies
            maList = []
            flList = []
            thList = []

            #Go Through complete Data Set
            for i in range(len(FLmap)):
                thList.append([Tmap[i - 1], mDotmap[i - 1]])

                if Mamap[i] != Mamap[i - 1]:
                    maList.append([Mamap[i - 1], thList])
                    thList = []

                if FLmap[i] != FLmap[i - 1]:
                    flList.append([FLmap[i - 1], maList])
                    maList = []

            # Final List of List of List for the engine deck
            self.TList = flList

            #set calcTWDat as the new Calculation method
            self.calc = self.calcCPACS
            self.monkeyPatch('CPACS')

        else:
            self.importError()
Пример #18
0
    def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None):
        '''
        Overwrites the parameters cpacsImport method!

        Imports the enginePerformanceMap

        This method replaces the initial calc method by calcCPACS

        sfcCR will not be set fix because ongoing interpolation is necessary to find
        the correct values
        '''
        if not TIXIHandle:
            TIXIHandle = openTIXI(path)

        if checkElement(TIXIHandle, '/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap'):

            # Get performanceMap from CPACS
            Tmap = getText(TIXIHandle,
                           "/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap/thrust").split(
                ';')
            Mamap = getText(TIXIHandle,
                            "/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap/machNumber").split(
                ';')
            FLmap = getText(TIXIHandle,
                            "/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap/flightLevel").split(
                ';')
            mDotmap = getText(TIXIHandle,
                              "/cpacs/vehicles/engines/engine[last()]/analysis/performanceMaps/performanceMap/mDotFuel").split(
                ';')

            #Pop Last entries because of garbage
            FLmap.pop()
            mDotmap.pop()
            Tmap.pop()
            Mamap.pop()

            #Conversion
            FLmap = [float(val) for val in FLmap]
            Mamap = [float(val) for val in Mamap]
            Tmap = [float(val) for val in Tmap]
            mDotmap = [float(val) for val in mDotmap]

            #Dummies
            maList = []
            flList = []
            thList = []

            #Go Through complete Data Set
            for i in range(len(FLmap)):
                thList.append([Tmap[i - 1], mDotmap[i - 1]])

                if Mamap[i] != Mamap[i - 1]:
                    maList.append([Mamap[i - 1], thList])
                    thList = []

                if FLmap[i] != FLmap[i - 1]:
                    flList.append([FLmap[i - 1], maList])
                    maList = []

            # Final List of List of List for the engine deck
            self.TList = flList

            #set calcTWDat as the new Calculation method
            self.calc = self.calcCPACS
            self.monkeyPatch('CPACS')

        else:
            self.importError()
Пример #19
0
def importGUI(myAircraft,path):
    '''
    This is an import routine for simple input from the tool-specific part of a
    CPACS file. This also reads all information that can be generated by the
    simple GUI available in the binary version of VAMPzero

    It takes an *aircraft* as input. This is necessary to set the values in
    the aircraft according to the information given in *path*. Usually
    *path* is specified as ./ToolInput/toolInput.xml
    '''
    log = zeroLogger('General')
    log.info('')
    log.info("##############################################################################")
    log.info('VAMPzero GUI: importing GUI Values from: %s'%path)
    log.info("reading toolspecific/GUI inputs")
    log.info("##############################################################################")
    
    myAircraft.modelUID.cpacsImport(path)
    
    if myAircraft.modelUID.getValue() != '':
        log.info('VAMPzero GUI: Running with: %s as modelUID.'%myAircraft.modelUID.getValue())
    else:
        log.warning('VAMPzero GUI: No valid information for modelUID!')

    TIXIHandle  = openTIXI(path)
    cpacsVal    = c_char_p() 
    top = "/cpacs/toolspecific/vampZero/components/"

    ##Component#############################################################
    countC = 1
    while 1==1:
        pathC = top+'component['+str(countC)+']'

        if checkElement(TIXIHandle,pathC):
            nameC = getText(TIXIHandle, pathC+'/name')
            
            if nameC: 
                log.debug('VAMPzero GUI: importing for component: %s'%nameC)
            else:
                break

            ##Discipline#############################################################                        
            countD  = 1
            while 1==1:
                pathD = pathC+'/disciplines/discipline['+str(countD)+']'
                
                if checkElement(TIXIHandle,pathD):
                
                    ##Parameter#############################################################    
                    countP  = 1
                    while 1==1:
                        pathP = pathD+'/parameters/parameter['+str(countP)+']'

                        if checkElement(TIXIHandle,pathP):
                            nameP   = getText(TIXIHandle,pathP+'/name')
                            valueP  = getText(TIXIHandle,pathP+'/value')
                            factorP = getText(TIXIHandle,pathP+'/factor')
                            statusP = getText(TIXIHandle,pathP+'/status')
                            exportP = getText(TIXIHandle,pathP+'/exportTS')

                            setParameter(myAircraft, nameC, nameP, valueP, factorP, statusP, exportP)
                            countP += 1
                        else:
                            break

                    countD += 1
                else:
                    break
            countC += 1
        else:
            break
Пример #20
0
def importGUI(myAircraft, path):
    '''
    This is an import routine for simple input from the tool-specific part of a
    CPACS file. This also reads all information that can be generated by the
    simple GUI available in the binary version of VAMPzero

    It takes an *aircraft* as input. This is necessary to set the values in
    the aircraft according to the information given in *path*. Usually
    *path* is specified as ./ToolInput/toolInput.xml
    '''
    log = zeroLogger('General')
    log.info('')
    log.info(
        "##############################################################################"
    )
    log.info('VAMPzero GUI: importing GUI Values from: %s' % path)
    log.info("reading toolspecific/GUI inputs")
    log.info(
        "##############################################################################"
    )

    myAircraft.modelUID.cpacsImport(path)

    if myAircraft.modelUID.getValue() != '':
        log.info('VAMPzero GUI: Running with: %s as modelUID.' %
                 myAircraft.modelUID.getValue())
    else:
        log.warning('VAMPzero GUI: No valid information for modelUID!')

    TIXIHandle = openTIXI(path)
    cpacsVal = c_char_p()
    top = "/cpacs/toolspecific/vampZero/components/"

    ##Component#############################################################
    countC = 1
    while 1 == 1:
        pathC = top + 'component[' + str(countC) + ']'

        if checkElement(TIXIHandle, pathC):
            nameC = getText(TIXIHandle, pathC + '/name')

            if nameC:
                log.debug('VAMPzero GUI: importing for component: %s' % nameC)
            else:
                break

            ##Discipline#############################################################
            countD = 1
            while 1 == 1:
                pathD = pathC + '/disciplines/discipline[' + str(countD) + ']'

                if checkElement(TIXIHandle, pathD):

                    ##Parameter#############################################################
                    countP = 1
                    while 1 == 1:
                        pathP = pathD + '/parameters/parameter[' + str(
                            countP) + ']'

                        if checkElement(TIXIHandle, pathP):
                            nameP = getText(TIXIHandle, pathP + '/name')
                            valueP = getText(TIXIHandle, pathP + '/value')
                            factorP = getText(TIXIHandle, pathP + '/factor')
                            statusP = getText(TIXIHandle, pathP + '/status')
                            exportP = getText(TIXIHandle, pathP + '/exportTS')

                            setParameter(myAircraft, nameC, nameP, valueP,
                                         factorP, statusP, exportP)
                            countP += 1
                        else:
                            break

                    countD += 1
                else:
                    break
            countC += 1
        else:
            break