예제 #1
0
파일: thrust.py 프로젝트: maximtyan/actools
def runTest_thrustAnalysis():
    import aircraft
    print '\n Testing Single Engine Variable Pitch'
    ac=aircraft.load("sampleInput1")
    th=thrustAnalysis(ac)
    th.runAnalysis(60.,1.225,100.)
    th.printResults()
    print '\n Testing Thrust Matching - Single Engine Variable Pitch'
    th.matchRequiredThrust(40.,1.225,600)
    th.printResults()
    print '\n Testing - Twin Engine Variable Pitch'
    ac=aircraft.load("sampleInput2")
    th=thrustAnalysis(ac)
    th.runAnalysis(60.,1.225,100.)
    th.printResults()
    print '\n Testing Thrust Matching - Twin Engine Variable Pitch'
    th.matchRequiredThrust(40.,1.225,1200)
    th.printResults()
    print '\n Testing Twin Engine Fixed Pitch'
    ac=aircraft.load("fixedPitchSample")
    th=thrustAnalysis(ac)
    th.runAnalysis(60.,1.225,100.)
    th.printResults()
    print '\n Testing Thrust Matching - Twin Engine Fixed Pitch'
    th.matchRequiredThrust(40.,1.225,1200)
    th.printResults()
예제 #2
0
def run_clean_configuration():
    ac = aircraft.load('V0510')
    CG = ac.get_CG()
    CG = [1.711,0.0,-0.104]
    I = ac.get_inertia()
    m = ac.get_mass_total()
    V = 34.0
    rho = 1.2255
    CD0 = ac.get_drag(V,0.0)
    aero3d = aerodynamics.aero3d_VLM(ac)

    case = [9,10,11]
    alpha = array([-2,0.0,2,4,6,8,10,12])
    beta = array([0.0,10.0,20.0])
    wtRslt = list()
    avlRslt = list()

    for i in range(len(case)):
        fc = aerodynamics.flightConditions()
        b = beta[i]
        for a in alpha:
            fc.add_flight_condition('wt validation',m,CG,I,V,rho,CD0=CD0,alpha=a,beta=b)
        wtPath = find_file_by_number(case[i])
        wtRslt.append(WTresult(wtPath))
        _avlrslt = aero3d.runVLM(fc).results
        _avlRslt = WTresult()
        _avlRslt._read_vlm_results(_avlrslt)
        avlRslt.append(_avlRslt)
        compare_results(wtRslt[i],avlRslt[i])
예제 #3
0
def example1():
    # run trim analysis
    import aircraft
    ac = aircraft.load('V0510')
    fc = flightConditions()
    CG = numpy.array([1.7,0,0])
    I = numpy.array([500., 1000, 1000])
    M = 600.
    V = 50.
    density = 1.2255
    Cd0 = ac.get_drag(V,0.0)
    fc.addTrimmedFlightCondition('cruise1',M,CG,I,V,density,CmTrim=0.0,Cd0=Cd0)
    a3d = aero3d_VLM(ac)
    rslt = a3d.runVLM(fc,False)
    print 'GENERAL'
    rslt.results[0].display()
    print 'PHUGOID'
    rslt.results[0].dynamicStability.phugoid.display()
    print 'SHORT PERIOD'
    rslt.results[0].dynamicStability.shortPeriod.display()
    print 'DUTCH ROLL'
    rslt.results[0].dynamicStability.dutchRoll.display()
    print 'SPIRAL'
    rslt.results[0].dynamicStability.spiral.display()
    print 'ROLL'
    rslt.results[0].dynamicStability.roll.display()
예제 #4
0
def runTest2():
    import aircraft
    AC =aircraft.load("Xtail_sample")
    FC =flightConditions()
    CG =numpy.array([0.65,0,0])
    I  =numpy.array([500.0,1000.0,1000.0])
    M  =75.0
    V  =50.0
    rho=1.225
    CD0=AC.drag.total.get_total_drag()
    FC.addTrimmedFlightCondition('cruise1',M,CG,I,V,rho,CmTrim=0.0,Cd0=CD0)
    FC.flightConditionList[0].flap = 0.0
    #FC.addTrimmedFlightCondition('cruise2',M/2,CG,I,V/2,rho,Cd0=CD0)
    a3d=aero3d_VLM(AC)
    R=a3d.runVLM(FC,False)
    R.results[0].display()
    print_header('PHUGOID')
    R.results[0].dynamicStability.phugoid.display()
    print_header('SHORT PERIOD')
    R.results[0].dynamicStability.shortPeriod.display()
    print_header('DUTCH ROLL')
    R.results[0].dynamicStability.dutchRoll.display()
    print_header('SPIRAL')
    R.results[0].dynamicStability.spiral.display()
    print_header('ROLL')
    R.results[0].dynamicStability.roll.display()
    AC.display()
