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()
def run(self, argv=None): ''' Runs VAMPzero. ''' if argv is None: argv = sys.argv try: generalLib.printHeader() print argv self.args = self.parser.parse_args() self.readConfig() ################################################################################################### ##VAMPzero Initialize ################################################################################################### self.aircraft.engine.sfcCR.calc = self.aircraft.engine.sfcCR.calcOverallEff self.setFixed() ################################################################################################### ##VAMPzero Imports ################################################################################################### if self.args.m: importMatlabLib.importMatlab(self.aircraft) else: guiLib.importGUI(self.aircraft, self.cpacsIn) tixiHandle = tixiLib.openTIXI(self.cpacsIn) hasModel = tixiLib.checkElement(tixiHandle,'/cpacs/vehicles/aircraft/model') if hasModel: self.aircraft.cpacsImport(self.cpacsIn) hasEngine = tixiLib.checkElement(tixiHandle,'/cpacs/vehicles/engines/engine') if hasEngine: self.aircraft.engine.cpacsImport(self.cpacsIn) self.aircraft.atmosphere.hCR.setValueFix(self.aircraft.altCR.getValue()) self.aircraft.atmosphere.MaCR.setValueFix(self.aircraft.machCR.getValue()) self.calc() self.finish() self.setUIDs() self.exportToolspecific() # needs to be called after the last use of cpacsLib (otherwise all nodes not in the schema will be removed) generalLib.printFooter() return 0 except (argparse.ArgumentError), err: print >>sys.stderr, err self.parser.print_help() return 2
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()
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()
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()
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()
def resultToolspecExport(component, path): """ Exports marked parameters into VAMPzeros toolspecific results node. @param component: should be the aircraft component """ log = zeroLogger("resultToolspecExport") log.info("") log.info("##############################################################################") log.info("VAMPzero Result Toolspecific Export to %s" % (path)) log.info("##############################################################################") # reset outfile TIXIHandle = tixiLib.openTIXI(path) for para in component.getParameters(): if not para["exportTS"]: continue # try to get componentNode compPathBase = "/cpacs/toolspecific/vampZero/results/components/component" compPath = compPathBase + '[name="%s"]' % para.parent.id discPathBase = compPath + "/disciplines/discipline" discPath = discPathBase + '[name="%s"]' % para["discipline"] paraPathBase = discPath + "/parameters/parameter" paraPath = paraPathBase + '[name="%s"]' % para.getName() # try to get component node exists = tixiLib.checkElement(TIXIHandle, compPath) if not exists: # create it tixiLib.buildTree(TIXIHandle, compPath + "/name") tixiLib.addText(TIXIHandle, compPathBase + "[last()]/name", para.parent.id) # try to get discipline node exists = tixiLib.checkElement(TIXIHandle, discPath) if not exists: # create it tixiLib.buildTree(TIXIHandle, discPath + "/name") tixiLib.addText(TIXIHandle, discPathBase + "[last()]/name", para["discipline"]) # try to get parameter node exists = tixiLib.checkElement(TIXIHandle, paraPath) if not exists: # create it tixiLib.buildTree(TIXIHandle, paraPath + "/name") tixiLib.addText(TIXIHandle, paraPathBase + "[last()]/name", para.getName()) tixiLib.setText(TIXIHandle, paraPath + "/value", para.getValue()) tixiLib.saveXML(path, TIXIHandle) tixiLib.closeXML(TIXIHandle) log.info("VAMPzero RESULT TOOLSPECIFIC EXPORT: done.")
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()
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()
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()
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()
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()
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()
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()
def cpacsImport(self, path='.\\cpacs.xml', TIXIHandle=None, TIGLHandle=None): ''' Overwrites the parameters cpacsImport method! Will get the value for refArea for VTP 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 vtp is number 3 wing if checkElement(TIXIHandle, '/cpacs/vehicles/aircraft/model/wings/wing[3]'): #get First Point from the WingRoot area = getWingSurfaceArea(TIGLHandle, 3) self.setValueFix(area / 2.) self.importSuccess() else: self.importError()
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()
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()
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 = 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(z1) self.importSuccess() else: self.importError()
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
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()
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
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()