Demo entry 2842798

fun

Submitted by anonymous on Oct 15, 2015 at 01:09
Language: Python. Code size: 2.1 kB.

# -*- coding: utf-8 -*-
"""
Created on Fri Oct  9 11:06:53 2015

@author: Aleksandar Petrov
@contact: aleksanndar1995@gmail.com
"""
import numpy as np

def I(f_r, f_l, b, MAC, TOM, boxh, c_root, taper):

halfb=float(b)/2
midchord = ChordAtSpanPercent(0.5,c_root,taper)

#fuselage and wings volume
Vf = np.pi*f_r**2 * f_l
Vw = halfb*midchord*boxh #for one wing

If = 0.5 * TOM * (float(Vf) / (Vf + 2*Vw) ) * f_r**2

Iw_centroid = (1./12.) * TOM * (float(Vw) / (Vf + 2*Vw)) * (halfb**2 + boxh**2)
Iw_steiner =  TOM * (float(Vw) / (Vf + 2*Vw)) * (halfb*0.5)**2

I=If+2*(Iw_centroid + Iw_steiner)

return I

def ChordAtSpanPercent(percent, c_root, taper):

c_tip = c_root * taper

return c_tip + (c_root-c_tip)*(1-percent)

def DeltaL(dCL, V_inf, SweepLE, ba, bai, b, c_root, taper, rho):
#velocity seen by wing
rho = 1.225
V = V_inf * np.cos(np.deg2rad(SweepLE))

#wing area affecteed by ailerons (for one wing)
Sa_half = 0.5*(ChordAtSpanPercent(bai, c_root, taper) + ChordAtSpanPercent(ba+bai, c_root, taper) ) * ba * 0.5* b

DeltaL = dCL * 0.5 * rho * V**2 * Sa_half

return DeltaL

def L_A(dCL, V_inf, SweepLE, ba, bai, b, c_root, taper, rho):

y_A = (bai+ba*0.5)*b*0.5
L_A = 2* DeltaL(dCL, V_inf, SweepLE, ba, bai, b, c_root, taper, rho) * y_A

return L_A

def y_D(y_D_p,b):
return y_D_p*b*0.5

def Pss(dCL, V_inf, SweepLE, ba, bai, b, c_root, taper, rho, Stot, C_DR , y_D_p ):

y_D_h = y_D(y_D_p, b)
L_Ah = L_A(dCL, V_inf, SweepLE, ba, bai, b, c_root, taper, rho)

return np.sqrt(float(2*L_Ah)/(rho*Stot*C_DR*y_D_h**3))

def DeltaD(rho,P,b,y_D_p, Stot, C_DR):

VR = P* y_D(y_D_p, b)
DeltaD=0.5 * rho*VR**2 * Stot * C_DR