예제 #5
0
def get_drag_polar():
    rsltFile = 'drag_polar.txt'
    
    ac = aircraft.load('V0510')
    fc = aero.flightConditions()
    CG = ac.get_CG(False)
    I = ac.get_inertia(False)
    M = ac.get_mass_total(False)
    V = 34.0
    rho = 1.2255
    CD0 = ac.get_drag(V,0.0)
    fc.addTrimmedFlightCondition('trim',M, CG, I, V, rho)
    aero3D = aero.aero3d_VLM(ac)
    rslt = aero3D.runVLM(fc)
    
    alpha = np.linspace(-10.,20.,20)
    CLexp, CDexp, alphaExp = experimental_data()
    
    CLa = rslt.results[0].a * (np.pi/180.0)
    CL0 = rslt.results[0].CL0
    k   = rslt.results[0].k
    CL = CL0 + alpha*CLa
    CD = CD0 + CL*CL*k
    
    fid = open(rsltFile,'wt')
    fid.write('Velocity %.2f m/sec\n'%V)
    fid.write('Density %.2f kg/m3\n'%rho)
    fid.write('CD0 %.4f\n'%CD0)
    fid.write('alpha[deg]\tCL\tCD\n')
    for i,a in enumerate(alpha):
        fid.write('%.1f\t%.4f\t%.4f\n'%(a,CL[i],CD[i]))
    fid.close()
예제 #6
0
def aero_valid():
    ac = aircraft.load('V0510')
    fc = aero.flightConditions()
    CG = ac.get_CG(False)
    I = ac.get_inertia(False)
    M = ac.get_mass_total(False)
    V = 34.0
    rho = 1.2255
    CD0 = ac.get_drag(V,0.0)
    fc.addTrimmedFlightCondition('trim',M, CG, I, V, rho)
    aero3D = aero.aero3d_VLM(ac)
    rslt = aero3D.runVLM(fc)
    
    alpha = np.linspace(-10.,20.,20)
    CLexp, CDexp, alphaExp = experimental_data()
    
    CLa = rslt.results[0].a * (np.pi/180.0)
    CL0 = rslt.results[0].CL0
    k   = rslt.results[0].k
    rslt.results[0].display()
    CL = CL0 + alpha*CLa
    CD = CD0 + CL*CL*k

    plt = mpl.pyplot
    
    font = {'family' : 'normal',
            'weight' : 'normal',
            'size'   : 20}
    
    mpl.rc('font',**font)    
    
    plt.figure(1)
    plt.hold(True)
    plt.grid(True)
    plt.plot(CDexp,CLexp,'bo-')
    plt.plot(CD,CL,'r-')
    plt.ylabel('lift coefficient')
    plt.xlabel('drag coefficient')
    plt.axis([0,0.3,-1.0,1.5])
    plt.legend(['wind tunnel','calculated'],'lower right')
    
    plt.figure(2)
    plt.hold(True)
    plt.grid(True)
    plt.plot(alphaExp,CDexp,'bo-')
    plt.plot(alpha,CD,'r-')
    plt.xlabel('angle of attack,deg')
    plt.ylabel('drag coefficient')
    plt.legend(['wind tunnel','calculated'],'upper left')
    
    plt.figure(3)
    plt.hold(True)
    plt.grid(True)
    plt.plot(alphaExp,CLexp,'bo-')
    plt.plot(alpha,CL,'r-')
    plt.xlabel('angle of attack,deg')
    plt.ylabel('lift coefficient')
    plt.legend(['wind tunnel','calculated'],'lower right')
    plt.axis([-10,25,-0.5,1.5])
    plt.show()
예제 #7
0
def run_test2():
    import aircraft
    ac = aircraft.load('V0510')
    aero = aerodynamics(ac)
    aero.update(65.,0.8,3.0)
    aero.results.display()
    ac.display()
예제 #8
0
def kla100_mass():
    import aircraft
    ac = aircraft.load('V0510')
    print 'Aft CG\n======'
    ac.mass.update_item_mass('Payload','baggage',70.)
    ac.mass.display()
    ac.mass.update_item_mass('Fuel','Fuel Tank Right',47.5/2.)
    ac.mass.update_item_mass('Fuel','Fuel Tank Left',47.5/2.)
    ac.mass.total.display()
    ac.mass.update_item_mass('Fuel','Fuel Tank Right',2.5)
    ac.mass.update_item_mass('Fuel','Fuel Tank Left',2.5)
    ac.mass.total.display()
    print 'front CG\n========'
    ac.mass.update_item_mass('Payload','passenger',86.)
    ac.mass.update_item_mass('Payload','pilot',86.)
    ac.mass.update_item_mass('Payload','baggage',0.0)

    ac.mass.update_item_mass('Fuel','Fuel Tank Right',47.5)
    ac.mass.update_item_mass('Fuel','Fuel Tank Left',47.5)
    ac.mass.total.display()

    ac.mass.update_item_mass('Fuel','Fuel Tank Right',47.5/2)
    ac.mass.update_item_mass('Fuel','Fuel Tank Left',47.5/2)
    ac.mass.total.display()

    ac.mass.update_item_mass('Fuel','Fuel Tank Right',2.5)
    ac.mass.update_item_mass('Fuel','Fuel Tank Left',2.5)
    ac.mass.total.display()
    ac.display()
