Ejemplo n.º 1
0
def read_exp_data():
    wbName = r'D:\propeller_results.xls'
    wb = dbTools.loadDB(wbName)
    sh = wb.selectByName('Sheet1')
    sh = dbTools.readDB(sh)
    
    J = list()
    J.append(sh.readCol(3,0,13))
#    J.append(sh.readCol(3,2,17))
#    J.append(sh.readCol(3,4,18))
    J.append(sh.readCol(3,6,21))
#    J.append(sh.readCol(3,8,17))
#    J.append(sh.readCol(3,10,16))
    J.append(sh.readCol(3,12,17))
    
    effy = list()
    effy.append(sh.readCol(3,1,13))
#    effy.append(sh.readCol(3,3,17))
#    effy.append(sh.readCol(3,5,18))
    effy.append(sh.readCol(3,7,21))
#    effy.append(sh.readCol(3,9,17))
#    effy.append(sh.readCol(3,11,16))
    effy.append(sh.readCol(3,13,17))
    
    return J, effy
Ejemplo n.º 2
0
 def read_from_db(self,name,dbFile=None):
     if dbFile==None:
         dbFile = 'LargeTypeASM.xls'
     wb = dbTools.loadDB(dbFile,'r')
     sh = dbTools.readDB(wb.selectByName(name))
     
     i = sh.findHeader('SECTION: BODY')
     self.body.xprofile = sh.readRow(i+1,1,True)
     self.body.yprofile = sh.readRow(i+2,1,True)
     self.body.set_length(sh.readRow(i+3,1))
     self.body.set_diameter(sh.readRow(i+4,1))
     
     i = sh.findHeader('SECTION: WING')
     self.wing.chords         = sh.readRow(i+1,1,True)
     self.wing.incidenceAngle = sh.readRow(i+2,1,True)
     self.wing.sectionSpan    = sh.readRow(i+3,1)
     self.wing.leSweep        = sh.readRow(i+4,1)
     self.wing.dihedral       = sh.readRow(i+5,1)
     self.wing._set_airfoil(sh.readRow(i+6,1))
     self.wing.location       = sh.readRow(i+7,1)
     
     i = sh.findHeader('SECTION: TAIL')
     self.tail.chords             = sh.readRow(i+1,1,True)
     self.tail.incidenceAngle     = sh.readRow(i+2,1,True)
     self.tail.sectionSpan        = sh.readRow(i+3,1)
     self.tail.leSweep            = sh.readRow(i+4,1)
     self.tail.dihedral           = sh.readRow(i+5,1)
     self.tail._set_airfoil(sh.readRow(i+6,1))
     self.tail.location           = sh.readRow(i+7,1)
     self.tail.xangle             = sh.readRow(i+8,1)
     self.tail.centerOffset       = sh.readRow(i+9,1)
     self.tail.elevatorChordRatio = sh.readRow(i+10,1)
Ejemplo n.º 3
0
 def _read_xls(self,name=None,dbName=None):
     if dbName==None:
         dbName = self.pth.engineExp
     if name==None:
         name = 'ROTAX_912'
     engDb = dbTools.loadDB(dbName)
     engSh = engDb.selectByName(name)
     db = dbTools.readDB(engSh)
     idx = db.findHeader('SETTING')
     self.rpmLb = np.zeros(len(idx))
     self.rpmUb = np.zeros(len(idx))
     psetList   = np.zeros(len(idx))
     for i,j in enumerate(idx):
         rpm = db.readRow(j+1,1,True)
         psetList[i] = db.readRow(j,1,False)
         pset = np.ones(len(rpm))*psetList[i]
         self.rpmLb[i] = rpm[0]
         self.rpmUb[i] = rpm[-1]
         if i==0:
             self.powerSetting = pset
             self.rpm = rpm
             self.power = db.readRow(j+2,1,True)
             self.fuelFlow = db.readRow(j+3,1,True)
         else:
             self.powerSetting = np.hstack([self.powerSetting,pset])
             self.rpm = np.hstack([self.rpm,rpm])
             self.power = np.hstack([self.power,db.readRow(j+2,1,True)])
             self.fuelFlow = np.hstack([self.fuelFlow,db.readRow(j+3,1,True)])
         self.rps = self.rpm / 60.0
     self.power = self.power * 745.699872 # HP to Watt
     self.powerSurf = Rbf(self.powerSetting,self.rpm,self.power)
     self.fuelFlowSurf = Rbf(self.powerSetting,self.rpm,self.fuelFlow)
     self.rpmLbCurve = interp1d(psetList,self.rpmLb,'cubic')
     self.rpmUbCurve = interp1d(psetList,self.rpmUb,'cubic')
     self.powerSettingList = psetList
