Cm*0.5*rho*V_local**2*S_w*MAC +\ Cmh*0.5*rho*V_local**2*S_h*MAC_h u_dot = Fx / mtow - q * w w_dot = Fz / mtow + q * u q_dot = My / I_yy u += u_dot * dt w += w_dot * dt q += q_dot * dt theta += q * dt alpha_nose = np.arctan(w / u) V_local = np.sqrt(u**2 + w**2) alst.append(alpha_nose.to('degree').magnitude) qlst.append(q.to('degree /s').magnitude) qdotlst.append(q_dot.to('degree/s**2').magnitude) thetalst.append(theta.to('degree').magnitude) Vlst.append(V_local.magnitude) print('finished') plt.figure() plt.plot(tlst, qlst, label='pitch rate', color='black') plt.plot(tlst, thetalst, label='theta [deg]', color='black', ls='--') plt.plot(tlst, alst, label='alpha [deg]', color='black', ls='-.') plt.xlabel("time [s]") plt.ylabel("pitch rate [deg/s]") #plt.plot(tlst,qdotlst,label='q dot') plt.legend()
import sys sys.path.append( '../' ) # This makes sure the parent directory gets added to the system path from Misc import ureg, Q_ import math as m import numpy as np import scipy as sp from Geometry import Geometry from pint import UnitRegistry import Aeroprops #Input variables, to be filled in by user AoA = Q_("5 deg") #fill in angle of attack flight condition drag to be known AoA = AoA.to(ureg.rad) Rwb = 1.05 #Read in DATCOM p1164, wing body interference factor Rhtb = 1.05 Rvtb = 1.05 CL_trim = 0 #lift coefficient needed to trim aircraft height = Q_('500 m') # height in m velocity = Q_('94 m/s') #velocity in m/s loc_max_tc_wing = 0 # 0 if t/c max is < 30%c, 1 if t/c max is >= 30%c loc_max_tc_ht = 0 # 0 if t/c max is < 30%c, 1 if t/c max is >= 30%c loc_max_tc_vt = 0 # 0 if t/c max is < 30%c, 1 if t/c max is >= 30%c Sref = Geometry.Wing.S CL_wing = Aeroprops.CL_alpha_wing * AoA #max lift coefficient AR_wing = Geometry.Wing.A ih = Geometry.H_tail.i_h #incidende angle HT CL_ht = Aeroprops.CL_alpha_ht * AoA.to(ureg.rad) - Aeroprops.de_da * \
disc_wing_h[i, 7] = y_i.magnitude # Moments and Forces sum_Fn_w = sum(disc_wing_w[:, 1]) * Q_("N") sum_Fn_h = sum(disc_wing_h[:, 1]) * Q_("N") My = dx_w * sum_Fn_w + dx_h * Fn_h Mx = (sum(disc_wing_w[:, 3]) + sum(disc_wing_h[:, 3])) * Q_("N*m") Mz = sum(disc_wing_w[:, 4]) * Q_("N*m") p_dot = Mx / I_xx q_dot = My / I_yy p += p_dot * dt q += q_dot * dt plst.append(p.to('degree/s').magnitude) pdotlst.append(p_dot.to('degree/s**2').magnitude) Mzlst.append(Mz.magnitude) plt.plot(tlst, plst, label='roll rate', c='black') #plt.plot(tlst,Mzlst,label='moment due to roll') #plt.plot(tlst,pdotlst,label='p dot') plt.xlabel("Time [s]") plt.ylabel("Roll rate [" r'$^\circ$' "/s]") plt.legend() plt.show() "=============================================================================" #### Pitch ####alpha_nose, de, Thrust = trim() ## #V_local = V_inf