예제 #9
0
def example2():
    # run trim using modified function
    import aircraft
    ac = aircraft.load('V0510')
    aero = aerodynamics(ac)
    aero.update(65.,0.8,3.0)
    aero.results.display()
    ac.display()
예제 #10
0
def debug1():
    import aircraft
    ac = aircraft.load('V0510')
    ac.mass.fuel.set_fuel_mass(30,'total')
    ac.mass.display()
    ac.mass.fuel.set_fuel_mass_burned(1.5,'total')
    ac.mass.display()
    
    baggage = MassComponent('baggage', 70.0, [2.85,0,-0.125])
    baggage.display(True,True)
예제 #11
0
def test_flight_mechanics():
    ac = aircraft.load('V0510')
    bi = BasicInput(ac,1.6,2000.)
    tm = ac.analysis.thrust
    fm = FlightMechanics(bi,tm)
    
    print fm.get_EAS(50,1.05)
    print fm.get_LDmax()
    print fm.get_requiredThrust(65)
    print fm.get_Vstall(1.2)
예제 #12
0
def new_report():
    ac = aircraft.load('V0510')
    sr = StabilityReport(ac)
    sr.init_report()
    sr.add_cg([1.656,0.0,0.0],726.0,1.0,'current FWD')
    sr.add_cg([1.800,0.0,0.0],726.0,1.0,'current AFT')
    
    sr.add_flight_condition(0.0,[20.0,75.0,15])
    sr.reportStaticMargin = True
    sr.set_required_param('derivatives',['Clb','Cnb','Cma'],['Cl_beta','Cn_beta','Cm_alpha'])
    sr.set_required_param('basic',['elevator','xNP'],['elev deflection,deg','neutral point'])
    sr.generate(14)
예제 #13
0
def run_takeoff():
    name = 'V0510-MDO'
    velocity =50.0
    altitude =2000.
    ac       =aircraft.load(name)
    mass      =ac.mass.totalMass
    rslt = ac.analyze_aero_trim(velocity,altitude)
    ac.analysis.aerodynamics.update(velocity,1.225)
    Cd0      =ac.get_drag(velocity,altitude)
    tm       =ac.analysis.thrust
    
    TO = Takeoff(ac,0.0,tm)
    print TO.analyze(1.5,800.0)
예제 #14
0
def run_test1():
    ac = aircraft.load('V0510-MDO')
    alt = 2000.0
    vel = ny.linspace(10,100.0,20)
    Cd0 = list()
    for v in vel:
        Cd0.append(ac.get_drag(v,alt))
    plt.figure(2)
    plt.plot(vel,Cd0,'b-')
    plt.hold(True)
    plt.grid(True)
    plt.xlabel('velocity, m/sec')
    plt.ylabel('CD0')
    plt.show()
예제 #15
0
def generate_stability_report():
    ac = aircraft.load('V0510')
    names,massList,cgList = get_mass_data()
    velocity = 60.0
    density = 1.0581
    loadFactor = 1.0
    aero = aerodynamics.aerodynamics(ac)
    out = ''
    show = [True,False,False,False]
    for name,m,cg,s in zip(names,massList,cgList,show):
        aero.update(velocity,density,loadFactor,name=name,mass=m,CG=cg)
        sr = rt.StabilityTextReport(aero.results,velocity,m,cg)
        out += sr._report(s,dynamic=True) + '\n'
    print out
예제 #16
0
def calc_hinges():
    import aircraft
    ac = aircraft.load('V0510')
    fc = flightConditions()
    CG = [1.824,0.0,-0.125]
    I = ac.get_inertia()
    m = 620.0
    V = 75.0
    rho = 1.2255
    CD0 = ac.get_drag(V,0.0)
    n = 1.0
    fc.add_flight_condition('hinge',m,CG,I,V,rho,n,CD0,alpha=20.0,elevator=30.0)
    aero3d = aero3d_VLM(ac)
    rslt = aero3d.runVLM(fc)
    rslt.results[0].hingeMoments.display()
예제 #17
0
def run_test():
    import aircraft
    ac = aircraft.load('V0510')
    fc = flightConditions()
    CG = ac.get_CG(False)
    I = ac.get_inertia(False)
    M = ac.get_mass_total(False)
    V = 1.0
    rho = 1.2255
    Cd0 = ac.get_drag(V,0.0)
    fc.addTrimmedFlightCondition('trim',M, CG, I, V, rho)
    fc.flightConditionList[0].setRudder(0.)
    aero3D = aero3d_VLM(ac)
    rslt = aero3D.runVLM(fc)
    rslt.results[0].display()
예제 #18
0
파일: thrust.py 프로젝트: maximtyan/actools
def runTest_fixPitch():
    import aircraft
    import matplotlib.pyplot as plt 
    ac          =aircraft.load("sampleInput1")
    thrust      =thrustPerEngine(ac.engine.engineList[0],ac.propeller.propellerList[0])
    
    N=10
    Blist       =frange(15.,45.,N) # pitch angle list
    propRPMlist =frange(500.,3000.,N)
    Vlist       =frange(1,70,N)       
    thrust.buildPropTable(Blist,propRPMlist,Vlist)
    
    V           =30.
    rho         =1.2
    beta        =20.0

    #pwrList =np.array(frange(50.,100.,20))
    pwrList = np.array([50.,75.,100.])
    Vlist   =np.array(frange(1., 70.,20))

    t1 = time.time()
    for i in range(0,100,1):thrust.thrust_fixedPitch(V,rho,100,beta,True)
    t2=time.time()    
    for i in range(0,100,1):thrust.thrust_fixedPitch(V,rho,100,beta,False)
    t3 = time.time()
    print 'exact  time = '+str(t2-t1)
    print 'approx time = '+str(t3-t2)
    
    T  =np.zeros([len(pwrList),len(Vlist)])
    P  =np.zeros([len(pwrList),len(Vlist)])
    N  =np.zeros([len(pwrList),len(Vlist)])
    RPM=np.zeros([len(pwrList),len(Vlist)])
    VV =np.zeros([len(pwrList),len(Vlist)])
    
    beta  =25.    
    plt.figure(1)
    plt.hold(True)
    for i,pwr in enumerate(pwrList):
        for j,V in enumerate(Vlist):
            T[i,j],P[i,j],FF,RPM[i,j],N[i,j],beta=thrust.thrust_fixedPitch(V,rho,pwr,beta,1)
            #aprx=thrust.thrust_fixedPitch(V,rho,pwr,beta,0)            
            VV[i,j]=V
        plt.plot(VV[i,:],T[i,:],'o-')
    plt.xlabel('Velocity, m/sec')
    plt.ylabel('Thrust, N')
    plt.grid(True)
    plt.legend(['50% throttle','75% throttle','full throttle'])
    plt.show()
예제 #19
0
def run_performance_test(inputSheet='V0510'):
    from report_tools import header
    velocity =50.
    altitude =2000.
    Clmax    =1.4
    nMax     =4.5
    
    ac       =aircraft.load(inputSheet)

    tm       =ac.analysis.thrust
    bi       =BasicInput(ac, Clmax, altitude)
    
    slf      = SteadyLevelFlight(bi,tm)
    clm      = ClimbAndDescendingFlight(bi,tm)
    trn      = TurningFlight(bi,tm)
    
    print header('TURN')
    trn.run_turnRate(60.*np.pi/180.,velocity,nMax,100)
    trn.display()
    print header('CLIMB RATE')
    clm.run_climbRate(velocity,100)
    clm.display()
    print header('MAXIMUM CLIMB ANGLE')
    clm.run_maximumClimbAngle(100.)
    clm.display()
    timer.start()
    print header('MAXIMUM CLIMB RATE')
    clm.run_maximumClimbRate(100.)
    clm.display()
    timer.finish()
    print header('MINIMUM GLIDE ANGLE')
    clm.run_minGlideAngle()
    clm.display()
    print header('MINIMUM GLIDE SINK RATE')
    clm.run_minGlideSinkRate()
    clm.display()
    
    print header('MAXIMUM VELOCITY')
    slf.run_velocity_maxTAS(75.)
    slf.display()
    timer.start()
    print header('MAXIMUM SAR')
    slf.run_velocity_maxSAR()
    slf.display()
    timer.finish()
    print header('MINIMUM FUEL')
    slf.run_velocity_minFuel()
    slf.display()
예제 #20
0
def run_test1():
    import matplotlib.pyplot as plt
    name = 'V0510-MDO'
    velocity =50.0
    altitude =2000.
    Clmax    =1.4
    ac       =aircraft.load(name)
    rslt = ac.analyze_aero_trim(velocity,altitude)
    ac.analysis.aerodynamics.update(velocity,1.225)
    tm       =ac.analysis.thrust
    bi = BasicInput(ac,Clmax,altitude)

    print_header('Cruise')
    crs = Cruise(bi,tm)
    rslt = crs.get_range_at_power_setting(80.,10.,2000.0,75.0,6)
    rslt.display()
    crs.display()
예제 #21
0
def new_report():
    ac = aircraft.load('V0510')
    sr = StabilityReport(ac)
    sr.init_report()
    sr.plot = True
    sr.report = False
    sr.add_cg([1.711,-0.040,-0.124],593.1,1.0,'aft load')
    sr.add_cg([1.824,-0.0,-0.103],583.1,1.0,'fwd load')
    sr.add_flight_condition(1500.0,[30.0,70.0,7])
    #sr.set_alpha_sweep(0.0,70.0,aileron=20.0)
    sr.reportStaticMargin = True
