Ejemplo n.º 1
0
def find_takeoff_weight_given_tofl(vehicle, analyses, airport, target_tofl):
    """Estimates the takeoff weight given a certain takeoff field length.

    Assumptions:
    assumptions per estimate_take_off_field_length()

    Source:
    N/A

    Inputs:
    vehicle.mass_properties.
      operating_empty         [kg]
      max_takeoff             [kg]
      analyses                [SUAVE data structure]
      airport                 [SUAVE data structure]
      target_tofl             [m]
      
    Outputs:
    max_tow                   [kg]

    Properties Used:
    N/A
    """

    #unpack
    tow_lower = vehicle.mass_properties.operating_empty
    tow_upper = 1.10 * vehicle.mass_properties.max_takeoff

    #saving initial reference takeoff weight
    tow_ref = vehicle.mass_properties.max_takeoff

    tow_vec = np.linspace(tow_lower, tow_upper, 50.)
    tofl = np.zeros_like(tow_vec)

    for id, tow in enumerate(tow_vec):
        vehicle.mass_properties.takeoff = tow
        tofl[id] = estimate_take_off_field_length(vehicle, analyses, airport)

    target_tofl = np.atleast_1d(target_tofl)
    max_tow = np.zeros_like(target_tofl)

    for id, toflid in enumerate(target_tofl):
        max_tow[id] = np.interp(toflid, tofl, tow_vec)

    #reset the initial takeoff weight
    vehicle.mass_properties.max_takeoff = tow_ref

    return max_tow
Ejemplo n.º 2
0
def find_takeoff_weight_given_tofl(vehicle,takeoff_config,airport,target_tofl):
    """ SUAVE.Methods.Perfomance.find_takeoff_weight_given_tofl(vehicle,takeoff_config,airport,target_tofl)
        This routine estimates the takeoff weight given a certain takeoff field lenght

        Inputs:
            vehicle - SUAVE type vehicle

            takeoff_config - data dictionary containing:
                 mass_properties.operating_empty
                 mass_properties.max_takeoff

            airport   - SUAVE type airport data, with followig fields:
                atmosphere                  - Airport atmosphere (SUAVE type)
                altitude                    - Airport altitude
                delta_isa                   - ISA Temperature deviation

            target_tofl - The available field lenght for takeoff

        Outputs:
            max_tow - Maximum takeoff weight for a given field lenght

    """

#unpack

    tow_lower = takeoff_config.mass_properties.operating_empty
    tow_upper = 1.10 * takeoff_config.mass_properties.max_takeoff

#saving initial reference takeoff weight
    tow_ref = takeoff_config.mass_properties.max_takeoff

    tow_vec = np.linspace(tow_lower,tow_upper,50.)
    tofl = np.zeros_like(tow_vec)

    for id,tow in enumerate(tow_vec):
        takeoff_config.mass_properties.takeoff = tow
        tofl[id] = estimate_take_off_field_length(vehicle,takeoff_config,airport)

    target_tofl = np.atleast_1d(target_tofl)
    max_tow = np.zeros_like(target_tofl)

    for id,toflid in enumerate(target_tofl):
        max_tow[id] = np.interp(toflid,tofl,tow_vec)

#reset the initial takeoff weight
    takeoff_config.mass_properties.max_takeoff = tow_ref

    return max_tow
Ejemplo n.º 3
0
def find_takeoff_weight_given_tofl(vehicle,analyses,airport,target_tofl):
    """Estimates the takeoff weight given a certain takeoff field length.

    Assumptions:
    assumptions per estimate_take_off_field_length()

    Source:
    N/A

    Inputs:
    vehicle.mass_properties.
      operating_empty         [kg]
      max_takeoff             [kg]
      analyses                [SUAVE data structure]
      airport                 [SUAVE data structure]
      target_tofl             [m]
      
    Outputs:
    max_tow                   [kg]

    Properties Used:
    N/A
    """       

    #unpack
    tow_lower = vehicle.mass_properties.operating_empty
    tow_upper = 1.10 * vehicle.mass_properties.max_takeoff

    #saving initial reference takeoff weight
    tow_ref = vehicle.mass_properties.max_takeoff

    tow_vec = np.linspace(tow_lower,tow_upper,50.)
    tofl    = np.zeros_like(tow_vec)

    for id,tow in enumerate(tow_vec):
        vehicle.mass_properties.takeoff = tow
        tofl[id] = estimate_take_off_field_length(vehicle,analyses,airport)

    target_tofl = np.atleast_1d(target_tofl)
    max_tow = np.zeros_like(target_tofl)

    for id,toflid in enumerate(target_tofl):
        max_tow[id] = np.interp(toflid,tofl,tow_vec)

    #reset the initial takeoff weight
    vehicle.mass_properties.max_takeoff = tow_ref

    return max_tow
