def maximum_range_mach(mass, cruise_altitude, delta_ISA, vehicle):
    knots_to_meters_second = 0.514444
    wing = vehicle['wing']
    wing_surface = wing['area']

    VMO = 340
    altitude = cruise_altitude

    VMO = V_cas_to_V_tas(VMO - 10, altitude, delta_ISA)

    initial_mach = 0.2

    mach = np.linspace(initial_mach, 0.82, 100)

    V_tas = mach_to_V_tas(mach, altitude, delta_ISA)

    _, _, _, _, _, rho_ISA, a = atmosphere_ISA_deviation(altitude, delta_ISA)

    CL_required = (2*mass*GRAVITY) / \
        (rho_ISA*((knots_to_meters_second*V_tas)**2)*wing_surface)

    phase = 'cruise'

    # CD = zero_fidelity_drag_coefficient(aircraft_data, CL_required, phase)

    CD = []
    for i in range(len(CL_required)):
        # Input for neural network: 0 for CL | 1 for alpha
        switch_neural_network = 0
        alpha_deg = 1
        CD_aux, _ = aerodynamic_coefficients_ANN(vehicle, altitude, mach[i],
                                                 float(CL_required[i]),
                                                 alpha_deg,
                                                 switch_neural_network)
        CD.append(CD_aux)

    MLD = mach * (CL_required / CD)

    index, value = max(enumerate(MLD), key=operator.itemgetter(1))

    mach_maximum_cruise = mach[index]

    V_maximum = mach_to_V_tas(mach_maximum_cruise, altitude, delta_ISA)

    if V_maximum > VMO:
        V_maximum = VMO
        mach_maximum_cruise = V_maximum / a

    return mach_maximum_cruise
def missed_approach_climb_OEI(vehicle, maximum_takeoff_weight, weight_landing):
    '''
    '''
    aircraft = vehicle['aircraft']
    wing = vehicle['wing']
    airport_destination = vehicle['airport_destination']

    maximum_landing_weight = weight_landing
    CL_maximum_landing = aircraft['CL_maximum_landing']
    wing_surface = wing['area']
    airfield_elevation = airport_destination['elevation']
    airfield_delta_ISA = airport_destination['delta_ISA']
    phase = 'climb'

    _, _, _, _, _, rho, a = atmosphere_ISA_deviation(
        airfield_elevation, airfield_delta_ISA)  # [kg/m3]

    V = 1.3 * np.sqrt(2 * maximum_landing_weight /
                      (CL_maximum_landing * wing_surface * rho))
    mach = V / a

    # Input for neural network: 0 for CL | 1 for alpha
    switch_neural_network = 0
    alpha_deg = 1

    CD_landing, _ = aerodynamic_coefficients_ANN(vehicle, airfield_elevation,
                                                 mach, CL_maximum_landing,
                                                 alpha_deg,
                                                 switch_neural_network)
    # CD_landing = zero_fidelity_drag_coefficient(aircraft_data, CL_maximum_landing, phase)

    L_to_D = CL_maximum_landing / CD_landing
    if aircraft['number_of_engines'] == 2:
        steady_gradient_of_climb = 0.021  # 2.4% for two engines airplane
    elif aircraft['number_of_engines'] == 3:
        steady_gradient_of_climb = 0.024  # 2.4% for two engines airplane
    elif aircraft['number_of_engines'] == 4:
        steady_gradient_of_climb = 0.027  # 2.4% for two engines airplane

    aux1 = (aircraft['number_of_engines'] /
            (aircraft['number_of_engines'] - 1))
    aux2 = (1 / L_to_D) + steady_gradient_of_climb
    aux3 = maximum_landing_weight / maximum_takeoff_weight
    thrust_to_weight_landing = aux1 * aux2 * aux3
    return thrust_to_weight_landing