#    sr.set_required_param('basic',['xNP','alpha','elevator'],['neutral point','trim AOA','trim elevator defl.'])
#    sr.set_required_param('coefficients',['CL','CD'],['lift coef.','drag coef.'])
#    sr.set_required_param('derivatives',['Clb','Cnb','Cma'],['Cl beta','Cn beta','Cm alpha'])
#    sr.set_required_param('short period',['Wn','Z'],['Short period nat freq.','Short period damping ratio'])
#    sr.set_required_param('dutch roll',['Wn','Z'],['Dutch roll nat freq.','Dutch roll damping ratio'])
    sr.set_required_param('hinge moment',['Mrudder','Maileron','aileron','Melevator'],['rudder, N*m','aileron, N*m','aileron coef','elevator, N*m'])
    sr.generate(14)
예제 #22
0
def run_test3():
    ac = aircraft.load('V0510-MDO')
    altitude = 0.0
    dT = 0
    velocity = 50.0
    mass = ac.mass.totalMass
    rslt = ac.analyze_aero_trim(velocity,altitude)
    k        =rslt.k
    Cd0      =ac.get_drag(velocity,altitude)
    S        =ac.wing.area
    Clmax = 1.8
    
    tm       =ac.analysis.thrust
    bi       =basicInput(altitude,dT,Cd0,k,S,mass,Clmax)
    climb = Climb()
    climb._init_climb(ac,bi,tm)
    print climb.climb_simulation_integr(0,2000)
    print climb.climb_simulation_max(0,2000)
예제 #23
0
파일: thrust.py 프로젝트: maximtyan/actools
def runTest_propTable():
    import aircraft
    import matplotlib.pyplot as plt 
    N=20
    ac          =aircraft.load("sampleInput1")
    prop        =ac.propeller.propellerList[0]
    Blist       =frange(15.,45.,N)
    propRPMlist =frange(500.,3000.,N)
    Vlist       =frange(1,70,N)
        
    thrust      =thrustPerEngine(ac.engine.engineList[0],ac.propeller.propellerList[0])
    thrust.buildPropTable(Blist,propRPMlist,Vlist)            
    exactMode =thrust.thrust_fixedPitch(40.,1.22,100,25.,True)  
    approxMode=thrust.thrust_fixedPitch(40.,1.22,100,25.,False)  
    print exactMode
    print approxMode
    #propTbl     =propTable(engine,prop,Blist,propRPMlist,Vlist)
    propTbl      =thrust.propTable
    
    beta    =25.
    rho     =1.225
    propRPM =1500.
    V       =35.
    print 'CP     = '+str(propTbl.getCP(beta,propRPM,V))
    print 'Power  = '+str(propTbl.getPropPower(beta,propRPM,V,rho)/1000.)+' kw'
    print 'Thrust = '+str(propTbl.getPropThrust(beta,propRPM,V,rho))+' N'
    
    T,P,Jreq,CT,CP,effy=prop.analyze_prop(beta,propRPM,V,1.225)
    print 'CP     = '+str(CP)
    print 'Power  = '+str(P/1000.)+' kw'
    print 'Thrust = '+str(T)+' N'
    
    T=np.zeros([len(Vlist)])

    plt.figure(1)
    plt.hold(True)
    for i,RPM in enumerate(propRPMlist):
        for j,V in enumerate(Vlist):
            #T[j]=CPtab.getPropThrust(beta,RPM,V,rho)
            T[j]=propTbl.getCT(beta,RPM,V)
        plt.plot(Vlist,T,'o-')
    plt.show()
예제 #24
0
def v200_stability():
    # report for KLA100 CDR 2014-03-31
    ac = aircraft.load('V204-ext_aileron')
    #ac.display()
    sr = StabilityReport(ac)
    sr.init_report()
    sr.plot = True
    wingLoc = ac.wing.aapex[0]
    wingMAC = ac.wing.MAC
    sr.add_cg([0.2513*wingMAC+wingLoc, 0,0],620,1.0,'maximum mass,fw CG')
    sr.add_cg([0.3691*wingMAC+wingLoc, 0,0],620.,1.0,'maximum mass, aft CG')
    sr.add_cg([0.1649*wingMAC+wingLoc, 0,0],403.5,1.0,'minimum mass, abs fw CG')
    sr.add_flight_condition(1500.0,[30,80,10])
    sr.reportStaticMargin = True
    sr.set_required_param('basic',['xNP','alpha','elevator'],['neutral point','trim AOA','trim elevator defl.'])
    sr.set_required_param('coefficients',['CL','CD'],['lift coef.','drag coef.'])
    sr.set_required_param('derivatives',['Clb','Cnb','Cma'],['Cl beta','Cn beta','Cm alpha'])
    sr.set_required_param('short period',['Wn','Z'],['Short period nat freq.','Short period damping ratio'])
    sr.set_required_param('dutch roll',['Wn','Z'],['Dutch roll nat freq.','Dutch roll damping ratio'])
    sr.generate()