Ejemplo n.º 4
0
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------

    vehicle = vehicle_setup()
    configs = configs_setup(vehicle)
    # --- Takeoff Configuration ---
    configuration = configs.takeoff
    configuration.wings['main_wing'].flaps_angle = 20. * Units.deg
    configuration.wings['main_wing'].slats_angle = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21

    #configs_analyses = analyses_setup(configs)
    analyses = base_analysis(vehicle)
    #analyses = SUAVE.Analyses.Analysis.Container()
    #analyses.configs  = configs_analyses

    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude = 0.0 * Units.ft
    airport.delta_isa = 0.0
    airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()

    w_vec = np.linspace(40000., 52000., 10)
    engines = (2, 3, 4)
    takeoff_field_length = np.zeros((len(w_vec), len(engines)))

    for id_eng, engine_number in enumerate(engines):

        configuration.propulsors.turbo_fan.number_of_engines = engine_number

        for id_w, weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,
                                 id_eng] = estimate_take_off_field_length(
                                     configuration, analyses, airport)

    truth_TOFL = np.array([[850.19992906, 567.03906016, 411.69975426],
                           [893.11528215, 592.95224563, 430.3183183],
                           [937.78501446, 619.84892797, 449.62233042],
                           [984.23928481, 647.73943813, 469.61701137],
                           [1032.50914159, 676.63434352, 490.30766781],
                           [1082.62653274, 706.54445208, 511.69969462],
                           [1134.62431541, 737.48081617, 533.79857721],
                           [1188.53626527, 769.45473631, 556.60989361],
                           [1244.39708554, 802.47776475, 580.13931657],
                           [1302.24241572, 836.56170886, 604.39261547]])

    TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length))

    print 'Maximum Take OFF Field Length Error= %.4e' % TOFL_error

    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1)
    plt.hold
    plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.figure(2)
    plt.hold
    plt.plot(w_vec, truth_TOFL[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, truth_TOFL[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, truth_TOFL[:, 2], 'b-', label='4 Engines')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')

    #currently running again,but need to review results
    #assert( TOFL_error   < 1e-5 )

    return
Ejemplo n.º 5
0
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------
    vehicle = vehicle_setup()
    configs = configs_setup(vehicle)
    # --- Takeoff Configuration ---
    configuration = configs.takeoff
    configuration.wings['main_wing'].flaps_angle = 20. * Units.deg
    configuration.wings['main_wing'].slats_angle = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21
    analyses = SUAVE.Analyses.Analysis.Container()
    analyses = base_analysis(vehicle)
    analyses.aerodynamics.settings.maximum_lift_coefficient_factor = 0.90

    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude = 0.0 * Units.ft
    airport.delta_isa = 0.0
    airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()

    w_vec = np.linspace(40000., 52000., 10)
    engines = (2, 3, 4)
    takeoff_field_length = np.zeros((len(w_vec), len(engines)))
    second_seg_clb_grad = np.zeros((len(w_vec), len(engines)))

    compute_clb_grad = 1  # flag for Second segment climb estimation

    for id_eng, engine_number in enumerate(engines):

        configuration.propulsors.turbofan.number_of_engines = engine_number

        for id_w, weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \
                    estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad)

    truth_TOFL = np.array([[1132.02796293, 735.9383927, 532.69742204],
                           [1197.35974193, 774.67804758, 560.33363101],
                           [1265.59738094, 814.98266121, 589.04125774],
                           [1336.81070755, 856.87662796, 618.83286389],
                           [1411.07189875, 900.38501278, 649.7212839],
                           [1488.45551849, 945.53356385, 681.71963124],
                           [1569.03855498, 992.34872487, 714.84130444],
                           [1652.90045778, 1040.85764732, 749.09999299],
                           [1740.12317463, 1091.08820251, 784.50968324],
                           [1830.79118831, 1143.06899356, 821.08466403]])

    print(' takeoff_field_length = ', takeoff_field_length)
    print(' second_seg_clb_grad  = ', second_seg_clb_grad)

    truth_clb_grad = np.array([[0.06842616, 0.24573587, 0.42304558],
                               [0.0624858, 0.23365346, 0.40482112],
                               [0.05691173, 0.22233091, 0.38775008],
                               [0.05167129, 0.21169929, 0.3717273],
                               [0.04673554, 0.20169777, 0.35666],
                               [0.04207879, 0.19227239, 0.34246598],
                               [0.03767816, 0.18337517, 0.32907217],
                               [0.03351319, 0.17496329, 0.31641339],
                               [0.02956553, 0.16699843, 0.30443134],
                               [0.02581868, 0.15944617, 0.29307367]])

    TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length) / truth_TOFL)
    GRAD_error = np.max(
        np.abs(truth_clb_grad - second_seg_clb_grad) / truth_clb_grad)

    print('Maximum Take OFF Field Length Error= %.4e' % TOFL_error)
    print('Second Segment Climb Gradient Error= %.4e' % GRAD_error)

    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1)
    plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')

    title = "2nd Segment Climb Gradient vs W"
    plt.figure(2)
    plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Second Segment Climb Gradient (%)')

    assert (TOFL_error < 1e-6)
    assert (GRAD_error < 1e-6)

    return
Ejemplo n.º 6
0
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------
    vehicle = vehicle_setup()
    configs = configs_setup(vehicle)
    # --- Takeoff Configuration ---
    configuration = configs.takeoff
    configuration.wings['main_wing'].flaps_angle = 20. * Units.deg
    configuration.wings['main_wing'].slats_angle = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21
    configuration.max_lift_coefficient_factor = 0.90
    analyses = SUAVE.Analyses.Analysis.Container()
    analyses.base = base_analysis(vehicle)

    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude = 0.0 * Units.ft
    airport.delta_isa = 0.0
    airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()

    w_vec = np.linspace(40000., 52000., 10)
    engines = (2, 3, 4)
    takeoff_field_length = np.zeros((len(w_vec), len(engines)))
    second_seg_clb_grad = np.zeros((len(w_vec), len(engines)))

    compute_clb_grad = 1  # flag for Second segment climb estimation

    for id_eng, engine_number in enumerate(engines):

        configuration.propulsors.turbofan.number_of_engines = engine_number

        for id_w, weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \
                    estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad)

    truth_TOFL = np.array([[1188.96105839, 769.70626688, 556.7892293],
                           [1258.89622705, 811.03166826, 586.22911148],
                           [1331.98245573, 854.04157057, 616.81833361],
                           [1408.2986729, 898.76345152, 648.5709987],
                           [1487.92650289, 945.22556064, 681.5015251],
                           [1570.95030987, 993.45693386, 715.62465361],
                           [1657.45724176, 1043.48740797, 750.95545452],
                           [1747.53727375, 1095.34763481, 787.50933445],
                           [1841.28325183, 1149.06909545, 825.30204308],
                           [1938.7909361, 1204.68411412, 864.34967986]])

    print(' takeoff_field_length = ', takeoff_field_length)
    print(' second_seg_clb_grad  = ', second_seg_clb_grad)

    truth_clb_grad = np.array([[0.0802881, 0.25686068, 0.43343326],
                               [0.07416381, 0.2446121, 0.41506038],
                               [0.0684322, 0.23314888, 0.39786556],
                               [0.06305712, 0.22239872, 0.38174032],
                               [0.05800668, 0.21229785, 0.36658901],
                               [0.0532527, 0.20278987, 0.35232705],
                               [0.04877011, 0.19382471, 0.3388793],
                               [0.04453662, 0.18535773, 0.32617884],
                               [0.04053228, 0.17734905, 0.31416581],
                               [0.03673921, 0.16976291, 0.3027866]])

    TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length) / truth_TOFL)
    GRAD_error = np.max(
        np.abs(truth_clb_grad - second_seg_clb_grad) / truth_clb_grad)

    print('Maximum Take OFF Field Length Error= %.4e' % TOFL_error)
    print('Second Segment Climb Gradient Error= %.4e' % GRAD_error)

    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1)
    plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')

    title = "2nd Segment Climb Gradient vs W"
    plt.figure(2)
    plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Second Segment Climb Gradient (%)')

    assert (TOFL_error < 1e-6)
    assert (GRAD_error < 1e-6)

    return
Ejemplo n.º 7
0
def main():

    configs, analyses, vehicle = full_setup()

    simple_sizing(configs)

    configs.finalize()
    analyses.finalize()

    # weight analysis
    weights = analyses.configs.base.weights
    breakdown = weights.evaluate()
    # analyses.configs.base.weights.mass_properties.operating_empty = 20736. * Units.kg

    # mission analysis
    mission = analyses.missions.base
    results = mission.evaluate()

    # print weight breakdown
    print_weight_breakdown(configs.base,filename = 'E170_weight_breakdown.dat')

    # print engine data into file
    print_engine_data(configs.base,filename = 'E170_engine_data.dat')

    # print parasite drag data into file
    # define reference condition for parasite drag
    ref_condition = Data()
    ref_condition.mach_number = 0.3
    ref_condition.reynolds_number = 12e6     
    print_parasite_drag(ref_condition,configs.cruise,analyses,'E170_parasite_drag.dat')

    # print compressibility drag data into file
    print_compress_drag(configs.cruise,analyses,filename = 'E170_compress_drag.dat')

    # print mission breakdown
    print_mission_breakdown(results,filename='E170_mission_breakdown.dat')

    state = Data()
    state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics()
    state.numerics = SUAVE.Analyses.Mission.Segments.Conditions.Numerics()

    # ---------------------------------------------------------------------------------------
    # PAYLOAD RANGE DIAGRAM

    config = configs.base
    cruise_segment_tag = "cruise"
    reserves = 1600.
    # payload_range_results = payload_range(config, mission, cruise_segment_tag, reserves)

    # ---------------------------------------------------------------------------------------
    # PLOT RESULTS

    # plot_mission(results)

    # ---------------------------------------------------------------------------------------
    # TAKE OFF FIELD LENGTH
    # ---- Inputs
    analyses.base = analyses.configs.base
    airport = mission.airport
    
    airport.delta_isa  = 0.0
    airport.altitude   = 8000.0 * Units.ft


    clb_grad = 1
    weights_tofl = [20000,
    21009.319,
    22008.12425,
    23017.44325,
    24005.73477,
    25009.79689,
    25998.08841,
    27427.95699,
    28999.76105,
    29988.05257,
    30997.37157,
    32994.98208,
    35008.3632,
    37005.97372,
    38588.29152]

    np.linspace(vehicle.mass_properties.operating_empty, vehicle.mass_properties.max_takeoff, 10)
    tofl          = np.zeros(len(weights_tofl))
    secsegclbgrad = np.zeros(len(weights_tofl))

    # ---- Run
    for i, TOW in enumerate(weights_tofl):
        configs.takeoff.mass_properties.takeoff = TOW * Units.kg
        tofl[i], secsegclbgrad[i] = estimate_take_off_field_length(configs.takeoff, analyses, airport, clb_grad)
        print tofl[i]

    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1)
    plt.plot(weights_tofl, tofl, 'k-')
    plt.xlabel('TOW (kg)')
    plt.ylabel('Takeoff Field Length (m)')
    plt.title(title)
    plt.grid(True)
    plt.show(True)

    return