Ejemplo n.º 4
0
def read_data():
    import dbTools
    dbname = r'D:\light aircraft\V05\propeller analysis\elprop_results\prop_results.xls'
    sheetname = ['15deg_2000rpm','25deg_2000rpm','35deg_2000rpm']
    wb = dbTools.loadDB(dbname)
    J = list()
    effy = list()
    for name in sheetname:
        sh = dbTools.readDB(wb.selectByName(name))
        J.append(sh.readCol(0,3,30))
        effy.append(sh.readCol(0,11,30))
    return J,effy
Ejemplo n.º 5
0
 def _read_db(self,sheetName='Sheet1',dbPath=''):
     if dbPath=='':
         dbPath = self.dbPath
     dbPath = paths.fixPaths(dbPath)
     dragDb = dbTools.loadDB(dbPath)
     sheet = dragDb.selectByName(sheetName)
     db = dbTools.readDB(sheet)
     nComp = sheet.nrows - 1
     self.name = db.readCol(1,0,nComp)
     self.desc = db.readCol(1,1,nComp)
     self.relCD = db.readCol(1,2,nComp)
     mode = db.readCol(1,3,nComp)
     for m in mode:
         if m=='*':
             self.mode.append(True)
         else:
             self.mode.append(False)        
Ejemplo n.º 6
0
    def read_xls(self,propName, dbPath=None, afDbPath=None):
        """
        reads in excel propeller database. Two database files are needed: 
        propeller, airfoil.
        
        Parameters
        ----------
        
        propName : string
            propeller name
        dbPath : path
            path of the propeller database. Default db will be used if not 
            specified.
        afDbPath : path
            path of the airfoil database. Default db will be used if not 
            specified.

        """
        if dbPath==None:
            dbPath = self.defaultPath.prop
        if afDbPath==None:
            afDbPath = self.defaultPath.propAirfoil
        dbPath = paths.fixPaths(dbPath)
        propDb = dbTools.loadDB(dbPath)
        sheet = propDb.selectByName(propName)
        db = dbTools.readDB(sheet)
        self.name        = propName
        self.diameter    = db.readRow(1,1)
        self.radius      = self.diameter / 2.0
        self.hubDiameter = db.readRow(2,1)
        self.numBlades   = db.readRow(3,1)
        self.betaRange   = db.readRow(4,1)
        self.r           = db.readRow(5,1)
        self.x           = 2*self.r / self.diameter
        self.chord       = db.readRow(7,1)
        self.beta        = db.readRow(8,1)
        self.airfoilName = db.readRow(9,1)
        self.numStations = len(self.r)
        self.betaCurrent = 0.0
        self.betaXstation = 0.0
        for afName in self.airfoilName:
            af = airfoil.Airfoil()
            af.read_xls(afName,afDbPath)
            self.airfoil.append(af)
        self.analyze_geometry()