예제 #25
0
def run_test3():
    import aircraft
    import matplotlib.pyplot as plt
    ac = aircraft.load('V0510')
    fc = flightConditions()
    CG = ac.get_CG()
    I = ac.get_inertia()
    m = ac.get_mass_total()
    V = 50.0
    rho = 1.2255
    CD0 = ac.get_drag(V,0.0)
    ail = [-10,0,2,5,7,10]
    ailDisp = list()
    r = 15
    for a in ail:
        fc.add_flight_condition('untrimmed',m,CG,I,V,rho,CD0=CD0,aileron=a,rudder=r)
        ailDisp.append(a)
    aero3d = aero3d_VLM(ac)
    rslt = aero3d.runVLM(fc)
    cl = [rslt.results[i].coefficients.Cl for i in range(len(ail))]
    plt.plot(ailDisp,cl,'ro-')
    plt.show()
예제 #26
0
def test_report():
    ac = aircraft.load('V0510')
    print ac.wing.MAC
    print ac.vStab.MAC
    print ac.hStab.MAC
    sr = StabilityReport(ac)
    sr.init_report()
    CG = generate_payload_mass_list()
    sr.add_flight_condition(0.0,[20.0,30.0,10],False,flap=15.0)
    for cg in CG:
        sr.add_payload_mass_list(cg)
        print cg.display()
#    sr.reportStaticMargin = True
#    sr.reprtHingeMoments = True
#    sr.set_required_param('basic',['alpha','elevator'],['Trim AOA, deg','elev. deflection,deg'])
#    sr.set_required_param('coefficients',['CL','CD'],['lift coefficient','drag coefficient'])
#    sr.set_required_param('derivatives',['Cma','Cnb','Clb'],['Cm-alpha','Cn-beta','Cl-beta'])

    sr.set_required_param('short period',['w','Z'],['short period nat.freq.','short period damp.ratio'])
    sr.set_required_param('dutch roll',['w','Z'],['dutch roll nat.freq.','dutch roll damp.ratio'])
#    sr.set_required_param('hinge moment',['elevator','flap'],['elev hinge moment coeficient','flap hinge moment coefficient'])
    sr.generate()
예제 #27
0
def calculate_part_inertia():
    ac = aircraft.load('V0510')
    name = ['main wing','hStab','vStab','fuselage']
    Ixx, Iyy, Izz = zeros(len(name)),zeros(len(name)),zeros(len(name))
    
    i = 0
    m = 56.30
    a = ac.wing.MAC
    b = ac.wing.thicknessRatio*a
    l = ac.wing.span
    Ixx[i],Iyy[i],Izz[i] = rect_inertia(m,a,b,l)
    
    i = 1
    m = 10.40
    a = ac.hStab.MAC
    b = ac.hStab.thicknessRatio*a
    l = ac.hStab.span
    Ixx[i],Iyy[i],Izz[i] = rect_inertia(m,a,b,l)
    
    i = 2
    #m = ac.mass.airframe.get_item_mass_by_name('vStab')
    m = 3.8
    a = ac.vStab.MAC
    b = ac.vStab.span
    l = ac.vStab.thicknessRatio*a
    Ixx[i],Iyy[i],Izz[i] = rect_inertia(m,a,b,l)
    
    i = 3
    m = 66.20+16.80-1.9+66.9
    r = ac.fuselage.diameter / 2.0
    l = ac.fuselage.length
    Ixx[i],Iyy[i],Izz[i] = circ_inertia(m,r,l)
    
    print 'unit: kg*m^2'
    out = '{0:15}|{1:^12}|{2:^12}|{3:^12}|'.format('name','Ixx','Iyy','Izz')
    print out + '\n' + '='*len(out)
    for i,n in enumerate(name):
        print '{0:15} {1:12.4f} {2:12.4f} {3:12.4f}'.format(n, Ixx[i],Iyy[i],Izz[i])
예제 #28
0
파일: thrust.py 프로젝트: maximtyan/actools
def runTest_varPitch():
    import aircraft
    import matplotlib.pyplot as plt
    import matplotlib
    ac=aircraft.load("V0510")
    T=thrustPerEngine(ac.engine.engineList[0],ac.propeller.propellerList[0])
    V           =76.
    rho         =1.2
    pctThrottle =75.   
    
#    N=20
#    Blist       =frange(15.,45.,N)
#    propRPMlist =frange(500.,3000.,N)
#    Vlist       =frange(1,70,N)       
    #T.buildPropTable(Blist,propRPMlist,Vlist)   

    Vlist =np.array(range(30,70,2))
    thrust1=np.zeros(len(Vlist))
    effy1  =np.zeros(len(Vlist))
    beta1  =np.zeros(len(Vlist))
    thrust2=np.zeros(len(Vlist))
    effy2  =np.zeros(len(Vlist))
    beta2  =np.zeros(len(Vlist))
    
    t1 = time.time()
    for i in range(0,100,1):
        T.thrust_variablePitch(V,rho,pctThrottle,mode='max_thrust')
    t2 = time.time()
    print 'Time = '+str((t2-t1)/100)+ ' seconds per run'
    
    for i,V in enumerate(Vlist):
        thrust1[i],powerAchieved1,fuelFlow1,RPM,effy1[i],beta1[i]=T.thrust_variablePitch(V,rho,pctThrottle,mode='max_thrust')
        thrust2[i],powerAchieved2,fuelFlow2,RPM,effy2[i],beta2[i]=T.thrust_variablePitch(V,rho,pctThrottle,mode='max_efficiency')
        print str(thrust1[i])+' '+str(thrust2[i])
    
    font = {'family' : 'sans-serif',
            'style'  : 'normal',
            'size'   : 16}
    matplotlib.rc('font', **font)
    
    plt.figure(1)
    plt.hold(True)
    plt.grid(True)
    l1,=plt.plot(Vlist,effy1,'b-')    
    l2,=plt.plot(Vlist,effy2,'r-')
    plt.legend([l1,l2],['Max Thrust Mode','Max Efficiency Mode'],loc=2)
    plt.title('Velocity vs. Efficiency')
    plt.xlabel('Velocity (m/s)')
    plt.ylabel('Efficiency')
    
    plt.figure(2)
    plt.hold(True)
    plt.grid(True)
    l1,=plt.plot(Vlist,thrust1,'b-')
    l2,=plt.plot(Vlist,thrust2,'r-')
    plt.legend([l1,l2],['Max Thrust Mode','Max Efficiency Mode'],loc=2)
    plt.title('Velocity vs. Thrust')
    plt.xlabel('Velocity (m/s)')
    plt.ylabel('Thrust (N)')
    
    plt.figure(3)
    plt.hold(True)
    plt.grid(True)
    l1,=plt.plot(Vlist,beta1,'b-')
    l2,=plt.plot(Vlist,beta2,'r-')
    plt.legend([l1,l2],['Max Thrust Mode','Max Efficiency Mode'],loc=2)
    plt.title('Velocity vs. Beta')
    plt.xlabel('Velocity (m/s)')
    plt.ylabel('Beta (deg)')

    plt.show()