Ejemplo n.º 8
0
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------    
    vehicle = vehicle_setup()
    configs=configs_setup(vehicle)
    # --- Takeoff Configuration ---
    configuration = configs.takeoff
    configuration.wings['main_wing'].flaps_angle =  20. * Units.deg
    configuration.wings['main_wing'].slats_angle  = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21
    configuration.max_lift_coefficient_factor = 0.90
    analyses = SUAVE.Analyses.Analysis.Container()
    analyses.base = base_analysis(vehicle)

    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude   =  0.0  * Units.ft
    airport.delta_isa  =  0.0
    airport.atmosphere =  SUAVE.Analyses.Atmospheric.US_Standard_1976()
    
    w_vec = np.linspace(40000.,52000.,10)
    engines = (2,3,4)
    takeoff_field_length = np.zeros((len(w_vec),len(engines)))
    second_seg_clb_grad  = np.zeros((len(w_vec),len(engines)))
    
    compute_clb_grad = 1 # flag for Second segment climb estimation
    
    for id_eng,engine_number in enumerate(engines):
        
        configuration.propulsors.turbofan.number_of_engines = engine_number
        
        for id_w,weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \
                    estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad)
    
   
    truth_TOFL = np.array([[ 1118.63611639,   727.97884809,   527.01392339],
                           [ 1182.89024405,   766.11098981,   554.22570668],
                           [ 1249.99344765,   805.78023921,   582.49069546],
                           [ 1320.01349207,   847.01029051,   611.82110075],
                           [ 1393.02041385,   889.82548587,   642.22939685],
                           [ 1469.08655728,   934.2508275 ,   673.72832735],
                           [ 1548.28661027,   980.31198958,   706.33091096],
                           [ 1630.69763999,  1028.03532998,   740.05044723],
                           [ 1716.39912829,  1077.44790196,   774.9005222 ],
                           [ 1805.47300708,  1128.57746562,   810.89501387]])                          
                             
    print ' takeoff_field_length=',  takeoff_field_length
    print ' second_seg_clb_grad = ', second_seg_clb_grad                      
                             
    truth_clb_grad =  np.array([[ 0.07389745,  0.25138656,  0.42887567],
                                [ 0.06775111,  0.23909388,  0.41043665],
                                [ 0.06199853,  0.22758873,  0.39317893],
                                [ 0.05660348,  0.21679862,  0.37699377],
                                [ 0.051534  ,  0.20665966,  0.36178532],
                                [ 0.04676181,  0.19711529,  0.34746877],
                                [ 0.04226183,  0.18811533,  0.33396883],
                                [ 0.03801168,  0.17961503,  0.32121838],
                                [ 0.03399137,  0.17157441,  0.30915745],
                                [ 0.03018298,  0.16395762,  0.29773227]])

                               
    TOFL_error = np.max(np.abs(truth_TOFL-takeoff_field_length)/truth_TOFL)                           
    GRAD_error = np.max(np.abs(truth_clb_grad-second_seg_clb_grad)/truth_clb_grad)
    
    print 'Maximum Take OFF Field Length Error= %.4e' % TOFL_error
    print 'Second Segment Climb Gradient Error= %.4e' % GRAD_error    
    
    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1); plt.hold
    plt.plot(w_vec,takeoff_field_length[:,0], 'k-', label = '2 Engines')
    plt.plot(w_vec,takeoff_field_length[:,1], 'r-', label = '3 Engines')
    plt.plot(w_vec,takeoff_field_length[:,2], 'b-', label = '4 Engines')

    plt.title(title); plt.grid(True)
    plt.plot(w_vec,truth_TOFL[:,0], 'k--o', label = '2 Engines [truth]')
    plt.plot(w_vec,truth_TOFL[:,1], 'r--o', label = '3 Engines [truth]')
    plt.plot(w_vec,truth_TOFL[:,2], 'b--o', label = '4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow = 'true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')    
        
    
    title = "2nd Segment Climb Gradient vs W"
    plt.figure(2); plt.hold
    plt.plot(w_vec,second_seg_clb_grad[:,0], 'k-', label = '2 Engines')
    plt.plot(w_vec,second_seg_clb_grad[:,1], 'r-', label = '3 Engines')
    plt.plot(w_vec,second_seg_clb_grad[:,2], 'b-', label = '4 Engines')

    plt.title(title); plt.grid(True)
    plt.plot(w_vec,truth_clb_grad[:,0], 'k--o', label = '2 Engines [truth]')
    plt.plot(w_vec,truth_clb_grad[:,1], 'r--o', label = '3 Engines [truth]')
    plt.plot(w_vec,truth_clb_grad[:,2], 'b--o', label = '4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow = 'true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Second Segment Climb Gradient (%)')    
    
    assert( TOFL_error   < 1e-6 )
    assert( GRAD_error   < 1e-6 )

    return 
Ejemplo n.º 9
0
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------
    vehicle = vehicle_setup()
    configs = configs_setup(vehicle)
    # --- Takeoff Configuration ---
    configuration = configs.takeoff
    configuration.wings['main_wing'].flaps_angle = 20. * Units.deg
    configuration.wings['main_wing'].slats_angle = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21
    analyses = SUAVE.Analyses.Analysis.Container()
    analyses = base_analysis(vehicle)
    analyses.aerodynamics.settings.maximum_lift_coefficient_factor = 0.90

    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude = 0.0 * Units.ft
    airport.delta_isa = 0.0
    airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()

    w_vec = np.linspace(40000., 52000., 10)
    engines = (2, 3, 4)
    takeoff_field_length = np.zeros((len(w_vec), len(engines)))
    second_seg_clb_grad = np.zeros((len(w_vec), len(engines)))

    compute_clb_grad = 1  # flag for Second segment climb estimation

    for id_eng, engine_number in enumerate(engines):

        configuration.propulsors.turbofan.number_of_engines = engine_number

        for id_w, weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \
                    estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad)

    truth_TOFL = np.array([[1173.30474724, 760.43161763, 550.17542593],
                           [1241.97048851, 801.0454711, 579.11942109],
                           [1313.71925195, 843.31076941, 609.19124856],
                           [1388.62740991, 887.25412516, 640.40457932],
                           [1466.77393275, 932.90289417, 672.77338767],
                           [1548.24043104, 980.28518949, 706.31195806],
                           [1633.11119749, 1029.42989526, 741.03489188],
                           [1721.47324876, 1080.36668034, 776.95711399],
                           [1813.41636696, 1133.12601188, 814.09387926],
                           [1909.0331412, 1187.7391687, 852.46077892]])

    print(' takeoff_field_length = ', takeoff_field_length)
    print(' second_seg_clb_grad  = ', second_seg_clb_grad)

    truth_clb_grad = np.array([[0.07244437, 0.24921567, 0.42598697],
                               [0.06651232, 0.23715452, 0.40779672],
                               [0.06094702, 0.22585304, 0.39075907],
                               [0.05571568, 0.21524227, 0.37476886],
                               [0.0507893, 0.20526131, 0.35973331],
                               [0.04614213, 0.19585619, 0.34557024],
                               [0.04175123, 0.18697891, 0.33220659],
                               [0.03759607, 0.17858664, 0.3195772],
                               [0.03365829, 0.17064104, 0.30762378],
                               [0.02992135, 0.16310768, 0.29629402]])

    TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length) / truth_TOFL)
    GRAD_error = np.max(
        np.abs(truth_clb_grad - second_seg_clb_grad) / truth_clb_grad)

    print('Maximum Take OFF Field Length Error= %.4e' % TOFL_error)
    print('Second Segment Climb Gradient Error= %.4e' % GRAD_error)

    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1)
    plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')

    title = "2nd Segment Climb Gradient vs W"
    plt.figure(2)
    plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Second Segment Climb Gradient (%)')

    assert (TOFL_error < 1e-6)
    assert (GRAD_error < 1e-6)

    return