Ejemplo n.º 7
0
 def _readData(self):
     """
     reads engine database excel file.
     
     Parameters
     ----------
     
     gearboxRatio  : float
         engine gearbox ratio
     mass : float, kg
         engine mass
     length : float, m
         engine length
     width : float, m
         engine width
     height : float, m
         engine height
     flatRateAlt : float, m
         engine flat rate altitude
         The altitude at which engine performance begins to decrease due to
         reducing atmospheric density
     RPM : array
         array of rpm from db
     torque : array
         array of torque at rpm
     fuelFlow : array
         array of fuel flow at rpm
     fuelDensity : float
         density of fuel for conversion kg/h, l/h
     """
     db=dbTools.readDB(self._inputSheet)
     self.gearboxRatio =db.readRow(1,1)
     self.mass         =db.readRow(2,1)
     self.length       =db.readRow(3,1)
     self.width        =db.readRow(4,1)
     self.height       =db.readRow(5,1)
     self.flatRateAlt  =db.readRow(6,1)
     self.RPM          =db.readRow(7,1)
     self.power        =db.readRow(8,1)*1000
     self.torque       =db.readRow(9,1)
     self.fuelFlow     =db.readRow(10,1)
     self.fuelDensity  =db.readRow(11,1)
     self.sfc          =self.fuelFlow*self.fuelDensity/3600.0/self.power
Ejemplo n.º 8
0
def read_exp_data():
    dataPath = r'D:\engauge\propeller\digitized_results.xls'
    wb = dbTools.loadDB(dataPath)
    db = dbTools.readDB(wb.selectByName('NACA5868-9'))
    J = list()
    CP = list()
    CT = list()
    
    J.append(db.readCol(2,0,10))
    J.append(db.readCol(2,3,13))
    J.append(db.readCol(2,6,13))
    J.append(db.readCol(2,9,13))
    CP.append(db.readCol(2,1,10))
    CP.append(db.readCol(2,4,13))
    CP.append(db.readCol(2,7,13))
    CP.append(db.readCol(2,10,13))
    CT.append(db.readCol(2,2,10))
    CT.append(db.readCol(2,5,13))
    CT.append(db.readCol(2,8,13))
    CT.append(db.readCol(2,11,13))
    return J, CP, CT
Ejemplo n.º 9
0
 def read_xls(self,name,dbPath='',afDbPath=''):
     if dbPath=='':
         dbPath = self.defaultPath.prop
     if afDbPath=='':
         afDbPath = self.defaultPath.propAirfoil
     dbPath = paths.fixPaths(dbPath)
     propDb = dbTools.loadDB(dbPath)
     sheet = propDb.selectByName(name)
     db = dbTools.readDB(sheet)
     self.name = name
     self.diameter = db.readRow(1,1)
     self.hubDiam  = db.readRow(2,1)
     self.numBlades= db.readRow(3,1)
     self.betaRange= db.readRow(4,1)
     self.r        = db.readRow(5,1)
     self.x = 2.0*self.r / self.diameter
     self.chord = db.readRow(7,1)
     self.beta = db.readRow(8,1)
     afname = db.readRow(9,1)
     self.airfoil = list()
     for afn in afname:
         af = airfoil.load(afn)
         self.airfoil.append(af)
     self._get_prop_data()