def second_segment_climb(vehicle, weight_takeoff):
    '''
    '''

    aircraft = vehicle['aircraft']
    wing = vehicle['wing']
    airport_departure = vehicle['airport_departure']

    CL_maximum_takeoff = aircraft['CL_maximum_takeoff']
    wing_surface = wing['area']
    maximum_takeoff_weight = weight_takeoff  # [N]

    airfield_elevation = airport_departure['elevation']
    airfield_delta_ISA = airport_departure['delta_ISA']

    _, _, _, _, _, rho, a = atmosphere_ISA_deviation(
        airfield_elevation, airfield_delta_ISA)  # [kg/m3]

    V = 1.2*np.sqrt(2*maximum_takeoff_weight /
                    (CL_maximum_takeoff*wing_surface*rho))
    mach = V/a
    phase = 'takeoff'

    # CD_takeoff = zero_fidelity_drag_coefficient(aircraft_data, CL_maximum_takeoff, phase)
    # Input for neural network: 0 for CL | 1 for alpha
    switch_neural_network = 0
    alpha_deg = 1
    CD_takeoff, _ = aerodynamic_coefficients_ANN(
        vehicle, airfield_elevation, mach, CL_maximum_takeoff,alpha_deg,switch_neural_network)

    L_to_D = CL_maximum_takeoff/CD_takeoff
    if aircraft['number_of_engines']  == 2:
        steady_gradient_of_climb = 0.024  # 2.4% for two engines airplane
    elif aircraft['number_of_engines']  == 3:
        steady_gradient_of_climb = 0.027  # 2.4% for two engines airplane
    elif aircraft['number_of_engines']  == 4:
        steady_gradient_of_climb = 0.03  # 2.4% for two engines airplane

    aux1 = (aircraft['number_of_engines'] /(aircraft['number_of_engines'] -1))
    aux2 = (1/L_to_D) + steady_gradient_of_climb

    thrust_to_weight_takeoff = aux1*aux2
    return thrust_to_weight_takeoff
def specific_fuel_consumption(vehicle, mach, altitude, delta_ISA, mass):
    aircraft = vehicle['aircraft']
    wing = vehicle['wing']
    knots_to_meters_second = 0.514444
    wing_surface = wing['area']

    V_tas = mach_to_V_tas(mach, altitude, delta_ISA)
    _, _, _, _, _, rho_ISA, _ = atmosphere_ISA_deviation(altitude, delta_ISA)

    CL_required = (2*mass*GRAVITY) / \
        (rho_ISA*((knots_to_meters_second*V_tas)**2)*wing_surface)
    phase = 'cruise'
    # CD = zero_fidelity_drag_coefficient(aircraft_data, CL_required, phase)

    # Input for neural network: 0 for CL | 1 for alpha
    switch_neural_network = 0
    alpha_deg = 1
    CD, _ = aerodynamic_coefficients_ANN(vehicle, altitude, mach, CL_required,
                                         alpha_deg, switch_neural_network)
    L_over_D = CL_required / CD
    throttle_position = 0.6

    thrust_force, fuel_flow = turbofan(
        altitude, mach, throttle_position)  # force [N], fuel flow [kg/hr]

    FnR = mass * GRAVITY / L_over_D

    step_throttle = 0.01
    throttle_position = 0.6
    total_thrust_force = 0

    while (total_thrust_force < FnR and throttle_position <= 1):
        thrust_force, fuel_flow = turbofan(
            altitude, mach, throttle_position)  # force [N], fuel flow [kg/hr]
        TSFC = (fuel_flow * GRAVITY) / thrust_force
        total_thrust_force = aircraft['number_of_engines'] * thrust_force
        throttle_position = throttle_position + step_throttle

    L_over_D = CL_required / CD

    return TSFC, L_over_D, fuel_flow, throttle_position
