def Case3(cd0, k1, k2, V, Rc, h, alpha, beta, WS_range=np.arange(5, 300, 1), g0=9.81): ''' calculates the wing loading for constant altitude/ speed turn designing for turn radius ''' T_W = [] W_S = [] _, _, rho = isa(h) q = 0.5 * rho * V**2 n = np.sqrt(1 + ((V**2) / (g0 * Rc))**2) for WS in WS_range: TW = beta / alpha * (k1 * n**2 * beta / q * WS + k2 * n + cd0 / (beta / q * WS)) T_W.append(1 / (V * TW)) # T_W.append(TW) W_S.append(WS) plt.plot(W_S, T_W, label='Case 3', linewidth=4)
def Case00(cd0, k1, k2, dVdt, V, h, alpha, beta, WS_range=np.arange(5, 300, 1), g0=9.81): ''' calculates the wing loading for accelerating climb designing for climb ''' T_W = [] W_S = [] _, _, rho = isa(h) q = 0.5 * rho * V**2 n = 1 + dVdt / g0 for WS in WS_range: TW = q / alpha * (cd0 / WS + k1 * (n * beta / q)**2 * WS + k2 * n * beta / q) + beta / alpha * (1 + 1 / g0 * dVdt) T_W.append(1 / (V * TW)) # T_W.append(TW) W_S.append(WS) plt.plot(W_S, T_W, label='Case 00', linewidth=4)
def Case8(cd0, k1, k2, V, dhdt, CL, h, alpha, beta, WS_range=np.arange(5, 300, 1)): ''' calculates the wing loading for service ceiling designing for maximum altitude ''' T_W = [] W_S = [] _, _, rho = isa(h) q = 0.5 * rho * V**2 for WS in WS_range: TW = beta / alpha * (k1 * beta / q * WS + k2 + cd0 / (beta / q * WS) + 1 / V * dhdt) T_W.append(1 / (V * TW)) # T_W.append(TW) W_S.append(WS) plt.plot(W_S, T_W, label='Case 8', linewidth=4)
def Case4(cd0, k1, k2, dVdt, V, h, alpha, beta, WS_range=np.arange(5, 300, 1), g0=9.81): ''' calculates the wing loading for horizontal acceleration designing for dVdt (acceleration) ''' T_W = [] W_S = [] _, _, rho = isa(h) q = 0.5 * rho * V**2 for WS in WS_range: TW = beta / alpha * (k1 * beta / q * WS + k2 + cd0 / (beta / q * WS) + 1 / g0 * dVdt) T_W.append(1 / (V * TW)) # T_W.append(TW) W_S.append(WS) plt.plot(W_S, T_W, label='Case 4', linewidth=4)
def noise_heat(xyzsource, d_inch, P_h, T, B, RPM, h): ''' Calculates the SPL on a set of points. Also produces heat map of the surroundings ''' R_ft = 0.0833333333 * d_inch / 2 m = 1 gamma, R, Temp = 1.4, 287, isa(h)[1] M_t = V_r(RPM, d_inch, 1) * 0.3048 / np.sqrt(gamma * R * Temp) V_07 = V_r(RPM, d_inch, 0.7) #Assumption blade area A_b = 2 / B * 1 / 12 SPLlst = list() xrange = np.arange(-0.6, 1 + 0.01, 0.01) yrange = np.arange(-1.6, 1.6 + 0.01, 0.01) for x in xrange: for y in yrange: xyzobserver = [x, y, 0] S, theta = position(xyzsource, xyzobserver) p_rn = list() p_v = list() for S, theta in zip(S, theta): #ORDERED ROTATIONAL NOISE PRESSURE AT OBSERVER rotationp = p_m(m, S, R_ft, P_h, T, B, M_t, theta) p_rn.append(rotationp) #VORTEX NOISE AT OBSERVER vortexSPL = SPL_vortex(A_b, V_07) vortexSPL_obs = SPL_to_PWL_dist(vortexSPL, 300, S_obs=S) vortexp = SPL_to_p(vortexSPL_obs) p_v.append(vortexp) p_sum = sum(p_rn) + sum(p_v) SPL = p_to_SPL(p_sum) if SPL > 120: SPLlst.append(120) else: SPLlst.append(SPL) SPLlst = np.array(SPLlst).reshape(len(xrange), len(yrange)) window = [yrange[0], yrange[-1], xrange[-1], xrange[0]] plt.imshow(SPLlst, cmap='Reds', extent=window) plt.colorbar() plt.plot(FW_skeleton[1], FW_skeleton[0], "black") return SPLlst
def Case1(V, h, cd0, alpha, WS_range=np.arange(5, 300, 1)): ''' calculates the wing loading for constant altitude and speed cruise designing for cruise speed ''' T_W = [] W_S = [] _, _, rho = isa(h) q = 0.5 * rho * V**2 for WS in WS_range: TW = (q * cd0) / (alpha * WS) T_W.append(1 / (V * TW)) # T_W.append(TW) W_S.append(WS) plt.plot(W_S, T_W, label='Case 1', linewidth=4)
def Case2(cd0, k1, k2, V, h, alpha, beta, WS_range=np.arange(5, 300, 1)): ''' calculates the wing loading for constant speed climb designing for climb ''' T_W = [] W_S = [] _, _, rho = isa(h) q = 0.5 * rho * V**2 for WS in WS_range: TW = beta / alpha * (k1 * beta / q * WS + k2 + cd0 / (beta / q * WS) + 1) T_W.append(1 / (V * TW)) # T_W.append(TW) W_S.append(WS) plt.plot(W_S, T_W, label='Case 2', linewidth=4)
def req_noise(xyzsource, d_inch, P_h, T, B, RPM, h, r, CG, PWL_req): SPL_req = PWL_to_SPL(PWL_req, r) print(SPL_req) SPLlst = list() R_ft = 0.0833333333 * d_inch / 2 m = 1 gamma, R, Temp = 1.4, 287, isa(h)[1] M_t = V_r(RPM, d_inch, 1) * 0.3048 / np.sqrt(gamma * R * Temp) V_07 = V_r(RPM, d_inch, 0.7) #Assumption blade area A_b = 2 / B * 1 / 12 thetalst = list() for theta in np.arange(0, 360 + 1, 1): x = r * np.sin(theta) y = r * np.cos(theta) thetalst.append(theta) xyzobserver = [x, y, 0] S, theta = position(xyzsource, xyzobserver) p_rn = list() p_v = list() for S, theta in zip(S, theta): #ORDERED ROTATIONAL NOISE PRESSURE AT OBSERVER rotationp = p_m(m, S, R_ft, P_h, T, B, M_t, theta) p_rn.append(rotationp) #VORTEX NOISE AT OBSERVER vortexSPL = SPL_vortex(A_b, V_07) vortexSPL_obs = SPL_to_PWL_dist(vortexSPL, 300, S_obs=S) vortexp = SPL_to_p(vortexSPL_obs) p_v.append(vortexp) p_sum = sum(p_rn + p_v) SPL = p_to_SPL(p_sum) SPLlst.append(SPL) return max(SPLlst), thetalst, SPLlst #BUTTERFLY PLOT #plst=list() #thetalst=list() #for theta in np.arange(0,2*np.pi*1.026,0.05): # p=p_m(1,3,0.645833333075,1.36,12.521858094085683,3, 0.75, theta) # if p>0: # thetalst.append(theta) # plst.append(p) # else: # thetalst.append(theta) # plst.append(-p) # #plt.plot(thetalst,plst) #plt.polar(thetalst,plst) #plt.show() #plt.ylabel('p') #plt.xlabel('theta')