def buffet_altitude(vehicle, mass, altitude, limit_altitude, mach_climb): wing = vehicle['wing'] wing_surface = wing['area'] step = 100 load_factor = 1.3 gamma = 1.4 delta_ISA = 0 # Typical values of wing loading for jet airplanes around 5749 [Pascal] wing_loading_constraint = 6000 _, _, _, _, P_ISA, _, _ = atmosphere_ISA_deviation(limit_altitude, delta_ISA) CL_constraint = ((2) / (gamma * P_ISA * mach_climb**2)) * wing_loading_constraint CL = 0.1 while CL < CL_constraint: theta, delta, sigma, T_ISA, P_ISA, rho_ISA, a = atmosphere_ISA_deviation( altitude, delta_ISA) CL = ((2*load_factor)/(gamma*P_ISA*mach_climb*mach_climb)) * \ (mass*GRAVITY/wing_surface) altitude = altitude + step return altitude
def landing_field_length(vehicle, weight_landing): ''' ''' # Aircraft data import aircraft = vehicle['aircraft'] wing = vehicle['wing'] airport_destination = vehicle['airport_destination'] CL_max_landing = aircraft['CL_maximum_landing'] wing_surface = wing['area'] # [m2] # Airport data import airfield_elevation = airport_destination['elevation'] # [ft] delta_ISA = airport_destination['delta_ISA'] # [deg C] _, _, sigma, _, _, rho, _ = atmosphere_ISA_deviation( airfield_elevation, delta_ISA) # [kg/m3] gamma_bar = 0.1 # mean value of (D-T)/W h_landing = 15.3 # screen height in landing - [m] g = 9.807 # [m/s2] a_bar_g = 0.4 # mean_deceleration, between 0.4 to 0.5 for jets Delta_n = 0.1 # incremental_load_factor during flare f_land = 5 / 3 # landing safe factor FAR Part 91 aux1 = 1 / gamma_bar aux2 = 1.69 * ((weight_landing / wing_surface) / (h_landing * rho * g * CL_max_landing)) aux3 = (1 / a_bar_g) * (1 - ((gamma_bar**2) / Delta_n)) + (gamma_bar / Delta_n) S_landing_h_landing = aux1 + aux2 * aux3 return S_landing_h_landing * h_landing * f_land
def climb(time, state, climb_V_cas, mach_climb, delta_ISA, vehicle): aircraft = vehicle['aircraft'] distance = state[0] altitude = state[1] mass = state[2] _, _, _, _, _, rho_ISA, _ = atmosphere_ISA_deviation(altitude, delta_ISA) throttle_position = 1.0 if climb_V_cas > 0: mach = V_cas_to_mach(climb_V_cas, altitude, delta_ISA) else: mach = mach_climb thrust_force, fuel_flow = turbofan( altitude, mach, throttle_position) # force [N], fuel flow [kg/hr] thrust_to_weight = aircraft['number_of_engines'] * thrust_force / (mass * GRAVITY) rate_of_climb, V_tas, climb_path_angle = rate_of_climb_calculation( thrust_to_weight, altitude, delta_ISA, mach, mass, vehicle) if rate_of_climb < 300: print('rate of climb violated!') x_dot = (V_tas * 101.269) * np.cos(climb_path_angle) # ft/min h_dot = rate_of_climb # ft/min W_dot = -2 * fuel_flow * 0.01667 # kg/min time_dot = h_dot dout = np.array([x_dot, h_dot, W_dot]) dout = dout.reshape(3, ) return dout
def mach_to_V_tas(mach, h, delta_ISA): """ Description: - Converts mach number to True Air Speed Inputs: - Mach number - Altitude [ft] - Delta ISA [deg C] Outputs: - true airspeed [knots] """ theta, _, _, _, _, _, _ = atmosphere_ISA_deviation(h, delta_ISA) speed_of_sound = 661.4786 # sea level [knots] return speed_of_sound * mach * np.sqrt(theta)
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 V_cas_to_mach(V_cas, h, delta_ISA): """ Description: - Converts calibrated air speed to mach Inputs: - Calibrated air speed [knots] - Altitude [ft] - Delta ISA [deg C] Outputs: - Mach number """ _, delta, _, _, _, _, _ = atmosphere_ISA_deviation(h, delta_ISA) speed_of_sound = 661.4786 # sea level [knots] aux1 = ((1 + 0.2 * ((V_cas / speed_of_sound)**2))**3.5) - 1 aux2 = ((1 / delta) * aux1 + 1)**((1.4 - 1) / 1.4) return np.sqrt(5 * (aux2 - 1))
def V_cas_to_V_tas(V_cas, h, delta_ISA): """ Description: - Converts Calibrated Air Speed to True Air Speed Inputs: - Calibrated air speed [knots] - Altitude [ft] - Delta ISA [deg C] Outputs: - True airspeed [knots] """ speed_of_sound = 661.4786 # sea level [knots] theta, delta, _, _, _, _, _ = atmosphere_ISA_deviation(h, delta_ISA) aux1 = (1 + 0.2 * (V_cas / speed_of_sound)**2)**3.5 aux2 = ((1 / delta) * (aux1 - 1) + 1)**(1 / 3.5) aux3 = np.sqrt(theta * (aux2 - 1)) return 1479.1 * aux3
def mach_to_V_cas(mach, h, delta_ISA): """ Description: - Converts mach number to Calibrated Air Speed Inputs: - Mach number - Altitude [ft] - Delta ISA [deg C] Outputs: - Calibated airspeed [knots] """ _, delta, _, _, _, _, _ = atmosphere_ISA_deviation(h, delta_ISA) speed_of_sound = 661.4786 # sea level [knots] aux1 = ((0.2 * (mach**2) + 1)**3.5) - 1 aux2 = (delta * aux1 + 1)**(1 / 3.5) return speed_of_sound * np.sqrt(5 * (aux2 - 1))
def wing_mass(maximum_takeoff_weight, landing_gear_position, spoilers, wing_aspect_ratio, wing_area, wing_taper_ratio, wing_sweep_c_4, mach, wing_mean_thickness, altitude): """ Description: Methodology from Isikveren 2002, pag. 56, eq. 84 - Calculates the wing mass in kg Inputs: - maximum takeoff weight [kg] - wing position - landing gear position - spoilers presence - wing aspect ratio - wing area [m2] - wing taper ration - wing sweep at c/4 - mach number - wing mean thickness - altitude [ft] Outputs: - wing mass [kg] """ # Assiciative constants definition safety_factor = 1.5 YEIS = 2016 # Year of entry into service alpha_w = 0.0328 phi_w = 0.656 Beta_w = 1.5 delta_w = 1.5 epsilon_w = 1.5 Chi_w = 1.1 rho_sls_g = 0.125 _, _, _, _, _, _, a = atmosphere_ISA_deviation( altitude, 0) V_MO = mach*a*kn_to_m_s # Maximum operating speed [m/s] # limit load factor - Roskam, pag. 37, eq 4.23 n_limit = 2.1 + 24000/((kg_to_lb*MTOW) + 10000) if n_limit <= 2.5: n_limit = 2.5 # wing installation philosophy if wing['position'] == 1: k_co = 1.17 else wing['position']: k_co = 1.25
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 balanced_field_length(vehicle, weight_takeoff): ''' Note: for project design the case of delta_gamma2 = 0 presents most interest, as the corresponding weight is limited by the second segment climb requirement (Torenbeek, 1982) ''' wing = vehicle['wing'] aircraft = vehicle['aircraft'] airport_departure = vehicle['airport_departure'] # Aircraft data import CL_max_takeoff = aircraft['CL_maximum_takeoff'] wing_surface = wing['area'] # [m2] T_avg = aircraft['average_thrust'] # [N] # Airport data import airfield_elevation = airport_departure['elevation'] # [ft] delta_ISA = airport_departure['delta_ISA'] # [deg C] # horizontal distance from airfield surface requirement according to FAR 25 - [m] h_takeoff = 10.7 delta_gamma2 = 0.024 delta_S_takeoff = 200 # [m] g = 9.807 # [m/s2] CL_2 = 0.694 * CL_max_takeoff mu = 0.01 * CL_max_takeoff + 0.02 _, _, sigma, _, _, rho, _ = atmosphere_ISA_deviation( airfield_elevation, delta_ISA) # [kg/m3] aux1 = 0.863 / (1 + (2.3 * delta_gamma2)) aux2 = ((weight_takeoff / wing_surface) / (rho * g * CL_2)) + h_takeoff # To high takeoff weight will made this coeficient less than mu resulting in a negative # landing field, when that happend this code will use twice the takeoff weight as coefficient # to continue with the iteration if T_avg / weight_takeoff > mu: aux3 = (1 / ((T_avg / weight_takeoff) - mu)) + 2.7 else: aux3 = weight_takeoff * 2 aux4 = delta_S_takeoff / np.sqrt(sigma) return aux1 * aux2 * aux3 + aux4 # [m]
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 climb(time, state, climb_V_cas, mach_climb, delta_ISA, vehicle): aircraft = vehicle['aircraft'] distance = state[0] altitude = state[1] mass = state[2] _, _, _, _, _, rho_ISA, _ = atmosphere_ISA_deviation(altitude, delta_ISA) throttle_position = 0.3 if climb_V_cas > 0: mach = V_cas_to_mach(climb_V_cas, altitude, delta_ISA) else: mach = mach_climb thrust_force, fuel_flow = turbofan( altitude, mach, throttle_position) # force [N], fuel flow [kg/hr] total_thrust_force = thrust_force * aircraft['number_of_engines'] total_fuel_flow = fuel_flow * aircraft['number_of_engines'] step_throttle = 0.1 while (total_fuel_flow < 0 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_fuel_flow = aircraft['number_of_engines'] * fuel_flow throttle_position = throttle_position + step_throttle thrust_to_weight = aircraft['number_of_engines'] * thrust_force / (mass * GRAVITY) rate_of_climb, V_tas, climb_path_angle = rate_of_climb_calculation( thrust_to_weight, altitude, delta_ISA, mach, mass, vehicle) x_dot = (V_tas * 101.269) * np.cos(climb_path_angle) # ft/min h_dot = rate_of_climb # ft/min W_dot = -2 * fuel_flow * 0.01667 # kg/min # time_dot = h_dot dout = np.array([x_dot, h_dot, W_dot]) dout = dout.reshape(3, ) return dout
def acceleration_factor_calculation(h, delta_ISA, mach): lambda_rate = 0.0019812 tropopause = (71.5 + delta_ISA) / lambda_rate T, _, _, _ = atmosphere(h) _, _, _, T_ISA, _, _, _ = atmosphere_ISA_deviation(h, delta_ISA) if h < tropopause: # For constant calibrated airspeed below the tropopause: acceleration_factor_V_CAS = (0.7 * mach**2) * (phi_factor(mach) - 0.190263 * (T_ISA / T)) # For constant Mach number below the tropopause: acceleration_factor_mach = (-0.13318 * mach**2) * (T_ISA / T) elif h > tropopause: # For constant calibrated airspeed above the tropopause: acceleration_factor_V_CAS = (0.7 * mach**2) * phi_factor(mach) # For constant Mach number above the tropopause: acceleration_factor_mach = 0 return acceleration_factor_V_CAS, acceleration_factor_mach
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
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 mission(origin_destination_distance): global GRAVITY GRAVITY = 9.80665 gallon_to_liter = 3.7852 feet_to_nautical_miles = 0.000164579 tolerance = 100 airport_departure = vehicle['airport_departure'] airport_destination = vehicle['airport_destination'] # [kg] max_zero_fuel_weight = aircraft['maximum_zero_fuel_weight'] / GRAVITY # [kg] max_fuel_capacity = aircraft['maximum_fuel_capacity'] / GRAVITY operational_empty_weight = aircraft['operational_empty_weight'] / GRAVITY passenger_capacity_initial = aircraft['passenger_capacity'] engines_number = aircraft['number_of_engines'] max_engine_thrust = engine['maximum_thrust'] reference_load_factor = 0.85 heading = 2 # Operations and certification parameters: buffet_margin = 1.3 # [g] residual_rate_of_climb = 300 # [ft/min] ceiling = 40000 # [ft] UPDATE INPUT!!!!!!!!! descent_altitude = 1500 # Network and mission parameters fuel_density = 0.81 # [kg/l] fuel_price_per_kg = 1.0 # [per kg] fuel_price = (fuel_price_per_kg / fuel_density) * gallon_to_liter time_between_overhaul = 2500 # [hr] taxi_fuel_flow_reference = 5 # [kg/min] contingency_fuel_pct = 0.1 # pct ?????????????????? min_cruise_time = 3 # [min] go_around_allowance = 300 # Initial flight speed schedule climb_V_cas = 280 mach_climb = 0.78 cruise_V_cas = 310 descent_V_cas = 310 mach_descent = 0.78 delta_ISA = 0 captain_salary, first_officer_salary, flight_attendant_salary = crew_salary( 1000) regulated_takeoff_mass = regulated_takeoff_weight(vehicle) regulated_landing_mass = regulated_landing_weight(vehicle) max_takeoff_mass = regulated_takeoff_mass max_landing_mass = regulated_landing_mass takeoff_allowance_mass = 200 * max_takeoff_mass / 22000 approach_allowance_mass = 100 * max_takeoff_mass / 22000 average_taxi_in_time = 5 average_taxi_out_time = 10 payload = round(passenger_capacity_initial * operations['passenger_mass'] * reference_load_factor) initial_altitude = airport_departure['elevation'] f = 0 while f == 0: step = 500 out = 0 while out == 0: # Maximum altitude calculation max_altitude, rate_of_climb = maximum_altitude( vehicle, initial_altitude, ceiling, max_takeoff_mass, climb_V_cas, mach_climb, delta_ISA) # Optimal altitude calculation optim_altitude, rate_of_climb, _ = optimum_altitude( vehicle, initial_altitude, ceiling, max_takeoff_mass, climb_V_cas, mach_climb, delta_ISA) # Maximum altitude with minimum cruise time check g_climb = 4 / 1000 g_descent = 3 / 1000 K1 = g_climb + g_descent # Minimum distance at cruise stage Dmin = 10 * operations['mach_cruise'] * min_cruise_time K2 = (origin_destination_distance - Dmin + g_climb * (airport_departure['elevation'] + 1500) + g_descent * (airport_destination['elevation'] + 1500)) max_altitude_check = K2 / K1 if max_altitude_check > ceiling: max_altitude_check = ceiling if max_altitude > max_altitude_check: max_altitude = max_altitude_check if optim_altitude < max_altitude: final_altitude = optim_altitude else: final_altitude = max_altitude 'TODO: this should be replaced for information from ADS-B' # Check for next lower feasible RVSN FK check according to # present heading final_altitude = 1000 * (math.floor(final_altitude / 1000)) flight_level = final_altitude / 100 odd_flight_level = [ 90, 110, 130, 150, 170, 190, 210, 230, 250, 270, 290, 310, 330, 350, 370, 390, 410, 430, 450, 470, 490, 510 ] even_flight_level = [ 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 440, 460, 480, 500, 520 ] if (heading > 0 and heading <= 180): flight_level = min(odd_flight_level, key=lambda x: abs(x - flight_level)) final_altitude = flight_level * 100 elif (heading > 180 and heading <= 360): flight_level = min(even_flight_level, key=lambda x: abs(x - flight_level)) final_altitude = flight_level * 100 # Initial climb fuel estimation initial_altitude = initial_altitude + 1500 _, _, total_burned_fuel0, _ = climb_integration( max_takeoff_mass, mach_climb, climb_V_cas, delta_ISA, final_altitude, initial_altitude, vehicle) # Calculate best cruise mach mass_at_top_of_climb = max_takeoff_mass - total_burned_fuel0 operations['mach_cruise'] = maximum_range_mach( mass_at_top_of_climb, final_altitude, delta_ISA, vehicle) mach_climb = operations['mach_cruise'] mach_descent = operations['mach_cruise'] # Recalculate climb with new mach final_distance, total_climb_time, total_burned_fuel, final_altitude = climb_integration( max_takeoff_mass, mach_climb, climb_V_cas, delta_ISA, final_altitude, initial_altitude, vehicle) delta = total_burned_fuel0 - total_burned_fuel if delta < tolerance: out = 1 mass_at_top_of_climb = max_takeoff_mass - total_burned_fuel initial_cruise_altitude = final_altitude distance_climb = final_distance * feet_to_nautical_miles distance_cruise = origin_destination_distance - distance_climb altitude = initial_cruise_altitude flag = 1 while flag == 1: transition_altitude = crossover_altitude(operations['mach_cruise'], cruise_V_cas, delta_ISA) _, _, _, _, _, rho_ISA, _ = atmosphere_ISA_deviation( initial_cruise_altitude, delta_ISA) if altitude <= 10000: mach = V_cas_to_mach(250, altitude, delta_ISA) if (altitude > 10000 and altitude <= transition_altitude): mach = V_cas_to_mach(cruise_V_cas, altitude, delta_ISA) if altitude > transition_altitude: mach = operations['mach_cruise'] # Breguet calculation type for cruise performance total_cruise_time, final_cruise_mass = cruise_performance( altitude, delta_ISA, mach, mass_at_top_of_climb, distance_cruise, vehicle) final_cruise_altitude = altitude # Type of descent: 1 = full calculation | 2 = no descent computed type_of_descent = 1 if type_of_descent == 1: # Recalculate climb with new mach final_distance, total_descent_time, total_burned_fuel, final_altitude = descent_integration( final_cruise_mass, mach_descent, descent_V_cas, delta_ISA, descent_altitude, final_cruise_altitude, vehicle) distance_descent = final_distance * feet_to_nautical_miles distance_mission = distance_climb + distance_cruise + distance_descent distance_error = np.abs(origin_destination_distance - distance_mission) if distance_error <= 1.0: flag = 0 else: distance_cruise = distance_cruise - distance_error if type_of_descent == 2: flag = 0 total_burned_fuel = 0 final_distance = 0 total_decent_time = 0 total_burned_fuel = 0 final_altitude = 0 final_mission_mass = final_cruise_mass - total_burned_fuel total_mission_burned_fuel = max_takeoff_mass - final_mission_mass total_mission_flight_time = total_climb_time + \ total_cruise_time + total_descent_time total_mission_distance = distance_mission # Rule of three to estimate fuel flow during taxi taxi_fuel_flow = taxi_fuel_flow_reference * max_takeoff_mass / 22000 taxi_in_fuel = average_taxi_in_time * taxi_fuel_flow takeoff_fuel = total_mission_burned_fuel + takeoff_allowance_mass + taxi_in_fuel taxi_out_fuel = average_taxi_out_time * taxi_fuel_flow total_fuel_on_board = takeoff_fuel + taxi_out_fuel remaining_fuel = takeoff_fuel - total_mission_burned_fuel - \ approach_allowance_mass - taxi_in_fuel # Payload range envelope check MTOW_ZFW = max_zero_fuel_weight + total_fuel_on_board MTOW_LW = max_landing_mass + total_mission_burned_fuel delta_1 = max_takeoff_mass - MTOW_ZFW delta_2 = total_fuel_on_board - max_fuel_capacity delta_3 = max_takeoff_mass - MTOW_LW extra = (max_takeoff_mass - operational_empty_weight - payload) - takeoff_fuel[0] delta = max([delta_1, delta_2, delta_3, extra]) if delta > tolerance: max_takeoff_mass = max_takeoff_mass - delta else: # Payload reduction if restricted max_takeoff_mass = min([max_takeoff_mass, MTOW_ZFW, MTOW_LW]) payload_calculation = max_takeoff_mass - \ takeoff_fuel - operational_empty_weight if payload_calculation > payload: payload = payload else: payload = payload_calculation f = 1 passenger_capacity = np.round(payload / operations['passenger_mass']) load_factor = passenger_capacity / passenger_capacity_initial * 100 # DOC calculation fuel_mass = total_mission_burned_fuel + \ (average_taxi_out_time + average_taxi_in_time)*taxi_fuel_flow DOC = direct_operational_cost( time_between_overhaul, total_mission_flight_time, fuel_mass, operational_empty_weight, total_mission_distance, max_engine_thrust, engines_number, 0.35 * operational_empty_weight, max_takeoff_mass) return (DOC)
vertical_tail_sweep_leading_edge = 1/(deg_to_rad*(np.arctan(np.tan(deg_to_rad*vertical_tail_sweep_c_4) + 1/(vertical_tail['aspect_ratio']*(1 - vertical_tail['taper_ratio'])/(1 + vertical_tail['taper_ratio']))))) vertical_tail_sweep_c_2 = 1/(deg_to_rad*(np.arctan(np.tan(deg_to_rad*vertical_tail_sweep_c_4) - 1/(vertical_tail['aspect_ratio']*(1 - vertical_tail['taper_ratio'])/(1 + vertical_tail['taper_ratio']))))) vertical_tail_sweep_trailing_edge = 1/(deg_to_rad*(np.arctan(np.tan(deg_to_rad*vertical_tail['sweep']) - 3/(vertical_tail['aspect_ratio']*(1 - vertical_tail['taper_ratio'])/(1 + vertical_tail['taper_ratio']))))) vertical_tail_root_thickness = 0.11 vertical_tail_tip_thickness = 0.11 vertical_tail_mean_thickness = (vertical_tail_root_chord + 3*vertical_tail_tip_thickness)/4 vertical_tail_wetted_area = 2*vertical_tail['area']*(1 + 0.25*vertical_tail_root_thickness*(1 + (vertical_tail_root_thickness/vertical_tail_tip_thickness)*vertical_tail['taper_ratio'])/(1 + vertical_tail['taper_ratio'])) if horizontal_tail['position'] == 1: kv = 1 # vertical tail mounted in the fuselage else: zh = 0.95*vertical_tail_span kv = 1 + 0.15*((horizontal_tail['area']*zh)/(vertical_tail['area']*vertical_tail_span)) theta, delta, sigma, T_ISA, P_ISA, rho_ISA, a = atmosphere_ISA_deviation( altitude, 0) V_dive = mach*a aux_1 = (vertical_tail['area']**0.2 * V_dive)/(1000*np.sqrt(np.cos(vertical_tail_sweep_c_2*deg_to_rad))) vertical_tail_weight = kv*vertical_tail['area']*(62*aux_1 - 2.5) vertical_tail_weight = vertical_tail_weight*kg_to_lb return # ============================================================================= # MAIN # ============================================================================= # ============================================================================= # TEST # =============================================================================
def parametric_analysis(h, M0, beta, C_TOL, C_TOH, h_PR, epsilon1, epsilon2, pi_b, pi_dmax, pi_n, e_cL, e_cH, e_tH, e_tL, e_tF, eta_b, eta_mL, eta_mH, eta_mPL, eta_mPH, eta_prop, eta_g, pi_cL, pi_cH, tau_t, Tt4, m0_dot): # ======================================================================== # Inputs: # ========================================================================= # --------------Flight and Atmosphere------------------------- delta_ISA = 0 _, _, _, T0, P0, _, _ = atmosphere_ISA_deviation(h, delta_ISA) # Flight parametres P0 = P0 # Pa T0 = T0 # K # T0 and P0 are obtained from altitude # Others g_0 = 9.80665 g_c = 1 # ======================================================================== # Execution: # ========================================================================= # Far upstream of freestream ============================================== # in: T0 K | out: h0 J/kg Pr0 Pa R0 J/KgK _, h0, Pr0, _, _, R0, gamma0, a0 = FAIR(item=1, f=0, T=T0) V0 = M0 * a0 # m/s ht0 = h0 + (V0**2) / (2) # J/kg # in: ht0 J/kg | out: Prt0 Pa _, _, Prt0, _, _, _, _, _ = FAIR(item=2, f=0, h=ht0) tau_r = ht0 / h0 pi_r = Prt0 / Pr0 pi_d = pi_dmax # Compressor LP =========================================================== ht2 = ht0 # J/kg Prt2 = Prt0 # Pa Prt2_5 = Prt2 * pi_cL**(1 / e_cL) # Pa # in: Prt2_5 Pa | out: ht2_5 J/kg _, ht2_5, _, _, _, _, _, _ = FAIR(item=3, f=0, Pr=Prt2_5) tau_cL = ht2_5 / ht2 Prt2_5i = Prt2 * pi_cL # Pa # in: Prt2_5i Pa | out: ht2_5i J/kg _, ht2_5i, _, _, _, _, _, _ = FAIR(item=3, f=0, Pr=Prt2_5i) eta_cL = (ht2_5i - ht2) / (ht2_5 - ht2) # Compressor HP =========================================================== Prt3 = Prt2_5 * pi_cH**(1 / e_cH) # Pa # in: Prt3 Pa | out: ht3 J/kg _, ht3, _, _, _, _, _, _ = FAIR(item=3, f=0, Pr=Prt3) tau_cH = ht3 / ht2_5 Prt3i = Prt2_5 * pi_cH # Pa Prt3_Prt2 = Prt3 / Prt2 # in: Prt3i Pa | out: ht3i J/kg _, ht3i, _, _, _, _, _, _ = FAIR(item=3, f=0, Pr=Prt3i) eta_cH = (ht3i - ht2_5) / (ht3 - ht2_5) # Turbine HP ============================================================== # Set initial value of fuel/air ratio at station 4 f4i = 0.06 while True: # in: T4 K f4i | out: ht4 J/kg _, ht4, _, _, _, _, _, _ = FAIR(item=1, f=f4i, T=Tt4) f = (ht4 - ht3) / (eta_b * h_PR - ht4) if np.abs(f - f4i) > 0.0001: f4i = f continue else: break M4 = 1 _, _, _, MFP4 = RGCOMPR(item=1, Tt=Tt4, M=M4, f=f) tau_lambda = ht4 / h0 tau_m1 = ((1 - beta - epsilon1 - epsilon2) * (1 + f) + ((epsilon1 * tau_r * tau_cL * tau_cH) / tau_lambda)) / ( (1 - beta - epsilon1 - epsilon2) * (1 + f) + epsilon1) tau_tH = 1 - ((tau_r * tau_cL * (tau_cH - 1) + (C_TOL / (eta_mPH))) / (eta_mH * tau_lambda * ((1 - beta - epsilon1 - epsilon2) * (1 + f) + ((epsilon1 * tau_r * tau_cL * tau_cH) / tau_lambda)))) ht4_1 = ht4 * tau_m1 # J/kg f4_1 = f / ((1 + f + epsilon1) / (1 - beta - epsilon1 - epsilon2)) # in: ht4_1 J/kg f4_1 | out: Prt4_1 Pa _, _, Prt4_1, _, _, _, _, _ = FAIR(item=2, f=f4_1, h=ht4_1) ht4_4 = ht4_1 * tau_tH # J/kg # in: ht4_4 J/kg f4_1 | out: Prt4_4 Pa _, _, Prt4_4, _, _, _, _, _ = FAIR(item=2, f=f4_1, h=ht4_4) pi_tH = (Prt4_4 / Prt4_1)**(1 / e_tH) Prt4_4i = pi_tH * Prt4_1 # Pa # in: Prt4_4i Pa f4_1 | out: ht4_4i J/kg _, ht4_4i, _, _, _, _, _, _ = FAIR(item=3, f=f4_1, Pr=Prt4_4i) eta_tH = (ht4_1 - ht4_4) / (ht4_1 - ht4_4i) # Turbine LP ============================================================== tau_m2 = ((1 - beta - epsilon1 - epsilon2) * (1 + f) + epsilon1 + (epsilon2 * ((tau_r * tau_cL * tau_cH) / (tau_lambda * tau_m1 * tau_tH)))) / ( (1 - beta - epsilon1 - epsilon2) * (1 + f) + epsilon1 + epsilon2) ht4_5 = ht4_4 * tau_m2 # J/kg f4_5 = f / (1 + f + ((epsilon1 + epsilon2) / (1 - beta - epsilon1 - epsilon2))) # in: ht4_5 J/kg f4_5 | out: Prt4_5 Pa _, _, Prt4_5, _, _, _, _, _ = FAIR(item=2, f=f4_5, h=ht4_5) tau_tL = 1 - ((tau_r * (tau_cL - 1) + (C_TOL / (eta_mPL))) / (eta_mH * tau_lambda * tau_tH * ((1 - beta - epsilon1 - epsilon2) * (1 + f) + (((epsilon1 + epsilon2) / tau_tH) * tau_r * tau_cL * tau_cH / tau_lambda)))) ht5 = ht4_5 * tau_tL # J/kg # in: ht5 J/kg f4_5 | out: Prt5 Pa Tt5 K Tt5, _, Prt5, _, _, _, _, _ = FAIR(item=2, f=f4_5, h=ht5) pi_tL = (Prt5 / Prt4_5)**(1 / e_tL) Prt5i = pi_tL * Prt4_5 # Pa # in: Prt5i Pa f4_5 | out: ht5i J/kg _, ht5i, _, _, _, _, _, _ = FAIR(item=3, f=f4_5, Pr=Prt5i) eta_tL = (ht4_5 - ht5) / (ht4_5 - ht5i) # Turbine Free ============================================================ ht5_5 = ht5 # in: ht5_5 J/kg f4_5 | out: Prt5_5 Pa Tt5_5 K Tt5_5, _, Prt5_5, _, _, _, _, _ = FAIR(item=2, f=f4_5, h=ht5_5) tau_tF = tau_t / tau_tL ht6 = ht5_5 * tau_tF Tt6, _, Prt6, _, _, _, _, _ = FAIR(item=2, f=f4_5, h=ht6) pi_tF = (Prt6 / Prt5)**(1 / e_tF) Prt6i = pi_tF * Prt5_5 # Pa # in: Prt5i Pa f4_5 | out: ht5i J/kg _, ht6i, _, _, _, _, _, _ = FAIR(item=3, f=f4_5, Pr=Prt6i) eta_tF = (ht5_5 - ht6) / (ht5_5 - ht6i) # ========================= Engine Exit ==================================== ht9 = ht6 # J/kg Tt9 = Tt6 # K Prt9 = Prt6 # Pa f9 = f4_5 M9 = 1 # in: Tt0 K M f9 | Tt_T9 Pt_P9 _, Tt_T9, Pt9_P9, _ = RGCOMPR(item=1, Tt=Tt9, M=M9, f=f9) Pt9_P0 = pi_r * pi_d * pi_cL * pi_cH * pi_b * pi_tH * pi_tL * pi_tF * pi_n if Pt9_P0 >= Pt9_P9: T9 = Tt9 / (Tt_T9) # K # in: T9 K f9 | out: h9 J/kg Pr9 Pa R9 J/KgK a9 m/s _, h9, Pr9, _, _, R9, _, a9 = FAIR(item=1, f=f9, T=T9) P0_P9 = Pt9_P9 / Pt9_P0 else: Pr9 = Prt9 / Pt9_P0 # in: Pr9 Pa f9 | out: h9 J/kg T0 K T9, h9, _, _, _, R9, _, a9 = FAIR(item=3, f=f9, Pr=Pr9) P0_P9 = 1 P9_P0 = 1 / P0_P9 T9_T0 = T9 / T0 # ========================= Engine Exit ==================================== V9 = np.sqrt(2 * g_c * (ht9 - h9)) # m/s M9 = V9 / a9 f0 = f * (1 - beta - epsilon1 - epsilon2) C_c = (gamma0 - 1) * M0 * ( (1 + f0 - beta) * (V9 / a0) - M0 + (1 + f0 - beta) * ((R9 / R0) * ((T9 / T0) / (V9 / a0)) * ((1 - P0_P9) / gamma0))) # dimensionless V9_a0 = V9 / a0 # dimensionless # Propeller work interaction coefficient: # C_prop = eta_prop*eta_g*(eta_mL*(1+f0-beta)*tau_lambda*tau_m1*tau_tH*tau_m2*(1-tau_tL)*tau_tF - (C_TOL/eta_mPL)) # dimensionless C_prop = eta_prop * eta_g * ( eta_mL * (1 + f0 - beta) * tau_lambda * tau_m1 * tau_tH * tau_m2 * tau_tL * (1 - tau_tF) - (C_TOL / eta_mPL)) # dimensionless C_TOTAL = C_prop + C_c # dimensionless # Uninstalled specific power of the engine: P_m0_dot = C_TOTAL * h0 # J/Kg # Power P = m0_dot * C_TOTAL * h0 # W # Uninstalled power specific fuel consumption: S_P = f0 / (C_TOTAL * h0) # Kg/J # S_P = 1e6*(S_P) # mg/W.s # Uninstalled equivalent specific thrust: F_m0_dot = (C_TOTAL * h0) / V0 # J.s/Kg.m # Thrust F = F_m0_dot * m0_dot # N # Uninstalled thrust specific fuel consumption: # S = f0*V0/(C_TOTAL*h0) # Kg.m/J.s S = (f0 / (F_m0_dot)) # Kg.m/J.s S_mg = S * 1e6 # mg/N-s # Propulsive efficiency: eta_P = C_TOTAL / ((C_prop / eta_prop) + ((gamma0 - 1) / 2) * ((1 + f0 - beta) * ((V9 / a0)**2) - M0**2)) # Thermanl efficiency: eta_TH = (C_TOTAL + C_TOL + C_TOH) / ((f0 * h_PR) / h0) return (F_m0_dot, S, P_m0_dot, S_P, f0, C_c, C_prop, eta_P, eta_TH, V9_a0, pi_tH, pi_tL, tau_cL, tau_cH, tau_tH, tau_tL, tau_tF, tau_lambda, tau_m1, tau_m2, f, eta_cL, eta_cH, eta_tH, eta_tL, eta_tF, M9, Pt9_P9, P9_P0, Prt3_Prt2, T9_T0, M0, T0, P0, F, P, pi_r, MFP4, h0, tau_r)
def sizing_horizontal_tail(vehicle, Mach, Ceiling): wing = vehicle['wing'] winglet = vehicle['winglet'] horizontal_tail = vehicle['horizontal_tail'] vertical_tail = vehicle['vertical_tail'] fuselage = vehicle['fuselage'] # rad = np.pi / 180 m22ft2 = (1 / 0.3048)**2 kt2ms = 1 / 1.943844 # [kt] para [m/s] horizontal_tail['sweep_c_4'] = wing['sweep_c_4'] + 5 horizontal_tail['aspect_ratio'] = horizontal_tail[ 'aspect_ratio'] # alongamento EH horizontal_tail['taper_ratio'] = horizontal_tail[ 'taper_ratio'] # Afilamento EH horizontal_tail['root_chord'] = 0.10 # [#]espessura relativa raiz horizontal_tail['tip_chord'] = 0.10 # [#]espessura relativa ponta horizontal_tail['mean_chord'] = ( horizontal_tail['root_chord'] + horizontal_tail['tip_chord']) / 2 # [#]espessura media horizontal_tail['tail_to_wing_area_ratio'] = horizontal_tail[ 'area'] / wing['area'] # rela�ao de areas horizontal_tail['twist'] = 0 # torcao EH if horizontal_tail['position'] == 1: # [�] enflechamento bordo de ataque horizontal_tail['sweep_leading_edge'] = 1/rad * \ (np.arctan(np.tan(rad*horizontal_tail['sweep_c_4']) + 1/horizontal_tail['aspect_ratio']*(1-horizontal_tail['taper_ratio'])/(1+horizontal_tail['taper_ratio']))) horizontal_tail['sweep_c_2'] = 1 / rad * (np.arctan( np.tan(rad * horizontal_tail['sweep_c_4']) - 1 / horizontal_tail['aspect_ratio'] * (1 - horizontal_tail['taper_ratio']) / (1 + horizontal_tail['taper_ratio']))) # [�] enflechamento C/2 # [�] enflechamento bordo de fuga horizontal_tail['sweep_trailing_edge'] = 1/rad * \ (np.arctan(np.tan(rad*horizontal_tail['sweep_c_4']) - 3/horizontal_tail['aspect_ratio']*(1-horizontal_tail['taper_ratio'])/(1+horizontal_tail['taper_ratio']))) horizontal_tail['span'] = np.sqrt( horizontal_tail['aspect_ratio'] * horizontal_tail['area']) # evergadura EH horizontal_tail['center_chord'] = 2 * horizontal_tail['area'] / ( horizontal_tail['span'] * (1 + horizontal_tail['taper_ratio'])) # corda de centro horizontal_tail['tip_chord'] = horizontal_tail[ 'taper_ratio'] * horizontal_tail['center_chord'] # corda na ponta horizontal_tail['dihedral'] = 3 else: horizontal_tail['center_chord'] = vertical_tail['tip_chord'] horizontal_tail['tip_chord'] = horizontal_tail[ 'taper_ratio'] * horizontal_tail['center_chord'] horizontal_tail['span'] = 2 * horizontal_tail['area'] / ( horizontal_tail['tip_chord'] + horizontal_tail['center_chord']) horizontal_tail['aspect_ratio'] = horizontal_tail[ 'span']**2 / horizontal_tail['area'] # if "T" config a negative dihedral angle to help relaxe lateral stability horizontal_tail['dihedral'] = -2 # [�] enflechamento bordo de ataque horizontal_tail['sweep_leading_edge'] = 1/rad * \ (np.arctan(np.tan(rad*horizontal_tail['sweep_c_4']) + 1/horizontal_tail['aspect_ratio']*(1-horizontal_tail['taper_ratio'])/(1+horizontal_tail['taper_ratio']))) horizontal_tail['sweep_c_2'] = 1 / rad * (np.arctan( np.tan(rad * horizontal_tail['sweep_c_4']) - 1 / horizontal_tail['aspect_ratio'] * (1 - horizontal_tail['taper_ratio']) / (1 + horizontal_tail['taper_ratio']))) # [�] enflechamento C/2 # [�] enflechamento bordo de fuga horizontal_tail['sweep_trailing_edge'] = 1/rad * \ (np.arctan(np.tan(rad*horizontal_tail['sweep_c_4']) - 3/horizontal_tail['aspect_ratio']*(1-horizontal_tail['taper_ratio'])/(1+horizontal_tail['taper_ratio']))) # corda da ponta horizontal_tail['mean_geometrical_chord'] = horizontal_tail[ 'area'] / horizontal_tail['span'] # mgc horizontal_tail['mean_aerodynamic_chord'] = 2/3*horizontal_tail['center_chord']*(1+horizontal_tail['taper_ratio']+horizontal_tail['taper_ratio']**2) / \ (1+horizontal_tail['taper_ratio']) # mean aerodynamic chord horizontal_tail['mean_aerodynamic_chord_yposition'] = horizontal_tail[ 'span'] / 6 * (1 + 2 * horizontal_tail['taper_ratio']) / ( 1 + horizontal_tail['taper_ratio']) # ######################### HT Wetted area ###################################### horizontal_tail[ 'tau'] = horizontal_tail['root_chord'] / horizontal_tail['tip_chord'] #ht.thicknessavg = horizontal_tail['mean_chord']*0.50*(horizontal_tail['center_chord']+horizontal_tail['tip_chord']) horizontal_tail['wetted_area'] = 2.*horizontal_tail['area'] * \ (1+0.25*horizontal_tail['root_chord']*(1+(horizontal_tail['tau'] * horizontal_tail['taper_ratio']))/(1+horizontal_tail['taper_ratio'])) # [m2] # HT aerodynamic center if horizontal_tail['position'] == 1: horizontal_tail['aerodynamic_center'] = ( 0.92 * fuselage['length'] - horizontal_tail['center_chord'] + horizontal_tail['mean_aerodynamic_chord_yposition'] * np.tan(rad * horizontal_tail['sweep_leading_edge']) + horizontal_tail['aerodynamic_center'] * horizontal_tail['mean_aerodynamic_chord']) else: horizontal_tail['aerodynamic_center'] = 0.95*fuselage['length']-vertical_tail['center_chord']+vertical_tail['span'] * \ np.tan(rad*vertical_tail['sweep_leading_edge'])+horizontal_tail['aerodynamic_center'] * \ horizontal_tail['mean_aerodynamic_chord']+horizontal_tail['mean_aerodynamic_chord_yposition'] *np.tan(rad*horizontal_tail['sweep_leading_edge']) # EMPENAGEM HORIZONTAL (HORIZONTAL TAIL) theta, delta, sigma, T_ISA, P_ISA, rho_ISA, a = atmosphere_ISA_deviation( Ceiling, 0) # propriedades da atmosfera va = a # velocidade do som [m/s] sigma = sigma # velocidade de cruzeiro meta, verdadeira [m/s] vc = Mach * va # velocidade de cruzeiro meta [KEAS] vckeas = vc * sigma**0.5 / kt2ms vdkeas = 1.25 * vckeas # empenagem horizontal movel kh = 1.1 prod1 = 3.81 * ( ((horizontal_tail['area'] * m22ft2)**0.2) * vdkeas) # termo 1 prod2 = (1000 * (np.cos(horizontal_tail['sweep_c_2'] * rad))**0.5 ) # termo 2 prodf = prod1 / prod2 # termo 3 horizontal_tail['weight'] = 1.25 * kh * (horizontal_tail['area'] * m22ft2) * (prodf - 0.287) return (vehicle)
from framework.Attributes.Atmosphere.atmosphere_ISA_deviation import atmosphere_ISA_deviation from framework.baseline_aircraft import baseline_aircraft import matplotlib.pyplot as plt import numpy as np g = 9.81 gamma = 1.4 delta_ISA = 0 load_factor = 1.3 weight = 43112 maximum_altitude = 41000 theta, delta, sigma, T_ISA, P_ISA, rho_ISA, a = atmosphere_ISA_deviation( maximum_altitude, delta_ISA) mach_design = 0.78 CL_constraint = ((2) / (gamma * P_ISA * mach_design * mach_design)) * 6000 print(CL_constraint) aircraft_data = baseline_aircraft() wing_surface = wing['area'] # altitude = 20000 # theta, delta, sigma, T_ISA, P_ISA, rho_ISA, a = atmosphere_ISA_deviation(altitude, delta_ISA) # CL = (2*load_factor*weight*9.81)/(1.4*P_ISA*M*M*S) delta_altitude = 100 initial_altitude = 100 altitude = initial_altitude CL = 0 while CL < CL_constraint: