try: from Database.database_functions import DatabaseConnector except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector database_connector = DatabaseConnector() chord_r = database_connector.load_value("root_chord") taper = database_connector.load_value("taper_ratio") half_span = database_connector.load_value("wing_span") / 2 #Determines the chord length at every y position along the span def chord_function(y): return chord_r - chord_r*(1-taper)*(y/half_span)
from scipy import interpolate try: from Database.database_functions import DatabaseConnector from Integrator import Integration from MOIcalc.moicalc import inertia except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector from Integrator import Integration from MOIcalc.moicalc import inertia database_connector = DatabaseConnector() wing_span = database_connector.load_value("wing_span") / 2 outer_diameter = database_connector.load_value("df,outer") radius_fuselage = outer_diameter / 2 E_Modulus = 68.9E9 # function of Mx(span) # whole function Mx(span)/Ixx(span) # (-1/E)*(sp.integrate.quad(func, 0, y)) ? Also non linear functions # first interval is (0 to y) # second interval (0 to 26) try:
from CentroidCalculator.centroid_funcs import get_amount_of_stringers from CentroidCalculator.centroid_calculator import get_centroid import Importer.xflr5 as aerodynamic_data except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector from CentroidCalculator.centroid_funcs import get_amount_of_stringers from CentroidCalculator.centroid_calculator import get_centroid import Importer.xflr5 as aerodynamic_data database_connector = DatabaseConnector() def shearflow_doublecell(spanwise_location): centroid = get_centroid(spanwise_location) # PROGRAM FROM REINIR TO GET STRINGER LOCATIONS wingbox_corner_points = database_connector.load_wingbox_value( 'wingbox_corner_points') def get_location(end_points): # Input end_points as [[x1,y1], [x2,y2]] return [(end_points[0][0] + end_points[1][0]) / 2 - centroid[0], (end_points[0][1] + end_points[1][1]) / 2 - centroid[1]] def get_length(end_points):
# Scroll all the way down for instructions import numpy as np import scipy as sp from scipy import interpolate import os import inspect try: from Database.database_functions import DatabaseConnector except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector database_connector = DatabaseConnector() aerodynamic_data_file_0 = '\\MainWing_a0.00_v10.00ms.txt' aerodynamic_data_file_10 = '\\MainWing_a10.00_v10.00ms.txt' """ Output of this function is a numpy array, where [1] is the second data point, so in essence rows. In that data point: [0] is the y-span, [1] is the chord, [2] the induced angle of attack, [3] the Cl, [4] the induced Cd, [5] is Cm around c/4 """ def main_wing_xflr5(name): main_wing = np.genfromtxt(name, skip_header=40, skip_footer=1029, usecols=(0, 1, 2, 3, 5, 7)) return main_wing
from matplotlib import pyplot as plt import numpy as np import math try: from Database.database_functions import DatabaseConnector from CentroidCalculator.centroid_calculator import get_centroid except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector from CentroidCalculator.centroid_calculator import get_centroid database_connector = DatabaseConnector() # COORDINATES:___________________________________________________ # list_coordinates = [(0.15, 0.0627513), (0.6, 0.0627513), (0.6, -0.02702924), (0.15, -0.04083288)] # Class of Parts: # ____________________________________________ class Part: def __init__(self, length, thickness, area, angle): self.LEN = length self.T = thickness self.AREA = area self.ANGL = angle
from Integrator import Integration from Database.database_functions import DatabaseConnector from MOIcalc.moicalc import inertia from CentroidCalculator.centroid_calculator import get_centroid from WingData.chord_function import chord_function except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector from Integrator import Integration from MOIcalc.moicalc import inertia from CentroidCalculator.centroid_calculator import get_centroid from WingData.chord_function import chord_function database_connector = DatabaseConnector() try: with open("../InertialLoadingCalculator/data.pickle", 'rb') as file: data = pickle.load(file) except FileNotFoundError: with open("./data.pickle", 'rb') as file: data = pickle.load(file) y_lst = data[0] x_moment_lst = data[3] z_moment_lst = data[6] step = y_lst[1] - y_lst[0] b = database_connector.load_value("wing_span") / 2 wingbox_points = database_connector.load_wingbox_value("wingbox_corner_points")
import pickle try: from Integrator import Integration import Importer.xflr5 as aerodynamic_data from Database.database_functions import DatabaseConnector except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) import Importer.xflr5 as aerodynamic_data from Database.database_functions import DatabaseConnector from Integrator import Integration database_connector = DatabaseConnector() # Import basic geometry wing_span = database_connector.load_value("wing_span") / 2 outer_diameter = database_connector.load_value("df,outer") radius_fuselage = outer_diameter / 2 surface_area = database_connector.load_value("surface_area") / 2 root_chord = database_connector.load_value("root_chord") tip_chord = database_connector.load_value("tip_chord") taper_ratio = database_connector.load_value("taper_ratio") spanwise_location_engine = database_connector.load_value( "engine_spanwise_location") chord_at_engine_location = aerodynamic_data.chord_function( spanwise_location_engine) radius_engine = database_connector.load_value("d_engine") / 2
import numpy as np import scipy as sp try: from Database.database_functions import DatabaseConnector except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector database_connector = DatabaseConnector() wingbox_corner_points = database_connector.load_wingbox_value("wingbox_corner_points") wingbox_centroid_location = [0.37216, 0.01494] # database_connector.load_wingbox_value("wingbox_centroid_location") def spar_positions(): # x position of the spar x_spar = wingbox_centroid_location[0] slope_top_surface = (wingbox_corner_points[1][1] - wingbox_corner_points[0][1])/ (wingbox_corner_points[1][0] - wingbox_corner_points[0][0]) y_top = (x_spar - wingbox_corner_points[0][0]) * slope_top_surface + wingbox_corner_points[0][1] slope_bottom_surface = (wingbox_corner_points[3][1] - wingbox_corner_points[2][1])/ (wingbox_corner_points[3][0] - wingbox_corner_points[2][0]) y_bottom = (x_spar - wingbox_corner_points[3][0]) * slope_bottom_surface + wingbox_corner_points[3][1] return (x_spar, y_top), (x_spar, y_bottom)
import sys import os import inspect from os import path import scipy as sp from scipy import interpolate import numpy as np try: from Database.database_functions import DatabaseConnector except ModuleNotFoundError: sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector # Init database connection database_connector = DatabaseConnector() # Locate wingbox file destination wingbox_creator_folder = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) wingbox_file_destination = wingbox_creator_folder.replace( "\\", "/").removesuffix("/WingboxCreator") + '/Database/wingbox.json' halfspan = database_connector.load_value("wing_span") / 2 quarter_chord_sweep = database_connector.load_value("quarter_chord_sweep") dihedral_angle = database_connector.load_value("dihedral_angle") """ Determination of the wingbox coordinates """ def airfoil_definition_converter( airfoil_file): # Previously 'text_to_array_converter'
from math import * try: from Database.database_functions import DatabaseConnector from WingData.chord_function import chord_function except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector from WingData.chord_function import chord_function database_connector = DatabaseConnector() pois = database_connector.load_wingbox_value("poisson_ratio") E = database_connector.load_wingbox_value("youngs_modulus_pa") t = database_connector.load_wingbox_value("spar_thickness") points = database_connector.load_wingbox_value("wingbox_corner_points") def spar_crit_stress(y): #ks needs to be determined manually if y <= 10: ks = 9.8 if 10 < y <= 20: ks = 9.5 if y > 20: ks = 9.5 b = (points[1][1] - points[2][1]) * chord_function(y) stress = (((pi**2) * ks * E) / (12 * (1 - (pois**2)))) * ((t / b)**2) return stress
from Buckling.plate_crit import plate_crit_force from Buckling.spar_crit import spar_crit_stress from Buckling.Shear_flow_1cell import main_shear_stress except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector from Buckling.stringer_applied import string_stress_normal, string_stress_tension from Buckling.stringer_crit import crit_stress_stringer from Buckling.shear_flow_multicell import shearflow_doublecell from Buckling.plate_crit import plate_crit_force from Buckling.spar_crit import spar_crit_stress from Buckling.Shear_flow_1cell import main_shear_stress database_connector = DatabaseConnector() try: with open("../InertialLoadingCalculator/data.pickle", 'rb') as file: data = pickle.load(file) except FileNotFoundError: with open("./data.pickle", 'rb') as file: data = pickle.load(file) y_lst = data[0][:-60] strength = database_connector.load_wingbox_value("ultimate_strength") crack_strength = 231400000 shear_strength = database_connector.load_wingbox_value('shear_strength') def margin_safety_crit(applied, crit):
import matplotlib.pyplot as plt try: import Importer.xflr5 as aerodynamic_data from Database.database_functions import DatabaseConnector except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) import Importer.xflr5 as aerodynamic_data from Database.database_functions import DatabaseConnector database_connector = DatabaseConnector() # Import basic geometry wing_span = database_connector.load_value("wing_span") Outer_diameter = database_connector.load_value("df,outer") radius_fuselage = Outer_diameter / 2 surface_area = database_connector.load_value("surface_area") # Import weight and location of the engine weight_engine = database_connector.load_value("engine_weight") spanwise_location_engine = database_connector.load_value( "engine_spanwise_location") # Import the weight of the wing and fuel (Class II) weight_wing = database_connector.load_value("wing_weight") weight_fuel = database_connector.load_value("fuel_max") def lift_distribution(y, density, velocity): return aerodynamic_data.lift_coef_function_10(y) * 0.5 * density * ( velocity**2) * surface_area
import matplotlib.pyplot as plt try: from Database.database_functions import DatabaseConnector from WingData.chord_function import chord_function from Integrator import Integration except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector from WingData.chord_function import chord_function from Integrator import Integration database_connector = DatabaseConnector() G = 26 * 10**9 # database_connector.load_value("shear_modulus_pa") t1 = 0.035 # database_connector.load_wingbox_value("...") left and right spar t2 = 0.035 # database_connector.load_wingbox_value("...") skin t3 = 0.035 # database_connector.load_wingbox_value("...") mid spar engine_pos = database_connector.load_value("engine_spanwise_location") wingbox_points = database_connector.load_wingbox_value("wingbox_corner_points") b_one = (wingbox_points[0][1] - wingbox_points[5][1]) b_two = (wingbox_points[2][1] - wingbox_points[3][1]) b_three = (wingbox_points[1][1] - wingbox_points[4][1]) a_one = sqrt((wingbox_points[0][1] - wingbox_points[1][1])**2 + (wingbox_points[1][0] - wingbox_points[0][0])**2) a_two = sqrt((wingbox_points[4][1] - wingbox_points[5][1])**2 +
from math import * try: from Database.database_functions import DatabaseConnector except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector database_connector = DatabaseConnector() pois = E = database_connector.load_wingbox_value("stringer_modulus") k = 0 #Dont know yet def plate_crit_force(): Fcr = ((pi**2)*k*E) / (12*(1-))
from math import * import matplotlib.pyplot as plt import numpy as np try: from Database.database_functions import DatabaseConnector except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector database_connector = DatabaseConnector() #I = 0.00000158483 #Moment of inertia per stringer. This still needs to be determined. I = 1.87875E-05 E = database_connector.load_wingbox_value("youngs_modulus_pa") K = 4 #May vary per section in the wingbox. Needs to be determined manually per section. def crit_stress_stringer( y): #L is the wingbox section length, thus rib spacing. if y <= 10: L = 0.25 if 10 < y <= 20: L = 1 if y > 20: L = 1.7 sigma = (K * (pi**2) * E * I) / (L**2) return sigma
from math import * try: from Database.database_functions import DatabaseConnector from WingData.chord_function import chord_function except ModuleNotFoundError: import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) from Database.database_functions import DatabaseConnector from WingData.chord_function import chord_function database_connector = DatabaseConnector() pois = database_connector.load_wingbox_value("poisson_ratio") E = database_connector.load_wingbox_value("youngs_modulus_pa") kc = 7.3 t = database_connector.load_wingbox_value("plate_thickness") points = database_connector.load_wingbox_value("wingbox_corner_points") top_lim1 = database_connector.load_wingbox_value("top_stringer_lim_point_1") top_lim2 = database_connector.load_wingbox_value("top_stringer_lim_point_2") top_num_1 = database_connector.load_wingbox_value("top_number_of_stringers_1") top_num_2 = database_connector.load_wingbox_value("top_number_of_stringers_2") top_num_3 =database_connector.load_wingbox_value("top_number_of_stringers_3") bot_lim1 = database_connector.load_wingbox_value("bottom_stringer_lim_point_1") bot_lim2 = database_connector.load_wingbox_value("bottom_stringer_lim_point_2") bot_num_1 = database_connector.load_wingbox_value("bottom_number_of_stringers_1") bot_num_2 = database_connector.load_wingbox_value("bottom_number_of_stringers_2") bot_num_3 =database_connector.load_wingbox_value("bottom_number_of_stringers_3")