コード例 #1
0
def coefficient_LLT(AC, velocity, AOA):
    Au_P = [0.1828, 0.1179, 0.2079, 0.0850, 0.1874]
    Al_P = Au_P
    deltaz = 0

    # Determine children shape coeffcients
    AC_u = list(data.values[i, 0:4])
    Au_C, Al_C, c_C, spar_thicknesses = calculate_dependent_shape_coefficients(
        AC_u, psi_spars, Au_P, Al_P, deltaz, c_P, morphing=morphing_direction)

    # Calculate aerodynamics for that airfoil
    airfoil = 'optimal'
    x = create_x(1., distribution='linear')
    y = CST(x, 1., [deltaz / 2., deltaz / 2.], Al=Al_C, Au=Au_C)
    # Create file for Xfoil to read coordinates
    xf.create_input(x, y['u'], y['l'], airfoil, different_x_upper_lower=False)
    Data = xf.find_coefficients(airfoil,
                                AOA,
                                Reynolds=Reynolds(10000, velocity, c_C),
                                iteration=100,
                                NACA=False)
    deviation = 0.001
    while Data['CL'] is None:
        Data_aft = xf.find_coefficients(airfoil,
                                        AOA * deviation,
                                        Reynolds=Reynolds(
                                            10000, velocity, c_C),
                                        iteration=100,
                                        NACA=False)
        Data_fwd = xf.find_coefficients(airfoil,
                                        AOA * (1 - deviation),
                                        Reynolds=Reynolds(
                                            10000, velocity, c_C),
                                        iteration=100,
                                        NACA=False)
        try:
            for key in Data:
                Data[key] = (Data_aft[key] + Data_fwd[key]) / 2.
        except:
            deviation += deviation
    alpha_L_0 = xf.find_alpha_L_0(airfoil,
                                  Reynolds=0,
                                  iteration=100,
                                  NACA=False)

    coefficients = LLT_calculator(alpha_L_0,
                                  Data['CD'],
                                  N=100,
                                  b=span,
                                  taper=1.,
                                  chord_root=chord_root,
                                  alpha_root=AOA,
                                  V=velocity)
    lift = coefficients['C_L']
    drag = coefficients['C_D']

    return lift, drag
コード例 #2
0
 def analyzeFlapFoil(self, inputAlpha, inputReynolds, inputIteration):
     if isinstance(inputReynolds, list) or isinstance(
             inputReynolds, np.ndarray):
         for re in inputReynolds:
             xf.find_coefficients(airfoil=self.flapFoilName,
                                  alpha=inputAlpha,
                                  Reynolds=re,
                                  iteration=inputIteration,
                                  NACA=False,
                                  delete=False,
                                  dir=self.relFlapFoilDir() + '/')
     else:
         xf.find_coefficients(airfoil=self.flapFoilName,
                              alpha=inputAlpha,
                              Reynolds=inputReynolds,
                              iteration=inputIteration,
                              NACA=False,
                              delete=False,
                              dir=self.relFlapFoilDir())
コード例 #3
0
def find_3D_coefficients(airfoil,
                         alpha,
                         Reynolds=0,
                         iteration=10,
                         NACA=True,
                         N=10,
                         span=10.,
                         taper=1.,
                         chord_root=1,
                         alpha_root=1.,
                         velocity=1.):
    """ Calculate the 3D distribution using the Lifting Line Theory.

    :param airfoil: if NACA is false, airfoil is the name of the plain
           filewhere the airfoil geometry is stored (variable airfoil).
           If NACA is True, airfoil is the naca series of the airfoil
           (i.e.: naca2244). By default NACA is False.

    :param Reynolds: Reynolds number in case the simulation is for a
          viscous flow. In case not informed, the code will assume
          inviscid. (Use the aero_module function to calculate reynolds)

    :param alpha: list/array/float/int of angles of attack.

    :param iteration: changes how many times XFOIL will try to make the
          results converge. Specialy important for viscous flows

    :param NACA: Boolean variable that defines if the code imports an
          airfoil from a file or generates a NACA airfoil.

    :param N: number of cross sections on the wing

    :param span: span in meters

    :param taper: unidimendional taper (This options is still not 100%
            operational)

    :param chord_root: value of the chord at the the root

    :param alpha_root: angle of attack of the chord at the root (degrees)

    :param velocity: velocity in m/s

"""
    coefficients = xf.find_coefficients(airfoil, alpha, Reynolds, iteration,
                                        NACA)
    alpha_L_0_root = xf.find_alpha_L_0(airfoil, Reynolds, iteration, NACA)
    return ar.LLT_calculator(alpha_L_0_root, coefficients['CD'], N, span,
                             taper, chord_root, alpha_root, velocity)