예제 #29
0
def cross_wind_landing_manual_input():
    """
    Performs crosswind takeoff and landing simulation.
    """
    Vcross = 10.0 #kt
    rho = 1.2255
    Vstall = 20.6
    VTo = 1.1*Vstall
    aileron = 2.0
    alphaGround=0.0
    steering = 0.0
    g = 9.81
    n = 25
    Cbeta = 0.025
    
    mu = 0.03
    mass = 620.0
    #CG = np.array([1.925,0,-0.144])
    #CG = np.array([1.813,0,-0.125])
    Vcross = Vcross*0.5144 # kt to m/s
    aileron = np.radians(aileron)
    steering = np.radians(steering)
    ac = aircraft.load('V204')
    xCG = 1.4+1.116*0.2554 #ac.wing.get_fs_on_mac(40.0)
    CG = np.array([xCG,0,0])
    
    #aero = aerodynamics.aerodynamics(ac)
    #aeroData = aero.update_notrim(0.5*Vstall,rho,flap=flap,aileron=0.0,rudder=0.0,alpha=alphaGround,beta=beta)
    T = 0
    cref = 1.166
    bref = 10.311
    Sref = 11.607
    Xmlg = ac.landingGear.groundContact_X[2]
    Xnlg = ac.landingGear.groundContact_X[0]
    Ymlg = ac.landingGear.groundContact_Y[2]
    Zmlg = ac.landingGear.groundContact_Z[2]
    Znlg = ac.landingGear.groundContact_Z[0]
    zmg = CG[2] - Zmlg
    zng = CG[2] - Znlg
    ymg = abs(Ymlg)

    V = np.linspace(0.8*VTo,VTo,n)
    Png = np.zeros(n)
    Pmg = np.zeros(n)
    betaCross = np.zeros(n)
    rudder = np.zeros(n)
    PmgL = np.zeros(n)
    PmgR = np.zeros(n)
    PsiA = np.zeros(n)
    Ytot = np.zeros(n)
    Yng = np.zeros(n)
    YmgL = np.zeros(n)
    YmgR = np.zeros(n)

    CYb = -0.541
    CYda = 0.063
    CYdr = 0.097
    Clb = -0.175
    Clda = 0.1356
    Cldr = 0.0096
    Cnb = 0.075
    Cnda = -0.0156
    Cndr = -0.0471
    Cm = -0.1925
    CD = 0.22
    CL = 1.65

    Mweight = mass*g*(CG[0] - Xmlg)
    A = np.ones([3,3])
    A[1,2] = 0.0
    A[2,0] = 0.0
    A[0,2] = mass/mu
    A[2,2] = mass*(CG[2]-Zmlg)
    b = np.zeros(3)
    A1 = np.ones([3,3])
    b1 = np.ones(3)
    for i,v in enumerate(V):
        betaCross[i] = np.arctan(Vcross/v)
        qS = rho*v*v*Sref / 2.0
        qSb = qS*bref
        Maero = Cm*qS*cref
        Mthrust = T*(-ac.landingGear.groundContact_Z[2])
        D = qS*CD
        L = qS*CL
        b[0] = (D-T*np.cos(np.radians(alphaGround)))/mu
        b[1] = mass*g-L-T*np.sin(np.radians(alphaGround))
        b[2] = Maero - Mthrust - Mweight
        x = np.linalg.solve(A,b)
        Pmg[i] = x[0]
        Png[i] = x[1]
        A1[0,0] = CYb*qS + Cbeta*(Png[i] + Pmg[i])
        A1[0,1] = 0.0
        A1[0,2] = CYdr*qS
        b1[0] = -( (CYb*betaCross[i] + CYda*aileron)*qS + Cbeta*Png[i]*steering )
        A1[1,0] = Clb*qSb - Cbeta*(Png[i]*zng + Pmg[i]*zmg)
        A1[1,1] = 2.0*ymg
        A1[1,2] = Cldr*qSb
        b1[1] = - ((Clb*betaCross[i] + Clda*aileron)*qSb - Pmg[i]*ymg - Cbeta*steering*Png[i]*zng)
        A1[2,0] = Cnb*qSb + Cbeta*(Png[i]*(Xnlg-CG[0]) - Pmg[i]*(Xmlg-CG[0]))
        A1[2,1] = 0.0
        A1[2,2] = Cndr*qSb
        b1[2] =  - ( (Cnb*betaCross[i]+Cnda*aileron)*qSb - Cbeta*steering*Png[i]*(Xnlg-CG[0]) )
        x1 = np.linalg.solve(A1,b1)
        betaCross[i] = np.degrees(betaCross[i])
        PsiA[i] = np.degrees(x1[0])
        PmgL[i] = x1[1]
        PmgR[i] = Pmg[i] - PmgL[i]
        Yng[i] = Cbeta*Png[i]
        YmgL[i] = Cbeta*PmgL[i]
        YmgR[i] = Cbeta*PmgR[i]
        Ytot[i] = Yng[i]+YmgL[i]+YmgR[i]
        rudder[i] = np.degrees(x1[2])
        #print '%.4f\t%.4f\t%.4f\t%.4f'%(np.degrees(betaCross[i]),np.degrees(x1[0]), x1[1], np.degrees(x1[2]))

    print '%.1f\t%.1f\t%.1f\t%.1f\t%.1f\t%.1f\t%.1f'%(Yng[-1],PmgL[-1],PmgR[-1],Yng[-1],YmgL[-1],YmgR[-1],Ytot[-1])

    fig1 = plt.figure(1)
    ax1 = fig1.add_subplot(211)
    ax1.hold(True)
    ax1.grid(True)
    ax1.plot(V,betaCross,'bo-')
    ax1.plot(V,PsiA,'ro-')
    ax1.legend(['beta cross','crab angle'],loc='upper left')
    ax1.set_ylim([-30,30])
    ax1.set_ylabel('deg')
    ax1.set_xlim([0.85*V[0],V[-1]])
    ax2 = fig1.add_subplot(212)
    ax2.hold(True)
    ax2.grid(True)
    ax2.plot(V,rudder,'bo-')
    ax2.set_ylabel('rudder defl, deg')
    ax2.set_ylim([-45,45])
    ax2.set_xlabel('Velocity,m/s')
    ax2.set_xlim([0.85*V[0],V[-1]])

    fig2 = plt.figure(2)
    ax3 = fig2.add_subplot(211)
    ax3.hold(True)
    ax3.grid(True)
    ax3.plot(V,Pmg/1e3,'bo-')
    ax3.plot(V,PmgL/1e3,'ro-')
    ax3.plot(V,PmgR/1e3,'go-')
    ax3.plot(V,Png/1e3,'ko-')
    ax3.legend(['main total','main left','main right','nose'],loc='upper left')
    ax3.set_ylabel('Landing gear reaction, kN')
    #ax3.set_ylim([-4,8])
    ax3.set_xlim([0.85*V[0],V[-1]])

    ax4 = fig2.add_subplot(212)
    ax4.hold(True)
    ax4.grid(True)
    ax4.set_ylabel('Side force, kN')
    ax4.plot(V,Ytot/1e3,'bo-')
    ax4.plot(V,YmgL/1e3,'ro-')
    ax4.plot(V,YmgR/1e3,'go-')
    ax4.plot(V,Yng/1e3,'ko-')
    ax4.legend(['total','main left','main right','nose'],loc='upper left')
    #ax4.set_ylim([-0.05,Cbeta*mass*0.01])
    ax4.set_xlim([0.85*V[0],V[-1]])
    ax4.set_xlabel('Velocity,m/s')
    plt.show()
예제 #30
0
def run_test3():
    ac = aircraft.load('V05')
    alt = 2000.0
    ac.drag.total.display()