Ejemplo n.º 10
0
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------
    vehicle = vehicle_setup()
    configs = configs_setup(vehicle)
    # --- Takeoff Configuration ---
    configuration = configs.takeoff
    configuration.wings['main_wing'].flaps_angle = 20. * Units.deg
    configuration.wings['main_wing'].slats_angle = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21
    configuration.max_lift_coefficient_factor = 0.90
    analyses = SUAVE.Analyses.Analysis.Container()
    analyses.base = base_analysis(vehicle)

    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude = 0.0 * Units.ft
    airport.delta_isa = 0.0
    airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()

    w_vec = np.linspace(40000., 52000., 10)
    engines = (2, 3, 4)
    takeoff_field_length = np.zeros((len(w_vec), len(engines)))
    second_seg_clb_grad = np.zeros((len(w_vec), len(engines)))

    compute_clb_grad = 1  # flag for Second segment climb estimation

    for id_eng, engine_number in enumerate(engines):

        configuration.propulsors.turbofan.number_of_engines = engine_number

        for id_w, weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \
                    estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad)

    truth_TOFL = np.array([[1116.10635509, 726.47454766, 525.93957657],
                           [1180.15587618, 764.49121395, 553.07064632],
                           [1247.04359555, 804.03963238, 581.25141247],
                           [1316.83687778, 845.14335923, 610.49401596],
                           [1389.60534387, 887.82659431, 640.81085913],
                           [1465.42090714, 932.1141929, 672.21461168],
                           [1544.3578087, 978.0316776, 704.71821645],
                           [1626.49265282, 1025.60525002, 738.33489512],
                           [1711.90444209, 1074.86180226, 773.07815381],
                           [1800.67461244, 1125.82892836, 808.96178847]])

    print ' takeoff_field_length=', takeoff_field_length
    print ' second_seg_clb_grad = ', second_seg_clb_grad

    truth_clb_grad = np.array([[0.07441427, 0.25242021, 0.43042615],
                               [0.06825112, 0.24009391, 0.4119367],
                               [0.0624828, 0.22855727, 0.39463173],
                               [0.05707296, 0.21773759, 0.37840221],
                               [0.05198957, 0.20757081, 0.36315205],
                               [0.04720429, 0.19800024, 0.34879619],
                               [0.04269194, 0.18897554, 0.33525915],
                               [0.0384301, 0.18045186, 0.32247363],
                               [0.03439872, 0.1723891, 0.31037949],
                               [0.03057983, 0.16475133, 0.29892282]])

    TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length))
    GRAD_error = np.max(np.abs(truth_clb_grad - second_seg_clb_grad))

    print 'Maximum Take OFF Field Length Error= %.4e' % TOFL_error
    print 'Second Segment Climb Gradient Error= %.4e' % GRAD_error

    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1)
    plt.hold
    plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')

    title = "2nd Segment Climb Gradient vs W"
    plt.figure(2)
    plt.hold
    plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Second Segment Climb Gradient (%)')

    assert (TOFL_error < 1e-5)
    assert (GRAD_error < 1e-5)

    return