コード例 #4
0
def airfoil_coefficients(x):
    naca_number = int((x[1] / x[0]) * 100)
    if x[1] <= 0:
        return 100
    if naca_number <= 4:
        return 100
    if naca_number / 10 < 1:
        naca_number = str(naca_number).zfill(2)
    naca_airfoil = 'naca' + '00' + str(naca_number)
    print(naca_airfoil)

    airfoil_coeff = find_coefficients(airfoil=naca_airfoil,
                                      alpha=0.1,
                                      Reynolds=500000,
                                      NACA=True,
                                      iteration=30.)
    # scale c_D based on length of hull
    c_d_x = x[0] * airfoil_coeff['CD']
    print("the value of c_d is " + str(c_d_x))
    return c_d_x
コード例 #5
0
import aeropy.xfoil_module as xf
from aeropy.CST_2D import CST
from aeropy.CST_2D.fitting import fitting_shape_coefficients, shape_parameter_study

airfoli_fn = os.listdir(".")
data_cd = []
data_cl = []
fn_list = []
angles = 0.

for fn in airfoli_fn:
    with open(fn, 'r', encoding="utf8", errors='ignore') as f:
        try:
            coefs = xf.find_coefficients(fn,
                                         angles,
                                         Reynolds=100000,
                                         iteration=100,
                                         NACA=False)
            print(fn)
            print(coefs['CD'], coefs['CL'])
            if coefs['CD'] is not None and coefs['CL'] is not None:
                data_cd.append(coefs['CD'])
                data_cl.append(coefs['CL'])
                fn_list.append(fn)
        except:
            continue

print('Number of data:', len(data_cd))
# np.savez('../coefs.npz', data_cd, data_cl)
# with open('../file_names.csv', 'w', newline='') as f:
#     wr = csv.writer(f, quoting=csv.QUOTE_ALL)
コード例 #6
0
import numpy as np
import matplotlib.pyplot as plt

import aeropy.xfoil_module as xf
from aeropy.CST.module_2D import *
from aeropy.aero_module import Reynolds
from aeropy.geometry.airfoil import CST, create_x

# Au = [0.23993240191629417, 0.34468227138908186, 0.18125405377549103,
# 0.35371349126072665, 0.2440815012119143, 0.25724974995738387]
# Al = [0.18889012559339036, -0.24686758992053115, 0.077569769493868401,
# -0.547827192265256, -0.0047342206759065641, -0.23994805474814629]
Au = [0.172802, 0.167353, 0.130747, 0.172053, 0.112797, 0.168891]
Al = Au
# c_avian = 0.36                  #m
# deltaz = 0.0093943568219451313*c_avian
c_avian = 1.
deltaz = 0

airfoil = 'avian'
x = create_x(1., distribution='linear')
y = CST(x, 1., [deltaz / 2., deltaz / 2.], Au=Au, Al=Al)
# Create file for Xfoil to read coordinates
xf.create_input(x, y['u'], y['l'], airfoil, different_x_upper_lower=False)
print('Reynolds: ', Reynolds(10000, 30, c_avian))
Data = xf.find_coefficients(airfoil,
                            0.,
                            Reynolds=Reynolds(10000, 30, c_avian),
                            iteration=100,
                            NACA=False)
print(Data)
コード例 #7
0
'''Example comparing moment coefficient from xfoil relative to an in-house
code. The in-house code allows for moment calculation around regions of aifoils
(e.g. flap)'''

import matplotlib.pyplot as plt
import numpy as np

import aeropy.aero_module as ar
import aeropy.xfoil_module as xf

# For a single angle of attack
alpha = 0.

data = xf.find_pressure_coefficients('naca0012', alpha)
C_m = ar.calculate_moment_coefficient(data['x'], data['y'], data['Cp'], alpha)
data_CM = xf.find_coefficients('naca0012', alpha, delete=True)

print('calculated:', C_m)
print('objective:', data_CM['CM'])

# FOr multiple angles of attack
Cm_xfoil = []
Cm_aeropy = []