Example #5
0
def rate_of_climb_calculation(thrust_to_weight, h, delta_ISA, mach, mass,
                              vehicle):
    wing = vehicle['wing']

    wing_surface = wing['area']

    knots_to_feet_minute = 101.268
    knots_to_meters_second = 0.514444

    phase = "climb"

    V_tas = mach_to_V_tas(mach, h, delta_ISA)

    _, _, _, _, _, rho_ISA, _ = atmosphere_ISA_deviation(h, delta_ISA)

    CL = (2*mass*GRAVITY) / \
        (rho_ISA*((V_tas*knots_to_meters_second)**2)*wing_surface)
    CL = float(CL)

    # CD = zero_fidelity_drag_coefficient(aircraft_data, CL, phase)
    # Input for neural network: 0 for CL | 1 for alpha
    switch_neural_network = 0
    alpha_deg = 1
    CD, _ = aerodynamic_coefficients_ANN(vehicle, h, mach, CL, alpha_deg,
                                         switch_neural_network)

    L_to_D = CL / CD

    if mach > 0:
        acceleration_factor, _ = acceleration_factor_calculation(
            h, delta_ISA, mach)
        climb_path_angle = np.arcsin(
            (thrust_to_weight - 1 / (L_to_D)) / (1 + acceleration_factor))
    else:
        _, acceleration_factor = acceleration_factor_calculation(
            h, delta_ISA, mach)
        climb_path_angle = np.arcsin(
            (thrust_to_weight - 1 / (L_to_D)) / (1 + acceleration_factor))
    rate_of_climb = knots_to_feet_minute * V_tas * np.sin(climb_path_angle)
    return rate_of_climb, V_tas, climb_path_angle