Ejemplo n.º 11
0
def main():
    # ---------------------------------------------------------------------------------------
    # INITIALIZING AIRCRAFT

    configs, analyses, vehicle = full_setup()

    print 'full setup OK'
    simple_sizing(configs)

    configs.finalize()
    analyses.finalize()

    # ---------------------------------------------------------------------------------------
    # WEIGHT ANALYSIS
    weights = analyses.configs.base.weights
    weights.evaluate()

    print 'WEIGHTS OK'
    # ---------------------------------------------------------------------------------------
    # MISSION ANALYSIS
    mission = analyses.missions.base
    results = mission.evaluate()
    print 'MISSION OK'
    configs.cruise.conditions = Data()
    configs.cruise.conditions = results.segments.cruise.conditions

    # print weight breakdown
    print_weight_breakdown(configs.base, filename='ATR72_weight_breakdown.dat')

    # print parasite drag data into file - define reference condition for parasite drag
    ref_condition = Data()
    ref_condition.mach_number = 0.3
    ref_condition.reynolds_number = 12e6
    print_parasite_drag(ref_condition, configs.cruise, analyses,
                        'ATR72_parasite_drag.dat')

    # print compressibility drag data into file
    print_compress_drag(configs.cruise,
                        analyses,
                        filename='ATR72_compress_drag.dat')

    # print mission breakdown
    print_mission_breakdown(results, filename='ATR72_mission_breakdown.dat')

    state = Data()
    state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics(
    )
    state.numerics = SUAVE.Analyses.Mission.Segments.Conditions.Numerics()
    # ---------------------------------------------------------------------------------------
    # PLOT RESULTS

    plot_mission(results, 0)
    # ---------------------------------------------------------------------------------------
    # PAYLOAD RANGE DIAGRAM

    config = configs.base
    cruise_segment_tag = "cruise"
    reserves = [775., 1120., 1040.]

    weights.mass_properties.operating_empty = weights.mass_properties.operating_empty - 239.
    payloadrange = payload_range(config, mission, cruise_segment_tag, reserves)

    # ---------------------------------------------------------------------------------------
    # TAKE OFF FIELD LENGTH
    # ---- Inputs
    analyses.base = analyses.configs.base
    airport = mission.airport
    clb_grad = 1

    altitude = [0., 6000.]
    delta_isa = 0.  # +23
    # 1000, 1100, 1200, 1300, 1400, -, 1500, 1600
    # 1200, 1300, 1400, 1500, 1600, 1700
    weights_tofl = [[20062, 21044, 21954, 22801, 23000, 23452, 23754, 21200],
                    [18489, 19342, 20154, 20928, 21671, 22105, 21530]]

    # ---- Inputs: FLAP AND SLAT DEFLECTION
    flaps = [15., 0.]  # Deflections inboard local
    slats = [0., 0.]

    # ---- Inputs: FACTOR CLMAX
    configs.takeoff.max_lift_coefficient_factor = 1.189
    configs.takeoff.V2_VS_ratio = 1.143

    # ---- Open output file
    fid = open('TOFL.txt', 'w')  # Open output file

    # ---- Run
    for j, h in enumerate(altitude):
        airport.altitude = h * Units.ft
        airport.delta_isa = delta_isa
        fid.write('Altitude: %4.0f ft \n' % (h))
        fid.write(
            'TOFL      CLIMB GRADIENT     THRUST    L/D     L/Dv2    CDasym    CDwindm     CL     CD  CG_CORRECT\n'
        )
        tofl = np.zeros(len(weights_tofl[j]))
        secsegclbgrad = np.zeros(len(weights_tofl[j]))
        thrust = np.zeros(len(weights_tofl[j]))
        l_over_d = np.zeros(len(weights_tofl[j]))
        l_over_d_v2 = np.zeros(len(weights_tofl[j]))
        asymmetry_drag_coefficient = np.zeros(len(weights_tofl[j]))
        windmilling_drag_coefficient = np.zeros(len(weights_tofl[j]))
        clv2 = np.zeros(len(weights_tofl[j]))
        cdv2 = np.zeros(len(weights_tofl[j]))
        secsegclbgrad_corrected = np.zeros(len(weights_tofl[j]))

        CLmax_ind = 0
        # configs.takeoff.maximum_lift_coefficient = maximum_lift_coefficient[CLmax_ind]
        configs.takeoff.wings[
            'main_wing'].flaps.angle = flaps[CLmax_ind] * Units.deg
        configs.takeoff.wings[
            'main_wing'].slats.angle = slats[CLmax_ind] * Units.deg

        for i, TOW in enumerate(weights_tofl[j]):
            configs.takeoff.mass_properties.takeoff = TOW * Units.kg
            tofl[i], secsegclbgrad[i], thrust[i], l_over_d[i], l_over_d_v2[i], asymmetry_drag_coefficient[i], \
            windmilling_drag_coefficient[i], clv2[i], cdv2[i], secsegclbgrad_corrected[
                i] = estimate_take_off_field_length(configs.takeoff,
                                                    analyses, airport,
                                                    clb_grad)
            if secsegclbgrad_corrected[i] < 0.024:
                # CLmax_ind = CLmax_ind + 1
                # if CLmax_ind > 1:
                #     CLmax_ind = 1
                print CLmax_ind, CLmax_ind, CLmax_ind, CLmax_ind, CLmax_ind, CLmax_ind

                configs.takeoff.wings[
                    'main_wing'].flaps.angle = flaps[CLmax_ind] * Units.deg
                configs.takeoff.wings[
                    'main_wing'].slats.angle = slats[CLmax_ind] * Units.deg

                tofl[i], secsegclbgrad[i], thrust[i], l_over_d[i], l_over_d_v2[i], asymmetry_drag_coefficient[i], \
                windmilling_drag_coefficient[i], clv2[i], cdv2[i], secsegclbgrad_corrected[
                    i] = estimate_take_off_field_length(configs.takeoff,
                                                        analyses, airport,
                                                        clb_grad)

            fid.write(
                '%4.2f     %4.4f    %4.4f    %4.4f    %4.4f    %4.4f    %4.4f    %4.4f    %4.4f    %4.4f \n'
                % (tofl[i], secsegclbgrad[i], thrust[i], l_over_d[i],
                   l_over_d_v2[i], asymmetry_drag_coefficient[i],
                   windmilling_drag_coefficient[i], clv2[i], cdv2[i],
                   secsegclbgrad_corrected[i]))
        fid.write('\n')

    fid.close()
    # ---------------------------------------------------------------------------------------
    # LANDING FIELD LENGTH
    # ---- Inputs
    airport.delta_isa = 0
    altitude = [0, 6000]
    weights_lfl = [[17000, 18000, 19000, 20000, 21000, 22000, 22350],
                   [17000, 18000, 19000, 20000, 21000, 22000, 22350]]

    flaps = [30., 15.]
    slats = [0., 0.]
    configs.landing.landing_constants = Data()

    configs.landing.landing_constants[0] = 250. * 0.25
    configs.landing.landing_constants[1] = 0.
    configs.landing.landing_constants[2] = 2.485 / 9.81

    configs.landing.wings['main_wing'].flaps.angle = flaps[0] * Units.deg
    configs.landing.wings['main_wing'].slats.angle = slats[0] * Units.deg

    configs.landing.max_lift_coefficient_factor = 1.31

    fid = open('LFL.txt', 'w')  # Open output file
    for j, h in enumerate(altitude):
        airport.altitude = h * Units.ft
        lfl = np.zeros(len(weights_lfl[j]))
        fid.write('Altitude: %4.0f ft \n' % (h))
        for i, TOW in enumerate(weights_lfl[j]):
            configs.landing.mass_properties.landing = TOW * Units.kg
            lfl[i] = estimate_landing_field_length(configs.landing, analyses,
                                                   airport)
            fid.write('%4.2f \n' % (lfl[i]))
        fid.write('\n')
    fid.close()

    return
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------

    # --- Vehicle definition ---
    vehicle = define_vehicle()

    # --- Takeoff Configuration ---
    configuration = vehicle.configs.takeoff
    configuration.wings['Main Wing'].flaps_angle =  20. * Units.deg
    configuration.wings['Main Wing'].slats_angle  = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21
    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude   =  0.0  * Units.ft
    airport.delta_isa  =  0.0
    airport.atmosphere =  SUAVE.Attributes.Atmospheres.Earth.US_Standard_1976()

    w_vec = np.linspace(40000.,52000.,10)
    engines = (2,3,4)
    takeoff_field_length = np.zeros((len(w_vec),len(engines)))
    for id_eng,engine_number in enumerate(engines):
        vehicle.propulsors.TurboFan.number_of_engines = engine_number
        for id_w,weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,id_eng] = estimate_take_off_field_length(vehicle,configuration,airport)

    truth_TOFL = np.array([[  850.19992906,   567.03906016,   411.69975426],
                           [  893.11528215,   592.95224563,   430.3183183 ],
                           [  937.78501446,   619.84892797,   449.62233042],
                           [  984.23928481,   647.73943813,   469.61701137],
                           [ 1032.50914159,   676.63434352,   490.30766781],
                           [ 1082.62653274,   706.54445208,   511.69969462],
                           [ 1134.62431541,   737.48081617,   533.79857721],
                           [ 1188.53626527,   769.45473631,   556.60989361],
                           [ 1244.39708554,   802.47776475,   580.13931657],
                           [ 1302.24241572,   836.56170886,   604.39261547]])
    
    TOFL_error = np.max(np.abs(truth_TOFL-takeoff_field_length))
    
    print 'Maximum Take OFF Field Length Error= %.4e' % TOFL_error
    
    
    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1); plt.hold
    plt.plot(w_vec,takeoff_field_length[:,0], 'k-', label = '2 Engines')
    plt.plot(w_vec,takeoff_field_length[:,1], 'r-', label = '3 Engines')
    plt.plot(w_vec,takeoff_field_length[:,2], 'b-', label = '4 Engines')

    plt.title(title); plt.grid(True)
    legend = plt.legend(loc='lower right', shadow = 'true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')    
    
    assert( TOFL_error   < 1e-5 )

    return 