alpha_list = np.linspace(0, 10, 11)
for alpha in alpha_list:
    alpha = float(alpha)
    data = xf.find_pressure_coefficients('naca0012', alpha, delete=True)
    Cm_aeropy.append(ar.calculate_moment_coefficient(data['x'], data['y'],
                                                     data['Cp'], alpha))
    data_CM = xf.find_coefficients('naca0012', alpha, delete=True)
コード例 #8
0
ファイル: AeroPy.py プロジェクト: belac626/AeroPy
def calculate_flap_coefficients(x, y, alpha, x_hinge, deflection, Reynolds = 0,):
    """For a given airfoil with coordinates x and y at angle of attack
    alpha, calculate the moment coefficient around the joint at x_hinge
    and deflection """

    def separate_upper_lower(x, y, Cp = None, i_separator=None):
        """Return dictionaries with upper and lower keys with respective
        coordiantes. It is assumed the leading edge is frontmost point at
        alpha=0"""
        #TODO: when using list generated by xfoil, there are two points for
        #the leading edge
        def separate(variable_list, i_separator):
            if type(i_separator) == int:
                variable_dictionary = {'upper': variable_list[0:i_separator+1],
                                       'lower': variable_list[i_separator+1:]}
            elif type(i_separator) == list:
                i_upper = i_separator[0]
                i_lower = i_separator[1]

                variable_dictionary = {'upper': variable_list[0:i_upper],
                                       'lower': variable_list[i_lower:]}
            return variable_dictionary
        #If i is not defined, separate upper and lower surface from the
        # leading edge
        if i_separator == None:
            i_separator = x.index(min(x))

        if Cp == None:
            x = separate(x, i_separator)
            y = separate(y, i_separator)
            return x, y
        else:
            x = separate(x, i_separator)
            y = separate(y, i_separator)
            Cp = separate(Cp, i_separator)
            return x, y, Cp
    # If x and y are not dictionaries with keys upper and lower, make them
    # be so
    if type(x) == list:
        x, y = separate_upper_lower(x, y)

    upper = {'x': x['upper'], 'y': y['upper']}
    lower = {'x': x['lower'], 'y': y['lower']}

    #Determining hinge
    hinge = af.find_hinge(x_hinge, upper, lower)

    upper_static, upper_flap = af.find_flap(upper, hinge)
    lower_static, lower_flap = af.find_flap(lower, hinge, lower = True)

    upper_rotated, lower_rotated = af.rotate(upper_flap, lower_flap, hinge, deflection)

    flapped_airfoil, i_separator = af.clean(upper_static, upper_rotated, lower_static,
                            lower_rotated, hinge, deflection, N = 5,
                            return_flap_i = True)

    #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    #Third step: get new values of pressure coefficient
    xf.create_input(x = flapped_airfoil['x'], y_u = flapped_airfoil['y'],
                    filename = 'flapped', different_x_upper_lower = True)
    Data = xf.find_coefficients('flapped', alpha, NACA = False,
                                Reynolds = Reynolds, iteration=500)

    return Data
コード例 #9
0
ファイル: AeroPy.py プロジェクト: belac626/AeroPy
    V = 10
    altitude = 10000 #feet

    Reynolds = ar.Reynolds(altitude, V, 1.0)

    deflection_list = list(np.linspace(5,30,4))
    alpha_list = list(np.linspace(0,15,20))

    # Calculate coefficients for without flap
    CL_list = []
    CD_list = []
    ratio_list = []
    CM_list = []

    for alpha_i in alpha_list:
        Data_0 = xf.find_coefficients('naca0012', alpha_i, Reynolds = Reynolds,
                                      iteration = 200)
        CL_list.append(Data_0['CL'])
        CD_list.append(Data_0['CD'])
        ratio_list.append(Data_0['CL']/Data_0['CD'])
        CM_list.append(Data_0['CM'])
    All_data = {0:{r'$c_m$': CM_list, r'$c_l$':CL_list,
                     r'$c_d$': CD_list,
                     r'$c_l/c_d$': ratio_list}}#:Data_0['CL']/Data_0['CD']}}

    # Calculate foeccifient when using flap
    for deflection_i in deflection_list:
        CL_list = []
        CD_list = []
        ratio_list = []
        CM_list = []
        for alpha_i in alpha_list:
コード例 #10
0
for j in range(1145, len(Au_database)):
    data['L/D'].append([])
    print(j, airfoil_database['names'][j])
    Au = Au_database[j, :]
    Al = Al_database[j, :]
    x = create_x(1., distribution = 'linear')
    y = CST(x, chord, deltasz=[du_database[j], dl_database[j]],
                     Al=Al, Au=Au)

    xf.create_input(x, y['u'], y['l'], airfoil, different_x_upper_lower = False)
    for i in range(len(AOAs)):
        AOA = AOAs[i]
        V = velocities[i]
        try:
            Data = xf.find_coefficients(airfoil, AOA,
                                        Reynolds=Reynolds(10000, V, chord),
                                        iteration=100, NACA=False,
                                        delete=True)
            lift_drag_ratio = Data['CL']/Data['CD']
        except:
            lift_drag_ratio = None
            increment = 0.1
            conv_counter = 0
            while lift_drag_ratio is None and conv_counter <3:
                print(increment)
                Data_f = xf.find_coefficients(airfoil, AOA*(1+increment),
                                              Reynolds=Reynolds(10000, V*(1+increment), chord),
                                              iteration=100, NACA=False,
                                              delete=True)
                Data_b = xf.find_coefficients(airfoil, AOA*(1-increment),
                                              Reynolds=Reynolds(10000, V*(1-increment), chord),
                                              iteration=100, NACA=False,
コード例 #11
0
def aerodynamic_performance(AC, psi_spars, Au_P, Al_P, c_P, deltaz, alpha, H,
                            V):
    morphing_direction = 'forwards'

    air_data = air_properties(H, unit='feet')
    density = air_data['Density']
    dyn_pressure = .5 * density * V**2

    # Generate dependent shape coefficients
    # try:
    Au_C, Al_C, c_C, spar_thicknesses = calculate_dependent_shape_coefficients(
        AC, psi_spars, Au_P, Al_P, deltaz, c_P, morphing=morphing_direction)

    # print 'Reynolds: ', Reynolds(H, V, c_C)
    # Generate aifoil file
    airfoil = 'test'
    x = create_x(1., distribution='linear', n=300)
    y = CST(x, 1., [deltaz / 2., deltaz / 2.], Au=Au_C, Al=Al_C)

    # Get strain data
    strains, av_strain = calculate_strains(Au_P, Al_P, c_P, Au_C, Al_C, c_C,
                                           deltaz, psi_spars, spar_thicknesses)

    intersections = intersect_curves(x, y['l'], x, y['u'])
    print(intersections, intersections[0][1:])
    if len(intersections[0][1:]) == 0:
        # print y
        create_input(x, y['u'], y['l'], airfoil, different_x_upper_lower=False)

        # Get aerodynamic data
        print(airfoil, alpha, Reynolds(H, V, c_C))
        Data = find_coefficients(airfoil,
                                 alpha,
                                 Reynolds=Reynolds(H, V, c_C),
                                 iteration=200,
                                 NACA=False,
                                 delete=True,
                                 PANE=True,
                                 GDES=True)

        # plot_airfoil(AC, psi_spars, c_P, deltaz, Au_P, Al_P, image = 'save', iteration=counter, dir = airfoil+'_dir')

        # filtering data (for now I only care about negative strains
        str_output = {
            'CL': Data['CL'],
            'CD': Data['CD'],
            'CM': Data['CM'],
            'av_strain': av_strain,
            'Au_C': Au_C,
            'Al_C': Al_C,
            'spars': psi_spars
        }

        if Data['CM'] == None:
            str_output['lift'] = None
            str_output['drag'] = None
            str_output['moment'] = None
        else:
            str_output['lift'] = Data['CL'] / dyn_pressure / c_C,
            str_output['drag'] = Data['CD'] / dyn_pressure / c_C,
            str_output['moment'] = Data['CM'] / dyn_pressure / c_C
        for i in range(len(strains)):
            str_output['strain_' + str(i)] = strains[i]

        # Writing to a text file
        # f_worker = open(str(airfoil) + '.txt', 'wb')
        # for i in range(len(key_list)):
        # if i != len(key_list)-1:
        # if key_list[i][:1] == 'Au':
        # f_worker.write('%f\t' % str_output[key_list[i][:1]+'_C'][int(key_list[i][-1])])
        # else:
        # else:
        # if key_list[i][:1] == 'Au':
        # f_worker.write('%f\n' % str_output[key_list[i][:1]+'_C'][int(key_list[i][-1])])
    else:
        str_output = {
            'CL': 1000,
            'CD': None,
            'CM': None,
            'av_strain': av_strain,
            'spars': psi_spars,
            'Au_C': Au_C,
            'Al_C': Al_C,
            'lift': None,
            'drag': None,
            'moment': None
        }
        for i in range(len(strains)):
            str_output['strain_' + str(i)] = strains[i]
    # except:
    # str_output = {'CL':None, 'CD':None, 'CM':None, 'av_strain':None,
    # 'Au_C':[None]*len(AC), 'Al_C': [None]*len(AC),
    # 'lift': None, 'drag': None, 'moment':None,
    # 'strains':[None]*(len(AC)-1), 'spars':psi_spars}
    return str_output
コード例 #12
0
                Eng=True):
    if (X_0 != None):
        ax.xaxis.set_major_locator(ticker.MultipleLocator(mult_x * X_0))
        ax.xaxis.set_minor_locator(ticker.MultipleLocator((mult_x / 5) * X_0))
    if (Eng):
        ax.xaxis.set_major_formatter(ticker.EngFormatter())
        ax.yaxis.set_major_formatter(ticker.EngFormatter())
    if (Y_0 != None):
        ax.yaxis.set_major_locator(ticker.MultipleLocator(mult_y * Y_0))
        ax.yaxis.set_minor_locator(ticker.MultipleLocator(mult_y / 5 * Y_0))
    if (grd == True):
        ax.grid(b=True, which='major', axis='both')
    else:
        ax.grid(b=False, which='major', axis='both')
    if (minorgrd == True):
        ax.grid(b=True, which='minor', axis='both')
    else:
        ax.grid(b=False, which='minor', axis='both')

    if (x_lim != None):
        ax.set_xlim(x_lim)
    if (y_lim != None):
        ax.set_ylim(y_lim)
    return ax