def airplane_sizing(x, vehicle):

    aircraft = vehicle['aircraft']

    wing = vehicle['wing']
    winglet = vehicle['winglet']
    horizontal_tail = vehicle['horizontal_tail']
    vertical_tail = vehicle['vertical_tail']
    fuselage = vehicle['fuselage']
    engine = vehicle['engine']
    pylon = vehicle['pylon']

    nose_landing_gear = vehicle['nose_langing_gear']
    main_landing_gear = vehicle['main_langing_gear']

    performance = vehicle['performance']
    operations = vehicle['operations']

    airport_departure = vehicle['airport_departure']
    airport_destination = vehicle['airport_destination']

    wing['area'] = x[0]
    wing['aspect_ratio'] = x[1]
    wing['taper_ratio'] = x[2]
    wing['sweep_c_4'] = x[3]
    wing['tip_incidence'] = x[4]
    wing['semi_span_kink'] = x[5]
    aircraft['passenger_capacity'] = x[11]
    aircraft['seat_abreast_number'] = x[12]
    performance['range'] = x[13]
    aircraft['winglet_presence'] = x[17]
    aircraft['slat_presence'] = x[18]
    horizontal_tail['position'] = x[19]

    engine['bypass'] = x[6]
    engine['fan_diameter'] = x[7]
    engine['compressor_pressure_ratio'] = x[8]
    engine['turbine_inlet_temperature'] = x[9]
    engine['fan_pressure_ratio'] = x[10]
    engine['design_point_pressure'] = x[14]
    engine['design_point_mach'] = x[15]
    engine['position'] = x[16]

    # Aerodynamics
    Cl_max = 1.9

    # Operations
    payload = aircraft['passenger_capacity'] * operations['passenger_mass']
    proceed = 0

    # Airframe parameters
    wing['span'] = np.sqrt(wing['aspect_ratio'] * wing['area'])
    CL_max = 0.9 * Cl_max * np.cos(wing['sweep_c_4'] * np.pi / 180)
    CL_max_clean = CL_max

    # Engine paramters

    if engine['position'] == 0:
        aircraft['number_of_engines'] = 2
        engines_under_wing = 0
    elif engine['position'] == 1:
        aircraft['number_of_engines'] = 2
        engines_under_wing = 2

    if wing['position'] == 2 or engine['position'] == 2:
        horizontal_tail['position'] == 2

    classification = 0
    for i in range(len(fuselage['transition_points'])):
        track = aircraft['passenger_capacity'] - \
            fuselage['transition_points'][i]
        if track < 0:
            classification = i
            break

    if classification == 0:
        classification = fuselage['pax_transitions']

    if classification == 1:
        fuselage['container_type'] == 'None'
    elif classification == 2:
        fuselage['container_type'] == 'LD3-45W'
    elif classification == 3:
        fuselage['container_type'] == 'LD3-45'

    fuselage = fuselage_cross_section(fuselage)

    (vehicle, xutip, yutip, xltip, yltip, xukink, yukink, xlkink, ylkink,
     xuroot, yuroot, xlroot, ylroot) = wetted_area(vehicle)

    (vehicle) = wing_structural_layout(vehicle, xutip, yutip, yltip, xukink,
                                       xlkink, yukink, ylkink, xuroot, xlroot,
                                       yuroot, ylroot)

    # Estimation of MTOW [kg] by Class I methodology
    wing_wetted_area_ft2 = wing['wetted_area'] * m2_to_ft2
    aux1 = (np.log(wing_wetted_area_ft2) - 0.0199) / 0.7531
    wt0_i = 10**aux1
    MTOW_i = wt0_i * lb_to_kg
    fuselage['diameter'] = np.sqrt(fuselage['width'] * fuselage['height'])
    wing['leading_edge_xposition'] = 0.45 * fuselage['length']
    fuselage['cabine_length'] = fuselage['length'] - \
        (fuselage['tail_length']+fuselage['cockpit_length'])

    engine_diameter = engine['fan_diameter'] * 1.1
    engine['maximum_thrust'] = 0.3264 * MTOW_i + 2134.8
    engine_static_trhust = engine['maximum_thrust'] * 0.95

    # Calculo deo CD0 da asa e do fator k do arrasto induzido
    CL_1 = 0.4
    # Input for neural network: 0 for CL | 1 for alpha
    switch_neural_network = 0
    alpha_deg = 0
    h = 100
    mach = 0.15
    CD_1, _ = aerodynamic_coefficients_ANN(vehicle, h, mach, CL_1, alpha_deg,
                                           switch_neural_network)

    CL_2 = 0.5
    CD_2, _ = aerodynamic_coefficients_ANN(vehicle, h, mach, CL_2, alpha_deg,
                                           switch_neural_network)

    K_coefficient = (CD_1 - CD_2) / (CL_1**2 - CL_2**2)
    wing_CD0 = CD_1 - K_coefficient * (CL_1**2)

    h = 0
    CL = 0.45
    # CLalpha derivative estimation
    switch_neural_network = 1
    alpha_deg_1 = 1
    _, CL_out_1 = aerodynamic_coefficients_ANN(vehicle, h, mach, CL,
                                               alpha_deg_1,
                                               switch_neural_network)

    alpha_deg_2 = 2
    _, CL_out_2 = aerodynamic_coefficients_ANN(vehicle, h, mach, CL,
                                               alpha_deg_2,
                                               switch_neural_network)

    CL_alpha_deg = (CL_out_2 - CL_out_2) / (alpha_deg_2 - alpha_deg_1)
    CL_alpha_rad = CL_alpha_deg / (np.pi / 180)

    # Divergence mach check
    mach = 0.7
    CL_1 = 0.4
    alga_deg = 1
    CD_max = -1000
    CD_min = 1000

    while mach <= operations['mach_maximum_operating']:
        mach = mach + 1
        switch_neural_network = 0
        CD_wing, _ = aerodynamic_coefficients_ANN(vehicle, h, mach, CL_1,
                                                  alpha_deg,
                                                  switch_neural_network)
        CD_ubrige = friction_coefficient * \
            (aircraft['wetted_area'] - wing['wetted_area']) / \
            wing['area']
        CD_total = CD_wing - CD_ubrige
        CD_max = max(CD_max, CD_total)
        CD_min = min(CD_min, CD_total)

    delta_CD = CD_max - CD_min

    if aircraft['slat_presence'] == 1:
        CL_maximum_takeoff = CL_max_clean + 0.6
        CL_maximum_landing = CL_max_clean + 1.2
    else:
        CL_maximum_takeoff = CL_max_clean + 0.4
        CL_maximum_landing = CL_max_clean + 1.0

    status = 0

    return status