Ejemplo n.º 10
0
    def _readData(self):
        db=dbTools.readDB(self._inputSheet)
        # Reading in Design Quantities Section
        i=db.findHeader("SECTION: DESIGN QUANTITIES")
        self.type                  =db.readRow(i+1,1)
        fuelMass                   =db.readRow(i+2,1)
        designGrossMass            =db.readRow(i+3,1)
        designSpeed                =db.readRow(i+4,1)
        designAltitude             =db.readRow(i+5,1)
        designLoadFactor           =db.readRow(i+6,1)
        designLandingLoadFactor    =db.readRow(i+7,1)
        occupantNumber             =db.readRow(i+8,1)
        payloadMass                =db.readRow(i+9,1)
        self.designGoals=designGoals(fuelMass,designGrossMass,designSpeed,designAltitude,designLoadFactor,designLandingLoadFactor,occupantNumber,payloadMass)
        # Reading in Main Wing Section        
        i=db.findHeader("SECTION: MAIN WING")
        segmentSpans               =db.readRow(i+1,1,iterable=True)
        chords                     =db.readRow(i+2,1,iterable=True)
        airfoilName                =db.readRow(i+3,1,iterable=True)
        segmentOffsets             =db.readRow(i+4,1,iterable=True)
        segmentDihedrals           =db.readRow(i+5,1,iterable=True)
        twistAngles                =numpy.concatenate((numpy.zeros(1),db.readRow(i+6,1,iterable=True)))
        incidence                  =db.readRow(i+7,1)
        aapex                      =db.readRow(i+8,1)
        aileronLocation            =db.readRow(i+9,1)
        flapLocation               =db.readRow(i+10,1)
        flapType                   =db.readRow(i+11,1)
        fuelWingCG                 =db.readRow(i+12,1)
        material                   =db.readRow(i+13,1)
        self.wing=wing(segmentSpans,chords,airfoilName,segmentOffsets,
                       segmentDihedrals,twistAngles,incidence,aapex,material,1)
        self.wing.setFuelTank(fuelMass/2.0,1,fuelWingCG[0],fuelWingCG[1])
        self.wing.addAileron(aileronLocation)
        self.wing.addFlap(flapLocation,flapType)
        # Reading in Horizontal Stab Section
        i=db.findHeader("SECTION: HORIZONTAL STABILIZER")
        segmentLengths             =db.readRow(i+1,1,iterable=True)
        chords                     =db.readRow(i+2,1,iterable=True)
        airfoilName                =db.readRow(i+3,1,iterable=True)
        segmentOffsets             =db.readRow(i+4,1,iterable=True)
        segmentDihedrals           =db.readRow(i+5,1,iterable=True)
        twistAngles                =numpy.zeros(len(chords))
        incidence                  =db.readRow(i+6,1)
        aapex                      =db.readRow(i+7,1)
        elevatorLocation           =db.readRow(i+8,1)
        material                   =db.readRow(i+8,1)
        #self.hStab=hStab(segmentLengths,chords,airfoilName,segmentOffsets,segmentDihedrals,incidence,aapex,elevatorLocation,material)
        self.hStab=wing(segmentLengths,chords,airfoilName,segmentOffsets,segmentDihedrals,twistAngles,incidence,aapex,material,1,False)
        self.hStab.addElevator(elevatorLocation)
        # Reading in Vertical Stab Section
        i=db.findHeader("SECTION: VERTICAL STABILIZER")
        number                     =db.readRow(i+1,1)
        lateralDistance            =db.readRow(i+2,1)
        segmentLengths             =db.readRow(i+3,1,iterable=True)
        chords                     =db.readRow(i+4,1,iterable=True)
        airfoilName                =db.readRow(i+5,1,iterable=True)
        segmentOffsets             =db.readRow(i+6,1,iterable=True)
        segmentDihedrals           =db.readRow(i+7,1,iterable=True)
        twistAngles                =numpy.zeros(len(chords))
        aapex                      =db.readRow(i+8,1)
        rudderLocation             =db.readRow(i+9,1)
        material                   =db.readRow(i+10,1)
        self.vStab=wing(segmentLengths,chords,airfoilName,segmentOffsets,segmentDihedrals,twistAngles,incidence,aapex,material,0,True)
        self.vStab.addRudder(rudderLocation)
        self.vStabNum              =number
        self.vStabSeparation       =lateralDistance 
        # Reading in Fuselage Data
        i=db.findHeader("SECTION: FUSELAGE")
        length                     =db.readRow(i+1,1)
        diameter                   =db.readRow(i+2,1)
        wettedArea                 =db.readRow(i+3,1)
        sideProfile_X              =db.readRow(i+4,1)
        sideProfile_Y              =db.readRow(i+5,1)
        topProfile_X               =db.readRow(i+6,1)
        topProfile_Y               =db.readRow(i+7,1)
        material                   =db.readRow(i+8,1)        
        self.fuselage=fuselage(length,diameter,wettedArea,sideProfile_X,sideProfile_Y,topProfile_X,topProfile_Y,material)
        # Reading in Engine Data
        i=db.findHeader("SECTION: PROPULSION")
        name                       =db.readRow(i+1,1)
        CG_X                       =db.readRowAsArray(i+2,1)
        CG_Y                       =db.readRowAsArray(i+3,1)
        CG_Z                       =db.readRowAsArray(i+4,1)
        propName                   =db.readRow(i+5,1)
        propHub_X                  =db.readRowAsArray(i+6,1)
        propHub_Y                  =db.readRowAsArray(i+7,1)
        propHub_Z                  =db.readRowAsArray(i+8,1)
        minBeta                    =db.readRowAsArray(i+9,1)
        maxBeta                    =db.readRowAsArray(i+10,1)
        self.engine=engine(name,CG_X,CG_Y,CG_Z)
        self.propeller=propeller(propName,propHub_X,propHub_Y,propHub_Z,minBeta,maxBeta)
        # Reading in Landing Gear Data
        i=db.findHeader("SECTION: LANDING GEAR")
        gearType                   =db.readRow(i+1,1)
        tireWidth                  =db.readRow(i+2,1)
        tireDiameter               =db.readRow(i+3,1)
        strutLength                =db.readRow(i+4,1)
        strutType                  =db.readRow(i+5,1)
        fairingType                =db.readRow(i+6,1)
        groundContact_X            =db.readRow(i+7,1)
        groundContact_Y            =db.readRow(i+8,1)
        groundContact_Z            =db.readRow(i+9,1)
        self.landingGear=landingGear(gearType,tireWidth,tireDiameter,strutLength,strutType,fairingType,groundContact_X,groundContact_Y,groundContact_Z)
        # Reading in VLM Operating Parameters        
        i=db.findHeader("SECTION: OPTIONAL VLM PARAMS")
        defaultFlag                =int(db.readRow(i+1,1))
        if defaultFlag==1:
            wing_spanwise          =db.readRow(i+2,1)
            wing_chordwise         =db.readRow(i+3,1)
            hStab_spanwise         =db.readRow(i+4,1)
            hStab_chordwise        =db.readRow(i+5,1)
            vStab_spanwise         =db.readRow(i+6,1)
            vStab_chordwise        =db.readRow(i+7,1)
            cosDistribution        =db.readRow(i+8,1)
            sinDistribution        =db.readRow(i+9,1)
            self.VLMsetup=VLMsetup(wing_spanwise,wing_chordwise,hStab_spanwise,hStab_chordwise,vStab_spanwise,vStab_chordwise,cosDistribution,sinDistribution)
        else:
            self.VLMsetup=VLMsetup()
        # Reading in Mass List
        massSec=db.read_section('MASS SOURCES',0)
        self.mass = weight.AircraftMass(self.name)
        for line in massSec:
            name=str(line[0])
            values  =numpy.array(line[1:])
            mass    =values[0]
            CG      =values[1:4]
            MOM     =values[5:8]
            self.mass.payload.add_item(name,mass,CG,MOM)
        self.mass.fuel.add_item('Fuel tank Right',fuelMass/2.0)
        self.mass.fuel.add_item('Fuel tank Left',fuelMass/2.0)
        self.mass.update_total()
        # Reading in Drag List
        dragSec=db.read_section('DRAG SOURCES',0)
        self.drag = drag.AircraftDrag()
#        self.drag=drag.DragList()
        for line in dragSec:
            drg=drag.DragItem()
            drg.name=str(line[0])
            drg.quantity=int(line[1])
            drg.frontArea=float(line[2])
            self.drag.components.add_item(drg)