def initialise_mass(inp): global mass mass = inp def initialise_xcg(inp): global xcg xcg = inp # End defining global variables # Start assigning values to variables # Vertical distance between engine mount attachment points to firewall v_dist = Q_("1 m") # DUMMY, can be chosen v_dist.ito(ureg.m) # Horizontal distance between engine mount attachment points to firewall h_dist = Q_("1 m") # DUMMY, can be chosen h_dist.ito(ureg.m) # Distance between engine mounts and firewall length = Firewall.eng_clearance # From Firewall file length.ito(ureg.m) # Engine mounts mass mass = Q_("5 kg") # DUMMY # Engine mounts cg, assumed at end of engine (engine attachments are not at the end of the engine) xcg = Engine.length # Start calculations # Load case # Max load factor (defined from requirements):
import numpy as np from Geometry import Geometry from Aerodynamics import Aeroprops #from Aerodynamics import Drag from Aerodynamics import Wing from Performance import Performance from Propulsion_and_systems import Propeller import matplotlib.pyplot as plt # Find CL & CD for max Cl/Cd (cruise) # Calculate Acro fuel needed fuel_cons_a = Q_("142 lbs/hr") fuel_density = Q_("0.721 kg/l") fuel_cons_a = fuel_cons_a / fuel_density fuel_cons_a.ito("l/hr") # print(fuel_cons_a) min_fuel_cap_a = fuel_cons_a / 2 print("Minimum amount of acro fuel: {}".format(min_fuel_cap_a)) # C_L = np.sqrt(np.pi*Geometry.Wing.A*Aeroprops.CD0_tot) # C_D = 2*Aeroprops.CD0_tot C_D = Aeroprops.CD0_tot # Define weights W_fuel = Q_("100 kg") W_empty = Geometry.Masses.W_OEW + Geometry.Masses.W_pilot + W_fuel W_tot = (Geometry.Masses.W_OEW + Geometry.Masses.W_pilot + W_fuel) * Performance.g0 # Calculate Drag
alpha_max = AWing.alpha_stall V_lof = 1.05 * V_stall V_max = PF.V_a_clean #Tmax = (P_to**2*eta_prop**2*m.pi*dp**2/2*rho)**(1/3) # Inputs flight_path_angle = Q_("20 deg") dV = Q_("1 m/s") # Empty lists V_list = [] alpha_list = [] T_list = [] T_max_list = [] flight_path_angle.ito(Q_("rad")) for V in np.arange(16, 100, 1): V *= Q_("m/s") L_req = W * np.cos(flight_path_angle) alpha_req = L_req / (0.5 * rho * V**2 * S * C_L_alpha) C_D = C_d_0 + (C_L_alpha * alpha_req)**2 / (m.pi * A * e) D = C_D * 0.5 * rho * V**2 * S T_req = D + W * np.sin(flight_path_angle) alpha_req.ito(Q_("deg")) V_list.append(V.magnitude) alpha_list.append(alpha_req.magnitude) T_list.append(T_req.magnitude) T_max = Propdata.data_reader(V, "Total thrust")
# X axis: parallel to the crankshaft centreline, pointing towards tail # Y axis: up # Z axis: left # Start defining global variables for easy editing from elsewhere # For explanations of the variables defined here, see below, where they are given values def initialise_rpm(inp): global rpm rpm = inp # Start assigning values rpm = Q_("2700 rpm") rpm.ito(ureg("rad/min")) # Make function which calculates gyro accelerations (prop only!) from moment and rate inputs def input_moment(yaw_moment, pitch_moment, yaw_rate, pitch_rate): # Make compatible for inputs with and without units if yaw_moment.__class__ == int or yaw_moment.__class__ == float: yaw_moment *= ureg("newton*meter") if pitch_moment.__class__ == int or pitch_moment.__class__ == float: pitch_moment *= ureg("newton*meter") if yaw_rate.__class__ == int or yaw_rate.__class__ == float: yaw_rate *= ureg("rad/s") if pitch_rate.__class__ == int or pitch_rate.__class__ == float: pitch_rate *= ureg("rad/s")
def initialise_ycg(inp): global ycg ycg = inp def initialise_zcg(inp): global zcg zcg = inp # End defining global variables # Start assigning values to variables # Engine dry mass as provided by Lycoming drymass = Q_("446 lbs") drymass.ito(ureg.kg) # Assume additional 10% to include fluids and hoses mass = 1.1 * drymass # Engine mass moments of inertia about engine cg, as provided by Lycoming ixg = Q_("84.4 inch*lbf*s**2") iyg = Q_("93.5 inch*lbf*s**2") izg = Q_("145.8 inch*lbf*s**2") # Transfer to SI units ixg.ito(ureg("kg*m**2")) iyg.ito(ureg("kg*m**2")) izg.ito(ureg("kg*m**2")) # Engine dimensions length = Q_("39.34 in") width = Q_("34.25 in")
b = GM.Wing.b maxdefl_aileron = GM.Wing.delta_a maxdefl_aileron.ito(Q_("rad")) Fa= Q_("1000 N") #Newton stick force dt = 0.01 V_list = [] p_list = [] aileron_deflection_list=[] for V in np.arange(V_stall.magnitude, V_a.magnitude , 0.5): V *= Q_("m/s") t = 0 p = Q_("0 rad/s") aileron_deflection = Q_("29 deg") # min(abs(maxdefl_aileron), abs(delta_aileron_force)) aileron_deflection.ito(Q_("rad")) while t < 1: delta_alpha_a = (p * 0.5 * b / V) #min(p * 0.5 * b / V, 10) # delta angle of attack at the tip #delta_aileron_force = (Fa / ( # -d_delta_a / d_s_a * 0.5 * rho * V ** 2 * Sa * ca) - C_h_alpha * delta_alpha_a) * 2 / C_h_delta # aileron deflection for force, hingemoment and speed #print(aileron_deflection) p = - C_l_delta_a / C_l_p * aileron_deflection * 2 * V / b t = t + dt #print (aileron_deflection/m.pi*180) #print (delta_alpha_a/m.pi*180) p_list.append(p.magnitude) V_list.append(V.magnitude) aileron_deflection_list.append(aileron_deflection)
from Performance import Performance from Inertia import Inertia # First check CG position for tipping: Z_mainlg = Geometry.Landing_gear.Z_mainlg X_mainlg = Geometry.Landing_gear.X_mainlg X_taillg = Geometry.Landing_gear.X_taillg cgangle_fw = Q_("15 deg") cgangle_rear = Q_("25 deg") X_maxfront = X_mainlg + Z_mainlg * np.tan(cgangle_fw) X_maxback = X_mainlg + Z_mainlg * np.tan(cgangle_rear) X_cgmtow = Geometry.CG.CG_mtow X_cgoew = Geometry.CG.CG_OEW V_taxi = Q_("5 kts") V_taxi.ito(Q_("m/s")) rho0 = Q_("1.225 kg/m**3") g0 = Performance.g0.magnitude g0 = g0 * Q_("m/s**2") m_mtow = Geometry.Masses.W_MTOW W_mtow = m_mtow * g0 V_taxi = Q_("5 kts") V_taxi.ito(Q_("m/s")) rho0 = Q_("1.225 kg/m**3") g0 = Performance.g0.magnitude g0 = g0 * Q_("m/s**2") m_mtow = Geometry.Masses.W_MTOW W_mtow = m_mtow * g0 Wheel_base = X_mainlg - X_taillg if not X_maxfront < X_cgmtow < X_maxback or not X_maxfront < X_cgoew < X_maxback: print('\x1b[3;37;41m' + "Front landing gear does not meet requirements" +
print("L =", L) # print the result ## EXAMPLE 3: GETTING THE MAGNITUDE OF A VALUE ## For compatibility reasons with other software ## You might only want the maginutude of a value ## without the unit, this example shows you how: L_mag = L.magnitude # Get the magnitude of L print("\nMagnnitude of L=", L_mag) # Print the result ## EXAMPLE 4: ASSIGING A UNIT USING A STRING EXPRESSION ## You can also assign a value and unit by typing them as a string ## Use Q_(<USER STRING>) function I_XX = Q_( "2457 mm**4" ) # To have for instance the 4th power, use the python expression **4 I_YY = Q_("0.002 m**4") print("\n I_XX=", I_XX) print("I_yy=", I_YY) ## EXAMPLE 5: CONVERTING UNITS USING STRING EXPRESSION ## FOR COMPOUND UNITS A STRING EXPRESSION IS OFTEN USEFUL ## FOR THE CONVERSION: I_ZZ = Q_("84.4 lbf*inch*s**2") print("\n Before conversion: Izz=", I_ZZ) I_ZZ.ito(ureg("kg*m**2")) print("After conversion: Izz=", I_ZZ)