"""#########################################################################"""

import aeropy.xfoil_module as xf
print(xf.find_coefficients('naca4415', 5.0, 10e5, 10))
コード例 #13
0
ファイル: fan_geo.py プロジェクト: belac626/fan-design
    def calcairfoil(self,
                    stage,
                    blade: str,
                    station: str,
                    plot_airfoil=False,
                    plot_ploar=False,
                    plot_cp=False,
                    plot_sv=False):
        """Calculate Bezier-PARSEC variables and airfoil properties."""
        avle, avte, rvle, rvte, v1, v2, radius = ut.get_vars(stage=stage,
                                                             blade=blade,
                                                             station=station)
        cx = v1 * m.cos(r(avle))
        u = stage.rpm / 60 * 2 * m.pi * radius
        betam = d(m.atan((m.tan(r(avle)) + m.tan(r(avte))) / 2))

        self.dh = v2 / v1
        self.space = (2 * m.pi * radius) / self.z
        # self.chord = stage.span/self.ar
        # self.sigma = self.chord/self.space
        # self.df = ((1 - m.cos(r(avle))/m.cos(r(avte)))
        #            + ((m.cos(r(avle))*(m.tan(r(avle)) - m.tan(r(avte))))
        #               / (2*self.sigma)))
        self.sigma = ((m.cos(r(avle)) * (m.tan(r(avle)) - m.tan(r(avte)))) /
                      (2 * (m.cos(r(avle)) / m.cos(r(avte)) - 1 + self.df)))
        self.chord = self.sigma * self.space

        # Incidence, deviation, and blade angle calculation
        self.deflection = abs(avle - avte)
        self.incidence, _n_slope = ut.calcincidence(thickness=2 * self.yt,
                                                    solidity=self.sigma,
                                                    relative_inlet_angle=rvle)
        self.deviation, _m_slope = ut.calcdeviation(thickness=2 * self.yt,
                                                    solidity=self.sigma,
                                                    relative_inlet_angle=rvle)
        self.blade_angle_i = avle - self.incidence
        self.blade_angle_e = avte - self.deviation
        self.camber = abs(self.blade_angle_i - self.blade_angle_e)
        # Compare to:
        # self.camber2 = (self.deflection
        #                 - (self.incidence
        #                    - self.deviation))/(1 - m_slope + n_slope)
        # self.blade_angle_e2 = self.blade_angle_i + self.camber2

        # Assumes double circular arc airfoil to estimate stagger
        self.stagger = (self.blade_angle_i * self.xcr + self.blade_angle_e *
                        (1 - self.xcr))
        self.aoa = abs(self.stagger - avle)
        # Redefine blade angles to sw blade angles (stagger independent)
        self.cle = self.blade_angle_i - self.stagger
        self.cte = self.stagger - self.blade_angle_e

        # Assume NACA 4 definition of wedge angle and leading edge radius
        self.rle = 1.1019 * (2 * self.yt)**2
        self.wte = 2 * d(m.atan(1.16925 *
                                (2 * self.yt)))  # TE radius done in sw

        # Calculate natural xc,yc from cle and cte using ycr altitutde ratio
        self.xc = m.tan(r(
            self.cte)) / (m.tan(r(self.cle)) + m.tan(r(self.cte)))
        # self.ycr = (self.xc + 1)/2
        self.yc = self.ycr * self.xc * abs(m.tan(r(self.cle)))

        # Assume NACA 4 curvature
        self.kc, self.kt = ut.curvatures(xc=self.xc,
                                         yc=self.yc,
                                         xt=self.xt,
                                         yt=self.yt)

        self.bc, self.bt = ut.beziers(xc=self.xc,
                                      yc=self.yc,
                                      kc=self.kc,
                                      xt=self.xt,
                                      yt=self.yt,
                                      kt=self.kt,
                                      cle=self.cle,
                                      cte=self.cte,
                                      rle=self.rle,
                                      blade=blade,
                                      station=station)
        airfoil_name = blade + '_' + station
        wf.create_coord_file(filename=airfoil_name,
                             plot=plot_airfoil,
                             xc=self.xc,
                             yc=self.yc,
                             kc=self.kc,
                             bc=self.bc,
                             xt=self.xt,
                             yt=self.yt,
                             kt=self.kt,
                             bt=self.bt,
                             cle=self.cle,
                             cte=self.cte,
                             wte=self.wte,
                             rle=self.rle)

        self.Re = self.rho * v1 * self.chord / self.mu
        self.polar = xf.find_coefficients(airfoil=airfoil_name,
                                          indir='Input',
                                          outdir='Output',
                                          alpha=self.aoa,
                                          Reynolds=self.Re,
                                          iteration=500,
                                          echo=False,
                                          delete=False,
                                          NACA=False,
                                          PANE=True)
        self.cp = xf.find_pressure_coefficients(airfoil=airfoil_name,
                                                alpha=self.aoa,
                                                indir='Input',
                                                outdir='Output',
                                                Reynolds=self.Re,
                                                iteration=500,
                                                echo=False,
                                                NACA=False,
                                                chord=1.,
                                                PANE=True,
                                                delete=False)
        self.sv = {'x': list(), 'y': list(), 'v': list()}
        for i in range(len(self.cp['Cp'])):
            self.sv['x'].append(self.cp['x'][i])
            # self.sv['y'].append(self.cp['y'][i])
            self.sv['v'].append(m.sqrt(1 - self.cp['Cp'][i]))

        if plot_cp:
            plt.plot(self.cp['x'], self.cp['Cp'])
            plt.show()

        if plot_sv:
            plt.plot(self.sv['x'], self.sv['v'])
            plt.show()

        if plot_ploar:
            # Gather multiple angles of attack for airfoil and get polars
            alphas = list(range(-30, 30))
            polars = xf.find_coefficients(airfoil=airfoil_name,
                                          alpha=alphas,
                                          Reynolds=self.Re,
                                          iteration=500,
                                          delete=True,
                                          echo=False,
                                          NACA=False,
                                          PANE=True)
            # Plot airfoil
            plt.plot(polars['alpha'], polars['CL'])
            plt.show()

        try:
            cl = self.polar['CL']
            cd = self.polar['CD']
            gamma = m.atan(cd / cl)
            self._psi = (((cx / u) / 2) * ut.sec(r(betam)) * self.sigma *
                         (cl + cd * m.tan(r(betam))))
            self.psi_opt = (((cx / u) / m.sqrt(2)) * self.sigma * (cl + cd))

            self.dX = ((self.rho * cx**2 * self.chord * cl /
                        (2 * m.cos(r(betam))**2)) * m.sin(r(betam) - gamma) /
                       m.cos(gamma))
            self.dTau = (
                (self.rho * cx**2 * self.chord * cl * self.z * radius /
                 (2 * m.cos(r(betam))**2)) * m.cos(r(betam) - gamma) /
                m.cos(gamma))
            self.delta_p = cl * ((self.rho * cx**2 * self.chord /
                                  (2 * self.space * m.cos(r(betam))**2)) *
                                 m.sin(r(betam) - gamma) / m.cos(gamma))
            self.delta_T = (cl / 1.005) * (
                (u * cx * self.chord / (2 * self.space * m.cos(r(betam))**2)) *
                m.cos(r(betam) - gamma) / m.cos(gamma))
            self.efficiency = (cx/u)*m.tan(r(betam) - gamma)\
                + cx*m.tan(r(rvte))/(2*u)
        except TypeError:
            print('Design point did not converge in xfoil.')
            # pass

        print(f'{station} {blade} Performance')
        print(f'    DF: {self.df:.2f} (<=0.6)')
        print(f'    DH: {self.dh:.2f} (>=0.72)')
        print(f'    i : {self.incidence:.2f} deg')
        print(f'    d : {self.deviation:.2f} deg')
        print('\n')
