def coefficient_LLT(AC, velocity, AOA): Au_P = [0.1828, 0.1179, 0.2079, 0.0850, 0.1874] Al_P = Au_P deltaz = 0 # Determine children shape coeffcients AC_u = list(data.values[i, 0:4]) Au_C, Al_C, c_C, spar_thicknesses = calculate_dependent_shape_coefficients( AC_u, psi_spars, Au_P, Al_P, deltaz, c_P, morphing=morphing_direction) # Calculate aerodynamics for that airfoil airfoil = 'optimal' x = create_x(1., distribution='linear') y = CST(x, 1., [deltaz / 2., deltaz / 2.], Al=Al_C, Au=Au_C) # Create file for Xfoil to read coordinates xf.create_input(x, y['u'], y['l'], airfoil, different_x_upper_lower=False) Data = xf.find_coefficients(airfoil, AOA, Reynolds=Reynolds(10000, velocity, c_C), iteration=100, NACA=False) deviation = 0.001 while Data['CL'] is None: Data_aft = xf.find_coefficients(airfoil, AOA * deviation, Reynolds=Reynolds( 10000, velocity, c_C), iteration=100, NACA=False) Data_fwd = xf.find_coefficients(airfoil, AOA * (1 - deviation), Reynolds=Reynolds( 10000, velocity, c_C), iteration=100, NACA=False) try: for key in Data: Data[key] = (Data_aft[key] + Data_fwd[key]) / 2. except: deviation += deviation alpha_L_0 = xf.find_alpha_L_0(airfoil, Reynolds=0, iteration=100, NACA=False) coefficients = LLT_calculator(alpha_L_0, Data['CD'], N=100, b=span, taper=1., chord_root=chord_root, alpha_root=AOA, V=velocity) lift = coefficients['C_L'] drag = coefficients['C_D'] return lift, drag
def find_3D_coefficients(airfoil, alpha, Reynolds=0, iteration=10, NACA=True, N=10, span=10., taper=1., chord_root=1, alpha_root=1., velocity=1.): """ Calculate the 3D distribution using the Lifting Line Theory. :param airfoil: if NACA is false, airfoil is the name of the plain filewhere the airfoil geometry is stored (variable airfoil). If NACA is True, airfoil is the naca series of the airfoil (i.e.: naca2244). By default NACA is False. :param Reynolds: Reynolds number in case the simulation is for a viscous flow. In case not informed, the code will assume inviscid. (Use the aero_module function to calculate reynolds) :param alpha: list/array/float/int of angles of attack. :param iteration: changes how many times XFOIL will try to make the results converge. Specialy important for viscous flows :param NACA: Boolean variable that defines if the code imports an airfoil from a file or generates a NACA airfoil. :param N: number of cross sections on the wing :param span: span in meters :param taper: unidimendional taper (This options is still not 100% operational) :param chord_root: value of the chord at the the root :param alpha_root: angle of attack of the chord at the root (degrees) :param velocity: velocity in m/s """ coefficients = xf.find_coefficients(airfoil, alpha, Reynolds, iteration, NACA) alpha_L_0_root = xf.find_alpha_L_0(airfoil, Reynolds, iteration, NACA) return ar.LLT_calculator(alpha_L_0_root, coefficients['CD'], N, span, taper, chord_root, alpha_root, velocity)
def aircraft_range_LLT(AC, velocity, AOA): def to_integrate(weight): # velocity = 0.514444*108 # m/s (113 KTAS) span = 10.9728 RPM = 1800 a = 0.3089 # (lb/hr)/BTU b = 0.008 * RPM + 19.607 # lb/hr lbhr_to_kgs = 0.000125998 BHP_to_watt = 745.7 eta = 0.85 thrust = weight / lift_to_drag power_SI = thrust * velocity / eta power_BHP = power_SI / BHP_to_watt mass_flow = (a * power_BHP + b) mass_flow_SI = mass_flow * lbhr_to_kgs SFC = mass_flow_SI / thrust dR = velocity / g / SFC * lift_to_drag / weight return dR * 0.001 #*0.0005399 Au_P = [0.1828, 0.1179, 0.2079, 0.0850, 0.1874] Al_P = Au_P deltaz = 0 # Determine children shape coeffcients AC_u = list(data.values[i, 0:4]) Au_C, Al_C, c_C, spar_thicknesses = calculate_dependent_shape_coefficients( AC_u, psi_spars, Au_P, Al_P, deltaz, c_P, morphing=morphing_direction) # Calculate aerodynamics for that airfoil airfoil = 'optimal' x = create_x(1., distribution='linear') y = CST(x, 1., [deltaz / 2., deltaz / 2.], Al=Al_C, Au=Au_C) # Create file for Xfoil to read coordinates xf.create_input(x, y['u'], y['l'], airfoil, different_x_upper_lower=False) Data = xf.find_coefficients(airfoil, AOA, Reynolds=Reynolds(10000, velocity, c_C), iteration=100, NACA=False) deviation = 0.001 while Data['CL'] is None: Data_aft = xf.find_coefficients(airfoil, AOA * deviation, Reynolds=Reynolds( 10000, velocity, c_C), iteration=100, NACA=False) Data_fwd = xf.find_coefficients(airfoil, AOA * (1 - deviation), Reynolds=Reynolds( 10000, velocity, c_C), iteration=100, NACA=False) try: for key in Data: Data[key] = (Data_aft[key] + Data_fwd[key]) / 2. except: deviation += deviation alpha_L_0 = xf.find_alpha_L_0(airfoil, Reynolds=0, iteration=100, NACA=False) coefficients = LLT_calculator(alpha_L_0, Data['CD'], N=100, b=span, taper=1., chord_root=chord_root, alpha_root=AOA, V=velocity) lift_to_drag = coefficients['C_L'] / coefficients['C_D'] g = 9.81 # kg/ms fuel = 56 * 6.01 * 0.4535 * g initial_weight = 1111 * g final_weight = initial_weight - fuel return scipy.integrate.quad(to_integrate, final_weight, initial_weight)[0]