Ejemplo n.º 13
0
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------
    vehicle = vehicle_setup()
    configs = configs_setup(vehicle)
    # --- Takeoff Configuration ---
    configuration = configs.takeoff
    configuration.wings['main_wing'].flaps_angle = 20. * Units.deg
    configuration.wings['main_wing'].slats_angle = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21

    analyses = SUAVE.Analyses.Analysis.Container()
    analyses.base = base_analysis(vehicle)

    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude = 0.0 * Units.ft
    airport.delta_isa = 0.0
    airport.atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976()

    w_vec = np.linspace(40000., 52000., 10)
    engines = (2, 3, 4)
    takeoff_field_length = np.zeros((len(w_vec), len(engines)))
    second_seg_clb_grad = np.zeros((len(w_vec), len(engines)))

    compute_clb_grad = 1  # flag for Second segment climb estimation

    for id_eng, engine_number in enumerate(engines):

        configuration.propulsors.turbofan.number_of_engines = engine_number

        for id_w, weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \
                    estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad)

    truth_TOFL = np.array([[1106.1894316, 720.57532937, 521.72582498],
                           [1169.44251482, 758.14235055, 548.54256171],
                           [1235.49201944, 797.22058262, 576.39554512],
                           [1304.40380631, 837.83307113, 605.29666019],
                           [1376.24593627, 880.00348867, 635.25804638],
                           [1451.08870497, 923.75614652, 666.29210347],
                           [1529.00467733, 969.11600619, 698.41149721],
                           [1610.06872186, 1016.10869073, 731.6291648],
                           [1694.3580448, 1064.76049592, 765.95832037],
                           [1781.95222403, 1115.09840143, 801.41246029]])

    truth_clb_grad = np.array([[0.0663248, 0.24446563, 0.42260645],
                               [0.06064292, 0.23261737, 0.40459183],
                               [0.05530959, 0.22151265, 0.38771572],
                               [0.05029414, 0.21108444, 0.37187475],
                               [0.04556936, 0.20127349, 0.35697762],
                               [0.04111106, 0.19202724, 0.34294343],
                               [0.03689762, 0.18329891, 0.3297002],
                               [0.0329097, 0.17504671, 0.31718373],
                               [0.02912991, 0.16723321, 0.30533651],
                               [0.02554262, 0.15982479, 0.29410696]])

    print 'second_seg_clb_grad=', second_seg_clb_grad
    TOFL_error = np.max(np.abs(truth_TOFL - takeoff_field_length))
    GRAD_error = np.max(np.abs(truth_clb_grad - second_seg_clb_grad))

    print 'Maximum Take OFF Field Length Error= %.4e' % TOFL_error
    print 'Second Segment Climb Gradient Error= %.4e' % GRAD_error

    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1)
    plt.hold
    plt.plot(w_vec, takeoff_field_length[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, takeoff_field_length[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_TOFL[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_TOFL[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')

    title = "2nd Segment Climb Gradient vs W"
    plt.figure(2)
    plt.hold
    plt.plot(w_vec, second_seg_clb_grad[:, 0], 'k-', label='2 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 1], 'r-', label='3 Engines')
    plt.plot(w_vec, second_seg_clb_grad[:, 2], 'b-', label='4 Engines')

    plt.title(title)
    plt.grid(True)
    plt.plot(w_vec, truth_clb_grad[:, 0], 'k--o', label='2 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 1], 'r--o', label='3 Engines [truth]')
    plt.plot(w_vec, truth_clb_grad[:, 2], 'b--o', label='4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow='true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Second Segment Climb Gradient (%)')

    assert (TOFL_error < 1e-5)
    assert (GRAD_error < 1e-5)

    return
Ejemplo n.º 14
0
def main():

    # ----------------------------------------------------------------------
    #   Main
    # ----------------------------------------------------------------------    
    vehicle = vehicle_setup()
    configs=configs_setup(vehicle)
    # --- Takeoff Configuration ---
    configuration = configs.takeoff
    configuration.wings['main_wing'].flaps_angle =  20. * Units.deg
    configuration.wings['main_wing'].slats_angle  = 25. * Units.deg
    # V2_V2_ratio may be informed by user. If not, use default value (1.2)
    configuration.V2_VS_ratio = 1.21
   
    analyses = SUAVE.Analyses.Analysis.Container()
    analyses.base = base_analysis(vehicle)

    # CLmax for a given configuration may be informed by user
    # configuration.maximum_lift_coefficient = 2.XX

    # --- Airport definition ---
    airport = SUAVE.Attributes.Airports.Airport()
    airport.tag = 'airport'
    airport.altitude   =  0.0  * Units.ft
    airport.delta_isa  =  0.0
    airport.atmosphere =  SUAVE.Analyses.Atmospheric.US_Standard_1976()
    
    w_vec = np.linspace(40000.,52000.,10)
    engines = (2,3,4)
    takeoff_field_length = np.zeros((len(w_vec),len(engines)))
    second_seg_clb_grad  = np.zeros((len(w_vec),len(engines)))
    
    compute_clb_grad = 1 # flag for Second segment climb estimation
    
    for id_eng,engine_number in enumerate(engines):
        
        configuration.propulsors.turbofan.number_of_engines = engine_number
        
        for id_w,weight in enumerate(w_vec):
            configuration.mass_properties.takeoff = weight
            takeoff_field_length[id_w,id_eng],second_seg_clb_grad[id_w,id_eng] = \
                    estimate_take_off_field_length(configuration,analyses,airport,compute_clb_grad)
    
   
    truth_TOFL = np.array([[ 1106.1894316 ,   720.57532937,   521.72582498],
                           [ 1169.44251482,   758.14235055,   548.54256171],
                           [ 1235.49201944,   797.22058262,   576.39554512],
                           [ 1304.40380631,   837.83307113,   605.29666019],
                           [ 1376.24593627,   880.00348867,   635.25804638],
                           [ 1451.08870497,   923.75614652,   666.29210347],
                           [ 1529.00467733,   969.11600619,   698.41149721],
                           [ 1610.06872186,  1016.10869073,   731.6291648 ],
                           [ 1694.3580448 ,  1064.76049592,   765.95832037],
                           [ 1781.95222403,  1115.09840143,   801.41246029]])
                             
    truth_clb_grad = np.array([[ 0.0663248  , 0.24446563 , 0.42260645],
                               [0.06064292 , 0.23261737 , 0.40459183],
                               [0.05530959 , 0.22151265 , 0.38771572],
                               [0.05029414 , 0.21108444 , 0.37187475],
                               [0.04556936 , 0.20127349 , 0.35697762],
                               [0.04111106 , 0.19202724 , 0.34294343],
                               [0.03689762 , 0.18329891 , 0.3297002 ],
                               [0.0329097  , 0.17504671 , 0.31718373],
                               [0.02912991 , 0.16723321 , 0.30533651],
                               [0.02554262 , 0.15982479 , 0.29410696]]   )
                               
                       
                               
    print 'second_seg_clb_grad=', second_seg_clb_grad
    TOFL_error = np.max(np.abs(truth_TOFL-takeoff_field_length))                           
    GRAD_error = np.max(np.abs(truth_clb_grad-second_seg_clb_grad))
    
    print 'Maximum Take OFF Field Length Error= %.4e' % TOFL_error
    print 'Second Segment Climb Gradient Error= %.4e' % GRAD_error    
    
    import pylab as plt
    title = "TOFL vs W"
    plt.figure(1); plt.hold
    plt.plot(w_vec,takeoff_field_length[:,0], 'k-', label = '2 Engines')
    plt.plot(w_vec,takeoff_field_length[:,1], 'r-', label = '3 Engines')
    plt.plot(w_vec,takeoff_field_length[:,2], 'b-', label = '4 Engines')

    plt.title(title); plt.grid(True)
    plt.plot(w_vec,truth_TOFL[:,0], 'k--o', label = '2 Engines [truth]')
    plt.plot(w_vec,truth_TOFL[:,1], 'r--o', label = '3 Engines [truth]')
    plt.plot(w_vec,truth_TOFL[:,2], 'b--o', label = '4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow = 'true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Takeoff field length (m)')    
        
    
    title = "2nd Segment Climb Gradient vs W"
    plt.figure(2); plt.hold
    plt.plot(w_vec,second_seg_clb_grad[:,0], 'k-', label = '2 Engines')
    plt.plot(w_vec,second_seg_clb_grad[:,1], 'r-', label = '3 Engines')
    plt.plot(w_vec,second_seg_clb_grad[:,2], 'b-', label = '4 Engines')

    plt.title(title); plt.grid(True)
    plt.plot(w_vec,truth_clb_grad[:,0], 'k--o', label = '2 Engines [truth]')
    plt.plot(w_vec,truth_clb_grad[:,1], 'r--o', label = '3 Engines [truth]')
    plt.plot(w_vec,truth_clb_grad[:,2], 'b--o', label = '4 Engines [truth]')
    legend = plt.legend(loc='lower right', shadow = 'true')
    plt.xlabel('Weight (kg)')
    plt.ylabel('Second Segment Climb Gradient (%)')    
    
    assert( TOFL_error   < 1e-5 )
    assert( GRAD_error   < 1e-5 )

    return