コード例 #14
0
ファイル: range.py プロジェクト: alexudem/AeroPy
def aircraft_range_LLT(AC, velocity, AOA):
    def to_integrate(weight):
        # velocity = 0.514444*108 # m/s (113 KTAS)

        span = 10.9728
        RPM = 1800
        a = 0.3089  # (lb/hr)/BTU
        b = 0.008 * RPM + 19.607  # lb/hr

        lbhr_to_kgs = 0.000125998
        BHP_to_watt = 745.7

        eta = 0.85

        thrust = weight / lift_to_drag

        power_SI = thrust * velocity / eta
        power_BHP = power_SI / BHP_to_watt
        mass_flow = (a * power_BHP + b)
        mass_flow_SI = mass_flow * lbhr_to_kgs

        SFC = mass_flow_SI / thrust
        dR = velocity / g / SFC * lift_to_drag / weight
        return dR * 0.001  #*0.0005399

    Au_P = [0.1828, 0.1179, 0.2079, 0.0850, 0.1874]
    Al_P = Au_P
    deltaz = 0

    # Determine children shape coeffcients
    AC_u = list(data.values[i, 0:4])
    Au_C, Al_C, c_C, spar_thicknesses = calculate_dependent_shape_coefficients(
        AC_u, psi_spars, Au_P, Al_P, deltaz, c_P, morphing=morphing_direction)

    # Calculate aerodynamics for that airfoil
    airfoil = 'optimal'
    x = create_x(1., distribution='linear')
    y = CST(x, 1., [deltaz / 2., deltaz / 2.], Al=Al_C, Au=Au_C)
    # Create file for Xfoil to read coordinates
    xf.create_input(x, y['u'], y['l'], airfoil, different_x_upper_lower=False)
    Data = xf.find_coefficients(airfoil,
                                AOA,
                                Reynolds=Reynolds(10000, velocity, c_C),
                                iteration=100,
                                NACA=False)
    deviation = 0.001
    while Data['CL'] is None:
        Data_aft = xf.find_coefficients(airfoil,
                                        AOA * deviation,
                                        Reynolds=Reynolds(
                                            10000, velocity, c_C),
                                        iteration=100,
                                        NACA=False)
        Data_fwd = xf.find_coefficients(airfoil,
                                        AOA * (1 - deviation),
                                        Reynolds=Reynolds(
                                            10000, velocity, c_C),
                                        iteration=100,
                                        NACA=False)
        try:
            for key in Data:
                Data[key] = (Data_aft[key] + Data_fwd[key]) / 2.
        except:
            deviation += deviation
    alpha_L_0 = xf.find_alpha_L_0(airfoil,
                                  Reynolds=0,
                                  iteration=100,
                                  NACA=False)

    coefficients = LLT_calculator(alpha_L_0,
                                  Data['CD'],
                                  N=100,
                                  b=span,
                                  taper=1.,
                                  chord_root=chord_root,
                                  alpha_root=AOA,
                                  V=velocity)
    lift_to_drag = coefficients['C_L'] / coefficients['C_D']

    g = 9.81  # kg/ms
    fuel = 56 * 6.01 * 0.4535 * g
    initial_weight = 1111 * g
    final_weight = initial_weight - fuel
    return scipy.integrate.quad(to_integrate, final_weight, initial_weight)[0]